diff --git a/SaxoniteCoreUnitTests/UnitTests/Web/Admin/App/SaxSessionData_Admin_Tester.cs b/SaxoniteCoreUnitTests/UnitTests/Web/Admin/App/SaxSessionData_Admin_Tester.cs index f179440..6249d93 100644 --- a/SaxoniteCoreUnitTests/UnitTests/Web/Admin/App/SaxSessionData_Admin_Tester.cs +++ b/SaxoniteCoreUnitTests/UnitTests/Web/Admin/App/SaxSessionData_Admin_Tester.cs @@ -56,7 +56,7 @@ namespace Saxonite.Net.Core.UnitTests.Web.Admin.App SaxSessionData_Admin sessionDataDeserialized = JsonConvert.DeserializeObject( sessionDataJson, - new JsonSerializerSettings { ContractResolver = new SaxController_Base.SessionStorage.SaxSessionDataContractResolver() } + SaxController_Base.SessionStorage.JsonDeserialisationSettings ); Assert.IsNotNull(sessionDataDeserialized); diff --git a/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs b/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs index 706110c..276e759 100644 --- a/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs +++ b/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs @@ -137,12 +137,14 @@ namespace Saxonite.Net.Core.Web.Base.App //------------------------------------------------------------------- private class CodeCache { - public List regionTypes; - public List userRoles; - public List organisationTypes; - public List organisationCategories; - public List organisationRoles; - public List opportunityTypes; + public List sportParticipationCodes; + public List sportOfficiatingCodes; + public List regionTypeCodes; + public List userRoleCodes; + public List organisationTypeCodes; + public List organisationCategoryCodes; + public List organisationRoleCodes; + public List opportunityTypeCodes; } private CodeCache codes = new CodeCache(); @@ -153,64 +155,84 @@ namespace Saxonite.Net.Core.Web.Base.App 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. public String GetRegionTypeCaption(Sax.RegionType regionType) { if ((int)regionType < 1) return ""; - if (codes.regionTypes == null) - codes.regionTypes = SaxSystem.GetCodesOfType(Sax.CodeType.RegionType); + if (codes.regionTypeCodes == null) + codes.regionTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.RegionType); // ToDo Region type localisation. - return codes.regionTypes.GetDescForType(regionType); + return codes.regionTypeCodes.GetDescForType(regionType); } // User role. public String GetUserRoleCaption(Sax.UserRole userRole) { if ((int)userRole < 1) return ""; - if (codes.userRoles == null) - codes.userRoles = SaxSystem.GetCodesOfType(Sax.CodeType.UserRole); + if (codes.userRoleCodes == null) + codes.userRoleCodes = SaxSystem.GetCodesOfType(Sax.CodeType.UserRole); // ToDo User Role localisation. - return codes.userRoles.GetDescForType(userRole); + return codes.userRoleCodes.GetDescForType(userRole); } // Organisation type. public String GetOrganisationTypeCaption(Sax.OrganisationType organisationType) { if ((int)organisationType < 1) return ""; - if (codes.organisationTypes == null) - codes.organisationTypes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationType); + if (codes.organisationTypeCodes == null) + codes.organisationTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationType); // ToDo Organisation Type localisation. - return codes.organisationTypes.GetDescForType(organisationType); + return codes.organisationTypeCodes.GetDescForType(organisationType); } // Organisation category. public String GetOrganisationCategoryCaption(Sax.OrganisationCategory organisationCategory) { if ((int)organisationCategory < 1) return ""; - if (codes.organisationCategories == null) - codes.organisationCategories = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationCategory); + if (codes.organisationCategoryCodes == null) + codes.organisationCategoryCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationCategory); // ToDo Organisation Category localisation. - return codes.organisationCategories.GetDescForType(organisationCategory); + return codes.organisationCategoryCodes.GetDescForType(organisationCategory); } // Organisation role. public String GetOrganisationRoleCaption(Sax.OrganisationRole organisationRole) { if ((int)organisationRole < 1) return ""; - if (codes.organisationRoles == null) - codes.organisationRoles = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole); + if (codes.organisationRoleCodes == null) + codes.organisationRoleCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole); // ToDo Organisation Role localisation. - return codes.organisationRoles.GetDescForType(organisationRole); + return codes.organisationRoleCodes.GetDescForType(organisationRole); } // Opportunity type. public String GetOpportunityTypeCaption(Sax.OpportunityType opportunityType) { if ((int)opportunityType < 1) return ""; - if (codes.opportunityTypes == null) - codes.opportunityTypes = SaxSystem.GetCodesOfType(Sax.CodeType.OpportunityType); + if (codes.opportunityTypeCodes == null) + codes.opportunityTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OpportunityType); // ToDo Opportunity Type localisation. - return codes.opportunityTypes.GetDescForType(opportunityType); + return codes.opportunityTypeCodes.GetDescForType(opportunityType); } //------------------------------------------------------------------- diff --git a/SaxoniteCoreWeb/Base/App/SaxSessionData_Web.cs b/SaxoniteCoreWeb/Base/App/SaxSessionData_Web.cs index 91c5cf6..29e7b18 100644 --- a/SaxoniteCoreWeb/Base/App/SaxSessionData_Web.cs +++ b/SaxoniteCoreWeb/Base/App/SaxSessionData_Web.cs @@ -7,7 +7,7 @@ using System.Text; namespace Saxonite.Net.Core.Web.Base.App { //======================================================================= - public class SaxSessionData_Web : SaxSessionData + public abstract class SaxSessionData_Web : SaxSessionData { //------------------------------------------------------------------- // Protected construction. diff --git a/SaxoniteCoreWeb/Base/Consoles/SaxActivityConsole_Web.cs b/SaxoniteCoreWeb/Base/Consoles/SaxActivityConsole_Web.cs index 3a59d8c..61f4444 100644 --- a/SaxoniteCoreWeb/Base/Consoles/SaxActivityConsole_Web.cs +++ b/SaxoniteCoreWeb/Base/Consoles/SaxActivityConsole_Web.cs @@ -57,7 +57,7 @@ namespace Saxonite.Net.Core.Web.Base.Consoles public static int CompareActivityIndices(ActivityData_Web item1, ActivityData_Web item2) { int effectiveCompare = item1.EffectiveOn.CompareTo(item2.EffectiveOn); - if (effectiveCompare != null) return effectiveCompare * -1; + if (effectiveCompare != 0) return effectiveCompare * -1; return 1; } } diff --git a/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs b/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs index 1c43730..7e9d223 100644 --- a/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs +++ b/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs @@ -90,13 +90,15 @@ namespace Saxonite.Net.Core.Web.Base.Controllers public SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } } public SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } } // System codes. - public List RegionTypes { get { return Internals.RegionTypes; } } - public List UserRoles { get { return Internals.UserRoles; } } - public List OrganisationTypes { get { return Internals.OrganisationTypes; } } - public List OrganisationCategories { get { return Internals.OrganisationCategories; } } - public List OrganisationRoles { get { return Internals.OrganisationRoles; } } - public List OpportunityTypes { get { return Internals.OpportunityTypes; } } - public List DataItemTypes { get { return Internals.DataItemTypes; } } + public List SportParticipationCodes { get { return Internals.SportParticipationCodes; } } + public List SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } } + public List RegionTypeCodes { get { return Internals.RegionTypeCodes; } } + public List UserRoleCodes { get { return Internals.UserRoleCodes; } } + public List OrganisationTypeCodes { get { return Internals.OrganisationTypeCodes; } } + public List OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } } + public List OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } } + public List OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } } + public List DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } } // Email. public SaEmailConfig EmailConfig { get { return App.EmailConfig; } } public SaxEmailConsole EmailConsole { get { return Internals.EmailConsole; } } diff --git a/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs b/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs index a6423c2..aff9a89 100644 --- a/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs +++ b/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs @@ -55,13 +55,15 @@ namespace Saxonite.Net.Core.Web.Base.Models protected SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } } protected SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } } // System codes. - public List RegionTypes { get { return Internals.RegionTypes; } } - public List UserRoles { get { return Internals.UserRoles; } } - public List OrganisationTypes { get { return Internals.OrganisationTypes; } } - public List OrganisationCategories { get { return Internals.OrganisationCategories; } } - public List OrganisationRoles { get { return Internals.OrganisationRoles; } } - public List OpportunityTypes { get { return Internals.OpportunityTypes; } } - public List DataItemTypes { get { return Internals.DataItemTypes; } } + public List SportParticipationCodes { get { return Internals.SportParticipationCodes; } } + public List SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } } + public List RegionTypeCodes { get { return Internals.RegionTypeCodes; } } + public List UserRoleCodes { get { return Internals.UserRoleCodes; } } + public List OrganisationTypeCodes { get { return Internals.OrganisationTypeCodes; } } + public List OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } } + public List OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } } + public List OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } } + public List DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } } //------------------------------------------------------------------- // Page configuration. @@ -153,28 +155,40 @@ namespace Saxonite.Net.Core.Web.Base.Models get { return new SelectList(SaxSystem.GetCodesOfType(Sax.CodeType.YesNo), "Code", "Desc"); } } + /// List of Sport Participation options for dropdown. + public IEnumerable SportParticipationCodesForSelect + { + get { return new SelectList(SportParticipationCodes, "Code", "Desc"); } + } + + /// List of Sport Officiating options for dropdown. + public IEnumerable SportOfficiatingCodesForSelect + { + get { return new SelectList(SportOfficiatingCodes, "Code", "Desc"); } + } + + /// List of Region Types for dropdown. + public IEnumerable RegionTypesForSelect + { + get { return new SelectList(RegionTypeCodes, "Code", "Desc"); } + } + /// List of titles for dropdown. public IEnumerable TitlesForSelect { get { return new SelectList(SaxSystem.GetCodesOfType(Sax.CodeType.Title), "Code", "Desc"); } } - /// List of Region Types for dropdown. - public IEnumerable RegionTypesForSelect - { - get { return new SelectList(RegionTypes, "Code", "Desc"); } - } - /// List of Organisation Types for dropdown. public IEnumerable OrganisationTypesForSelect { - get { return new SelectList(OrganisationTypes, "Code", "Desc"); } + get { return new SelectList(OrganisationTypeCodes, "Code", "Desc"); } } /// List of Organisation Categories for dropdown. public IEnumerable OrganisationCategoriesForSelect { - get { return new SelectList(OrganisationCategories, "Code", "Desc"); } + get { return new SelectList(OrganisationCategoryCodes, "Code", "Desc"); } } //------------------------------------------------------------------- diff --git a/SaxoniteCoreWebAdmin/Admin/App/SaxSessionData_Admin.cs b/SaxoniteCoreWebAdmin/Admin/App/SaxSessionData_Admin.cs index 9411ed7..c1f73d7 100644 --- a/SaxoniteCoreWebAdmin/Admin/App/SaxSessionData_Admin.cs +++ b/SaxoniteCoreWebAdmin/Admin/App/SaxSessionData_Admin.cs @@ -28,8 +28,21 @@ namespace Saxonite.Net.Core.Web.Admin.App //------------------------------------------------------------------- // Properties. + + //------------------------------------------------------------------- + // User details. + private class UserData_Admin : UserData + { + public UserData_Admin(SaxSessionContext sessionContext, SaxUserAccount userAccount, List userRoles) : + base(sessionContext, userAccount, userRoles) + { } + public UserData_Admin(UserData userData) : + base(userData) + { } + } + protected override UserData CreateUserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List userRoles) { return new UserData_Admin(sessionContext, userAccount, userRoles); } /// User - JSON deserialisation route. - 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)); } } //------------------------------------------------------------------- } diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Ajax.cs index 2178711..1d0c81e 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Ajax.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Ajax.cs @@ -47,10 +47,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers { data.Id = SysId.ToString(organisation.Id); data.Name = organisation.Name; - data.TypeCode = OrganisationTypes.GetCodeForType(organisation.OrganisationType); - data.TypeDesc = OrganisationTypes.GetDescForType(organisation.OrganisationType); - data.CategoryCode = OrganisationCategories.GetCodeForType(organisation.OrganisationCategory); - data.CategoryDesc = OrganisationCategories.GetDescForType(organisation.OrganisationCategory); + data.TypeCode = OrganisationTypeCodes.GetCodeForType(organisation.OrganisationType); + data.TypeDesc = OrganisationTypeCodes.GetDescForType(organisation.OrganisationType); + data.CategoryCode = OrganisationCategoryCodes.GetCodeForType(organisation.OrganisationCategory); + data.CategoryDesc = OrganisationCategoryCodes.GetDescForType(organisation.OrganisationCategory); data.MemberCount = AccountMgr.GetOrganisationMemberCount(organisation.Id); // Sport. data.SportId = SysId.ToLong(organisation.SportIdPrimary); @@ -145,9 +145,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers Id = values.GetString(colId.DataName), Name = values.GetString(colName.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), - CategoryDesc = OrganisationCategories.GetDescForCode(values.GetString(colOrganisationCategory.DataName)), + CategoryDesc = OrganisationCategoryCodes.GetDescForCode(values.GetString(colOrganisationCategory.DataName)), MemberCount = StringUtil.ToLong(values.GetString(colMemberCount.DataName)), SportId = values.GetLong(colSportId.DataName), SportName = values.GetString(colSportName.DataName), diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Members-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Members-Ajax.cs index 06facfc..309d98d 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Members-Ajax.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Members-Ajax.cs @@ -47,7 +47,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers data.OrganisationName = organisation.Name; // Exclude 'Member' role. 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.StatusCode = userOrganisation.StatusCode; data.StatusDesc = userOrganisation.StatusDesc; @@ -91,7 +91,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers // Reference data - organisation roles. // 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)); // Reference data - statuses. diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/RegionController-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/RegionController-Ajax.cs index 13d5052..d32a7d5 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/RegionController-Ajax.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/RegionController-Ajax.cs @@ -36,8 +36,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers private void PopulateRegionResponseData(SaxRegion region, RegionData_List data) { data.Id = SysId.ToString(region.Id); - data.RegionTypeCode = RegionTypes.GetCodeForType(region.RegionType); - data.RegionTypeDesc = RegionTypes.GetDescForType(region.RegionType); + data.RegionTypeCode = RegionTypeCodes.GetCodeForType(region.RegionType); + data.RegionTypeDesc = RegionTypeCodes.GetDescForType(region.RegionType); data.CountryIso2Code = region.CountryIso2Code; data.Name = region.Name; data.StatusCode = region.StatusCode; @@ -117,8 +117,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers RegionData_List regionData = new RegionData_List() { Id = values.GetString(colId.DataName), - RegionTypeCode = RegionTypes.GetCodeForType(regionType), - RegionTypeDesc = RegionTypes.GetDescForType(regionType), + RegionTypeCode = RegionTypeCodes.GetCodeForType(regionType), + RegionTypeDesc = RegionTypeCodes.GetDescForType(regionType), CountryIso2Code = values.GetString(colIso2Code.DataName), Name = values.GetString(colName.DataName), ParentName = values.GetString(colParentName.DataName), diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/UserController-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/UserController-Ajax.cs index 11ce7d7..37d4810 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/UserController-Ajax.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/UserController-Ajax.cs @@ -55,7 +55,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers if (userRoles != null) { 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); // 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.DefaultStatusCode = SacsSystem.GetStatusCode(SaxUserAccount.DefaultStatus); @@ -280,7 +280,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers foreach (String userRoleCode in userRoleCodes) { // Role to activate. - Sax.UserRole role = (Sax.UserRole)UserRoles.GetTypeForCode(userRoleCode); + Sax.UserRole role = (Sax.UserRole)UserRoleCodes.GetTypeForCode(userRoleCode); SaxUserRole userRole = userRoles.GetUserRoleByRole(role); if (userRole == null) { @@ -292,7 +292,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers // Roles to deactivate. 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; } } diff --git a/SaxoniteCoreWebAdmin/Admin/Models/Model_Organisation.cs b/SaxoniteCoreWebAdmin/Admin/Models/Model_Organisation.cs index d0d264c..258d487 100644 --- a/SaxoniteCoreWebAdmin/Admin/Models/Model_Organisation.cs +++ b/SaxoniteCoreWebAdmin/Admin/Models/Model_Organisation.cs @@ -37,11 +37,11 @@ namespace Saxonite.Net.Core.Web.Admin.Models public FilterData Filter { get; } = new FilterData(); public Sax.OrganisationType FilterOrganisationType { - get { return (Sax.OrganisationType)OrganisationTypes.GetTypeForCode(Filter.OrganisationTypeCode); } + get { return (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(Filter.OrganisationTypeCode); } } 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 OrganisationName { 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 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 OrganisationRegionId { get; set; } // Common properties. diff --git a/SaxoniteCoreWebAdmin/Admin/Models/Model_Region.cs b/SaxoniteCoreWebAdmin/Admin/Models/Model_Region.cs index 0beca3f..ba4bae3 100644 --- a/SaxoniteCoreWebAdmin/Admin/Models/Model_Region.cs +++ b/SaxoniteCoreWebAdmin/Admin/Models/Model_Region.cs @@ -36,7 +36,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models public FilterData Filter { get; } = new FilterData(); 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 Sax.RegionType RegionType { - get { return (Sax.RegionType)RegionTypes.GetTypeForCode(RegionTypeCode); } - set { RegionTypeCode = RegionTypes.GetCodeForType(value); } + get { return (Sax.RegionType)RegionTypeCodes.GetTypeForCode(RegionTypeCode); } + set { RegionTypeCode = RegionTypeCodes.GetCodeForType(value); } } public String RegionCountryIso2Code { get; set; } public String RegionName { get; set; } diff --git a/SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js b/SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js index ba0dced..f637176 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js +++ b/SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js @@ -10,6 +10,7 @@ //-------------------------------------------------------------- sax.refreshDbSchema= function (delay) { + if (sax.awaitingLogin) return; var $results = $('.sax-panel-results.DbSchema'); if (!sax.awaitingRefreshResponse) { diff --git a/SaxoniteCoreWebOnline/Localisation/SaxOnlineProperties.resx b/SaxoniteCoreWebOnline/Localisation/SaxOnlineProperties.resx index ce6388f..ce58558 100644 --- a/SaxoniteCoreWebOnline/Localisation/SaxOnlineProperties.resx +++ b/SaxoniteCoreWebOnline/Localisation/SaxOnlineProperties.resx @@ -249,6 +249,9 @@ No + + Officiating + OK @@ -264,6 +267,9 @@ Outline + + Participation + Password diff --git a/SaxoniteCoreWebOnline/Online/App/SaxSessionData_Online.cs b/SaxoniteCoreWebOnline/Online/App/SaxSessionData_Online.cs index 3bcf3da..a62de02 100644 --- a/SaxoniteCoreWebOnline/Online/App/SaxSessionData_Online.cs +++ b/SaxoniteCoreWebOnline/Online/App/SaxSessionData_Online.cs @@ -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 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 userRoles) { return new UserData_Online(sessionContext, userAccount, userRoles); } /// User - JSON deserialisation route. - 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)); } } + + /// + /// Update the user's contect details against the session. + /// - User Account must match that already against the session. + /// + public bool RefreshUser(SaxUserAccount userAccount) + { + UserData_Online user = User as UserData_Online; + if (user != null) + return user.RefreshUserData(userAccount); + return false; + } //------------------------------------------------------------------- // User Profile. @@ -45,6 +71,7 @@ namespace Saxonite.Net.Core.Web.Online.App // Sports. public class SportData { + [JsonConstructor] public SportData(SysId sportId, SaStatus status) { SportId = sportId; diff --git a/SaxoniteCoreWebOnline/Online/Controllers/AccountController-Ajax-Contact.cs b/SaxoniteCoreWebOnline/Online/Controllers/AccountController-Ajax-Contact.cs index 3f0e31a..1651165 100644 --- a/SaxoniteCoreWebOnline/Online/Controllers/AccountController-Ajax-Contact.cs +++ b/SaxoniteCoreWebOnline/Online/Controllers/AccountController-Ajax-Contact.cs @@ -157,6 +157,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"])); } + // Refresh profile contact details to session. + RefreshSessionProfileContact(userAccount); + // Construct response. responseData.Contact = new ContactResponseData(); PopulateContactResponseData(responseData.Contact, userAccount); diff --git a/SaxoniteCoreWebOnline/Online/Controllers/AccountController-Ajax-Sports.cs b/SaxoniteCoreWebOnline/Online/Controllers/AccountController-Ajax-Sports.cs index 7564f98..05640e0 100644 --- a/SaxoniteCoreWebOnline/Online/Controllers/AccountController-Ajax-Sports.cs +++ b/SaxoniteCoreWebOnline/Online/Controllers/AccountController-Ajax-Sports.cs @@ -14,6 +14,7 @@ using Sarand.Net.Standard.Base.Bus; using Sarand.Net.Standard.Base.Utils; using Sarand.Net.Standard.Base.Core; using Sarand.Net.Standard.Base.Dbas; +using Saxonite.Net.Standard.Base.App; 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 SportId { get; set; } public String SportName { get; set; } + public String SportParticipation { get; set; } + public String SportOfficiating { get; set; } public String StatusCode { get; set; } public String StatusDesc { get; set; } } public class ProfileSportResponseData_Item : ProfileSportResponseData_List { + public String SportParticipationCode { get; set; } + public String SportOfficiatingCode { get; set; } public String CreatedOnFmt { get; set; } } 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.SportId = SysId.ToLong(userSport.SportId); 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.StatusCode = userSport.StatusCode; data.StatusDesc = userSport.StatusDesc; @@ -79,11 +88,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers ColumnDfn colId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Id); ColumnDfn colSportId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportId); 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); List columns = new List() { colId, colSportId, colSportName, + colParticipation, colOfficiating, colStatus, }; @@ -103,6 +115,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers Id = values.GetLong(colId.DataName), SportId = values.GetLong(colSportId.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), 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) - 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. + if (model.ProfileSportParticipationCode != null) + userSport.Participation = model.ProfileSportParticipation; + if (model.ProfileSportOfficiatingCode != null) + userSport.Officiating = model.ProfileSportOfficiating; // Store item. 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. PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport); responseData.Success = true; diff --git a/SaxoniteCoreWebOnline/Online/Controllers/OrganisationController-Ajax-Opportunities.cs b/SaxoniteCoreWebOnline/Online/Controllers/OrganisationController-Ajax-Opportunities.cs index 340c776..37f1966 100644 --- a/SaxoniteCoreWebOnline/Online/Controllers/OrganisationController-Ajax-Opportunities.cs +++ b/SaxoniteCoreWebOnline/Online/Controllers/OrganisationController-Ajax-Opportunities.cs @@ -46,7 +46,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_List data) { 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.Position = opportunity.Position; data.Outline = opportunity.Outline; @@ -113,7 +113,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers SessionData_Online.Filter.SetMemberOrganisation(organisation); // 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)); // User organisation. @@ -172,11 +172,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers { Id = values.GetString(colId.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), Outline = values.GetString(colOutline.DataName), - RegionCaption = model.GetRegionCaption(values.GetString(colRegionName.DataName).ToSysId()), - SportCaption = model.GetSportCaption(values.GetString(colSportName.DataName).ToSysId()), + RegionCaption = model.GetRegionCaption(values.GetString(colRegionId.DataName).ToSysId()), + SportCaption = model.GetSportCaption(values.GetString(colSportId.DataName).ToSysId()), CreatedOnFmt = DateUtil.Format(values.GetDateTime(colCreatedOn.DataName), "d-MMM-yyyy"), PublishedOnFmt = DateUtil.Format(values.GetDateTime(colPublishedOn.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) opportunity.SportIdPrimary = model.OpportunitySportId.ToSysId(); if (model.OpportunityTypeCode != null) - opportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypes.GetTypeForCode(model.OpportunityTypeCode); + opportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypeCodes.GetTypeForCode(model.OpportunityTypeCode); if (model.OpportunityPosition != null) opportunity.Position = model.OpportunityPosition; if (model.OpportunityOutline != null) diff --git a/SaxoniteCoreWebOnline/Online/Controllers/SaxController_Online.cs b/SaxoniteCoreWebOnline/Online/Controllers/SaxController_Online.cs index 1221a56..4731f53 100644 --- a/SaxoniteCoreWebOnline/Online/Controllers/SaxController_Online.cs +++ b/SaxoniteCoreWebOnline/Online/Controllers/SaxController_Online.cs @@ -96,6 +96,22 @@ namespace Saxonite.Net.Core.Web.Online.Controllers return true; } + //------------------------------------------------------------------- + /// Populate the user's profile contact details to the session. + 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; + } + //------------------------------------------------------------------- /// Populate the user's profile sports to the session. 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. ColumnDfn colSportId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportId); 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); SaxUserSport.Params prmUserSport = new SaxUserSport.Params(); prmUserSport.UserAccountIdsIncluded.Add(userAccountId); prmUserSport.StatusCat = SaxUserSport.StatusCat.ActiveOnly; - using (DbResultSet resultSet = AccountMgr.ExecuteUserSportQuery(new List() { colSportId, colSportName, colStatus }, prmUserSport)) + using (DbResultSet resultSet = AccountMgr.ExecuteUserSportQuery(new List() { colSportId, colSportName, colParticipation, colOfficiating, colStatus }, prmUserSport)) { while (resultSet != null && resultSet.NextRecord()) { NamedValue.Map values = resultSet.GetRecordValues(); SysId sportId = new SysId(values.GetLong(colSportId.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)); sessionData.Profile.AddSport(sportId, status); } diff --git a/SaxoniteCoreWebOnline/Online/Models/Model_Account.cs b/SaxoniteCoreWebOnline/Online/Models/Model_Account.cs index 77bcb0b..010a910 100644 --- a/SaxoniteCoreWebOnline/Online/Models/Model_Account.cs +++ b/SaxoniteCoreWebOnline/Online/Models/Model_Account.cs @@ -1,9 +1,11 @@ using Sarand.Net.Standard.Base.Bus; +using Sarand.Net.Standard.Base.Core; using Sarand.Net.Standard.Base.Utils; using Saxonite.Base.App; using Saxonite.Net.Core.Web.Base.App; using Saxonite.Net.Core.Web.Base.Controllers; using Saxonite.Net.Core.Web.Base.Models; +using Saxonite.Net.Standard.Base.App; using Saxonite.Net.Standard.Base.Bus; using System; using System.Collections.Generic; @@ -41,6 +43,18 @@ namespace Saxonite.Net.Core.Web.Online.Models public String UserSportId { get; set; } public String ProfileSportId { 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) diff --git a/SaxoniteCoreWebOnline/Views/Account/Profile-Sports.cshtml b/SaxoniteCoreWebOnline/Views/Account/Profile-Sports.cshtml index 68c92f4..121dc3d 100644 --- a/SaxoniteCoreWebOnline/Views/Account/Profile-Sports.cshtml +++ b/SaxoniteCoreWebOnline/Views/Account/Profile-Sports.cshtml @@ -29,8 +29,8 @@
-
-
+
@Localiser["label.participation"]: 
+
@Localiser["label.officiating"]: 
@@ -43,28 +43,50 @@ @Html.HiddenFor(model => model.UserSportId, new { @id = "", @class = "UserSportId" }) } -
+
- @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;" })) + { + + - @* Sport *@ -
-
- -
-
- -
-
-
-
+ @* Sport *@ +
+
+
+
+ +
+
+
+
+
- } + @* Sport Participation *@ +
+
+ +
+
+ @Html.DropDownListFor(model => model.ProfileSportParticipationCode, Model.SportParticipationCodesForSelect, "", new { @id = "cbProfileSportParticipation", @class = "ProfileSportParticipation sax-select" }) +
+
+
-
+ @* Sport Officiating *@ +
+
+ +
+
+ @Html.DropDownListFor(model => model.ProfileSportOfficiatingCode, Model.SportOfficiatingCodesForSelect, "", new { @id = "cbProfileSportOfficiating", @class = "ProfileSportOfficiating sax-select" }) +
+
+
+ + } + +
diff --git a/SaxoniteCoreWebOnline/Views/Journalist/Articles.cshtml b/SaxoniteCoreWebOnline/Views/Journalist/Articles.cshtml index e48f1b5..e455071 100644 --- a/SaxoniteCoreWebOnline/Views/Journalist/Articles.cshtml +++ b/SaxoniteCoreWebOnline/Views/Journalist/Articles.cshtml @@ -41,13 +41,13 @@
-
-
+
+
-
@Localiser["label.created"]: 
-
-
+
@Localiser["label.created"]: 
+
+
diff --git a/SaxoniteCoreWebOnline/Views/Organisation/Opportunities.cshtml b/SaxoniteCoreWebOnline/Views/Organisation/Opportunities.cshtml index e441d8a..b00a7b8 100644 --- a/SaxoniteCoreWebOnline/Views/Organisation/Opportunities.cshtml +++ b/SaxoniteCoreWebOnline/Views/Organisation/Opportunities.cshtml @@ -49,13 +49,13 @@
-
-
+
+
-
@Localiser["label.created"]: 
-
@Localiser["label.published"]: 
-
+
@Localiser["label.created"]: 
+
@Localiser["label.published"]: 
+
diff --git a/SaxoniteCoreWebOnline/wwwroot/js/sax-account.js b/SaxoniteCoreWebOnline/wwwroot/js/sax-account.js index a16a013..3471e33 100644 --- a/SaxoniteCoreWebOnline/wwwroot/js/sax-account.js +++ b/SaxoniteCoreWebOnline/wwwroot/js/sax-account.js @@ -5,6 +5,7 @@ (function (win, doc, undef) { "use strict"; + sax.profile = { contact: {}, sports: {}, organisations: {} }; //-------------------------------------------------------------- sax.refreshProfile = function () @@ -37,7 +38,7 @@ } sax.onRefreshProfileContactInfo = function (response) { - sax.debug('onRefreshProfileContactInfo', response); + //sax.debug('onRefreshProfileContactInfo', response); if (!response || !response.success || !response.contact) return; var $section = $('.sax-panel-section.ProfileContact'); $('.sax-message', $section).stop(true, false).fadeOut(200).empty(); @@ -50,7 +51,7 @@ } sax.onRefreshProfileContactForm = function (response) { - sax.debug('onRefreshProfileContactForm', response); + //sax.debug('onRefreshProfileContactForm', response); if (!response || !response.success) return; var $section = $('.sax-panel-section.ProfileContact'); $('.sax-message', $section).stop(true, false).fadeOut(200).empty(); @@ -85,7 +86,7 @@ } sax.onSelectRegionCountry = function (region) { - sax.debug(region); + //sax.debug(region); sax.clearControlError($('#ifAccountRegionIdCountry').val(region.id)); $('#ifAccountRegionCaptionCountry').val(region ? region.name : ''); } @@ -101,7 +102,7 @@ } sax.refreshProfileSports = function (callbackFn) { - //sax.debug('refreshProfileSports'); + sax.debug('refreshProfileSports'); delete sax.page.profileSportsChanged; sax.ajaxProfileSports = sax.ajaxProfileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true }; sax.ajaxProfileSports.callbackFn = callbackFn; @@ -109,11 +110,11 @@ } sax.onRefreshProfileSportsInfo = function (response) { - sax.debug('onRefreshProfileSportsInfo', response); + //sax.debug('onRefreshProfileSportsInfo', response); if (!response || !response.success) return; var $section = $('.sax-panel-section.ProfileSports'); $('.sax-message', $section).stop(true, false).fadeOut(200).empty(); - + sax.profile.sports.Ids = []; let items = response.sports; if (!items) return; let $items = $('.sax-panel-results.ProfileSports', $section).empty(); @@ -121,9 +122,11 @@ for (let itemIdx = 0; itemIdx < items.length; itemIdx++) { let item = items[itemIdx]; + sax.profile.sports.Ids.push(item.sportId); let $item = $tmpl.clone().prop('id', 'ProSpt_' + item.id); $('.sax-header .sax-action.sax-edit', $item).on('click', function (evt) { sax.updateProfileSport(item.id); }); $('.SportName', $item).text(item.sportName); + $('.SportParticipation', $item).text(item.sportParticipation); $items.append($item); } $items.show(); @@ -132,37 +135,40 @@ } sax.addProfileSport = function () { - sax.debug('addProfileSport'); + //sax.debug('addProfileSport'); 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(); $dlg.dialog('option', 'title', sax.dlg.title.addUserSport); sax.openDialog($dlg, 480, 400); } sax.updateProfileSport = function (id) { - sax.debug('updateProfileSport', id); + //sax.debug('updateProfileSport', id); $('#frmProfileSportId .UserSportId').val(id); sax.ajaxProfileSport = sax.ajaxProfileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport }; sax.doAjaxRequest(sax.ajaxProfileSport, 50); } sax.doUpdateProfileSport = function (response) { - sax.debug('doUpdateProfileSport', response); + //sax.debug('doUpdateProfileSport', response); let $dlg = sax.$dlg.profileSport; let item = response.sport; $('.UserSportId', $dlg).val(item.id); $('.ProfileSportExists', $dlg).val(1); $('#ifProfileSportId', $dlg).val(item.sportId); $('#ifProfileSport', $dlg).val(item.sportName); + $('#cbProfileSportParticipation', $dlg).val(item.sportParticipationCode); + $('#cbProfileSportOfficiating', $dlg).val(item.sportOfficiatingCode); $('#pbSelectSport', $dlg).hide(); $dlg.dialog('option', 'title', sax.dlg.title.updateUserSport); sax.openDialog($dlg, 480, 400); } sax.selectUserSport = function (sport) { - sax.debug('selectUserSport'); - sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), fnCallback: sax.onSelectUserSport }) + //sax.debug('selectUserSport'); + 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) { @@ -171,7 +177,7 @@ } sax.storeProfileSport = function () { - sax.debug('storeProfileSport'); + //sax.debug('storeProfileSport'); sax.clearControlErrors(); sax.ajaxStoreProfileSport = sax.ajaxStoreProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport }; sax.doAjaxRequest(sax.ajaxStoreProfileSport, 50); @@ -179,8 +185,7 @@ sax.onStoreProfileSport = function (response) { sax.refreshControlValues(response.controlValues); - if (!response || !response.success) - return; + if (!response || !response.success) return; sax.$dlg.profileSport.dialog('close'); sax.refreshProfileSportsInfo(); } @@ -204,7 +209,7 @@ } sax.onRefreshProfileOrganisationsInfo = function (response) { - sax.debug('onRefreshProfileOrganisationsInfo', response); + //sax.debug('onRefreshProfileOrganisationsInfo', response); if (!response || !response.success) return; var $section = $('.sax-panel-section.ProfileOrganisations'); $('.sax-message', $section).stop(true, false).fadeOut(200).empty(); diff --git a/SaxoniteCoreWebOnline/wwwroot/js/sax-home.js b/SaxoniteCoreWebOnline/wwwroot/js/sax-home.js index dcf3f28..2e1fd1d 100644 --- a/SaxoniteCoreWebOnline/wwwroot/js/sax-home.js +++ b/SaxoniteCoreWebOnline/wwwroot/js/sax-home.js @@ -9,6 +9,7 @@ //-------------------------------------------------------------- sax.refreshResults = function (delay) { + if (sax.awaitingLogin) return; var $results = $('.sax-panel-results'); if (!sax.awaitingRefreshResponse) { @@ -21,7 +22,7 @@ } sax.doRefreshResults = function (response) { - sax.debug('doRefreshResults', response); + //sax.debug('doRefreshResults', response); delete sax.awaitingRefreshResponse; var $results = $('.sax-panel-results'); var $msgs = $('.sax-panel-messages', $results).hide().empty(); diff --git a/SaxoniteCoreWebOnline/wwwroot/js/sax-jrn-art.js b/SaxoniteCoreWebOnline/wwwroot/js/sax-jrn-art.js index 032106a..a6d7649 100644 --- a/SaxoniteCoreWebOnline/wwwroot/js/sax-jrn-art.js +++ b/SaxoniteCoreWebOnline/wwwroot/js/sax-jrn-art.js @@ -22,7 +22,7 @@ } sax.doRefreshResults = function (response) { - sax.debug('doRefreshResults', response); + //sax.debug('doRefreshResults', response); delete sax.awaitingRefreshResponse; sax.refreshControlValues(response.controlValues); var $results = $('.sax-panel-results'); diff --git a/SaxoniteCoreWebOnline/wwwroot/js/sax-org-opp.js b/SaxoniteCoreWebOnline/wwwroot/js/sax-org-opp.js index 27aae87..03f7795 100644 --- a/SaxoniteCoreWebOnline/wwwroot/js/sax-org-opp.js +++ b/SaxoniteCoreWebOnline/wwwroot/js/sax-org-opp.js @@ -23,7 +23,7 @@ } sax.doRefreshResults = function (response) { - sax.debug('doRefreshResults', response); + //sax.debug('doRefreshResults', response); delete sax.awaitingRefreshResponse; sax.refreshControlValues(response.controlValues); var $panel = $('#pnlOpportunities'); @@ -83,7 +83,7 @@ { let handleMemberOrganisationsResponse = function (response) { - sax.debug('handleUserOrgsResponse', response); + //sax.debug('handleUserOrgsResponse', response); if (!response.success) return; sax.data.memberOrganisations = response.organisations; if (fnCallback) fnCallback(); diff --git a/SaxoniteCoreWebOnline/wwwroot/js/sax-security.js b/SaxoniteCoreWebOnline/wwwroot/js/sax-security.js index 4c22d73..79415a9 100644 --- a/SaxoniteCoreWebOnline/wwwroot/js/sax-security.js +++ b/SaxoniteCoreWebOnline/wwwroot/js/sax-security.js @@ -15,7 +15,6 @@ } sax.onSignin = function (response) { - sax.debug(response); sax.refreshControlValues(response.controlValues); if (!response.success) return; sax.goToPage(''); diff --git a/SaxoniteCoreWebOnline/wwwroot/js/sax-selectSport.js b/SaxoniteCoreWebOnline/wwwroot/js/sax-selectSport.js index 9a6adfc..ea9241d 100644 --- a/SaxoniteCoreWebOnline/wwwroot/js/sax-selectSport.js +++ b/SaxoniteCoreWebOnline/wwwroot/js/sax-selectSport.js @@ -11,7 +11,8 @@ /* * Sport selection config: * - 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. */ ss.fn.selectSport = function (cfg) @@ -61,6 +62,7 @@ for (let rgnIdx = 0; rgnIdx < sports.length; rgnIdx++) { let sport = sports[rgnIdx]; + if (ss.cfg.excludeIds && ss.cfg.excludeIds.includes(sport.id)) continue; let id = sport.id; if (filter && !sport.name.match(reFilter)) continue; let $sport = $sportTmpl.clone(); diff --git a/SaxoniteStandardBase/Base/App/Sax-Version.cs b/SaxoniteStandardBase/Base/App/Sax-Version.cs index c18764b..d1000ab 100644 --- a/SaxoniteStandardBase/Base/App/Sax-Version.cs +++ b/SaxoniteStandardBase/Base/App/Sax-Version.cs @@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App //------------------------------------------------------------------- public static class Version { - private static String version { get; } = "1.0.5.3"; + private static String version { get; } = "1.0.6.0"; // Retrieve version. public static String GetFullVersion () { return version; } public static String GetAppVersion () @@ -39,6 +39,9 @@ namespace Saxonite.Net.Standard.Base.App //------------------------------------------------------------------- // Version history. + //------------------------------------------------------------------- + // 1.0.6 ?-Jun-2021 ??? + // - ?. // 1.0.5 31-May-2021 Activity Index // - Admin Database Schema (Home) and Tables page. // - Online Account country, Home activities. diff --git a/SaxoniteStandardBase/Base/App/Sax.cs b/SaxoniteStandardBase/Base/App/Sax.cs index b9f121c..5468300 100644 --- a/SaxoniteStandardBase/Base/App/Sax.cs +++ b/SaxoniteStandardBase/Base/App/Sax.cs @@ -88,6 +88,8 @@ namespace Saxonite.Net.Standard.Base.App public enum CodeType { YesNo, + SportParticipation, + SportOfficiating, RegionType, UserRole, Title, @@ -170,10 +172,23 @@ namespace Saxonite.Net.Standard.Base.App { Unknown = 0, /* Do not change the values/codes - tied to database. */ - Regular, - Occasional, - Spectator, - Interested + Professional = 100, + Regular = 200, + Occasional = 300, + Spectator = 400, + Interested = 900, + } + + //------------------------------------------------------------------- + /// Sport Officiating + public enum SportOfficiating + { + Unknown = 0, + /* Do not change the values/codes - tied to database. */ + Professional = 100, + Regular = 200, + Occasional = 300, + Interested = 900, } //------------------------------------------------------------------- diff --git a/SaxoniteStandardBase/Base/App/SaxDbDfn_Core.cs b/SaxoniteStandardBase/Base/App/SaxDbDfn_Core.cs index f75ce25..5007e37 100644 --- a/SaxoniteStandardBase/Base/App/SaxDbDfn_Core.cs +++ b/SaxoniteStandardBase/Base/App/SaxDbDfn_Core.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; 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 { @@ -201,6 +201,8 @@ namespace Saxonite.Base.App UserSport_Id, UserSport_UserAccountId, UserSport_SportId, + UserSport_Participation, + UserSport_Officiating, UserSport_UserSportData, UserSport_Notes, UserSport_Flags, @@ -216,7 +218,7 @@ namespace Saxonite.Base.App //------------------------------------------------------------------- // Data members. private static readonly int tableCount = 11; - private static readonly int columnCount = 176; + private static readonly int columnCount = 178; private static ulong maxTextLen = 0; //------------------------------------------------------------------- @@ -565,6 +567,8 @@ namespace Saxonite.Base.App new ColumnDfn(11,"Id",4,4,true,10), new ColumnDfn(11,"UserAccountId",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,"Notes",0,-9,false,2000), new ColumnDfn(11,"Flags",3,5,false,5), diff --git a/SaxoniteStandardBase/Base/App/SaxInternals.cs b/SaxoniteStandardBase/Base/App/SaxInternals.cs index 88652c6..0d6df8e 100644 --- a/SaxoniteStandardBase/Base/App/SaxInternals.cs +++ b/SaxoniteStandardBase/Base/App/SaxInternals.cs @@ -87,13 +87,15 @@ namespace Saxonite.Net.Standard.Base.App //------------------------------------------------------------------- // System codes. private readonly Dictionary> codeTypes = new Dictionary>(); - public List RegionTypes { get { return GetCodesOfType(Sax.CodeType.RegionType); } } - public List UserRoles { get { return GetCodesOfType(Sax.CodeType.UserRole); } } - public List OrganisationTypes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } } - public List OrganisationCategories { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } } - public List OrganisationRoles { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } } - public List OpportunityTypes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } } - public List DataItemTypes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } } + public List SportParticipationCodes { get { return GetCodesOfType(Sax.CodeType.SportParticipation); } } + public List SportOfficiatingCodes { get { return GetCodesOfType(Sax.CodeType.SportOfficiating); } } + public List RegionTypeCodes { get { return GetCodesOfType(Sax.CodeType.RegionType); } } + public List UserRoleCodes { get { return GetCodesOfType(Sax.CodeType.UserRole); } } + public List OrganisationTypeCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } } + public List OrganisationCategoryCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } } + public List OrganisationRoleCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } } + public List OpportunityTypeCodes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } } + public List DataItemTypeCodes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } } public List GetCodesOfType(Sax.CodeType codeType) { if (!codeTypes.ContainsKey(codeType)) diff --git a/SaxoniteStandardBase/Base/App/SaxSessionData.cs b/SaxoniteStandardBase/Base/App/SaxSessionData.cs index faee414..f3c0d2d 100644 --- a/SaxoniteStandardBase/Base/App/SaxSessionData.cs +++ b/SaxoniteStandardBase/Base/App/SaxSessionData.cs @@ -14,7 +14,7 @@ using Newtonsoft.Json.Converters; namespace Saxonite.Net.Standard.Base.App { //======================================================================= - public class SaxSessionData + public abstract class SaxSessionData { //------------------------------------------------------------------- // Protected construction. @@ -28,7 +28,7 @@ namespace Saxonite.Net.Standard.Base.App private SaxSessionData(SaxSessionContext sessionContext) { SessionContext = sessionContext; - User = new UserData(SessionContext, null, null); + userData = CreateUserData(SessionContext, null, null); } /// /// Primary constructor - on user login. @@ -38,7 +38,7 @@ namespace Saxonite.Net.Standard.Base.App protected SaxSessionData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List userRoles) { 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 { protected UserData() { } - public UserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List userRoles) + protected UserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List userRoles) { if (userAccount != null) { UserAccountId = userAccount.Id; - FirstName = userAccount.FirstName; - LastName = userAccount.LastName; - DisplayName = userAccount.GetDisplayName(); - EmailAddress = userAccount.EmailAddress; - RegionIdCountry = userAccount.RegionIdCountry; - RegionIdProvince = userAccount.RegionIdProvince; + RefreshUserData(userAccount); if (sessionContext.Application == Sax.Application.Admin) KeepLoggedIn = userAccount.KeepLoggedIn_Admin; 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 String Title { get; protected set; } public String FirstName { get; protected set; } public String LastName { 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 bool KeepLoggedIn { 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. public class RoleData { @@ -107,19 +132,20 @@ namespace Saxonite.Net.Standard.Base.App public Sax.UserRole Role { get; protected set; } public SaStatus Status { get; protected set; } } - [JsonIgnore] private readonly List roles = new List(); public List Roles { get { return new List(roles); } protected set { roles.Clear(); roles.AddRange(value); } } [JsonIgnore] 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 userRoles); + private UserData userData; + public UserData User { get { return userData; } } /// User - JSON deserialisation route. protected void SetUser(UserData user) { - if (User != null && User.UserAccountSupplied) + if (this.userData != null && User.UserAccountSupplied) throw new NotSupportedException("Session User cannot be replaced."); - User = user; + this.userData = user; } //------------------------------------------------------------------- diff --git a/SaxoniteStandardBase/Base/App/SaxSystem-Statics.cs b/SaxoniteStandardBase/Base/App/SaxSystem-Statics.cs index 2fe4a9d..8c51dfc 100644 --- a/SaxoniteStandardBase/Base/App/SaxSystem-Statics.cs +++ b/SaxoniteStandardBase/Base/App/SaxSystem-Statics.cs @@ -14,8 +14,10 @@ namespace Saxonite.Net.Standard.Base.App //------------------------------------------------------------------- // Data members. // Code types. - private static readonly List regionTypeCodes = new List(); private static readonly List yesNoCodes = new List(); + private static readonly List sportParticipationCodes = new List(); + private static readonly List sportOfficiatingCodes = new List(); + private static readonly List regionTypeCodes = new List(); private static readonly List userRoleCodes = new List(); private static readonly List titleCodes = new List(); private static readonly List organisationTypeCodes = new List(); @@ -33,6 +35,20 @@ namespace Saxonite.Net.Standard.Base.App yesNoCodes.Add(Sax.YesNo.Yes, "YES", "Yes"); 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. regionTypeCodes.Add(Sax.RegionType.Continent, "CONT", "Continent"); diff --git a/SaxoniteStandardBase/Base/App/SaxSystem.cs b/SaxoniteStandardBase/Base/App/SaxSystem.cs index e34517c..4e562b6 100644 --- a/SaxoniteStandardBase/Base/App/SaxSystem.cs +++ b/SaxoniteStandardBase/Base/App/SaxSystem.cs @@ -38,6 +38,10 @@ namespace Saxonite.Net.Standard.Base.App { case Sax.CodeType.YesNo: return new List(yesNoCodes); + case Sax.CodeType.SportParticipation: + return new List(sportParticipationCodes); + case Sax.CodeType.SportOfficiating: + return new List(sportOfficiatingCodes); case Sax.CodeType.RegionType: return new List(regionTypeCodes); case Sax.CodeType.UserRole: diff --git a/SaxoniteStandardBase/Base/Bus/SaxUserSport.cs b/SaxoniteStandardBase/Base/Bus/SaxUserSport.cs index ca35595..36bd8b7 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxUserSport.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxUserSport.cs @@ -28,6 +28,12 @@ namespace Saxonite.Net.Standard.Base.Bus // Sport. SportId, Sport_Name, + SportParticipation, + SportParticipation_Code, + SportParticipation_Desc, + SportOfficiating, + SportOfficiating_Code, + SportOfficiating_Desc, // Associated data. // Common. Notes, @@ -45,6 +51,8 @@ namespace Saxonite.Net.Standard.Base.Bus { public SysId UserAccountId { get; set; } public SysId SportId { get; set; } + public Sax.SportParticipation Participation { get; set; } + public Sax.SportOfficiating Officiating { get; set; } public String UserSportData { get; set; } } @@ -70,6 +78,16 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.SportId; } 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 { get { return data.UserSportData; } @@ -79,6 +97,8 @@ namespace Saxonite.Net.Standard.Base.Bus internal void PopulateFrom(Data data) { UserAccountId = data.UserAccountId; + Participation = data.Participation; + Officiating = data.Officiating; SportId = data.SportId; UserSportData = data.UserSportData; base.PopulateFrom(data); @@ -97,6 +117,8 @@ namespace Saxonite.Net.Standard.Base.Bus { // Identifies the field that has invalid data. 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 UserSportData { get; set; } = ValidValue.Valid; } @@ -165,6 +187,16 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.SportId; } 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 { get { return data.UserSportData; } diff --git a/SaxoniteStandardBase/Base/Mgr/SaxAccountMgr-UserRole.cs b/SaxoniteStandardBase/Base/Mgr/SaxAccountMgr-UserRole.cs index 52b117e..23d625f 100644 --- a/SaxoniteStandardBase/Base/Mgr/SaxAccountMgr-UserRole.cs +++ b/SaxoniteStandardBase/Base/Mgr/SaxAccountMgr-UserRole.cs @@ -179,7 +179,7 @@ namespace Saxonite.Net.Standard.Base.Mgr case SaxUserRole.Column.UserRole_Desc: { String userRoleCode = values.GetValue(column.DataName).ToString(); - value = new DataValue(UserRoles.GetDescForCode(userRoleCode)); + value = new DataValue(UserRoleCodes.GetDescForCode(userRoleCode)); } break; diff --git a/SaxoniteStandardBase/Base/Mgr/SaxAccountMgr-UserSport.cs b/SaxoniteStandardBase/Base/Mgr/SaxAccountMgr-UserSport.cs index 9634c88..ea4e4e5 100644 --- a/SaxoniteStandardBase/Base/Mgr/SaxAccountMgr-UserSport.cs +++ b/SaxoniteStandardBase/Base/Mgr/SaxAccountMgr-UserSport.cs @@ -204,6 +204,28 @@ namespace Saxonite.Net.Standard.Base.Mgr DataValue value = new DataValue(); 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. case SaxUserSport.Column.Notes: diff --git a/SaxoniteStandardBase/Base/Mgr/SaxActivityMgr-ActivityIndex.cs b/SaxoniteStandardBase/Base/Mgr/SaxActivityMgr-ActivityIndex.cs index 34c0452..60d29e9 100644 --- a/SaxoniteStandardBase/Base/Mgr/SaxActivityMgr-ActivityIndex.cs +++ b/SaxoniteStandardBase/Base/Mgr/SaxActivityMgr-ActivityIndex.cs @@ -133,12 +133,12 @@ namespace Saxonite.Net.Standard.Base.Mgr // Data item type. case SaxActivityIndex.Column.ItemType_Code: { - value = new DataValue(DataItemTypes.GetCodeForType(values.GetLong(column.DataName))); + value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName))); } break; case SaxActivityIndex.Column.ItemType_Desc: { - value = new DataValue(DataItemTypes.GetDescForType(values.GetLong(column.DataName))); + value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName))); } break; diff --git a/SaxoniteStandardBase/Base/Mgr/SaxActivityMgr-OrganisationOpportunity.cs b/SaxoniteStandardBase/Base/Mgr/SaxActivityMgr-OrganisationOpportunity.cs index 7ab53f3..904ca16 100644 --- a/SaxoniteStandardBase/Base/Mgr/SaxActivityMgr-OrganisationOpportunity.cs +++ b/SaxoniteStandardBase/Base/Mgr/SaxActivityMgr-OrganisationOpportunity.cs @@ -196,7 +196,7 @@ namespace Saxonite.Net.Standard.Base.Mgr case SaxOrganisationOpportunity.Column.OpportunityType_Desc: { String code = values.GetValue(column.DataName).ToString(); - value = new DataValue(OpportunityTypes.GetDescForCode(code, code)); + value = new DataValue(OpportunityTypeCodes.GetDescForCode(code, code)); } break; diff --git a/SaxoniteStandardBase/Base/Mgr/SaxItemDataMgr-ItemSport.cs b/SaxoniteStandardBase/Base/Mgr/SaxItemDataMgr-ItemSport.cs index 343deae..4194177 100644 --- a/SaxoniteStandardBase/Base/Mgr/SaxItemDataMgr-ItemSport.cs +++ b/SaxoniteStandardBase/Base/Mgr/SaxItemDataMgr-ItemSport.cs @@ -150,12 +150,12 @@ namespace Saxonite.Net.Standard.Base.Mgr // Data item type. case SaxItemSport.Column.ItemType_Code: { - value = new DataValue(DataItemTypes.GetCodeForType(values.GetLong(column.DataName))); + value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName))); } break; case SaxItemSport.Column.ItemType_Desc: { - value = new DataValue(DataItemTypes.GetDescForType(values.GetLong(column.DataName))); + value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName))); } break; diff --git a/SaxoniteStandardBase/Base/Mgr/SaxItemMgr.cs b/SaxoniteStandardBase/Base/Mgr/SaxItemMgr.cs index 70a7b63..59a1e1d 100644 --- a/SaxoniteStandardBase/Base/Mgr/SaxItemMgr.cs +++ b/SaxoniteStandardBase/Base/Mgr/SaxItemMgr.cs @@ -45,7 +45,7 @@ namespace Saxonite.Net.Standard.Base.Mgr public ISacsDatabase CoreDatabase { get { return Internals.CoreDatabase; } } public IDatabaseInfo CoreDbInfo { get { return Internals.CreateCoreDbInfo(); } } // Business components. - protected SaxInternals Internals + protected SaxInternals Internals { get { @@ -66,13 +66,15 @@ namespace Saxonite.Net.Standard.Base.Mgr public SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } } public SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } } // Application codes. - public List RegionTypes { get { return Internals.RegionTypes; } } - public List UserRoles { get { return Internals.UserRoles; } } - public List OrganisationTypes { get { return Internals.OrganisationTypes; } } - public List OrganisationCategories { get { return Internals.OrganisationCategories; } } - public List OrganisationRoles { get { return Internals.OrganisationRoles; } } - public List OpportunityTypes { get { return Internals.OpportunityTypes; } } - public List DataItemTypes { get { return Internals.DataItemTypes; } } + public List SportParticipationCodes { get { return Internals.SportParticipationCodes; } } + public List SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } } + public List RegionTypeCodes { get { return Internals.RegionTypeCodes; } } + public List UserRoleCodes { get { return Internals.UserRoleCodes; } } + public List OrganisationTypeCodes { get { return Internals.OrganisationTypeCodes; } } + public List OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } } + public List OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } } + public List OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } } + public List DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } } //------------------------------------------------------------------- } diff --git a/SaxoniteStandardDbas/Dbas/Internal/ActivityIndex_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/ActivityIndex_Db.cs index 846d596..d9feddb 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/ActivityIndex_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/ActivityIndex_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/ItemSport_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/ItemSport_Db.cs index 461728d..38a2fb2 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/ItemSport_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/ItemSport_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/JournalistArticle_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/JournalistArticle_Db.cs index 0ea567f..34719a6 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/JournalistArticle_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/JournalistArticle_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/OrganisationOpportunity_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/OrganisationOpportunity_Db.cs index 1d03b48..deb96d0 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/OrganisationOpportunity_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/OrganisationOpportunity_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/Organisation_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Organisation_Db.cs index 92a04ad..a72cb9e 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Organisation_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Organisation_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/Region_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Region_Db.cs index 2ee8373..edd78ea 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Region_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Region_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/Sport_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Sport_Db.cs index 4774ca9..675f438 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Sport_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Sport_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/UserAccount_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/UserAccount_Db.cs index e70eadd..5e511b3 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/UserAccount_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/UserAccount_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/UserOrganisation_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/UserOrganisation_Db.cs index 96864e6..fb447c2 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/UserOrganisation_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/UserOrganisation_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/UserRole_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/UserRole_Db.cs index 03ff842..68757ba 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/UserRole_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/UserRole_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { diff --git a/SaxoniteStandardDbas/Dbas/Internal/UserSport_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/UserSport_Db.cs index 1e0644b..80f68ab 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/UserSport_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/UserSport_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; 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 { @@ -22,6 +22,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id", true); public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId"); 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 _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); @@ -41,6 +43,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal "Id", "UserAccountId", "SportId", + "Participation", + "Officiating", "UserSportData", "Notes", "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 _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 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 _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.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); _UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId); _SportId = GetFieldInt32(dbDataReader, "SportId", _SportId); + _Participation = GetFieldInt16(dbDataReader, "Participation", _Participation); + _Officiating = GetFieldInt16(dbDataReader, "Officiating", _Officiating); _UserSportData = GetFieldString(dbDataReader, "UserSportData", _UserSportData); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); @@ -153,6 +161,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal dbCommand.Parameters.Clear(); if (columnNames.ContainsCI("UserAccountId")) AddCommandParameter(dbCommand, "@UserAccountId", _UserAccountId); 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("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes); if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags); @@ -201,6 +211,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal dbCommand.Parameters.Clear(); if (columnNames.ContainsCI("UserAccountId")) AddCommandParameter(dbCommand, "@UserAccountId", _UserAccountId); 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("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes); if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags); diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-Organisation.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-Organisation.cs index 5903381..2ee4342 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-Organisation.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-Organisation.cs @@ -206,8 +206,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr dbOrganisation._Name = organisation.Name; dbOrganisation._PhoneMain = organisation.PhoneMain; dbOrganisation._PhoneAlt = organisation.PhoneAlt; - dbOrganisation._OrganisationType = OrganisationTypes.GetCodeForType(organisation.OrganisationType); - dbOrganisation._OrganisationCategory = OrganisationCategories.GetCodeForType(organisation.OrganisationCategory); + dbOrganisation._OrganisationType = OrganisationTypeCodes.GetCodeForType(organisation.OrganisationType); + dbOrganisation._OrganisationCategory = OrganisationCategoryCodes.GetCodeForType(organisation.OrganisationCategory); dbOrganisation._PhoneMain = organisation.PhoneMain; dbOrganisation._PhoneAlt = organisation.PhoneAlt; dbOrganisation._SportIdPrimary = SysId.ToInt(organisation.SportIdPrimary); @@ -232,8 +232,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr organisation.Name = dbOrganisation._Name; organisation.PhoneMain = dbOrganisation._PhoneMain; organisation.PhoneAlt = dbOrganisation._PhoneAlt; - organisation.OrganisationType = (Sax.OrganisationType)OrganisationTypes.GetTypeForCode(dbOrganisation._OrganisationType); - organisation.OrganisationCategory = (Sax.OrganisationCategory)OrganisationCategories.GetTypeForCode(dbOrganisation._OrganisationCategory); + organisation.OrganisationType = (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(dbOrganisation._OrganisationType); + organisation.OrganisationCategory = (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(dbOrganisation._OrganisationCategory); organisation.PhoneMain = dbOrganisation._PhoneMain; organisation.PhoneAlt = dbOrganisation._PhoneAlt; organisation.SportIdPrimary = new SysId(dbOrganisation._SportIdPrimary); diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserAccount.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserAccount.cs index 609cbd4..3424268 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserAccount.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserAccount.cs @@ -475,7 +475,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr { 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_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() + ")"); } } @@ -679,7 +679,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr queryUserRole.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserRole), aliasUserRole); 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_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) + "'"); query.Columns.Add("(" + queryUserRole.BuildQuery() + ")", colUserAccount_SystemAdminRole); } diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOrganisation.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOrganisation.cs index 0e77759..6342821 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOrganisation.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOrganisation.cs @@ -415,7 +415,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr List organisationRoleCodes = new List(); foreach (Sax.OrganisationRole organisationRole in prm.OrganisationRoles) { - String organisationRoleCode = OrganisationRoles.GetCodeForType(organisationRole).TrimAll(); + String organisationRoleCode = OrganisationRoleCodes.GetCodeForType(organisationRole).TrimAll(); if (!StringUtil.IsEmpty(organisationRoleCode)) filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationRoleCodes, aliasUserOrganisation) + " LIKE '%" + DbQuery.FormatForLike(organisationRoleCode) + "%'"); } diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs index 6d673b6..039b222 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs @@ -45,7 +45,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr private SaxUserRole_Dbas CreateUserRole(UserRole_Db dbUserRole) { 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); return userRole; } @@ -205,7 +205,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr { dbUserRole._Id = SysId.ToInt(userRole.Id); dbUserRole._UserAccountId = SysId.ToInt(userRole.UserAccountId); - dbUserRole._UserRoleCode = UserRoles.GetCodeForType(userRole.UserRole); + dbUserRole._UserRoleCode = UserRoleCodes.GetCodeForType(userRole.UserRole); // Common. dbUserRole._Notes = userRole.Notes; 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 + ")"); // User roles. - List userRoles = UserRoles; - String userRoleCodes = prm.UserRolesIncluded.Select(item => UserRoles.GetCodeForType(item)).ToList().Concat(",", "'", "'", true, true); + List userRoles = UserRoleCodes; + String userRoleCodes = prm.UserRolesIncluded.Select(item => UserRoleCodes.GetCodeForType(item)).ToList().Concat(",", "'", "'", true, true); if (!userRoleCodes.IsEmpty()) filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_UserRoleCode, aliasUserRole) + " IN (" + userRoleCodes + ")"); diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs index 22636bb..8cae9ff 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs @@ -206,6 +206,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr dbUserSport._Id = SysId.ToInt(userSport.Id); dbUserSport._UserAccountId = SysId.ToInt(userSport.UserAccountId); dbUserSport._SportId = SysId.ToInt(userSport.SportId); + dbUserSport._Participation = (short)userSport.Participation; + dbUserSport._Officiating = (short)userSport.Officiating; dbUserSport._UserSportData = userSport.UserSportData; // Common. dbUserSport._Notes = userSport.Notes; @@ -226,6 +228,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr //userSport.Id = new SysId(dbUserSport._Id); //userSport.UserAccountId = new SysId(dbUserSport._UserAccountId); //userSport.SportId = new SysId(dbUserSport._SportId); + userSport.Participation = (Sax.SportParticipation)dbUserSport._Participation; + userSport.Officiating = (Sax.SportOfficiating)dbUserSport._Participation; userSport.UserSportData = dbUserSport._UserSportData; // Common. userSport.Notes = dbUserSport._Notes; @@ -308,6 +312,28 @@ namespace Saxonite.Net.Standard.Dbas.Mgr columnDfn.ReadOnly = true; 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. @@ -487,6 +513,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr bool hasSportCols = (columns.HasId(SaxUserSport.Column.Sport_Name)); if (columns.HasId(SaxUserSport.Column.SportId) || hasSportCols) 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. if (columns.HasId(SaxUserSport.Column.Notes)) query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Notes, aliasUserSport)); diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationOpportunity.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationOpportunity.cs index a8f27d2..dfa9a09 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationOpportunity.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationOpportunity.cs @@ -207,7 +207,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr dbOrganisationOpportunity._OrganisationId = SysId.ToInt(organisationOpportunity.OrganisationId); dbOrganisationOpportunity._SportIdPrimary = SysId.ToInt(organisationOpportunity.SportIdPrimary); dbOrganisationOpportunity._RegionIdPrimary = SysId.ToInt(organisationOpportunity.RegionIdPrimary); - dbOrganisationOpportunity._OpportunityTypeCode = OpportunityTypes.GetCodeForType(organisationOpportunity.OpportunityType); + dbOrganisationOpportunity._OpportunityTypeCode = OpportunityTypeCodes.GetCodeForType(organisationOpportunity.OpportunityType); dbOrganisationOpportunity._Position = organisationOpportunity.Position; dbOrganisationOpportunity._Outline = organisationOpportunity.Outline; dbOrganisationOpportunity._OpportunityData = organisationOpportunity.OpportunityData; @@ -232,7 +232,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr //organisationOpportunity.OrganisationId = new SysId(dbOrganisationOpportunity._OrganisationId); organisationOpportunity.SportIdPrimary = new SysId(dbOrganisationOpportunity._SportIdPrimary); 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.Outline = dbOrganisationOpportunity._Outline; organisationOpportunity.OpportunityData = dbOrganisationOpportunity._OpportunityData; diff --git a/SaxoniteStandardDbas/Resources/Database/SaxDbDfn_Core.xml b/SaxoniteStandardDbas/Resources/Database/SaxDbDfn_Core.xml index 5fe710f..bf91fc1 100644 --- a/SaxoniteStandardDbas/Resources/Database/SaxDbDfn_Core.xml +++ b/SaxoniteStandardDbas/Resources/Database/SaxDbDfn_Core.xml @@ -256,7 +256,7 @@ false false 1 - 9 + 10 false @@ -1768,7 +1768,7 @@ false false 1 - 2 + 3 false @@ -3697,6 +3697,40 @@ dbo UserSport
4 + Participation + SmallInt + + 5 + smallint + false + 5 + 2 + 0 + Nullable + true + + + + dbo + UserSport
+ 5 + Officiating + SmallInt + + 5 + smallint + false + 5 + 2 + 0 + Nullable + true + +
+ + dbo + UserSport
+ 6 UserSportData VarChar @@ -3713,7 +3747,7 @@ dbo UserSport
- 5 + 7 Notes VarChar @@ -3730,7 +3764,7 @@ dbo UserSport
- 6 + 8 Flags SmallInt @@ -3747,7 +3781,7 @@ dbo UserSport
- 7 + 9 Status VarChar @@ -3764,7 +3798,7 @@ dbo UserSport
- 8 + 10 CreateOn DateTime @@ -3781,7 +3815,7 @@ dbo UserSport
- 9 + 11 CreateBy Int @@ -3798,7 +3832,7 @@ dbo UserSport
- 10 + 12 CreateHost VarChar @@ -3815,7 +3849,7 @@ dbo UserSport
- 11 + 13 UpdateOn DateTime @@ -3832,7 +3866,7 @@ dbo UserSport
- 12 + 14 UpdateBy Int @@ -3849,7 +3883,7 @@ dbo UserSport
- 13 + 15 UpdateHost VarChar