Refresh Online Session with profile region and sports.
This commit is contained in:
2021-06-02 16:52:57 +01:00
parent 7b0a710b13
commit 7e5940a542
62 changed files with 601 additions and 214 deletions
@@ -56,7 +56,7 @@ namespace Saxonite.Net.Core.UnitTests.Web.Admin.App
SaxSessionData_Admin sessionDataDeserialized = SaxSessionData_Admin sessionDataDeserialized =
JsonConvert.DeserializeObject<SaxSessionData_Admin>( JsonConvert.DeserializeObject<SaxSessionData_Admin>(
sessionDataJson, sessionDataJson,
new JsonSerializerSettings { ContractResolver = new SaxController_Base.SessionStorage.SaxSessionDataContractResolver() } SaxController_Base.SessionStorage.JsonDeserialisationSettings
); );
Assert.IsNotNull(sessionDataDeserialized); Assert.IsNotNull(sessionDataDeserialized);
+46 -24
View File
@@ -137,12 +137,14 @@ namespace Saxonite.Net.Core.Web.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
private class CodeCache private class CodeCache
{ {
public List<TypeCodeDesc> regionTypes; public List<TypeCodeDesc> sportParticipationCodes;
public List<TypeCodeDesc> userRoles; public List<TypeCodeDesc> sportOfficiatingCodes;
public List<TypeCodeDesc> organisationTypes; public List<TypeCodeDesc> regionTypeCodes;
public List<TypeCodeDesc> organisationCategories; public List<TypeCodeDesc> userRoleCodes;
public List<TypeCodeDesc> organisationRoles; public List<TypeCodeDesc> organisationTypeCodes;
public List<TypeCodeDesc> opportunityTypes; public List<TypeCodeDesc> organisationCategoryCodes;
public List<TypeCodeDesc> organisationRoleCodes;
public List<TypeCodeDesc> opportunityTypeCodes;
} }
private CodeCache codes = new CodeCache(); private CodeCache codes = new CodeCache();
@@ -153,64 +155,84 @@ namespace Saxonite.Net.Core.Web.Base.App
return SacsSystem.GetStatusDesc(status); return SacsSystem.GetStatusDesc(status);
} }
// Sport Participation.
public String GetSportParticipationTypeCaption(Sax.SportParticipation participation)
{
if ((int)participation < 1) return "";
if (codes.sportParticipationCodes == null)
codes.sportParticipationCodes = SaxSystem.GetCodesOfType(Sax.CodeType.SportParticipation);
// ToDo Sport Participation localisation.
return codes.sportParticipationCodes.GetDescForType(participation);
}
// Sport Officiating.
public String GetSportOfficiatingTypeCaption(Sax.SportOfficiating participation)
{
if ((int)participation < 1) return "";
if (codes.sportOfficiatingCodes == null)
codes.sportOfficiatingCodes = SaxSystem.GetCodesOfType(Sax.CodeType.SportOfficiating);
// ToDo Sport Officiating localisation.
return codes.sportOfficiatingCodes.GetDescForType(participation);
}
// Region type. // Region type.
public String GetRegionTypeCaption(Sax.RegionType regionType) public String GetRegionTypeCaption(Sax.RegionType regionType)
{ {
if ((int)regionType < 1) return ""; if ((int)regionType < 1) return "";
if (codes.regionTypes == null) if (codes.regionTypeCodes == null)
codes.regionTypes = SaxSystem.GetCodesOfType(Sax.CodeType.RegionType); codes.regionTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.RegionType);
// ToDo Region type localisation. // ToDo Region type localisation.
return codes.regionTypes.GetDescForType(regionType); return codes.regionTypeCodes.GetDescForType(regionType);
} }
// User role. // User role.
public String GetUserRoleCaption(Sax.UserRole userRole) public String GetUserRoleCaption(Sax.UserRole userRole)
{ {
if ((int)userRole < 1) return ""; if ((int)userRole < 1) return "";
if (codes.userRoles == null) if (codes.userRoleCodes == null)
codes.userRoles = SaxSystem.GetCodesOfType(Sax.CodeType.UserRole); codes.userRoleCodes = SaxSystem.GetCodesOfType(Sax.CodeType.UserRole);
// ToDo User Role localisation. // ToDo User Role localisation.
return codes.userRoles.GetDescForType(userRole); return codes.userRoleCodes.GetDescForType(userRole);
} }
// Organisation type. // Organisation type.
public String GetOrganisationTypeCaption(Sax.OrganisationType organisationType) public String GetOrganisationTypeCaption(Sax.OrganisationType organisationType)
{ {
if ((int)organisationType < 1) return ""; if ((int)organisationType < 1) return "";
if (codes.organisationTypes == null) if (codes.organisationTypeCodes == null)
codes.organisationTypes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationType); codes.organisationTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationType);
// ToDo Organisation Type localisation. // ToDo Organisation Type localisation.
return codes.organisationTypes.GetDescForType(organisationType); return codes.organisationTypeCodes.GetDescForType(organisationType);
} }
// Organisation category. // Organisation category.
public String GetOrganisationCategoryCaption(Sax.OrganisationCategory organisationCategory) public String GetOrganisationCategoryCaption(Sax.OrganisationCategory organisationCategory)
{ {
if ((int)organisationCategory < 1) return ""; if ((int)organisationCategory < 1) return "";
if (codes.organisationCategories == null) if (codes.organisationCategoryCodes == null)
codes.organisationCategories = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationCategory); codes.organisationCategoryCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationCategory);
// ToDo Organisation Category localisation. // ToDo Organisation Category localisation.
return codes.organisationCategories.GetDescForType(organisationCategory); return codes.organisationCategoryCodes.GetDescForType(organisationCategory);
} }
// Organisation role. // Organisation role.
public String GetOrganisationRoleCaption(Sax.OrganisationRole organisationRole) public String GetOrganisationRoleCaption(Sax.OrganisationRole organisationRole)
{ {
if ((int)organisationRole < 1) return ""; if ((int)organisationRole < 1) return "";
if (codes.organisationRoles == null) if (codes.organisationRoleCodes == null)
codes.organisationRoles = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole); codes.organisationRoleCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole);
// ToDo Organisation Role localisation. // ToDo Organisation Role localisation.
return codes.organisationRoles.GetDescForType(organisationRole); return codes.organisationRoleCodes.GetDescForType(organisationRole);
} }
// Opportunity type. // Opportunity type.
public String GetOpportunityTypeCaption(Sax.OpportunityType opportunityType) public String GetOpportunityTypeCaption(Sax.OpportunityType opportunityType)
{ {
if ((int)opportunityType < 1) return ""; if ((int)opportunityType < 1) return "";
if (codes.opportunityTypes == null) if (codes.opportunityTypeCodes == null)
codes.opportunityTypes = SaxSystem.GetCodesOfType(Sax.CodeType.OpportunityType); codes.opportunityTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OpportunityType);
// ToDo Opportunity Type localisation. // ToDo Opportunity Type localisation.
return codes.opportunityTypes.GetDescForType(opportunityType); return codes.opportunityTypeCodes.GetDescForType(opportunityType);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -7,7 +7,7 @@ using System.Text;
namespace Saxonite.Net.Core.Web.Base.App namespace Saxonite.Net.Core.Web.Base.App
{ {
//======================================================================= //=======================================================================
public class SaxSessionData_Web : SaxSessionData public abstract class SaxSessionData_Web : SaxSessionData
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Protected construction. // Protected construction.
@@ -57,7 +57,7 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
public static int CompareActivityIndices(ActivityData_Web item1, ActivityData_Web item2) public static int CompareActivityIndices(ActivityData_Web item1, ActivityData_Web item2)
{ {
int effectiveCompare = item1.EffectiveOn.CompareTo(item2.EffectiveOn); int effectiveCompare = item1.EffectiveOn.CompareTo(item2.EffectiveOn);
if (effectiveCompare != null) return effectiveCompare * -1; if (effectiveCompare != 0) return effectiveCompare * -1;
return 1; return 1;
} }
} }
@@ -90,13 +90,15 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
public SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } } public SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } }
public SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } } public SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } }
// System codes. // System codes.
public List<TypeCodeDesc> RegionTypes { get { return Internals.RegionTypes; } } public List<TypeCodeDesc> SportParticipationCodes { get { return Internals.SportParticipationCodes; } }
public List<TypeCodeDesc> UserRoles { get { return Internals.UserRoles; } } public List<TypeCodeDesc> SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } }
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } } public List<TypeCodeDesc> RegionTypeCodes { get { return Internals.RegionTypeCodes; } }
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } } public List<TypeCodeDesc> UserRoleCodes { get { return Internals.UserRoleCodes; } }
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } } public List<TypeCodeDesc> OrganisationTypeCodes { get { return Internals.OrganisationTypeCodes; } }
public List<TypeCodeDesc> OpportunityTypes { get { return Internals.OpportunityTypes; } } public List<TypeCodeDesc> OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } }
public List<TypeCodeDesc> DataItemTypes { get { return Internals.DataItemTypes; } } public List<TypeCodeDesc> OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } }
public List<TypeCodeDesc> OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } }
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
// Email. // Email.
public SaEmailConfig EmailConfig { get { return App.EmailConfig; } } public SaEmailConfig EmailConfig { get { return App.EmailConfig; } }
public SaxEmailConsole EmailConsole { get { return Internals.EmailConsole; } } public SaxEmailConsole EmailConsole { get { return Internals.EmailConsole; } }
+29 -15
View File
@@ -55,13 +55,15 @@ namespace Saxonite.Net.Core.Web.Base.Models
protected SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } } protected SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } }
protected SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } } protected SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } }
// System codes. // System codes.
public List<TypeCodeDesc> RegionTypes { get { return Internals.RegionTypes; } } public List<TypeCodeDesc> SportParticipationCodes { get { return Internals.SportParticipationCodes; } }
public List<TypeCodeDesc> UserRoles { get { return Internals.UserRoles; } } public List<TypeCodeDesc> SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } }
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } } public List<TypeCodeDesc> RegionTypeCodes { get { return Internals.RegionTypeCodes; } }
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } } public List<TypeCodeDesc> UserRoleCodes { get { return Internals.UserRoleCodes; } }
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } } public List<TypeCodeDesc> OrganisationTypeCodes { get { return Internals.OrganisationTypeCodes; } }
public List<TypeCodeDesc> OpportunityTypes { get { return Internals.OpportunityTypes; } } public List<TypeCodeDesc> OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } }
public List<TypeCodeDesc> DataItemTypes { get { return Internals.DataItemTypes; } } public List<TypeCodeDesc> OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } }
public List<TypeCodeDesc> OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } }
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Page configuration. // Page configuration.
@@ -153,28 +155,40 @@ namespace Saxonite.Net.Core.Web.Base.Models
get { return new SelectList(SaxSystem.GetCodesOfType(Sax.CodeType.YesNo), "Code", "Desc"); } get { return new SelectList(SaxSystem.GetCodesOfType(Sax.CodeType.YesNo), "Code", "Desc"); }
} }
/// <summary>List of Sport Participation options for dropdown.</summary>
public IEnumerable<SelectListItem> SportParticipationCodesForSelect
{
get { return new SelectList(SportParticipationCodes, "Code", "Desc"); }
}
/// <summary>List of Sport Officiating options for dropdown.</summary>
public IEnumerable<SelectListItem> SportOfficiatingCodesForSelect
{
get { return new SelectList(SportOfficiatingCodes, "Code", "Desc"); }
}
/// <summary>List of Region Types for dropdown.</summary>
public IEnumerable<SelectListItem> RegionTypesForSelect
{
get { return new SelectList(RegionTypeCodes, "Code", "Desc"); }
}
/// <summary>List of titles for dropdown.</summary> /// <summary>List of titles for dropdown.</summary>
public IEnumerable<SelectListItem> TitlesForSelect public IEnumerable<SelectListItem> TitlesForSelect
{ {
get { return new SelectList(SaxSystem.GetCodesOfType(Sax.CodeType.Title), "Code", "Desc"); } get { return new SelectList(SaxSystem.GetCodesOfType(Sax.CodeType.Title), "Code", "Desc"); }
} }
/// <summary>List of Region Types for dropdown.</summary>
public IEnumerable<SelectListItem> RegionTypesForSelect
{
get { return new SelectList(RegionTypes, "Code", "Desc"); }
}
/// <summary>List of Organisation Types for dropdown.</summary> /// <summary>List of Organisation Types for dropdown.</summary>
public IEnumerable<SelectListItem> OrganisationTypesForSelect public IEnumerable<SelectListItem> OrganisationTypesForSelect
{ {
get { return new SelectList(OrganisationTypes, "Code", "Desc"); } get { return new SelectList(OrganisationTypeCodes, "Code", "Desc"); }
} }
/// <summary>List of Organisation Categories for dropdown.</summary> /// <summary>List of Organisation Categories for dropdown.</summary>
public IEnumerable<SelectListItem> OrganisationCategoriesForSelect public IEnumerable<SelectListItem> OrganisationCategoriesForSelect
{ {
get { return new SelectList(OrganisationCategories, "Code", "Desc"); } get { return new SelectList(OrganisationCategoryCodes, "Code", "Desc"); }
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -28,8 +28,21 @@ namespace Saxonite.Net.Core.Web.Admin.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
//-------------------------------------------------------------------
// User details.
private class UserData_Admin : UserData
{
public UserData_Admin(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) :
base(sessionContext, userAccount, userRoles)
{ }
public UserData_Admin(UserData userData) :
base(userData)
{ }
}
protected override UserData CreateUserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) { return new UserData_Admin(sessionContext, userAccount, userRoles); }
/// <summary>User - JSON deserialisation route.</summary> /// <summary>User - JSON deserialisation route.</summary>
public new UserData User { get { return base.User; } set { SetUser(value); } } public new UserData User { get { return base.User; } set { SetUser(new UserData_Admin(value)); } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -47,10 +47,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
{ {
data.Id = SysId.ToString(organisation.Id); data.Id = SysId.ToString(organisation.Id);
data.Name = organisation.Name; data.Name = organisation.Name;
data.TypeCode = OrganisationTypes.GetCodeForType(organisation.OrganisationType); data.TypeCode = OrganisationTypeCodes.GetCodeForType(organisation.OrganisationType);
data.TypeDesc = OrganisationTypes.GetDescForType(organisation.OrganisationType); data.TypeDesc = OrganisationTypeCodes.GetDescForType(organisation.OrganisationType);
data.CategoryCode = OrganisationCategories.GetCodeForType(organisation.OrganisationCategory); data.CategoryCode = OrganisationCategoryCodes.GetCodeForType(organisation.OrganisationCategory);
data.CategoryDesc = OrganisationCategories.GetDescForType(organisation.OrganisationCategory); data.CategoryDesc = OrganisationCategoryCodes.GetDescForType(organisation.OrganisationCategory);
data.MemberCount = AccountMgr.GetOrganisationMemberCount(organisation.Id); data.MemberCount = AccountMgr.GetOrganisationMemberCount(organisation.Id);
// Sport. // Sport.
data.SportId = SysId.ToLong(organisation.SportIdPrimary); data.SportId = SysId.ToLong(organisation.SportIdPrimary);
@@ -145,9 +145,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
Id = values.GetString(colId.DataName), Id = values.GetString(colId.DataName),
Name = values.GetString(colName.DataName), Name = values.GetString(colName.DataName),
TypeCode = values.GetString(colOrganisationType.DataName), TypeCode = values.GetString(colOrganisationType.DataName),
TypeDesc = OrganisationTypes.GetDescForCode(values.GetString(colOrganisationType.DataName)), TypeDesc = OrganisationTypeCodes.GetDescForCode(values.GetString(colOrganisationType.DataName)),
CategoryCode = values.GetString(colOrganisationCategory.DataName), CategoryCode = values.GetString(colOrganisationCategory.DataName),
CategoryDesc = OrganisationCategories.GetDescForCode(values.GetString(colOrganisationCategory.DataName)), CategoryDesc = OrganisationCategoryCodes.GetDescForCode(values.GetString(colOrganisationCategory.DataName)),
MemberCount = StringUtil.ToLong(values.GetString(colMemberCount.DataName)), MemberCount = StringUtil.ToLong(values.GetString(colMemberCount.DataName)),
SportId = values.GetLong(colSportId.DataName), SportId = values.GetLong(colSportId.DataName),
SportName = values.GetString(colSportName.DataName), SportName = values.GetString(colSportName.DataName),
@@ -47,7 +47,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
data.OrganisationName = organisation.Name; data.OrganisationName = organisation.Name;
// Exclude 'Member' role. // Exclude 'Member' role.
foreach (Sax.OrganisationRole organisationRole in userOrganisation.OrganisationRoles.FindAll(item => item != Sax.OrganisationRole.Member)) foreach (Sax.OrganisationRole organisationRole in userOrganisation.OrganisationRoles.FindAll(item => item != Sax.OrganisationRole.Member))
data.RoleCodes.Add(OrganisationRoles.GetCodeForType(organisationRole)); data.RoleCodes.Add(OrganisationRoleCodes.GetCodeForType(organisationRole));
data.RoleCount = userOrganisation.OrganisationRoles.Count - 1; data.RoleCount = userOrganisation.OrganisationRoles.Count - 1;
data.StatusCode = userOrganisation.StatusCode; data.StatusCode = userOrganisation.StatusCode;
data.StatusDesc = userOrganisation.StatusDesc; data.StatusDesc = userOrganisation.StatusDesc;
@@ -91,7 +91,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Reference data - organisation roles. // Reference data - organisation roles.
// Exclude 'Member' as this is added automatically when stored. // Exclude 'Member' as this is added automatically when stored.
foreach (TypeCodeDesc organisationRole in OrganisationRoles.FindAll(item => item.Type != (int)Sax.OrganisationRole.Member)) foreach (TypeCodeDesc organisationRole in OrganisationRoleCodes.FindAll(item => item.Type != (int)Sax.OrganisationRole.Member))
responseData.MemberRoles.Add(organisationRole.Code, Localiser.GetOrganisationRoleCaption((Sax.OrganisationRole)organisationRole.Type)); responseData.MemberRoles.Add(organisationRole.Code, Localiser.GetOrganisationRoleCaption((Sax.OrganisationRole)organisationRole.Type));
// Reference data - statuses. // Reference data - statuses.
@@ -36,8 +36,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
private void PopulateRegionResponseData(SaxRegion region, RegionData_List data) private void PopulateRegionResponseData(SaxRegion region, RegionData_List data)
{ {
data.Id = SysId.ToString(region.Id); data.Id = SysId.ToString(region.Id);
data.RegionTypeCode = RegionTypes.GetCodeForType(region.RegionType); data.RegionTypeCode = RegionTypeCodes.GetCodeForType(region.RegionType);
data.RegionTypeDesc = RegionTypes.GetDescForType(region.RegionType); data.RegionTypeDesc = RegionTypeCodes.GetDescForType(region.RegionType);
data.CountryIso2Code = region.CountryIso2Code; data.CountryIso2Code = region.CountryIso2Code;
data.Name = region.Name; data.Name = region.Name;
data.StatusCode = region.StatusCode; data.StatusCode = region.StatusCode;
@@ -117,8 +117,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
RegionData_List regionData = new RegionData_List() RegionData_List regionData = new RegionData_List()
{ {
Id = values.GetString(colId.DataName), Id = values.GetString(colId.DataName),
RegionTypeCode = RegionTypes.GetCodeForType(regionType), RegionTypeCode = RegionTypeCodes.GetCodeForType(regionType),
RegionTypeDesc = RegionTypes.GetDescForType(regionType), RegionTypeDesc = RegionTypeCodes.GetDescForType(regionType),
CountryIso2Code = values.GetString(colIso2Code.DataName), CountryIso2Code = values.GetString(colIso2Code.DataName),
Name = values.GetString(colName.DataName), Name = values.GetString(colName.DataName),
ParentName = values.GetString(colParentName.DataName), ParentName = values.GetString(colParentName.DataName),
@@ -55,7 +55,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
if (userRoles != null) if (userRoles != null)
{ {
foreach (SaxUserRole userRole in userRoles.GetUserRolesByStatus(SaStatus.Active)) foreach (SaxUserRole userRole in userRoles.GetUserRolesByStatus(SaStatus.Active))
data.userRoleCodes.Add(UserRoles.GetCodeForType(userRole.UserRole)); data.userRoleCodes.Add(UserRoleCodes.GetCodeForType(userRole.UserRole));
} }
} }
@@ -97,7 +97,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
return GetAjaxResult_InvalidSession(responseData); return GetAjaxResult_InvalidSession(responseData);
// Reference data - user roles. // Reference data - user roles.
foreach (TypeCodeDesc userRole in UserRoles) foreach (TypeCodeDesc userRole in UserRoleCodes)
responseData.UserRoles.Add(userRole.Code, Localiser.GetUserRoleCaption((Sax.UserRole)userRole.Type)); responseData.UserRoles.Add(userRole.Code, Localiser.GetUserRoleCaption((Sax.UserRole)userRole.Type));
responseData.DefaultStatusCode = SacsSystem.GetStatusCode(SaxUserAccount.DefaultStatus); responseData.DefaultStatusCode = SacsSystem.GetStatusCode(SaxUserAccount.DefaultStatus);
@@ -280,7 +280,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
foreach (String userRoleCode in userRoleCodes) foreach (String userRoleCode in userRoleCodes)
{ {
// Role to activate. // Role to activate.
Sax.UserRole role = (Sax.UserRole)UserRoles.GetTypeForCode(userRoleCode); Sax.UserRole role = (Sax.UserRole)UserRoleCodes.GetTypeForCode(userRoleCode);
SaxUserRole userRole = userRoles.GetUserRoleByRole(role); SaxUserRole userRole = userRoles.GetUserRoleByRole(role);
if (userRole == null) if (userRole == null)
{ {
@@ -292,7 +292,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Roles to deactivate. // Roles to deactivate.
foreach (SaxUserRole userRole in userRoles) foreach (SaxUserRole userRole in userRoles)
{ {
if (!userRoleCodes.Exists(item => item.EqualsCI(UserRoles.GetCodeForType(userRole.UserRole)))) if (!userRoleCodes.Exists(item => item.EqualsCI(UserRoleCodes.GetCodeForType(userRole.UserRole))))
userRole.Status = SaStatus.Inactive; userRole.Status = SaStatus.Inactive;
} }
} }
@@ -37,11 +37,11 @@ namespace Saxonite.Net.Core.Web.Admin.Models
public FilterData Filter { get; } = new FilterData(); public FilterData Filter { get; } = new FilterData();
public Sax.OrganisationType FilterOrganisationType public Sax.OrganisationType FilterOrganisationType
{ {
get { return (Sax.OrganisationType)OrganisationTypes.GetTypeForCode(Filter.OrganisationTypeCode); } get { return (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(Filter.OrganisationTypeCode); }
} }
public Sax.OrganisationCategory FilterOrganisationCategory public Sax.OrganisationCategory FilterOrganisationCategory
{ {
get { return (Sax.OrganisationCategory)OrganisationCategories.GetTypeForCode(Filter.OrganisationCategoryCode); } get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(Filter.OrganisationCategoryCode); }
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -49,9 +49,9 @@ namespace Saxonite.Net.Core.Web.Admin.Models
public String OrganisationId { get; set; } public String OrganisationId { get; set; }
public String OrganisationName { get; set; } public String OrganisationName { get; set; }
public String OrganisationTypeValue { get; set; } public String OrganisationTypeValue { get; set; }
public Sax.OrganisationType OrganisationType { get { return (Sax.OrganisationType)OrganisationTypes.GetTypeForCode(OrganisationTypeValue); } } public Sax.OrganisationType OrganisationType { get { return (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(OrganisationTypeValue); } }
public String OrganisationCategoryValue { get; set; } public String OrganisationCategoryValue { get; set; }
public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategories.GetTypeForCode(OrganisationCategoryValue); } } public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(OrganisationCategoryValue); } }
public String OrganisationSportId { get; set; } public String OrganisationSportId { get; set; }
public String OrganisationRegionId { get; set; } public String OrganisationRegionId { get; set; }
// Common properties. // Common properties.
@@ -36,7 +36,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
public FilterData Filter { get; } = new FilterData(); public FilterData Filter { get; } = new FilterData();
public Sax.RegionType FilterRegionType public Sax.RegionType FilterRegionType
{ {
get { return (Sax.RegionType)RegionTypes.GetTypeForCode(Filter.RegionTypeCode); } get { return (Sax.RegionType)RegionTypeCodes.GetTypeForCode(Filter.RegionTypeCode); }
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -45,8 +45,8 @@ namespace Saxonite.Net.Core.Web.Admin.Models
public String RegionTypeCode { get; set; } public String RegionTypeCode { get; set; }
public Sax.RegionType RegionType public Sax.RegionType RegionType
{ {
get { return (Sax.RegionType)RegionTypes.GetTypeForCode(RegionTypeCode); } get { return (Sax.RegionType)RegionTypeCodes.GetTypeForCode(RegionTypeCode); }
set { RegionTypeCode = RegionTypes.GetCodeForType(value); } set { RegionTypeCode = RegionTypeCodes.GetCodeForType(value); }
} }
public String RegionCountryIso2Code { get; set; } public String RegionCountryIso2Code { get; set; }
public String RegionName { get; set; } public String RegionName { get; set; }
@@ -10,6 +10,7 @@
//-------------------------------------------------------------- //--------------------------------------------------------------
sax.refreshDbSchema= function (delay) sax.refreshDbSchema= function (delay)
{ {
if (sax.awaitingLogin) return;
var $results = $('.sax-panel-results.DbSchema'); var $results = $('.sax-panel-results.DbSchema');
if (!sax.awaitingRefreshResponse) if (!sax.awaitingRefreshResponse)
{ {
@@ -249,6 +249,9 @@
<data name="label.no" xml:space="preserve"> <data name="label.no" xml:space="preserve">
<value>No</value> <value>No</value>
</data> </data>
<data name="label.officiating" xml:space="preserve">
<value>Officiating</value>
</data>
<data name="label.ok" xml:space="preserve"> <data name="label.ok" xml:space="preserve">
<value>OK</value> <value>OK</value>
</data> </data>
@@ -264,6 +267,9 @@
<data name="label.outline" xml:space="preserve"> <data name="label.outline" xml:space="preserve">
<value>Outline</value> <value>Outline</value>
</data> </data>
<data name="label.participation" xml:space="preserve">
<value>Participation</value>
</data>
<data name="label.password" xml:space="preserve"> <data name="label.password" xml:space="preserve">
<value>Password</value> <value>Password</value>
</data> </data>
@@ -32,9 +32,35 @@ namespace Saxonite.Net.Core.Web.Online.App
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Security. // Contact details.
private class UserData_Online : UserData
{
public UserData_Online(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) :
base(sessionContext, userAccount, userRoles)
{ }
public UserData_Online(UserData userData) :
base(userData)
{ }
public new bool RefreshUserData(SaxUserAccount userAccount)
{
return base.RefreshUserData(userAccount);
}
}
protected override UserData CreateUserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) { return new UserData_Online(sessionContext, userAccount, userRoles); }
/// <summary>User - JSON deserialisation route.</summary> /// <summary>User - JSON deserialisation route.</summary>
public new UserData User { get { return base.User; } set { SetUser(value); } } public new UserData User { get { return base.User; } set { SetUser(new UserData_Online(value)); } }
/// <summary>
/// Update the user's contect details against the session.
/// <para>- User Account must match that already against the session.</para>
/// </summary>
public bool RefreshUser(SaxUserAccount userAccount)
{
UserData_Online user = User as UserData_Online;
if (user != null)
return user.RefreshUserData(userAccount);
return false;
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// User Profile. // User Profile.
@@ -45,6 +71,7 @@ namespace Saxonite.Net.Core.Web.Online.App
// Sports. // Sports.
public class SportData public class SportData
{ {
[JsonConstructor]
public SportData(SysId sportId, SaStatus status) public SportData(SysId sportId, SaStatus status)
{ {
SportId = sportId; SportId = sportId;
@@ -157,6 +157,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"])); return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
} }
// Refresh profile contact details to session.
RefreshSessionProfileContact(userAccount);
// Construct response. // Construct response.
responseData.Contact = new ContactResponseData(); responseData.Contact = new ContactResponseData();
PopulateContactResponseData(responseData.Contact, userAccount); PopulateContactResponseData(responseData.Contact, userAccount);
@@ -14,6 +14,7 @@ using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Utils; using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Base.Core; using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas; using Sarand.Net.Standard.Base.Dbas;
using Saxonite.Net.Standard.Base.App;
namespace Saxonite.Net.Core.Web.Online.Controllers namespace Saxonite.Net.Core.Web.Online.Controllers
{ {
@@ -29,11 +30,15 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
public long Id { get; set; } public long Id { get; set; }
public long SportId { get; set; } public long SportId { get; set; }
public String SportName { get; set; } public String SportName { get; set; }
public String SportParticipation { get; set; }
public String SportOfficiating { get; set; }
public String StatusCode { get; set; } public String StatusCode { get; set; }
public String StatusDesc { get; set; } public String StatusDesc { get; set; }
} }
public class ProfileSportResponseData_Item : ProfileSportResponseData_List public class ProfileSportResponseData_Item : ProfileSportResponseData_List
{ {
public String SportParticipationCode { get; set; }
public String SportOfficiatingCode { get; set; }
public String CreatedOnFmt { get; set; } public String CreatedOnFmt { get; set; }
} }
private void PopulateProfileSportResponseData(Model_Account model, SaxUserSport userSport, SaxSport sport, ProfileSportResponseData_Item data) private void PopulateProfileSportResponseData(Model_Account model, SaxUserSport userSport, SaxSport sport, ProfileSportResponseData_Item data)
@@ -41,6 +46,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
data.Id = SysId.ToLong(userSport.Id); data.Id = SysId.ToLong(userSport.Id);
data.SportId = SysId.ToLong(userSport.SportId); data.SportId = SysId.ToLong(userSport.SportId);
data.SportName = sport.Name; data.SportName = sport.Name;
data.SportParticipationCode = SportParticipationCodes.GetCodeForType(userSport.Participation);
data.SportParticipation = Localiser.GetSportParticipationTypeCaption(userSport.Participation);
data.SportOfficiatingCode = SportOfficiatingCodes.GetCodeForType(userSport.Officiating);
data.SportOfficiating = Localiser.GetSportOfficiatingTypeCaption(userSport.Officiating);
data.CreatedOnFmt = DateUtil.Format(userSport.CreateStamp.On, "d-MMM-yyyy"); data.CreatedOnFmt = DateUtil.Format(userSport.CreateStamp.On, "d-MMM-yyyy");
data.StatusCode = userSport.StatusCode; data.StatusCode = userSport.StatusCode;
data.StatusDesc = userSport.StatusDesc; data.StatusDesc = userSport.StatusDesc;
@@ -79,11 +88,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
ColumnDfn colId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Id); ColumnDfn colId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Id);
ColumnDfn colSportId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportId); ColumnDfn colSportId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportId);
ColumnDfn colSportName = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Sport_Name); ColumnDfn colSportName = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Sport_Name);
ColumnDfn colParticipation = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportParticipation);
ColumnDfn colOfficiating = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportOfficiating);
ColumnDfn colStatus = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Status); ColumnDfn colStatus = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Status);
List<ColumnDfn> columns = new List<ColumnDfn>() List<ColumnDfn> columns = new List<ColumnDfn>()
{ {
colId, colId,
colSportId, colSportName, colSportId, colSportName,
colParticipation, colOfficiating,
colStatus, colStatus,
}; };
@@ -103,6 +115,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
Id = values.GetLong(colId.DataName), Id = values.GetLong(colId.DataName),
SportId = values.GetLong(colSportId.DataName), SportId = values.GetLong(colSportId.DataName),
SportName = values.GetString(colSportName.DataName), SportName = values.GetString(colSportName.DataName),
SportParticipation = Localiser.GetSportParticipationTypeCaption((Sax.SportParticipation)values.GetLong(colParticipation.DataName)),
SportOfficiating = Localiser.GetSportOfficiatingTypeCaption((Sax.SportOfficiating)values.GetLong(colOfficiating.DataName)),
StatusCode = values.GetString(colStatus.DataName), StatusCode = values.GetString(colStatus.DataName),
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)) StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
}; };
@@ -227,11 +241,28 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
} }
} }
// Create new item if required. // If sport doesn't exist for the user, it may have been previously deleted.
if (userSport == null) if (userSport == null)
userSport = AccountMgr.CreateUserSport(SessionData.User.UserAccountId, sportId); {
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
prmUserSport.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
prmUserSport.SportIdsIncluded.Add(sportId);
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
userSport = AccountMgr.GetUserSport(prmUserSport);
if (userSport != null)
{
SaLogger.Info(fn + " Resurrecting User Sport with status: " + userSport.StatusDesc + ". Id: " + SysId.ToString(userSport.Id));
userSport.Status = SaxUserSport.DefaultStatus;
}
else
userSport = AccountMgr.CreateUserSport(SessionData.User.UserAccountId, sportId);
}
// Populate item properties. // Populate item properties.
if (model.ProfileSportParticipationCode != null)
userSport.Participation = model.ProfileSportParticipation;
if (model.ProfileSportOfficiatingCode != null)
userSport.Officiating = model.ProfileSportOfficiating;
// Store item. // Store item.
if (!SysId.IsValid(userSport.Id)) if (!SysId.IsValid(userSport.Id))
@@ -251,6 +282,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
} }
} }
// Refresh list of profile sports for Activity Index.
RefreshSessionProfileSports();
// Construct response. // Construct response.
PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport); PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport);
responseData.Success = true; responseData.Success = true;
@@ -46,7 +46,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_List data) private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_List data)
{ {
data.Id = SysId.ToString(opportunity.Id); data.Id = SysId.ToString(opportunity.Id);
data.TypeCode = OpportunityTypes.GetCodeForType(opportunity.OpportunityType); data.TypeCode = OpportunityTypeCodes.GetCodeForType(opportunity.OpportunityType);
data.TypeDesc = Localiser.GetOpportunityTypeCaption(opportunity.OpportunityType); data.TypeDesc = Localiser.GetOpportunityTypeCaption(opportunity.OpportunityType);
data.Position = opportunity.Position; data.Position = opportunity.Position;
data.Outline = opportunity.Outline; data.Outline = opportunity.Outline;
@@ -113,7 +113,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
SessionData_Online.Filter.SetMemberOrganisation(organisation); SessionData_Online.Filter.SetMemberOrganisation(organisation);
// Reference data - opportunity types. // Reference data - opportunity types.
foreach (TypeCodeDesc opportunityType in OpportunityTypes) foreach (TypeCodeDesc opportunityType in OpportunityTypeCodes)
responseData.OpportunityTypes.Add(opportunityType.Code, Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)opportunityType.Type)); responseData.OpportunityTypes.Add(opportunityType.Code, Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)opportunityType.Type));
// User organisation. // User organisation.
@@ -172,11 +172,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{ {
Id = values.GetString(colId.DataName), Id = values.GetString(colId.DataName),
TypeCode = values.GetString(colOpportunityTypeCode.DataName), TypeCode = values.GetString(colOpportunityTypeCode.DataName),
TypeDesc = Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)OpportunityTypes.GetTypeForCode(values.GetString(colOpportunityTypeCode.DataName))), TypeDesc = Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)OpportunityTypeCodes.GetTypeForCode(values.GetString(colOpportunityTypeCode.DataName))),
Position = values.GetString(colPosition.DataName), Position = values.GetString(colPosition.DataName),
Outline = values.GetString(colOutline.DataName), Outline = values.GetString(colOutline.DataName),
RegionCaption = model.GetRegionCaption(values.GetString(colRegionName.DataName).ToSysId()), RegionCaption = model.GetRegionCaption(values.GetString(colRegionId.DataName).ToSysId()),
SportCaption = model.GetSportCaption(values.GetString(colSportName.DataName).ToSysId()), SportCaption = model.GetSportCaption(values.GetString(colSportId.DataName).ToSysId()),
CreatedOnFmt = DateUtil.Format(values.GetDateTime(colCreatedOn.DataName), "d-MMM-yyyy"), CreatedOnFmt = DateUtil.Format(values.GetDateTime(colCreatedOn.DataName), "d-MMM-yyyy"),
PublishedOnFmt = DateUtil.Format(values.GetDateTime(colPublishedOn.DataName), "d-MMM-yyyy"), PublishedOnFmt = DateUtil.Format(values.GetDateTime(colPublishedOn.DataName), "d-MMM-yyyy"),
ExpiresOnFmt = DateUtil.Format(values.GetDateTime(colExpiresOn.DataName), "d-MMM-yyyy"), ExpiresOnFmt = DateUtil.Format(values.GetDateTime(colExpiresOn.DataName), "d-MMM-yyyy"),
@@ -326,7 +326,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
if (model.OpportunitySportId != null) if (model.OpportunitySportId != null)
opportunity.SportIdPrimary = model.OpportunitySportId.ToSysId(); opportunity.SportIdPrimary = model.OpportunitySportId.ToSysId();
if (model.OpportunityTypeCode != null) if (model.OpportunityTypeCode != null)
opportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypes.GetTypeForCode(model.OpportunityTypeCode); opportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypeCodes.GetTypeForCode(model.OpportunityTypeCode);
if (model.OpportunityPosition != null) if (model.OpportunityPosition != null)
opportunity.Position = model.OpportunityPosition; opportunity.Position = model.OpportunityPosition;
if (model.OpportunityOutline != null) if (model.OpportunityOutline != null)
@@ -96,6 +96,22 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
return true; return true;
} }
//-------------------------------------------------------------------
/// <summary>Populate the user's profile contact details to the session.</summary>
protected bool RefreshSessionProfileContact(SaxUserAccount userAccount)
{
String fn = GetType().Name + ".RefreshSessionProfileContact";
SaxSessionData_Online sessionData = SessionData_Online;
SysId userAccountId = sessionData?.User.UserAccountId ?? null;
if (!SysId.IsValid(userAccountId)) return false;
if (!SysId.IsValid(userAccount?.Id ?? null)) return false;
if (!userAccountId.Equals(userAccount.Id)) return false;
sessionData.RefreshUser(userAccount);
return true;
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Populate the user's profile sports to the session.</summary> /// <summary>Populate the user's profile sports to the session.</summary>
protected bool RefreshSessionProfileSports() protected bool RefreshSessionProfileSports()
@@ -109,18 +125,22 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Read discrete values to avoid loading the entire UserSport records which can be substantial. // Read discrete values to avoid loading the entire UserSport records which can be substantial.
ColumnDfn colSportId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportId); ColumnDfn colSportId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportId);
ColumnDfn colSportName = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Sport_Name); ColumnDfn colSportName = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Sport_Name);
ColumnDfn colParticipation = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportParticipation);
ColumnDfn colOfficiating = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportOfficiating);
ColumnDfn colStatus = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Status); ColumnDfn colStatus = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Status);
SaxUserSport.Params prmUserSport = new SaxUserSport.Params(); SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
prmUserSport.UserAccountIdsIncluded.Add(userAccountId); prmUserSport.UserAccountIdsIncluded.Add(userAccountId);
prmUserSport.StatusCat = SaxUserSport.StatusCat.ActiveOnly; prmUserSport.StatusCat = SaxUserSport.StatusCat.ActiveOnly;
using (DbResultSet resultSet = AccountMgr.ExecuteUserSportQuery(new List<ColumnDfn>() { colSportId, colSportName, colStatus }, prmUserSport)) using (DbResultSet resultSet = AccountMgr.ExecuteUserSportQuery(new List<ColumnDfn>() { colSportId, colSportName, colParticipation, colOfficiating, colStatus }, prmUserSport))
{ {
while (resultSet != null && resultSet.NextRecord()) while (resultSet != null && resultSet.NextRecord())
{ {
NamedValue.Map values = resultSet.GetRecordValues(); NamedValue.Map values = resultSet.GetRecordValues();
SysId sportId = new SysId(values.GetLong(colSportId.DataName)); SysId sportId = new SysId(values.GetLong(colSportId.DataName));
String sportName = values.GetString(colSportName.DataName); String sportName = values.GetString(colSportName.DataName);
Sax.SportParticipation participation = (Sax.SportParticipation)values.GetLong(colParticipation.DataName);
Sax.SportOfficiating officiating = (Sax.SportOfficiating)values.GetLong(colOfficiating.DataName);
SaStatus status = SacsSystem.GetStatusForCode(values.GetString(colStatus.DataName)); SaStatus status = SacsSystem.GetStatusForCode(values.GetString(colStatus.DataName));
sessionData.Profile.AddSport(sportId, status); sessionData.Profile.AddSport(sportId, status);
} }
@@ -1,9 +1,11 @@
using Sarand.Net.Standard.Base.Bus; using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils; using Sarand.Net.Standard.Base.Utils;
using Saxonite.Base.App; using Saxonite.Base.App;
using Saxonite.Net.Core.Web.Base.App; using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Core.Web.Base.Controllers; using Saxonite.Net.Core.Web.Base.Controllers;
using Saxonite.Net.Core.Web.Base.Models; using Saxonite.Net.Core.Web.Base.Models;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus; using Saxonite.Net.Standard.Base.Bus;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -41,6 +43,18 @@ namespace Saxonite.Net.Core.Web.Online.Models
public String UserSportId { get; set; } public String UserSportId { get; set; }
public String ProfileSportId { get; set; } public String ProfileSportId { get; set; }
public String ProfileSportExists { get; set; } public String ProfileSportExists { get; set; }
public String ProfileSportParticipationCode { get; set; }
public Sax.SportParticipation ProfileSportParticipation
{
get { return (Sax.SportParticipation)SportParticipationCodes.GetTypeForCode(ProfileSportParticipationCode); }
set { ProfileSportParticipationCode = SportParticipationCodes.GetCodeForType(value); }
}
public String ProfileSportOfficiatingCode { get; set; }
public Sax.SportOfficiating ProfileSportOfficiating
{
get { return (Sax.SportOfficiating)SportOfficiatingCodes.GetTypeForCode(ProfileSportOfficiatingCode); }
set { ProfileSportOfficiatingCode = SportOfficiatingCodes.GetCodeForType(value); }
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
public bool ValidateContactDetails(SaxController_Base.AjaxResponse_Data responseData) public bool ValidateContactDetails(SaxController_Base.AjaxResponse_Data responseData)
@@ -29,8 +29,8 @@
</div> </div>
<div class="sax-content"> <div class="sax-content">
<div class="row"> <div class="row">
<div class="col-sm-6"><div class=""></div></div> <div class="col-sm-6 sax-note">@Localiser["label.participation"]:&nbsp;<span class="SportParticipation"></span></div>
<div class="col-sm-6"><div class=""></div></div> <div class="col-sm-6 sax-note">@Localiser["label.officiating"]:&nbsp;<span class="SportOfficiating"></span></div>
</div> </div>
</div> </div>
</div> </div>
@@ -43,28 +43,50 @@
@Html.HiddenFor(model => model.UserSportId, new { @id = "", @class = "UserSportId" }) @Html.HiddenFor(model => model.UserSportId, new { @id = "", @class = "UserSportId" })
} }
<div id="dlgProfileSport" class="sax-dialog"> <div id="dlgProfileSport" class="sax-dialog">
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSport", @class = "sax-form", @onSubmit = "return false;" })) @using (Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSport", @class = "sax-form", @onSubmit = "return false;" }))
{ {
<input type="hidden" class="UserSportId" name="UserSportId" /> <input type="hidden" class="UserSportId" name="UserSportId" />
<input type="hidden" class="ProfileSportExists" name="ProfileSportExists" /> <input type="hidden" class="ProfileSportExists" name="ProfileSportExists" />
@* Sport *@ @* Sport *@
<div class="sax-form-control ProfileSportId"> <div class="sax-form-control ProfileSportId">
<div class="sax-label"> <div class="sax-label">
<label for="ifProfileSport"><span><span class="required">*</span> @Localiser["label.sport"]</span></label> <label for="ifProfileSport"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
</div>
<div class="sax-control row">
<input type="hidden" id="ifProfileSportId" class="ProfileSportId" name="ProfileSportId" />
<div class="col"><input type="text" id="ifProfileSport" class="ProfileSport sax-input" name="ProfileSport" readonly="readonly" maxlength=128 /></div>
<div class="fixed"><button id="pbSelectSport" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectUserSport()">@Localiser["label.select"]</button></div>
</div>
<div class="sax-message"></div>
</div> </div>
<div class="sax-control row">
<input type="hidden" id="ifProfileSportId" class="ProfileSportId" name="ProfileSportId" />
<div class="col"><input type="text" id="ifProfileSport" class="ProfileSport sax-input" name="ProfileSport" readonly="readonly" maxlength=128 /></div>
<div class="fixed"><button id="pbSelectSport" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectUserSport()">@Localiser["label.select"]</button></div>
</div>
<div class="sax-message"></div>
</div>
} @* Sport Participation *@
<div class="sax-form-control ProfileSportParticipation">
<div class="sax-label">
<label for="cbProfileSportParticipation"><span><span class="required">*</span> @Localiser["label.participation"]</span></label>
</div>
<div class="sax-control">
@Html.DropDownListFor(model => model.ProfileSportParticipationCode, Model.SportParticipationCodesForSelect, "", new { @id = "cbProfileSportParticipation", @class = "ProfileSportParticipation sax-select" })
</div>
<div class="sax-message"></div>
</div>
</div> @* Sport Officiating *@
<div class="sax-form-control ProfileSportOfficiating">
<div class="sax-label">
<label for="cbProfileSportOfficiating"><span><span class="required">*</span> @Localiser["label.officiating"]</span></label>
</div>
<div class="sax-control">
@Html.DropDownListFor(model => model.ProfileSportOfficiatingCode, Model.SportOfficiatingCodesForSelect, "", new { @id = "cbProfileSportOfficiating", @class = "ProfileSportOfficiating sax-select" })
</div>
<div class="sax-message"></div>
</div>
}
</div>
</div> </div>
@@ -41,13 +41,13 @@
<div class="sax-content"> <div class="sax-content">
<div class="row"> <div class="row">
<div class="col-sm-12"><div class="ArticleSummary"></div></div> <div class="col-sm-12"><div class="ArticleSummary"></div></div>
<div class="col-6"><div class="ArticleSportCaption"></div></div> <div class="col-6"><div class="ArticleSportCaption sax-note"></div></div>
<div class="col-6 right"><div class="ArticleRegionCaption"></div></div> <div class="col-6 right"><div class="ArticleRegionCaption sax-note"></div></div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-4"><div class="">@Localiser["label.created"]:&nbsp;<span class="ArticleCreatedOn"></span></div></div> <div class="col-sm-4"><div class="sax-note">@Localiser["label.created"]:&nbsp;<span class="ArticleCreatedOn"></span></div></div>
<div class="col-sm-4"><div class="ArticlePublished">@Localiser["label.published"]:&nbsp;<span class="ArticlePublishedOn"></span></div></div> <div class="col-sm-4"><div class="ArticlePublished sax-note">@Localiser["label.published"]:&nbsp;<span class="ArticlePublishedOn"></span></div></div>
<div class="col-sm-4 right"><div class="ArticleStatusDesc"></div></div> <div class="col-sm-4 right"><div class="ArticleStatusDesc sax-note"></div></div>
</div> </div>
</div> </div>
</div> </div>
@@ -49,13 +49,13 @@
<div class="sax-content"> <div class="sax-content">
<div class="row"> <div class="row">
<div class="col-sm-12"><div class="OpportunityOutline"></div></div> <div class="col-sm-12"><div class="OpportunityOutline"></div></div>
<div class="col-sm-6"><div class="OpportunityRegionCaption"></div></div> <div class="col-sm-6"><div class="OpportunityRegionCaption sax-note"></div></div>
<div class="col-sm-6 right"><div class="OpportunitySportCaption"></div></div> <div class="col-sm-6 right"><div class="OpportunitySportCaption sax-note"></div></div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-4"><div class="">@Localiser["label.created"]:&nbsp;<span class="OpportunityCreatedOn"></span></div></div> <div class="col-sm-4"><div class="sax-note">@Localiser["label.created"]:&nbsp;<span class="OpportunityCreatedOn"></span></div></div>
<div class="col-sm-4"><div class="OpportunityPublished">@Localiser["label.published"]:&nbsp;<span class="OpportunityPublishedOn"></span></div></div> <div class="col-sm-4"><div class="OpportunityPublished sax-note">@Localiser["label.published"]:&nbsp;<span class="OpportunityPublishedOn"></span></div></div>
<div class="col-sm-4 right"><div class="OpportunityStatusDesc"></div></div> <div class="col-sm-4 right"><div class="OpportunityStatusDesc sax-note"></div></div>
</div> </div>
</div> </div>
</div> </div>
+21 -16
View File
@@ -5,6 +5,7 @@
(function (win, doc, undef) (function (win, doc, undef)
{ {
"use strict"; "use strict";
sax.profile = { contact: {}, sports: {}, organisations: {} };
//-------------------------------------------------------------- //--------------------------------------------------------------
sax.refreshProfile = function () sax.refreshProfile = function ()
@@ -37,7 +38,7 @@
} }
sax.onRefreshProfileContactInfo = function (response) sax.onRefreshProfileContactInfo = function (response)
{ {
sax.debug('onRefreshProfileContactInfo', response); //sax.debug('onRefreshProfileContactInfo', response);
if (!response || !response.success || !response.contact) return; if (!response || !response.success || !response.contact) return;
var $section = $('.sax-panel-section.ProfileContact'); var $section = $('.sax-panel-section.ProfileContact');
$('.sax-message', $section).stop(true, false).fadeOut(200).empty(); $('.sax-message', $section).stop(true, false).fadeOut(200).empty();
@@ -50,7 +51,7 @@
} }
sax.onRefreshProfileContactForm = function (response) sax.onRefreshProfileContactForm = function (response)
{ {
sax.debug('onRefreshProfileContactForm', response); //sax.debug('onRefreshProfileContactForm', response);
if (!response || !response.success) return; if (!response || !response.success) return;
var $section = $('.sax-panel-section.ProfileContact'); var $section = $('.sax-panel-section.ProfileContact');
$('.sax-message', $section).stop(true, false).fadeOut(200).empty(); $('.sax-message', $section).stop(true, false).fadeOut(200).empty();
@@ -85,7 +86,7 @@
} }
sax.onSelectRegionCountry = function (region) sax.onSelectRegionCountry = function (region)
{ {
sax.debug(region); //sax.debug(region);
sax.clearControlError($('#ifAccountRegionIdCountry').val(region.id)); sax.clearControlError($('#ifAccountRegionIdCountry').val(region.id));
$('#ifAccountRegionCaptionCountry').val(region ? region.name : ''); $('#ifAccountRegionCaptionCountry').val(region ? region.name : '');
} }
@@ -101,7 +102,7 @@
} }
sax.refreshProfileSports = function (callbackFn) sax.refreshProfileSports = function (callbackFn)
{ {
//sax.debug('refreshProfileSports'); sax.debug('refreshProfileSports');
delete sax.page.profileSportsChanged; delete sax.page.profileSportsChanged;
sax.ajaxProfileSports = sax.ajaxProfileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true }; sax.ajaxProfileSports = sax.ajaxProfileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true };
sax.ajaxProfileSports.callbackFn = callbackFn; sax.ajaxProfileSports.callbackFn = callbackFn;
@@ -109,11 +110,11 @@
} }
sax.onRefreshProfileSportsInfo = function (response) sax.onRefreshProfileSportsInfo = function (response)
{ {
sax.debug('onRefreshProfileSportsInfo', response); //sax.debug('onRefreshProfileSportsInfo', response);
if (!response || !response.success) return; if (!response || !response.success) return;
var $section = $('.sax-panel-section.ProfileSports'); var $section = $('.sax-panel-section.ProfileSports');
$('.sax-message', $section).stop(true, false).fadeOut(200).empty(); $('.sax-message', $section).stop(true, false).fadeOut(200).empty();
sax.profile.sports.Ids = [];
let items = response.sports; let items = response.sports;
if (!items) return; if (!items) return;
let $items = $('.sax-panel-results.ProfileSports', $section).empty(); let $items = $('.sax-panel-results.ProfileSports', $section).empty();
@@ -121,9 +122,11 @@
for (let itemIdx = 0; itemIdx < items.length; itemIdx++) for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
{ {
let item = items[itemIdx]; let item = items[itemIdx];
sax.profile.sports.Ids.push(item.sportId);
let $item = $tmpl.clone().prop('id', 'ProSpt_' + item.id); let $item = $tmpl.clone().prop('id', 'ProSpt_' + item.id);
$('.sax-header .sax-action.sax-edit', $item).on('click', function (evt) { sax.updateProfileSport(item.id); }); $('.sax-header .sax-action.sax-edit', $item).on('click', function (evt) { sax.updateProfileSport(item.id); });
$('.SportName', $item).text(item.sportName); $('.SportName', $item).text(item.sportName);
$('.SportParticipation', $item).text(item.sportParticipation);
$items.append($item); $items.append($item);
} }
$items.show(); $items.show();
@@ -132,37 +135,40 @@
} }
sax.addProfileSport = function () sax.addProfileSport = function ()
{ {
sax.debug('addProfileSport'); //sax.debug('addProfileSport');
let $dlg = sax.$dlg.profileSport; let $dlg = sax.$dlg.profileSport;
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,#ifProfileSport', $dlg).val(''); $('.UserSportId,.ProfileSportExists,#ifProfileSportId,input.sax-input,select.sax-select', $dlg).val('');
$('#pbSelectSport', $dlg).show(); $('#pbSelectSport', $dlg).show();
$dlg.dialog('option', 'title', sax.dlg.title.addUserSport); $dlg.dialog('option', 'title', sax.dlg.title.addUserSport);
sax.openDialog($dlg, 480, 400); sax.openDialog($dlg, 480, 400);
} }
sax.updateProfileSport = function (id) sax.updateProfileSport = function (id)
{ {
sax.debug('updateProfileSport', id); //sax.debug('updateProfileSport', id);
$('#frmProfileSportId .UserSportId').val(id); $('#frmProfileSportId .UserSportId').val(id);
sax.ajaxProfileSport = sax.ajaxProfileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport }; sax.ajaxProfileSport = sax.ajaxProfileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport };
sax.doAjaxRequest(sax.ajaxProfileSport, 50); sax.doAjaxRequest(sax.ajaxProfileSport, 50);
} }
sax.doUpdateProfileSport = function (response) sax.doUpdateProfileSport = function (response)
{ {
sax.debug('doUpdateProfileSport', response); //sax.debug('doUpdateProfileSport', response);
let $dlg = sax.$dlg.profileSport; let $dlg = sax.$dlg.profileSport;
let item = response.sport; let item = response.sport;
$('.UserSportId', $dlg).val(item.id); $('.UserSportId', $dlg).val(item.id);
$('.ProfileSportExists', $dlg).val(1); $('.ProfileSportExists', $dlg).val(1);
$('#ifProfileSportId', $dlg).val(item.sportId); $('#ifProfileSportId', $dlg).val(item.sportId);
$('#ifProfileSport', $dlg).val(item.sportName); $('#ifProfileSport', $dlg).val(item.sportName);
$('#cbProfileSportParticipation', $dlg).val(item.sportParticipationCode);
$('#cbProfileSportOfficiating', $dlg).val(item.sportOfficiatingCode);
$('#pbSelectSport', $dlg).hide(); $('#pbSelectSport', $dlg).hide();
$dlg.dialog('option', 'title', sax.dlg.title.updateUserSport); $dlg.dialog('option', 'title', sax.dlg.title.updateUserSport);
sax.openDialog($dlg, 480, 400); sax.openDialog($dlg, 480, 400);
} }
sax.selectUserSport = function (sport) sax.selectUserSport = function (sport)
{ {
sax.debug('selectUserSport'); //sax.debug('selectUserSport');
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), fnCallback: sax.onSelectUserSport }) let excludeIds = $.grep(sax.profile.sports.Ids, function (value) { return !sport || value != sport.id; });
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), excludeIds: excludeIds, fnCallback: sax.onSelectUserSport })
} }
sax.onSelectUserSport = function (sport) sax.onSelectUserSport = function (sport)
{ {
@@ -171,7 +177,7 @@
} }
sax.storeProfileSport = function () sax.storeProfileSport = function ()
{ {
sax.debug('storeProfileSport'); //sax.debug('storeProfileSport');
sax.clearControlErrors(); sax.clearControlErrors();
sax.ajaxStoreProfileSport = sax.ajaxStoreProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport }; sax.ajaxStoreProfileSport = sax.ajaxStoreProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport };
sax.doAjaxRequest(sax.ajaxStoreProfileSport, 50); sax.doAjaxRequest(sax.ajaxStoreProfileSport, 50);
@@ -179,8 +185,7 @@
sax.onStoreProfileSport = function (response) sax.onStoreProfileSport = function (response)
{ {
sax.refreshControlValues(response.controlValues); sax.refreshControlValues(response.controlValues);
if (!response || !response.success) if (!response || !response.success) return;
return;
sax.$dlg.profileSport.dialog('close'); sax.$dlg.profileSport.dialog('close');
sax.refreshProfileSportsInfo(); sax.refreshProfileSportsInfo();
} }
@@ -204,7 +209,7 @@
} }
sax.onRefreshProfileOrganisationsInfo = function (response) sax.onRefreshProfileOrganisationsInfo = function (response)
{ {
sax.debug('onRefreshProfileOrganisationsInfo', response); //sax.debug('onRefreshProfileOrganisationsInfo', response);
if (!response || !response.success) return; if (!response || !response.success) return;
var $section = $('.sax-panel-section.ProfileOrganisations'); var $section = $('.sax-panel-section.ProfileOrganisations');
$('.sax-message', $section).stop(true, false).fadeOut(200).empty(); $('.sax-message', $section).stop(true, false).fadeOut(200).empty();
+2 -1
View File
@@ -9,6 +9,7 @@
//-------------------------------------------------------------- //--------------------------------------------------------------
sax.refreshResults = function (delay) sax.refreshResults = function (delay)
{ {
if (sax.awaitingLogin) return;
var $results = $('.sax-panel-results'); var $results = $('.sax-panel-results');
if (!sax.awaitingRefreshResponse) if (!sax.awaitingRefreshResponse)
{ {
@@ -21,7 +22,7 @@
} }
sax.doRefreshResults = function (response) sax.doRefreshResults = function (response)
{ {
sax.debug('doRefreshResults', response); //sax.debug('doRefreshResults', response);
delete sax.awaitingRefreshResponse; delete sax.awaitingRefreshResponse;
var $results = $('.sax-panel-results'); var $results = $('.sax-panel-results');
var $msgs = $('.sax-panel-messages', $results).hide().empty(); var $msgs = $('.sax-panel-messages', $results).hide().empty();
@@ -22,7 +22,7 @@
} }
sax.doRefreshResults = function (response) sax.doRefreshResults = function (response)
{ {
sax.debug('doRefreshResults', response); //sax.debug('doRefreshResults', response);
delete sax.awaitingRefreshResponse; delete sax.awaitingRefreshResponse;
sax.refreshControlValues(response.controlValues); sax.refreshControlValues(response.controlValues);
var $results = $('.sax-panel-results'); var $results = $('.sax-panel-results');
@@ -23,7 +23,7 @@
} }
sax.doRefreshResults = function (response) sax.doRefreshResults = function (response)
{ {
sax.debug('doRefreshResults', response); //sax.debug('doRefreshResults', response);
delete sax.awaitingRefreshResponse; delete sax.awaitingRefreshResponse;
sax.refreshControlValues(response.controlValues); sax.refreshControlValues(response.controlValues);
var $panel = $('#pnlOpportunities'); var $panel = $('#pnlOpportunities');
@@ -83,7 +83,7 @@
{ {
let handleMemberOrganisationsResponse = function (response) let handleMemberOrganisationsResponse = function (response)
{ {
sax.debug('handleUserOrgsResponse', response); //sax.debug('handleUserOrgsResponse', response);
if (!response.success) return; if (!response.success) return;
sax.data.memberOrganisations = response.organisations; sax.data.memberOrganisations = response.organisations;
if (fnCallback) fnCallback(); if (fnCallback) fnCallback();
@@ -15,7 +15,6 @@
} }
sax.onSignin = function (response) sax.onSignin = function (response)
{ {
sax.debug(response);
sax.refreshControlValues(response.controlValues); sax.refreshControlValues(response.controlValues);
if (!response.success) return; if (!response.success) return;
sax.goToPage(''); sax.goToPage('');
@@ -11,7 +11,8 @@
/* /*
* Sport selection config: * Sport selection config:
* - caption - dialog title. * - caption - dialog title.
* - sportId - currently selected sport. * - sportId - currently selected sport.
* - excludeIds - array of sports Ids to ignore.
* - fnCallback - method to call on completion to store selected sport. * - fnCallback - method to call on completion to store selected sport.
*/ */
ss.fn.selectSport = function (cfg) ss.fn.selectSport = function (cfg)
@@ -61,6 +62,7 @@
for (let rgnIdx = 0; rgnIdx < sports.length; rgnIdx++) for (let rgnIdx = 0; rgnIdx < sports.length; rgnIdx++)
{ {
let sport = sports[rgnIdx]; let sport = sports[rgnIdx];
if (ss.cfg.excludeIds && ss.cfg.excludeIds.includes(sport.id)) continue;
let id = sport.id; let id = sport.id;
if (filter && !sport.name.match(reFilter)) continue; if (filter && !sport.name.match(reFilter)) continue;
let $sport = $sportTmpl.clone(); let $sport = $sportTmpl.clone();
+4 -1
View File
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
public static class Version public static class Version
{ {
private static String version { get; } = "1.0.5.3"; private static String version { get; } = "1.0.6.0";
// Retrieve version. // Retrieve version.
public static String GetFullVersion () { return version; } public static String GetFullVersion () { return version; }
public static String GetAppVersion () public static String GetAppVersion ()
@@ -39,6 +39,9 @@ namespace Saxonite.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Version history. // Version history.
//-------------------------------------------------------------------
// 1.0.6 ?-Jun-2021 ???
// - ?.
// 1.0.5 31-May-2021 Activity Index // 1.0.5 31-May-2021 Activity Index
// - Admin Database Schema (Home) and Tables page. // - Admin Database Schema (Home) and Tables page.
// - Online Account country, Home activities. // - Online Account country, Home activities.
+19 -4
View File
@@ -88,6 +88,8 @@ namespace Saxonite.Net.Standard.Base.App
public enum CodeType public enum CodeType
{ {
YesNo, YesNo,
SportParticipation,
SportOfficiating,
RegionType, RegionType,
UserRole, UserRole,
Title, Title,
@@ -170,10 +172,23 @@ namespace Saxonite.Net.Standard.Base.App
{ {
Unknown = 0, Unknown = 0,
/* Do not change the values/codes - tied to database. */ /* Do not change the values/codes - tied to database. */
Regular, Professional = 100,
Occasional, Regular = 200,
Spectator, Occasional = 300,
Interested Spectator = 400,
Interested = 900,
}
//-------------------------------------------------------------------
/// <summary>Sport Officiating</summary>
public enum SportOfficiating
{
Unknown = 0,
/* Do not change the values/codes - tied to database. */
Professional = 100,
Regular = 200,
Occasional = 300,
Interested = 900,
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Base.App namespace Saxonite.Base.App
{ {
@@ -201,6 +201,8 @@ namespace Saxonite.Base.App
UserSport_Id, UserSport_Id,
UserSport_UserAccountId, UserSport_UserAccountId,
UserSport_SportId, UserSport_SportId,
UserSport_Participation,
UserSport_Officiating,
UserSport_UserSportData, UserSport_UserSportData,
UserSport_Notes, UserSport_Notes,
UserSport_Flags, UserSport_Flags,
@@ -216,7 +218,7 @@ namespace Saxonite.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private static readonly int tableCount = 11; private static readonly int tableCount = 11;
private static readonly int columnCount = 176; private static readonly int columnCount = 178;
private static ulong maxTextLen = 0; private static ulong maxTextLen = 0;
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -565,6 +567,8 @@ namespace Saxonite.Base.App
new ColumnDfn(11,"Id",4,4,true,10), new ColumnDfn(11,"Id",4,4,true,10),
new ColumnDfn(11,"UserAccountId",4,4,false,10), new ColumnDfn(11,"UserAccountId",4,4,false,10),
new ColumnDfn(11,"SportId",4,4,false,10), new ColumnDfn(11,"SportId",4,4,false,10),
new ColumnDfn(11,"Participation",3,5,false,5),
new ColumnDfn(11,"Officiating",3,5,false,5),
new ColumnDfn(11,"UserSportData",0,-9,false,0), new ColumnDfn(11,"UserSportData",0,-9,false,0),
new ColumnDfn(11,"Notes",0,-9,false,2000), new ColumnDfn(11,"Notes",0,-9,false,2000),
new ColumnDfn(11,"Flags",3,5,false,5), new ColumnDfn(11,"Flags",3,5,false,5),
@@ -87,13 +87,15 @@ namespace Saxonite.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// System codes. // System codes.
private readonly Dictionary<Sax.CodeType, List<TypeCodeDesc>> codeTypes = new Dictionary<Sax.CodeType, List<TypeCodeDesc>>(); private readonly Dictionary<Sax.CodeType, List<TypeCodeDesc>> codeTypes = new Dictionary<Sax.CodeType, List<TypeCodeDesc>>();
public List<TypeCodeDesc> RegionTypes { get { return GetCodesOfType(Sax.CodeType.RegionType); } } public List<TypeCodeDesc> SportParticipationCodes { get { return GetCodesOfType(Sax.CodeType.SportParticipation); } }
public List<TypeCodeDesc> UserRoles { get { return GetCodesOfType(Sax.CodeType.UserRole); } } public List<TypeCodeDesc> SportOfficiatingCodes { get { return GetCodesOfType(Sax.CodeType.SportOfficiating); } }
public List<TypeCodeDesc> OrganisationTypes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } } public List<TypeCodeDesc> RegionTypeCodes { get { return GetCodesOfType(Sax.CodeType.RegionType); } }
public List<TypeCodeDesc> OrganisationCategories { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } } public List<TypeCodeDesc> UserRoleCodes { get { return GetCodesOfType(Sax.CodeType.UserRole); } }
public List<TypeCodeDesc> OrganisationRoles { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } } public List<TypeCodeDesc> OrganisationTypeCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
public List<TypeCodeDesc> OpportunityTypes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } } public List<TypeCodeDesc> OrganisationCategoryCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
public List<TypeCodeDesc> DataItemTypes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } } public List<TypeCodeDesc> OrganisationRoleCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
public List<TypeCodeDesc> OpportunityTypeCodes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
public List<TypeCodeDesc> DataItemTypeCodes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } }
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType) public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
{ {
if (!codeTypes.ContainsKey(codeType)) if (!codeTypes.ContainsKey(codeType))
+40 -14
View File
@@ -14,7 +14,7 @@ using Newtonsoft.Json.Converters;
namespace Saxonite.Net.Standard.Base.App namespace Saxonite.Net.Standard.Base.App
{ {
//======================================================================= //=======================================================================
public class SaxSessionData public abstract class SaxSessionData
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Protected construction. // Protected construction.
@@ -28,7 +28,7 @@ namespace Saxonite.Net.Standard.Base.App
private SaxSessionData(SaxSessionContext sessionContext) private SaxSessionData(SaxSessionContext sessionContext)
{ {
SessionContext = sessionContext; SessionContext = sessionContext;
User = new UserData(SessionContext, null, null); userData = CreateUserData(SessionContext, null, null);
} }
/// <summary> /// <summary>
/// Primary constructor - on user login. /// Primary constructor - on user login.
@@ -38,7 +38,7 @@ namespace Saxonite.Net.Standard.Base.App
protected SaxSessionData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) protected SaxSessionData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles)
{ {
SessionContext = sessionContext; SessionContext = sessionContext;
User = new UserData(SessionContext, userAccount, userRoles); userData = CreateUserData(SessionContext, userAccount, userRoles);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -60,17 +60,12 @@ namespace Saxonite.Net.Standard.Base.App
public class UserData public class UserData
{ {
protected UserData() { } protected UserData() { }
public UserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) protected UserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles)
{ {
if (userAccount != null) if (userAccount != null)
{ {
UserAccountId = userAccount.Id; UserAccountId = userAccount.Id;
FirstName = userAccount.FirstName; RefreshUserData(userAccount);
LastName = userAccount.LastName;
DisplayName = userAccount.GetDisplayName();
EmailAddress = userAccount.EmailAddress;
RegionIdCountry = userAccount.RegionIdCountry;
RegionIdProvince = userAccount.RegionIdProvince;
if (sessionContext.Application == Sax.Application.Admin) if (sessionContext.Application == Sax.Application.Admin)
KeepLoggedIn = userAccount.KeepLoggedIn_Admin; KeepLoggedIn = userAccount.KeepLoggedIn_Admin;
else if (sessionContext.Application == Sax.Application.Online) else if (sessionContext.Application == Sax.Application.Online)
@@ -84,7 +79,22 @@ namespace Saxonite.Net.Standard.Base.App
} }
} }
} }
protected UserData(UserData userData)
{
UserAccountId = userData.UserAccountId;
Title = userData.Title;
FirstName = userData.FirstName;
LastName = userData.LastName;
DisplayName = userData.DisplayName;
EmailAddress = userData.EmailAddress;
RegionIdCountry = userData.RegionIdCountry;
RegionIdProvince = userData.RegionIdProvince;
KeepLoggedIn = userData.KeepLoggedIn;
roles.AddRange(userData.Roles);
}
// Properties.
public SysId UserAccountId { get; protected set; } public SysId UserAccountId { get; protected set; }
public String Title { get; protected set; }
public String FirstName { get; protected set; } public String FirstName { get; protected set; }
public String LastName { get; protected set; } public String LastName { get; protected set; }
public String DisplayName { get; protected set; } public String DisplayName { get; protected set; }
@@ -93,6 +103,21 @@ namespace Saxonite.Net.Standard.Base.App
public SysId RegionIdProvince { get; protected set; } public SysId RegionIdProvince { get; protected set; }
public bool KeepLoggedIn { get; protected set; } public bool KeepLoggedIn { get; protected set; }
public bool UserAccountSupplied { get; protected set; } public bool UserAccountSupplied { get; protected set; }
// Refresh properties.
protected bool RefreshUserData(SaxUserAccount userAccount)
{
// Check that user matches the session.
if (!SysId.IsValid(UserAccountId) || !SysId.IsValid(userAccount?.Id ?? null) || !UserAccountId.Equals(userAccount.Id)) return false;
// Refresh properties.
Title = userAccount.Title;
FirstName = userAccount.FirstName;
LastName = userAccount.LastName;
DisplayName = userAccount.GetDisplayName();
EmailAddress = userAccount.EmailAddress;
RegionIdCountry = userAccount.RegionIdCountry;
RegionIdProvince = userAccount.RegionIdProvince;
return true;
}
// Roles. // Roles.
public class RoleData public class RoleData
{ {
@@ -107,19 +132,20 @@ namespace Saxonite.Net.Standard.Base.App
public Sax.UserRole Role { get; protected set; } public Sax.UserRole Role { get; protected set; }
public SaStatus Status { get; protected set; } public SaStatus Status { get; protected set; }
} }
[JsonIgnore]
private readonly List<RoleData> roles = new List<RoleData>(); private readonly List<RoleData> roles = new List<RoleData>();
public List<RoleData> Roles { get { return new List<RoleData>(roles); } protected set { roles.Clear(); roles.AddRange(value); } } public List<RoleData> Roles { get { return new List<RoleData>(roles); } protected set { roles.Clear(); roles.AddRange(value); } }
[JsonIgnore] [JsonIgnore]
public bool IsJournalist { get { return roles?.Exists(item => item.Role == Sax.UserRole.Journalist) ?? false; } } public bool IsJournalist { get { return roles?.Exists(item => item.Role == Sax.UserRole.Journalist) ?? false; } }
} }
public UserData User { get; private set; } protected abstract UserData CreateUserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles);
private UserData userData;
public UserData User { get { return userData; } }
/// <summary>User - JSON deserialisation route.</summary> /// <summary>User - JSON deserialisation route.</summary>
protected void SetUser(UserData user) protected void SetUser(UserData user)
{ {
if (User != null && User.UserAccountSupplied) if (this.userData != null && User.UserAccountSupplied)
throw new NotSupportedException("Session User cannot be replaced."); throw new NotSupportedException("Session User cannot be replaced.");
User = user; this.userData = user;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -14,8 +14,10 @@ namespace Saxonite.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
// Code types. // Code types.
private static readonly List<TypeCodeDesc> regionTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> yesNoCodes = new List<TypeCodeDesc>(); private static readonly List<TypeCodeDesc> yesNoCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportParticipationCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportOfficiatingCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> regionTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> userRoleCodes = new List<TypeCodeDesc>(); private static readonly List<TypeCodeDesc> userRoleCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> titleCodes = new List<TypeCodeDesc>(); private static readonly List<TypeCodeDesc> titleCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>(); private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>();
@@ -33,6 +35,20 @@ namespace Saxonite.Net.Standard.Base.App
yesNoCodes.Add(Sax.YesNo.Yes, "YES", "Yes"); yesNoCodes.Add(Sax.YesNo.Yes, "YES", "Yes");
yesNoCodes.Add(Sax.YesNo.No, "NO", "No"); yesNoCodes.Add(Sax.YesNo.No, "NO", "No");
//---------------------------------------------------------------
// Sport participation.
sportParticipationCodes.Add(Sax.SportParticipation.Professional, "PRO", "Professional");
sportParticipationCodes.Add(Sax.SportParticipation.Regular, "REG", "Regular");
sportParticipationCodes.Add(Sax.SportParticipation.Occasional, "OCC", "Occasional");
sportParticipationCodes.Add(Sax.SportParticipation.Spectator, "SPC", "Spectator");
sportParticipationCodes.Add(Sax.SportParticipation.Interested, "INT", "Interested");
//---------------------------------------------------------------
// Sport officiating.
sportOfficiatingCodes.Add(Sax.SportParticipation.Professional, "PRO", "Professional");
sportOfficiatingCodes.Add(Sax.SportParticipation.Regular, "REG", "Regular");
sportOfficiatingCodes.Add(Sax.SportParticipation.Occasional, "OCC", "Occasional");
//--------------------------------------------------------------- //---------------------------------------------------------------
// Region types. // Region types.
regionTypeCodes.Add(Sax.RegionType.Continent, "CONT", "Continent"); regionTypeCodes.Add(Sax.RegionType.Continent, "CONT", "Continent");
@@ -38,6 +38,10 @@ namespace Saxonite.Net.Standard.Base.App
{ {
case Sax.CodeType.YesNo: case Sax.CodeType.YesNo:
return new List<TypeCodeDesc>(yesNoCodes); return new List<TypeCodeDesc>(yesNoCodes);
case Sax.CodeType.SportParticipation:
return new List<TypeCodeDesc>(sportParticipationCodes);
case Sax.CodeType.SportOfficiating:
return new List<TypeCodeDesc>(sportOfficiatingCodes);
case Sax.CodeType.RegionType: case Sax.CodeType.RegionType:
return new List<TypeCodeDesc>(regionTypeCodes); return new List<TypeCodeDesc>(regionTypeCodes);
case Sax.CodeType.UserRole: case Sax.CodeType.UserRole:
@@ -28,6 +28,12 @@ namespace Saxonite.Net.Standard.Base.Bus
// Sport. // Sport.
SportId, SportId,
Sport_Name, Sport_Name,
SportParticipation,
SportParticipation_Code,
SportParticipation_Desc,
SportOfficiating,
SportOfficiating_Code,
SportOfficiating_Desc,
// Associated data. // Associated data.
// Common. // Common.
Notes, Notes,
@@ -45,6 +51,8 @@ namespace Saxonite.Net.Standard.Base.Bus
{ {
public SysId UserAccountId { get; set; } public SysId UserAccountId { get; set; }
public SysId SportId { get; set; } public SysId SportId { get; set; }
public Sax.SportParticipation Participation { get; set; }
public Sax.SportOfficiating Officiating { get; set; }
public String UserSportData { get; set; } public String UserSportData { get; set; }
} }
@@ -70,6 +78,16 @@ namespace Saxonite.Net.Standard.Base.Bus
get { return data.SportId; } get { return data.SportId; }
set { CheckChanged(data.SportId, value); data.SportId = value; } set { CheckChanged(data.SportId, value); data.SportId = value; }
} }
public Sax.SportParticipation Participation
{
get { return data.Participation; }
set { CheckChanged((int)data.Participation, (int)value); data.Participation = value; }
}
public Sax.SportOfficiating Officiating
{
get { return data.Officiating; }
set { CheckChanged((int)data.Officiating, (int)value); data.Officiating = value; }
}
public String UserSportData public String UserSportData
{ {
get { return data.UserSportData; } get { return data.UserSportData; }
@@ -79,6 +97,8 @@ namespace Saxonite.Net.Standard.Base.Bus
internal void PopulateFrom(Data data) internal void PopulateFrom(Data data)
{ {
UserAccountId = data.UserAccountId; UserAccountId = data.UserAccountId;
Participation = data.Participation;
Officiating = data.Officiating;
SportId = data.SportId; SportId = data.SportId;
UserSportData = data.UserSportData; UserSportData = data.UserSportData;
base.PopulateFrom(data); base.PopulateFrom(data);
@@ -97,6 +117,8 @@ namespace Saxonite.Net.Standard.Base.Bus
{ {
// Identifies the field that has invalid data. // Identifies the field that has invalid data.
public ValidValue UserAccountId { get; set; } = ValidValue.Valid; public ValidValue UserAccountId { get; set; } = ValidValue.Valid;
public ValidValue Participation { get; set; } = ValidValue.Valid;
public ValidValue Officiating { get; set; } = ValidValue.Valid;
public ValidValue SportId { get; set; } = ValidValue.Valid; public ValidValue SportId { get; set; } = ValidValue.Valid;
public ValidValue UserSportData { get; set; } = ValidValue.Valid; public ValidValue UserSportData { get; set; } = ValidValue.Valid;
} }
@@ -165,6 +187,16 @@ namespace Saxonite.Net.Standard.Base.Bus
get { return data.SportId; } get { return data.SportId; }
protected set { data.SportId = value; } protected set { data.SportId = value; }
} }
public Sax.SportParticipation Participation
{
get { return data.Participation; }
set { data.Participation = value; }
}
public Sax.SportOfficiating Officiating
{
get { return data.Officiating; }
set { data.Officiating = value; }
}
public String UserSportData public String UserSportData
{ {
get { return data.UserSportData; } get { return data.UserSportData; }
@@ -179,7 +179,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
case SaxUserRole.Column.UserRole_Desc: case SaxUserRole.Column.UserRole_Desc:
{ {
String userRoleCode = values.GetValue(column.DataName).ToString(); String userRoleCode = values.GetValue(column.DataName).ToString();
value = new DataValue(UserRoles.GetDescForCode(userRoleCode)); value = new DataValue(UserRoleCodes.GetDescForCode(userRoleCode));
} }
break; break;
@@ -204,6 +204,28 @@ namespace Saxonite.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SaxUserSport.Column)column.Id) switch ((SaxUserSport.Column)column.Id)
{ {
//-----------------------------------------------------------
// Sport Participation.
case SaxUserSport.Column.SportParticipation_Code:
case SaxUserSport.Column.SportParticipation_Desc:
Sax.SportParticipation sportParticipation = (Sax.SportParticipation)values.GetLong(column.DataName);
if (column.Id == (int)SaxUserSport.Column.SportParticipation_Code)
value = new DataValue(SportParticipationCodes.GetCodeForType(sportParticipation));
else
value = new DataValue(SportParticipationCodes.GetDescForType(sportParticipation));
break;
//-----------------------------------------------------------
// Sport Officiating.
case SaxUserSport.Column.SportOfficiating_Code:
case SaxUserSport.Column.SportOfficiating_Desc:
Sax.SportOfficiating sportOfficiating = (Sax.SportOfficiating)values.GetLong(column.DataName);
if (column.Id == (int)SaxUserSport.Column.SportOfficiating_Code)
value = new DataValue(SportOfficiatingCodes.GetCodeForType(sportOfficiating));
else
value = new DataValue(SportOfficiatingCodes.GetDescForType(sportOfficiating));
break;
//----------------------------------------------------------- //-----------------------------------------------------------
// Notes. // Notes.
case SaxUserSport.Column.Notes: case SaxUserSport.Column.Notes:
@@ -133,12 +133,12 @@ namespace Saxonite.Net.Standard.Base.Mgr
// Data item type. // Data item type.
case SaxActivityIndex.Column.ItemType_Code: case SaxActivityIndex.Column.ItemType_Code:
{ {
value = new DataValue(DataItemTypes.GetCodeForType(values.GetLong(column.DataName))); value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName)));
} }
break; break;
case SaxActivityIndex.Column.ItemType_Desc: case SaxActivityIndex.Column.ItemType_Desc:
{ {
value = new DataValue(DataItemTypes.GetDescForType(values.GetLong(column.DataName))); value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName)));
} }
break; break;
@@ -196,7 +196,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
case SaxOrganisationOpportunity.Column.OpportunityType_Desc: case SaxOrganisationOpportunity.Column.OpportunityType_Desc:
{ {
String code = values.GetValue(column.DataName).ToString(); String code = values.GetValue(column.DataName).ToString();
value = new DataValue(OpportunityTypes.GetDescForCode(code, code)); value = new DataValue(OpportunityTypeCodes.GetDescForCode(code, code));
} }
break; break;
@@ -150,12 +150,12 @@ namespace Saxonite.Net.Standard.Base.Mgr
// Data item type. // Data item type.
case SaxItemSport.Column.ItemType_Code: case SaxItemSport.Column.ItemType_Code:
{ {
value = new DataValue(DataItemTypes.GetCodeForType(values.GetLong(column.DataName))); value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName)));
} }
break; break;
case SaxItemSport.Column.ItemType_Desc: case SaxItemSport.Column.ItemType_Desc:
{ {
value = new DataValue(DataItemTypes.GetDescForType(values.GetLong(column.DataName))); value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName)));
} }
break; break;
+10 -8
View File
@@ -45,7 +45,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
public ISacsDatabase CoreDatabase { get { return Internals.CoreDatabase; } } public ISacsDatabase CoreDatabase { get { return Internals.CoreDatabase; } }
public IDatabaseInfo CoreDbInfo { get { return Internals.CreateCoreDbInfo(); } } public IDatabaseInfo CoreDbInfo { get { return Internals.CreateCoreDbInfo(); } }
// Business components. // Business components.
protected SaxInternals Internals protected SaxInternals Internals
{ {
get get
{ {
@@ -66,13 +66,15 @@ namespace Saxonite.Net.Standard.Base.Mgr
public SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } } public SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } }
public SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } } public SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } }
// Application codes. // Application codes.
public List<TypeCodeDesc> RegionTypes { get { return Internals.RegionTypes; } } public List<TypeCodeDesc> SportParticipationCodes { get { return Internals.SportParticipationCodes; } }
public List<TypeCodeDesc> UserRoles { get { return Internals.UserRoles; } } public List<TypeCodeDesc> SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } }
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } } public List<TypeCodeDesc> RegionTypeCodes { get { return Internals.RegionTypeCodes; } }
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } } public List<TypeCodeDesc> UserRoleCodes { get { return Internals.UserRoleCodes; } }
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } } public List<TypeCodeDesc> OrganisationTypeCodes { get { return Internals.OrganisationTypeCodes; } }
public List<TypeCodeDesc> OpportunityTypes { get { return Internals.OpportunityTypes; } } public List<TypeCodeDesc> OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } }
public List<TypeCodeDesc> DataItemTypes { get { return Internals.DataItemTypes; } } public List<TypeCodeDesc> OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } }
public List<TypeCodeDesc> OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } }
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -9,7 +9,7 @@ using System.Data.Common;
using System.Linq; using System.Linq;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 25-May-2021 19:36:10 // Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
namespace Saxonite.Net.Standard.Dbas.Internal namespace Saxonite.Net.Standard.Dbas.Internal
{ {
@@ -22,6 +22,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal
public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id", true); public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id", true);
public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId"); public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId");
public ColumnDataInt32 _SportId { get; } = new ColumnDataInt32("SportId"); public ColumnDataInt32 _SportId { get; } = new ColumnDataInt32("SportId");
public ColumnDataInt16 _Participation { get; } = new ColumnDataInt16("Participation");
public ColumnDataInt16 _Officiating { get; } = new ColumnDataInt16("Officiating");
public ColumnDataString _UserSportData { get; } = new ColumnDataString("UserSportData"); public ColumnDataString _UserSportData { get; } = new ColumnDataString("UserSportData");
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
@@ -41,6 +43,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal
"Id", "Id",
"UserAccountId", "UserAccountId",
"SportId", "SportId",
"Participation",
"Officiating",
"UserSportData", "UserSportData",
"Notes", "Notes",
"Flags", "Flags",
@@ -86,6 +90,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal
public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } } public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
public Int32 _UserAccountId { get { return Cols._UserAccountId.Value; } set { Cols._UserAccountId.Value = value; } } public Int32 _UserAccountId { get { return Cols._UserAccountId.Value; } set { Cols._UserAccountId.Value = value; } }
public Int32 _SportId { get { return Cols._SportId.Value; } set { Cols._SportId.Value = value; } } public Int32 _SportId { get { return Cols._SportId.Value; } set { Cols._SportId.Value = value; } }
public Int16 _Participation { get { return Cols._Participation.Value; } set { Cols._Participation.Value = value; } }
public Int16 _Officiating { get { return Cols._Officiating.Value; } set { Cols._Officiating.Value = value; } }
public String _UserSportData { get { return Cols._UserSportData.Value; } set { Cols._UserSportData.Value = value; } } public String _UserSportData { get { return Cols._UserSportData.Value; } set { Cols._UserSportData.Value = value; } }
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
@@ -120,6 +126,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal
_Id = GetFieldInt32(dbDataReader, "Id", _Id); _Id = GetFieldInt32(dbDataReader, "Id", _Id);
_UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId); _UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId);
_SportId = GetFieldInt32(dbDataReader, "SportId", _SportId); _SportId = GetFieldInt32(dbDataReader, "SportId", _SportId);
_Participation = GetFieldInt16(dbDataReader, "Participation", _Participation);
_Officiating = GetFieldInt16(dbDataReader, "Officiating", _Officiating);
_UserSportData = GetFieldString(dbDataReader, "UserSportData", _UserSportData); _UserSportData = GetFieldString(dbDataReader, "UserSportData", _UserSportData);
_Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Notes = GetFieldString(dbDataReader, "Notes", _Notes);
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
@@ -153,6 +161,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal
dbCommand.Parameters.Clear(); dbCommand.Parameters.Clear();
if (columnNames.ContainsCI("UserAccountId")) AddCommandParameter(dbCommand, "@UserAccountId", _UserAccountId); if (columnNames.ContainsCI("UserAccountId")) AddCommandParameter(dbCommand, "@UserAccountId", _UserAccountId);
if (columnNames.ContainsCI("SportId")) AddCommandParameter(dbCommand, "@SportId", _SportId); if (columnNames.ContainsCI("SportId")) AddCommandParameter(dbCommand, "@SportId", _SportId);
if (columnNames.ContainsCI("Participation")) AddCommandParameter(dbCommand, "@Participation", _Participation);
if (columnNames.ContainsCI("Officiating")) AddCommandParameter(dbCommand, "@Officiating", _Officiating);
if (columnNames.ContainsCI("UserSportData")) AddCommandParameter(dbCommand, "@UserSportData", _UserSportData); if (columnNames.ContainsCI("UserSportData")) AddCommandParameter(dbCommand, "@UserSportData", _UserSportData);
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes); if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags); if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
@@ -201,6 +211,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal
dbCommand.Parameters.Clear(); dbCommand.Parameters.Clear();
if (columnNames.ContainsCI("UserAccountId")) AddCommandParameter(dbCommand, "@UserAccountId", _UserAccountId); if (columnNames.ContainsCI("UserAccountId")) AddCommandParameter(dbCommand, "@UserAccountId", _UserAccountId);
if (columnNames.ContainsCI("SportId")) AddCommandParameter(dbCommand, "@SportId", _SportId); if (columnNames.ContainsCI("SportId")) AddCommandParameter(dbCommand, "@SportId", _SportId);
if (columnNames.ContainsCI("Participation")) AddCommandParameter(dbCommand, "@Participation", _Participation);
if (columnNames.ContainsCI("Officiating")) AddCommandParameter(dbCommand, "@Officiating", _Officiating);
if (columnNames.ContainsCI("UserSportData")) AddCommandParameter(dbCommand, "@UserSportData", _UserSportData); if (columnNames.ContainsCI("UserSportData")) AddCommandParameter(dbCommand, "@UserSportData", _UserSportData);
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes); if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags); if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
@@ -206,8 +206,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
dbOrganisation._Name = organisation.Name; dbOrganisation._Name = organisation.Name;
dbOrganisation._PhoneMain = organisation.PhoneMain; dbOrganisation._PhoneMain = organisation.PhoneMain;
dbOrganisation._PhoneAlt = organisation.PhoneAlt; dbOrganisation._PhoneAlt = organisation.PhoneAlt;
dbOrganisation._OrganisationType = OrganisationTypes.GetCodeForType(organisation.OrganisationType); dbOrganisation._OrganisationType = OrganisationTypeCodes.GetCodeForType(organisation.OrganisationType);
dbOrganisation._OrganisationCategory = OrganisationCategories.GetCodeForType(organisation.OrganisationCategory); dbOrganisation._OrganisationCategory = OrganisationCategoryCodes.GetCodeForType(organisation.OrganisationCategory);
dbOrganisation._PhoneMain = organisation.PhoneMain; dbOrganisation._PhoneMain = organisation.PhoneMain;
dbOrganisation._PhoneAlt = organisation.PhoneAlt; dbOrganisation._PhoneAlt = organisation.PhoneAlt;
dbOrganisation._SportIdPrimary = SysId.ToInt(organisation.SportIdPrimary); dbOrganisation._SportIdPrimary = SysId.ToInt(organisation.SportIdPrimary);
@@ -232,8 +232,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
organisation.Name = dbOrganisation._Name; organisation.Name = dbOrganisation._Name;
organisation.PhoneMain = dbOrganisation._PhoneMain; organisation.PhoneMain = dbOrganisation._PhoneMain;
organisation.PhoneAlt = dbOrganisation._PhoneAlt; organisation.PhoneAlt = dbOrganisation._PhoneAlt;
organisation.OrganisationType = (Sax.OrganisationType)OrganisationTypes.GetTypeForCode(dbOrganisation._OrganisationType); organisation.OrganisationType = (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(dbOrganisation._OrganisationType);
organisation.OrganisationCategory = (Sax.OrganisationCategory)OrganisationCategories.GetTypeForCode(dbOrganisation._OrganisationCategory); organisation.OrganisationCategory = (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(dbOrganisation._OrganisationCategory);
organisation.PhoneMain = dbOrganisation._PhoneMain; organisation.PhoneMain = dbOrganisation._PhoneMain;
organisation.PhoneAlt = dbOrganisation._PhoneAlt; organisation.PhoneAlt = dbOrganisation._PhoneAlt;
organisation.SportIdPrimary = new SysId(dbOrganisation._SportIdPrimary); organisation.SportIdPrimary = new SysId(dbOrganisation._SportIdPrimary);
@@ -475,7 +475,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
{ {
roleQuery.Filters.Clear(); roleQuery.Filters.Clear();
roleQuery.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserAccountId, aliasUserRole) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserAccount)); roleQuery.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserAccountId, aliasUserRole) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserAccount));
roleQuery.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserRoleCode, aliasUserRole) + "='" + UserRoles.GetCodeForType(userRole) + "'"); roleQuery.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserRoleCode, aliasUserRole) + "='" + UserRoleCodes.GetCodeForType(userRole) + "'");
filter.Add("Exists(" + roleQuery.BuildQuery() + ")"); filter.Add("Exists(" + roleQuery.BuildQuery() + ")");
} }
} }
@@ -679,7 +679,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
queryUserRole.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserRole), aliasUserRole); queryUserRole.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserRole), aliasUserRole);
queryUserRole.Columns.Add("Count(*)"); queryUserRole.Columns.Add("Count(*)");
queryUserRole.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserAccountId, aliasUserRole) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserAccount)); queryUserRole.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserAccountId, aliasUserRole) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserAccount));
queryUserRole.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserRoleCode, aliasUserRole) + "='" + UserRoles.GetCodeForType(Sax.UserRole.SystemAdmin) + "'"); queryUserRole.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserRoleCode, aliasUserRole) + "='" + UserRoleCodes.GetCodeForType(Sax.UserRole.SystemAdmin) + "'");
queryUserRole.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_Status, aliasUserRole) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'"); queryUserRole.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_Status, aliasUserRole) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
query.Columns.Add("(" + queryUserRole.BuildQuery() + ")", colUserAccount_SystemAdminRole); query.Columns.Add("(" + queryUserRole.BuildQuery() + ")", colUserAccount_SystemAdminRole);
} }
@@ -415,7 +415,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
List<String> organisationRoleCodes = new List<string>(); List<String> organisationRoleCodes = new List<string>();
foreach (Sax.OrganisationRole organisationRole in prm.OrganisationRoles) foreach (Sax.OrganisationRole organisationRole in prm.OrganisationRoles)
{ {
String organisationRoleCode = OrganisationRoles.GetCodeForType(organisationRole).TrimAll(); String organisationRoleCode = OrganisationRoleCodes.GetCodeForType(organisationRole).TrimAll();
if (!StringUtil.IsEmpty(organisationRoleCode)) if (!StringUtil.IsEmpty(organisationRoleCode))
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationRoleCodes, aliasUserOrganisation) + " LIKE '%" + DbQuery.FormatForLike(organisationRoleCode) + "%'"); filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationRoleCodes, aliasUserOrganisation) + " LIKE '%" + DbQuery.FormatForLike(organisationRoleCode) + "%'");
} }
@@ -45,7 +45,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
private SaxUserRole_Dbas CreateUserRole(UserRole_Db dbUserRole) private SaxUserRole_Dbas CreateUserRole(UserRole_Db dbUserRole)
{ {
ClearErrorState(); ClearErrorState();
SaxUserRole_Dbas userRole = new SaxUserRole_Dbas(CoreDatabase, new SysId(dbUserRole._Id), new SysId(dbUserRole._UserAccountId), (Sax.UserRole)UserRoles.GetTypeForCode(dbUserRole._UserRoleCode), (ushort)dbUserRole._Flags); SaxUserRole_Dbas userRole = new SaxUserRole_Dbas(CoreDatabase, new SysId(dbUserRole._Id), new SysId(dbUserRole._UserAccountId), (Sax.UserRole)UserRoleCodes.GetTypeForCode(dbUserRole._UserRoleCode), (ushort)dbUserRole._Flags);
PopulateFrom(dbUserRole, userRole); PopulateFrom(dbUserRole, userRole);
return userRole; return userRole;
} }
@@ -205,7 +205,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
{ {
dbUserRole._Id = SysId.ToInt(userRole.Id); dbUserRole._Id = SysId.ToInt(userRole.Id);
dbUserRole._UserAccountId = SysId.ToInt(userRole.UserAccountId); dbUserRole._UserAccountId = SysId.ToInt(userRole.UserAccountId);
dbUserRole._UserRoleCode = UserRoles.GetCodeForType(userRole.UserRole); dbUserRole._UserRoleCode = UserRoleCodes.GetCodeForType(userRole.UserRole);
// Common. // Common.
dbUserRole._Notes = userRole.Notes; dbUserRole._Notes = userRole.Notes;
dbUserRole._Status = SacsSystem.GetStatusCode(userRole.Status); dbUserRole._Status = SacsSystem.GetStatusCode(userRole.Status);
@@ -355,8 +355,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserAccountId, aliasUserRole) + " IN (" + userAccountIdsIncluded + ")"); filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserAccountId, aliasUserRole) + " IN (" + userAccountIdsIncluded + ")");
// User roles. // User roles.
List<TypeCodeDesc> userRoles = UserRoles; List<TypeCodeDesc> userRoles = UserRoleCodes;
String userRoleCodes = prm.UserRolesIncluded.Select(item => UserRoles.GetCodeForType(item)).ToList().Concat(",", "'", "'", true, true); String userRoleCodes = prm.UserRolesIncluded.Select(item => UserRoleCodes.GetCodeForType(item)).ToList().Concat(",", "'", "'", true, true);
if (!userRoleCodes.IsEmpty()) if (!userRoleCodes.IsEmpty())
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserRoleCode, aliasUserRole) + " IN (" + userRoleCodes + ")"); filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserRoleCode, aliasUserRole) + " IN (" + userRoleCodes + ")");
@@ -206,6 +206,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
dbUserSport._Id = SysId.ToInt(userSport.Id); dbUserSport._Id = SysId.ToInt(userSport.Id);
dbUserSport._UserAccountId = SysId.ToInt(userSport.UserAccountId); dbUserSport._UserAccountId = SysId.ToInt(userSport.UserAccountId);
dbUserSport._SportId = SysId.ToInt(userSport.SportId); dbUserSport._SportId = SysId.ToInt(userSport.SportId);
dbUserSport._Participation = (short)userSport.Participation;
dbUserSport._Officiating = (short)userSport.Officiating;
dbUserSport._UserSportData = userSport.UserSportData; dbUserSport._UserSportData = userSport.UserSportData;
// Common. // Common.
dbUserSport._Notes = userSport.Notes; dbUserSport._Notes = userSport.Notes;
@@ -226,6 +228,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
//userSport.Id = new SysId(dbUserSport._Id); //userSport.Id = new SysId(dbUserSport._Id);
//userSport.UserAccountId = new SysId(dbUserSport._UserAccountId); //userSport.UserAccountId = new SysId(dbUserSport._UserAccountId);
//userSport.SportId = new SysId(dbUserSport._SportId); //userSport.SportId = new SysId(dbUserSport._SportId);
userSport.Participation = (Sax.SportParticipation)dbUserSport._Participation;
userSport.Officiating = (Sax.SportOfficiating)dbUserSport._Participation;
userSport.UserSportData = dbUserSport._UserSportData; userSport.UserSportData = dbUserSport._UserSportData;
// Common. // Common.
userSport.Notes = dbUserSport._Notes; userSport.Notes = dbUserSport._Notes;
@@ -308,6 +312,28 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
columnDfn.ReadOnly = true; columnDfn.ReadOnly = true;
break; break;
// Participation.
case SaxUserSport.Column.SportParticipation:
SetUserSportColDfn(columnDfn, "Participation", 80, SaxDbDfn_Core.ColumnIdx.UserSport_Participation, ColumnAlignment.Center, DataValue.DataType.Long);
break;
case SaxUserSport.Column.SportParticipation_Code:
SetUserSportColDfn(columnDfn, "Participation", 80, SaxDbDfn_Core.ColumnIdx.UserSport_Participation, ColumnAlignment.Center, DataValue.DataType.String);
break;
case SaxUserSport.Column.SportParticipation_Desc:
SetUserSportColDfn(columnDfn, "Participation", 120, SaxDbDfn_Core.ColumnIdx.UserSport_Participation, ColumnAlignment.Center, DataValue.DataType.String);
break;
// Officiating.
case SaxUserSport.Column.SportOfficiating:
SetUserSportColDfn(columnDfn, "Officiating", 80, SaxDbDfn_Core.ColumnIdx.UserSport_Officiating, ColumnAlignment.Center, DataValue.DataType.Long);
break;
case SaxUserSport.Column.SportOfficiating_Code:
SetUserSportColDfn(columnDfn, "Officiating", 80, SaxDbDfn_Core.ColumnIdx.UserSport_Officiating, ColumnAlignment.Center, DataValue.DataType.String);
break;
case SaxUserSport.Column.SportOfficiating_Desc:
SetUserSportColDfn(columnDfn, "Officiating", 120, SaxDbDfn_Core.ColumnIdx.UserSport_Officiating, ColumnAlignment.Center, DataValue.DataType.String);
break;
//----------------------------------------------------------- //-----------------------------------------------------------
// Derived properties. // Derived properties.
@@ -487,6 +513,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
bool hasSportCols = (columns.HasId(SaxUserSport.Column.Sport_Name)); bool hasSportCols = (columns.HasId(SaxUserSport.Column.Sport_Name));
if (columns.HasId(SaxUserSport.Column.SportId) || hasSportCols) if (columns.HasId(SaxUserSport.Column.SportId) || hasSportCols)
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_SportId, aliasUserSport)); query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_SportId, aliasUserSport));
if (columns.HasId(SaxUserSport.Column.SportParticipation) || columns.HasId(SaxUserSport.Column.SportParticipation_Code) || columns.HasId(SaxUserSport.Column.SportParticipation_Desc))
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Participation, aliasUserSport));
if (columns.HasId(SaxUserSport.Column.SportOfficiating) || columns.HasId(SaxUserSport.Column.SportOfficiating_Code) || columns.HasId(SaxUserSport.Column.SportOfficiating_Desc))
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Officiating, aliasUserSport));
// Common properties. // Common properties.
if (columns.HasId(SaxUserSport.Column.Notes)) if (columns.HasId(SaxUserSport.Column.Notes))
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Notes, aliasUserSport)); query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Notes, aliasUserSport));
@@ -207,7 +207,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
dbOrganisationOpportunity._OrganisationId = SysId.ToInt(organisationOpportunity.OrganisationId); dbOrganisationOpportunity._OrganisationId = SysId.ToInt(organisationOpportunity.OrganisationId);
dbOrganisationOpportunity._SportIdPrimary = SysId.ToInt(organisationOpportunity.SportIdPrimary); dbOrganisationOpportunity._SportIdPrimary = SysId.ToInt(organisationOpportunity.SportIdPrimary);
dbOrganisationOpportunity._RegionIdPrimary = SysId.ToInt(organisationOpportunity.RegionIdPrimary); dbOrganisationOpportunity._RegionIdPrimary = SysId.ToInt(organisationOpportunity.RegionIdPrimary);
dbOrganisationOpportunity._OpportunityTypeCode = OpportunityTypes.GetCodeForType(organisationOpportunity.OpportunityType); dbOrganisationOpportunity._OpportunityTypeCode = OpportunityTypeCodes.GetCodeForType(organisationOpportunity.OpportunityType);
dbOrganisationOpportunity._Position = organisationOpportunity.Position; dbOrganisationOpportunity._Position = organisationOpportunity.Position;
dbOrganisationOpportunity._Outline = organisationOpportunity.Outline; dbOrganisationOpportunity._Outline = organisationOpportunity.Outline;
dbOrganisationOpportunity._OpportunityData = organisationOpportunity.OpportunityData; dbOrganisationOpportunity._OpportunityData = organisationOpportunity.OpportunityData;
@@ -232,7 +232,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
//organisationOpportunity.OrganisationId = new SysId(dbOrganisationOpportunity._OrganisationId); //organisationOpportunity.OrganisationId = new SysId(dbOrganisationOpportunity._OrganisationId);
organisationOpportunity.SportIdPrimary = new SysId(dbOrganisationOpportunity._SportIdPrimary); organisationOpportunity.SportIdPrimary = new SysId(dbOrganisationOpportunity._SportIdPrimary);
organisationOpportunity.RegionIdPrimary = new SysId(dbOrganisationOpportunity._RegionIdPrimary); organisationOpportunity.RegionIdPrimary = new SysId(dbOrganisationOpportunity._RegionIdPrimary);
organisationOpportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypes.GetTypeForCode(dbOrganisationOpportunity._OpportunityTypeCode); organisationOpportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypeCodes.GetTypeForCode(dbOrganisationOpportunity._OpportunityTypeCode);
organisationOpportunity.Position = dbOrganisationOpportunity._Position; organisationOpportunity.Position = dbOrganisationOpportunity._Position;
organisationOpportunity.Outline = dbOrganisationOpportunity._Outline; organisationOpportunity.Outline = dbOrganisationOpportunity._Outline;
organisationOpportunity.OpportunityData = dbOrganisationOpportunity._OpportunityData; organisationOpportunity.OpportunityData = dbOrganisationOpportunity._OpportunityData;
@@ -256,7 +256,7 @@
<Clustered>false</Clustered> <Clustered>false</Clustered>
<Nullable>false</Nullable> <Nullable>false</Nullable>
<Pages>1</Pages> <Pages>1</Pages>
<UniqueValues>9</UniqueValues> <UniqueValues>10</UniqueValues>
<HasColumns>false</HasColumns> <HasColumns>false</HasColumns>
<Columns> <Columns>
<DbDfnIndexColumn> <DbDfnIndexColumn>
@@ -1768,7 +1768,7 @@
<Clustered>false</Clustered> <Clustered>false</Clustered>
<Nullable>false</Nullable> <Nullable>false</Nullable>
<Pages>1</Pages> <Pages>1</Pages>
<UniqueValues>2</UniqueValues> <UniqueValues>3</UniqueValues>
<HasColumns>false</HasColumns> <HasColumns>false</HasColumns>
<Columns> <Columns>
<DbDfnIndexColumn> <DbDfnIndexColumn>
@@ -3697,6 +3697,40 @@
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>4</Pos> <Pos>4</Pos>
<Name>Participation</Name>
<DataType>SmallInt</DataType>
<DataTypeName />
<DataTypeNative>5</DataTypeNative>
<DataTypeNameNative>smallint</DataTypeNameNative>
<IsIdentity>false</IsIdentity>
<Size>5</Size>
<BufferLen>2</BufferLen>
<DecimalDigits>0</DecimalDigits>
<Nullable>Nullable</Nullable>
<IsNullable>true</IsNullable>
<Remarks />
</DbDfnColumn>
<DbDfnColumn>
<Schema>dbo</Schema>
<Table>UserSport</Table>
<Pos>5</Pos>
<Name>Officiating</Name>
<DataType>SmallInt</DataType>
<DataTypeName />
<DataTypeNative>5</DataTypeNative>
<DataTypeNameNative>smallint</DataTypeNameNative>
<IsIdentity>false</IsIdentity>
<Size>5</Size>
<BufferLen>2</BufferLen>
<DecimalDigits>0</DecimalDigits>
<Nullable>Nullable</Nullable>
<IsNullable>true</IsNullable>
<Remarks />
</DbDfnColumn>
<DbDfnColumn>
<Schema>dbo</Schema>
<Table>UserSport</Table>
<Pos>6</Pos>
<Name>UserSportData</Name> <Name>UserSportData</Name>
<DataType>VarChar</DataType> <DataType>VarChar</DataType>
<DataTypeName /> <DataTypeName />
@@ -3713,7 +3747,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>5</Pos> <Pos>7</Pos>
<Name>Notes</Name> <Name>Notes</Name>
<DataType>VarChar</DataType> <DataType>VarChar</DataType>
<DataTypeName /> <DataTypeName />
@@ -3730,7 +3764,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>6</Pos> <Pos>8</Pos>
<Name>Flags</Name> <Name>Flags</Name>
<DataType>SmallInt</DataType> <DataType>SmallInt</DataType>
<DataTypeName /> <DataTypeName />
@@ -3747,7 +3781,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>7</Pos> <Pos>9</Pos>
<Name>Status</Name> <Name>Status</Name>
<DataType>VarChar</DataType> <DataType>VarChar</DataType>
<DataTypeName /> <DataTypeName />
@@ -3764,7 +3798,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>8</Pos> <Pos>10</Pos>
<Name>CreateOn</Name> <Name>CreateOn</Name>
<DataType>DateTime</DataType> <DataType>DateTime</DataType>
<DataTypeName /> <DataTypeName />
@@ -3781,7 +3815,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>9</Pos> <Pos>11</Pos>
<Name>CreateBy</Name> <Name>CreateBy</Name>
<DataType>Int</DataType> <DataType>Int</DataType>
<DataTypeName /> <DataTypeName />
@@ -3798,7 +3832,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>10</Pos> <Pos>12</Pos>
<Name>CreateHost</Name> <Name>CreateHost</Name>
<DataType>VarChar</DataType> <DataType>VarChar</DataType>
<DataTypeName /> <DataTypeName />
@@ -3815,7 +3849,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>11</Pos> <Pos>13</Pos>
<Name>UpdateOn</Name> <Name>UpdateOn</Name>
<DataType>DateTime</DataType> <DataType>DateTime</DataType>
<DataTypeName /> <DataTypeName />
@@ -3832,7 +3866,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>12</Pos> <Pos>14</Pos>
<Name>UpdateBy</Name> <Name>UpdateBy</Name>
<DataType>Int</DataType> <DataType>Int</DataType>
<DataTypeName /> <DataTypeName />
@@ -3849,7 +3883,7 @@
<DbDfnColumn> <DbDfnColumn>
<Schema>dbo</Schema> <Schema>dbo</Schema>
<Table>UserSport</Table> <Table>UserSport</Table>
<Pos>13</Pos> <Pos>15</Pos>
<Name>UpdateHost</Name> <Name>UpdateHost</Name>
<DataType>VarChar</DataType> <DataType>VarChar</DataType>
<DataTypeName /> <DataTypeName />