This commit is contained in:
2022-11-15 18:20:46 +00:00
parent d95d49d4c6
commit 5f2a181baa
67 changed files with 2225 additions and 378 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "1.2.9.1";
private static String version { get; } = "1.2.9.2";
// Retrieve version.
public static String GetFullVersion () { return version; }
public static String GetAppVersion ()
+20
View File
@@ -20,6 +20,7 @@ namespace Saxonite.Net.Standard.Base.App
DataItemType,
Gender,
SportSpecialityLabel,
SportContactType,
SportParticipation,
SportOfficiating,
RegionType,
@@ -138,6 +139,14 @@ namespace Saxonite.Net.Standard.Base.App
Visa = 210,
}
//-------------------------------------------------------------------
/// <summary>User Config</summary>
public enum UserConfigType
{
/* Do not change the values - tied to database. */
Online_Profile = 100,
}
//-------------------------------------------------------------------
/// <summary>User roles</summary>
public enum UserRole
@@ -159,6 +168,17 @@ namespace Saxonite.Net.Standard.Base.App
NotRelevant = 90,
}
//-------------------------------------------------------------------
/// <summary>Sport Contact Type</summary>
public enum SportContactType
{
Unknown = 0,
/* Do not change the values/codes - tied to database. */
Coach = 100,
Manager = 200,
Agent = 300,
}
//-------------------------------------------------------------------
/// <summary>Sport Participation</summary>
public enum SportParticipation
+77 -61
View File
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
//---------------------------------------------------------------------------
namespace Saxonite.Base.App
{
@@ -31,6 +31,7 @@ namespace Saxonite.Base.App
Sport,
UserAccount,
UserActivity,
UserConfig,
UserEligibility,
UserOnline,
UserOrganisation,
@@ -270,6 +271,7 @@ namespace Saxonite.Base.App
UserAccount_PhoneMobile,
UserAccount_PhoneAlt,
UserAccount_Gender,
UserAccount_GenderOther,
UserAccount_DateOfBirthDay,
UserAccount_DateOfBirthMonth,
UserAccount_DateOfBirthYear,
@@ -314,6 +316,12 @@ namespace Saxonite.Base.App
UserActivity_UpdateOn,
UserActivity_UpdateBy,
UserActivity_UpdateHost,
UserConfig_Id,
UserConfig_UserAccountId,
UserConfig_ConfigType,
UserConfig_ConfigData,
UserConfig_CreateOn,
UserConfig_UpdateOn,
UserEligibility_Id,
UserEligibility_UserAccountId,
UserEligibility_RegionId,
@@ -411,8 +419,8 @@ namespace Saxonite.Base.App
//-------------------------------------------------------------------
// Data members.
private static readonly int tableCount = 21;
private static readonly int columnCount = 362;
private static readonly int tableCount = 22;
private static readonly int columnCount = 369;
private static ulong maxTextLen = 0;
//-------------------------------------------------------------------
@@ -572,6 +580,7 @@ namespace Saxonite.Base.App
"Sport",
"UserAccount",
"UserActivity",
"UserConfig",
"UserEligibility",
"UserOnline",
"UserOrganisation",
@@ -830,6 +839,7 @@ namespace Saxonite.Base.App
new ColumnDfn(13,"PhoneMobile",0,-9,false,50),
new ColumnDfn(13,"PhoneAlt",0,-9,false,50),
new ColumnDfn(13,"Gender",2,-6,false,3),
new ColumnDfn(13,"GenderOther",0,-9,false,50),
new ColumnDfn(13,"DateOfBirthDay",2,-6,false,3),
new ColumnDfn(13,"DateOfBirthMonth",2,-6,false,3),
new ColumnDfn(13,"DateOfBirthYear",3,5,false,5),
@@ -876,42 +886,33 @@ namespace Saxonite.Base.App
new ColumnDfn(14,"UpdateHost",0,12,false,100),
new ColumnDfn(15,"Id",5,-5,true,19),
new ColumnDfn(15,"UserAccountId",4,4,false,10),
new ColumnDfn(15,"RegionId",4,4,false,10),
new ColumnDfn(15,"EligibilityType",3,5,false,5),
new ColumnDfn(15,"Info",0,-9,false,2000),
new ColumnDfn(15,"ExpiresOn",9,93,false,16),
new ColumnDfn(15,"Notes",0,-9,false,2000),
new ColumnDfn(15,"Flags",3,5,false,5),
new ColumnDfn(15,"Status",0,12,false,3),
new ColumnDfn(15,"ConfigType",3,5,false,5),
new ColumnDfn(15,"ConfigData",0,-9,false,0),
new ColumnDfn(15,"CreateOn",9,93,false,23),
new ColumnDfn(15,"CreateBy",4,4,false,10),
new ColumnDfn(15,"CreateHost",0,12,false,100),
new ColumnDfn(15,"UpdateOn",9,93,false,23),
new ColumnDfn(15,"UpdateBy",4,4,false,10),
new ColumnDfn(15,"UpdateHost",0,12,false,100),
new ColumnDfn(16,"Id",5,-5,true,19),
new ColumnDfn(16,"UserAccountId",4,4,false,10),
new ColumnDfn(16,"OnlineAt",9,93,false,16),
new ColumnDfn(17,"Id",5,-5,true,19),
new ColumnDfn(16,"RegionId",4,4,false,10),
new ColumnDfn(16,"EligibilityType",3,5,false,5),
new ColumnDfn(16,"Info",0,-9,false,2000),
new ColumnDfn(16,"ExpiresOn",9,93,false,16),
new ColumnDfn(16,"Notes",0,-9,false,2000),
new ColumnDfn(16,"Flags",3,5,false,5),
new ColumnDfn(16,"Status",0,12,false,3),
new ColumnDfn(16,"CreateOn",9,93,false,23),
new ColumnDfn(16,"CreateBy",4,4,false,10),
new ColumnDfn(16,"CreateHost",0,12,false,100),
new ColumnDfn(16,"UpdateOn",9,93,false,23),
new ColumnDfn(16,"UpdateBy",4,4,false,10),
new ColumnDfn(16,"UpdateHost",0,12,false,100),
new ColumnDfn(17,"UserAccountId",4,4,false,10),
new ColumnDfn(17,"OrganisationId",4,4,false,10),
new ColumnDfn(17,"OrganisationRoleCodes",0,12,false,256),
new ColumnDfn(17,"OrganisationRoleCount",2,-6,false,3),
new ColumnDfn(17,"AdminComment",0,-9,false,2000),
new ColumnDfn(17,"Notes",0,-9,false,2000),
new ColumnDfn(17,"Flags",3,5,false,5),
new ColumnDfn(17,"Status",0,12,false,3),
new ColumnDfn(17,"CreateOn",9,93,false,23),
new ColumnDfn(17,"CreateBy",4,4,false,10),
new ColumnDfn(17,"CreateHost",0,12,false,100),
new ColumnDfn(17,"UpdateOn",9,93,false,23),
new ColumnDfn(17,"UpdateBy",4,4,false,10),
new ColumnDfn(17,"UpdateHost",0,12,false,100),
new ColumnDfn(17,"OnlineAt",9,93,false,16),
new ColumnDfn(18,"Id",5,-5,true,19),
new ColumnDfn(18,"UserAccountId",4,4,false,10),
new ColumnDfn(18,"UserRoleCode",0,12,false,16),
new ColumnDfn(18,"LastLoginAt",9,93,false,16),
new ColumnDfn(18,"LastInvalidLoginAt",9,93,false,16),
new ColumnDfn(18,"InvalidLoginCount",3,5,false,5),
new ColumnDfn(18,"OrganisationId",4,4,false,10),
new ColumnDfn(18,"OrganisationRoleCodes",0,12,false,256),
new ColumnDfn(18,"OrganisationRoleCount",2,-6,false,3),
new ColumnDfn(18,"AdminComment",0,-9,false,2000),
new ColumnDfn(18,"Notes",0,-9,false,2000),
new ColumnDfn(18,"Flags",3,5,false,5),
new ColumnDfn(18,"Status",0,12,false,3),
@@ -921,43 +922,34 @@ namespace Saxonite.Base.App
new ColumnDfn(18,"UpdateOn",9,93,false,23),
new ColumnDfn(18,"UpdateBy",4,4,false,10),
new ColumnDfn(18,"UpdateHost",0,12,false,100),
new ColumnDfn(19,"Id",5,-5,true,19),
new ColumnDfn(19,"UserAccountId",4,4,false,10),
new ColumnDfn(19,"ActivityIndexIds",0,-9,false,0),
new ColumnDfn(19,"UserSessionData",0,-9,false,0),
new ColumnDfn(19,"UserRoleCode",0,12,false,16),
new ColumnDfn(19,"LastLoginAt",9,93,false,16),
new ColumnDfn(19,"LastInvalidLoginAt",9,93,false,16),
new ColumnDfn(19,"InvalidLoginCount",3,5,false,5),
new ColumnDfn(19,"Notes",0,-9,false,2000),
new ColumnDfn(19,"Flags",3,5,false,5),
new ColumnDfn(19,"Status",0,12,false,3),
new ColumnDfn(19,"CreateOn",9,93,false,23),
new ColumnDfn(19,"CreateBy",4,4,false,10),
new ColumnDfn(19,"CreateHost",0,12,false,100),
new ColumnDfn(19,"UpdateOn",9,93,false,23),
new ColumnDfn(20,"Id",5,-5,true,19),
new ColumnDfn(19,"UpdateBy",4,4,false,10),
new ColumnDfn(19,"UpdateHost",0,12,false,100),
new ColumnDfn(20,"UserAccountId",4,4,false,10),
new ColumnDfn(20,"SportId",4,4,false,10),
new ColumnDfn(20,"About",0,-9,false,2000),
new ColumnDfn(20,"Participation",3,5,false,5),
new ColumnDfn(20,"Officiating",3,5,false,5),
new ColumnDfn(20,"UserSportData",0,-9,false,0),
new ColumnDfn(20,"Notes",0,-9,false,2000),
new ColumnDfn(20,"ActivityIndexIds",0,-9,false,0),
new ColumnDfn(20,"UserSessionData",0,-9,false,0),
new ColumnDfn(20,"Flags",3,5,false,5),
new ColumnDfn(20,"Status",0,12,false,3),
new ColumnDfn(20,"CreateOn",9,93,false,23),
new ColumnDfn(20,"CreateBy",4,4,false,10),
new ColumnDfn(20,"CreateHost",0,12,false,100),
new ColumnDfn(20,"UpdateOn",9,93,false,23),
new ColumnDfn(20,"UpdateBy",4,4,false,10),
new ColumnDfn(20,"UpdateHost",0,12,false,100),
new ColumnDfn(21,"Id",5,-5,true,19),
new ColumnDfn(21,"UserSportId",5,-5,false,19),
new ColumnDfn(21,"PeriodFrom",9,93,false,16),
new ColumnDfn(21,"PeriodTo",9,93,false,16),
new ColumnDfn(21,"OrganisationId",4,4,false,10),
new ColumnDfn(21,"OrganisationName",0,-9,false,200),
new ColumnDfn(21,"Summary",0,-9,false,2000),
new ColumnDfn(21,"Team",0,-9,false,64),
new ColumnDfn(21,"League",0,-9,false,64),
new ColumnDfn(21,"Speciality",0,-9,false,64),
new ColumnDfn(21,"SpecialitiesOther",0,-9,false,1000),
new ColumnDfn(21,"RegionIdNation",4,4,false,10),
new ColumnDfn(21,"RegionIdProvince",4,4,false,10),
new ColumnDfn(21,"Awards",0,-9,false,2000),
new ColumnDfn(21,"UserSportExperienceData",0,-9,false,0),
new ColumnDfn(21,"UserAccountId",4,4,false,10),
new ColumnDfn(21,"SportId",4,4,false,10),
new ColumnDfn(21,"About",0,-9,false,2000),
new ColumnDfn(21,"Participation",3,5,false,5),
new ColumnDfn(21,"Officiating",3,5,false,5),
new ColumnDfn(21,"UserSportData",0,-9,false,0),
new ColumnDfn(21,"Notes",0,-9,false,2000),
new ColumnDfn(21,"Flags",3,5,false,5),
new ColumnDfn(21,"Status",0,12,false,3),
@@ -967,6 +959,30 @@ namespace Saxonite.Base.App
new ColumnDfn(21,"UpdateOn",9,93,false,23),
new ColumnDfn(21,"UpdateBy",4,4,false,10),
new ColumnDfn(21,"UpdateHost",0,12,false,100),
new ColumnDfn(22,"Id",5,-5,true,19),
new ColumnDfn(22,"UserSportId",5,-5,false,19),
new ColumnDfn(22,"PeriodFrom",9,93,false,16),
new ColumnDfn(22,"PeriodTo",9,93,false,16),
new ColumnDfn(22,"OrganisationId",4,4,false,10),
new ColumnDfn(22,"OrganisationName",0,-9,false,200),
new ColumnDfn(22,"Summary",0,-9,false,2000),
new ColumnDfn(22,"Team",0,-9,false,64),
new ColumnDfn(22,"League",0,-9,false,64),
new ColumnDfn(22,"Speciality",0,-9,false,64),
new ColumnDfn(22,"SpecialitiesOther",0,-9,false,1000),
new ColumnDfn(22,"RegionIdNation",4,4,false,10),
new ColumnDfn(22,"RegionIdProvince",4,4,false,10),
new ColumnDfn(22,"Awards",0,-9,false,2000),
new ColumnDfn(22,"UserSportExperienceData",0,-9,false,0),
new ColumnDfn(22,"Notes",0,-9,false,2000),
new ColumnDfn(22,"Flags",3,5,false,5),
new ColumnDfn(22,"Status",0,12,false,3),
new ColumnDfn(22,"CreateOn",9,93,false,23),
new ColumnDfn(22,"CreateBy",4,4,false,10),
new ColumnDfn(22,"CreateHost",0,12,false,100),
new ColumnDfn(22,"UpdateOn",9,93,false,23),
new ColumnDfn(22,"UpdateBy",4,4,false,10),
new ColumnDfn(22,"UpdateHost",0,12,false,100),
};
//-------------------------------------------------------------------
@@ -92,6 +92,7 @@ namespace Saxonite.Net.Standard.Base.App
public List<TypeCodeDesc> YesNoCodes { get { return GetCodesOfType(Sax.CodeType.YesNo); } }
public List<TypeCodeDesc> GenderCodes { get { return GetCodesOfType(Sax.CodeType.Gender); } }
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return GetCodesOfType(Sax.CodeType.SportSpecialityLabel); } }
public List<TypeCodeDesc> SportContactTypeCodes { get { return GetCodesOfType(Sax.CodeType.SportContactType); } }
public List<TypeCodeDesc> SportParticipationCodes { get { return GetCodesOfType(Sax.CodeType.SportParticipation); } }
public List<TypeCodeDesc> SportOfficiatingCodes { get { return GetCodesOfType(Sax.CodeType.SportOfficiating); } }
public List<TypeCodeDesc> RegionTypeCodes { get { return GetCodesOfType(Sax.CodeType.RegionType); } }
@@ -17,6 +17,7 @@ namespace Saxonite.Net.Standard.Base.App
private static readonly List<TypeCodeDesc> dataItemTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> genderCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportSpecialityLabelCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportContactCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportParticipationCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportOfficiatingCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> regionTypeCodes = new List<TypeCodeDesc>();
@@ -50,6 +51,8 @@ namespace Saxonite.Net.Standard.Base.App
return new List<TypeCodeDesc>(genderCodes);
case Sax.CodeType.SportSpecialityLabel:
return new List<TypeCodeDesc>(sportSpecialityLabelCodes);
case Sax.CodeType.SportContactType:
return new List<TypeCodeDesc>(sportContactCodes);
case Sax.CodeType.SportParticipation:
return new List<TypeCodeDesc>(sportParticipationCodes);
case Sax.CodeType.SportOfficiating:
@@ -133,6 +136,12 @@ namespace Saxonite.Net.Standard.Base.App
sportSpecialityLabelCodes.Add(Sax.SportSpecialityLabel.Discipline, "DIS", "Discipline");
sportSpecialityLabelCodes.Add(Sax.SportSpecialityLabel.NotRelevant, "NRE", "Not relevant");
//---------------------------------------------------------------
// Sport contact.
sportContactCodes.Add(Sax.SportContactType.Coach, "COA", "Coach");
sportContactCodes.Add(Sax.SportContactType.Manager, "MAN", "Manager");
sportContactCodes.Add(Sax.SportContactType.Agent, "AGE", "Agent");
//---------------------------------------------------------------
// Sport participation.
sportParticipationCodes.Add(Sax.SportParticipation.Professional, "PRO", "Professional");
@@ -78,6 +78,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public String PhoneMain { get; set; } = String.Empty;
public String PhoneMobile { get; set; } = String.Empty;
public Sax.Gender Gender { get; set; }
public String GenderOther { get; set; }
public byte DateOfBirthDay { get; set; }
public byte DateOfBirthMonth { get; set; }
public short DateOfBirthYear { get; set; }
@@ -151,6 +152,11 @@ namespace Saxonite.Net.Standard.Base.Bus
get { return data.Gender; }
set { CheckChanged((int)data.Gender, (int)value); data.Gender = value; }
}
public String GenderOther
{
get { return data.GenderOther; }
set { CheckChanged(data.GenderOther, value); data.GenderOther = value; }
}
public byte DateOfBirthDay
{
get { return data.DateOfBirthDay; }
@@ -230,6 +236,7 @@ namespace Saxonite.Net.Standard.Base.Bus
PhoneMain = data.PhoneMain;
PhoneMobile = data.PhoneMobile;
Gender = data.Gender;
GenderOther = data.GenderOther;
DateOfBirthDay = data.DateOfBirthDay;
DateOfBirthMonth = data.DateOfBirthMonth;
DateOfBirthYear = data.DateOfBirthYear;
@@ -268,6 +275,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public ValidValue PhoneMain { get; set; } = ValidValue.Valid;
public ValidValue PhoneMobile { get; set; } = ValidValue.Valid;
public ValidValue Gender { get; set; } = ValidValue.Valid;
public ValidValue GenderOther { get; set; } = ValidValue.Valid;
public ValidValue DateOfBirthDay { get; set; } = ValidValue.Valid;
public ValidValue DateOfBirthMonth { get; set; } = ValidValue.Valid;
public ValidValue DateOfBirthYear { get; set; } = ValidValue.Valid;
@@ -393,6 +401,11 @@ namespace Saxonite.Net.Standard.Base.Bus
get { return data.Gender; }
set { data.Gender = value; }
}
public String GenderOther
{
get { return data.GenderOther; }
set { data.GenderOther = value; }
}
public byte DateOfBirthDay
{
get { return data.DateOfBirthDay; }
@@ -0,0 +1,181 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static Saxonite.Net.Standard.Base.App.Sax;
namespace Saxonite.Net.Standard.Base.Bus
{
//=======================================================================
// User Config.
//=======================================================================
/// <summary>
/// User Config - parameters to control application behaviour.
/// </summary>
public abstract partial class SaxUserConfig : SacsHierarchyItem
{
//-------------------------------------------------------------------
// Columns.
public enum Column
{
Pos,
Id,
// User.
UserAccountId,
User_EmailAddress,
User_DisplayName,
User_Title,
User_FirstName,
User_LastName,
// Configuration.
ConfigType,
// Associated data.
// Common.
//Flags,
CreateOn_Date,
UpdateOn_Date,
}
//-------------------------------------------------------------------
/// <summary>Properties other than common.</summary>
public class DataProperties
{
public SysId UserAccountId { get; set; }
public Sax.UserConfigType ConfigType { get; set; }
public String ConfigData { get; set; }
}
//-------------------------------------------------------------------
// Data.
public new class Data : SacsHierarchyItem.Data
{
// Data members.
private readonly DataProperties data = new DataProperties();
// Construction.
public Data()
{
}
// Properties.
public SysId UserAccountId
{
get { return data.UserAccountId; }
set { CheckChanged(data.UserAccountId, value); data.UserAccountId = value; }
}
public Sax.UserConfigType ConfigType
{
get { return data.ConfigType; }
set { CheckChanged((int)data.ConfigType, (int)value); data.ConfigType = value; }
}
public String ConfigData
{
get { return data.ConfigData; }
set { CheckChanged(data.ConfigData, value); data.ConfigData = value; }
}
// Population.
internal void PopulateFrom(Data data)
{
UserAccountId = data.UserAccountId;
ConfigType = data.ConfigType;
ConfigData = data.ConfigData;
base.PopulateFrom(data);
}
public Data Clone()
{
Data data = new Data();
data.PopulateFrom(this);
return data;
}
}
//-------------------------------------------------------------------
// Error field - identify properties with validation error.
public new class ErrField : SacsHierarchyItem.ErrField
{
// Identifies the field that has invalid data.
public ValidValue UserAccountId { get; set; } = ValidValue.Valid;
public ValidValue ConfigType { get; set; } = ValidValue.Valid;
public ValidValue ConfigData { get; set; } = ValidValue.Valid;
}
//-------------------------------------------------------------------
// Data members.
private readonly Data data = new Data();
//-------------------------------------------------------------------
// Construction.
protected SaxUserConfig(SysId id, SysId userAccountId, Sax.UserConfigType configType) : base(id)
{
base.SetData(data);
UserAccountId = userAccountId;
ConfigType = configType;
}
//-------------------------------------------------------------------
// Utilities.
//-------------------------------------------------------------------
// Properties.
public static String ActivityIndexDelim { get; } = ",";
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException(fn + " User Account Id cannot be changed");
if (ConfigType != data.ConfigType)
throw new NotSupportedException(fn + " Config Type cannot be changed");
this.data.PopulateFrom(data);
}
public SysId UserAccountId
{
get { return data.UserAccountId; }
protected set { data.UserAccountId = value; }
}
public Sax.UserConfigType ConfigType
{
get { return data.ConfigType; }
protected set { data.ConfigType = value; }
}
public String ConfigData
{
get { return data.ConfigData; }
set { data.ConfigData = value; }
}
//-------------------------------------------------------------------
// Flags - positions 1-16 available.
//-------------------------------------------------------------------
// A s s o c i a t e d D a t a
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// P a r a m s
//-------------------------------------------------------------------
// List parameters.
/// <summary>
/// Item list parameters.
/// </summary>
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
public Sax.UserConfigType ConfigType { get; set; }
}
//-------------------------------------------------------------------
}
//=======================================================================
// Item list extension methods.
public static class SaxUserConfigList
{
}
//=======================================================================
}
@@ -221,7 +221,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public SysId UserAccountId
{
get { return data.UserAccountId; }
set
protected set
{
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException("EligibilityType.UserAccountId cannot be changed");
@@ -245,7 +245,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public Sax.EligibilityType EligibilityType
{
get { return data.EligibilityType; }
protected set { data.EligibilityType = value; }
set { data.EligibilityType = value; }
}
public String Info
@@ -0,0 +1,109 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Text;
using static Saxonite.Net.Standard.Base.Bus.SaxUserConfig;
using System.Xml.Linq;
namespace Saxonite.Net.Standard.Base.Data
{
//==========================================================================
public class SaxConfigData
{
//-------------------------------------------------------------------
// Definitions.
private static readonly String ElementName_Config = "Config";
private static readonly String ElementName_Profile = "Profile";
private static readonly String ElementName_Eligibility = "Eligibility";
private static readonly String ElementName_HideInfo = "HideInfo";
//-------------------------------------------------------------------
/// <summary>Profile settings.</summary>
public class ProfileData
{
//---------------------------------------------------------------
/// <summary>Eligibility settings.</summary>
public class EligibilityData
{
/// <summary>Hide the eligbiility information tip.</summary>
public bool HideInfo { get; set; }
}
public EligibilityData Eligibility { get; set; } = new EligibilityData();
//---------------------------------------------------------------
/// <summary>Serialise to XML.</summary>
public static String ToXml(ProfileData profile)
{
String fn = typeof(ProfileData).FullName + ".GetConfigData";
try
{
XDocument doc = new XDocument();
XElement configElement = doc.AppendElement(ElementName_Config);
// Profile.
XElement profileElement = configElement.AppendElement(ElementName_Profile);
// Profile - Eligibility.
XElement eligibilityElement = profileElement.AppendElement(ElementName_Eligibility);
if (profile.Eligibility.HideInfo)
eligibilityElement.AppendElement(ElementName_HideInfo, "1");
return doc.GetXml();
}
catch (Exception exc)
{
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
}
return "";
}
//---------------------------------------------------------------
/// <summary>Deserialise from XML.</summary>
public static ProfileData FromXml(String configData)
{
String fn = typeof(ProfileData).FullName + ".ExtractConfig";
ProfileData profile = new ProfileData();
if (StringUtil.IsEmpty(configData)) return profile;
try
{
// Load XML data.
// NB Serialised data has 'Config' as root element
XDocument doc = XDocument.Parse(configData);
XElement rootElement = doc.Root;
foreach (XElement rootChildElement in rootElement.GetChildElements())
{
String rootChildElementName = rootChildElement.GetLocalName();
if (rootChildElementName.EqualsCI(ElementName_Profile))
{
// Profile.
XElement profileElement = rootChildElement;
foreach (XElement profileChildElement in profileElement.GetChildElements())
{
String profileChildElementName = profileChildElement.GetLocalName();
if (profileChildElementName.EqualsCI(ElementName_Eligibility))
{
// Profile - Eligibility.
XElement eligibilityElement = profileChildElement;
String hideInfo = eligibilityElement.GetChildText(ElementName_HideInfo);
profile.Eligibility.HideInfo = StringUtil.ToBool(hideInfo);
}
else SaLogger.Warn(fn + " Unexpected 'Profile' child element: " + profileChildElementName);
}
}
else SaLogger.Warn(fn + " Unexpected 'Root' child element: " + rootChildElementName);
}
}
catch (Exception exc)
{
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
}
return profile;
}
//---------------------------------------------------------------
}
//-------------------------------------------------------------------
}
//==========================================================================
}
@@ -137,6 +137,12 @@ namespace Saxonite.Net.Standard.Base.Mgr
errField.PhoneMobile = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
// Gender other.
if (errField.GenderOther != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.GenderOther, "gender", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserAccount_GenderOther)))
{
errField.GenderOther = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
// Date of birth year.
if (errField.DateOfBirthYear != SacsHierarchyItem.ValidValue.Ignore && data.DateOfBirthYear > DateTime.Today.Year)
{
@@ -0,0 +1,135 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Saxonite.Base.App;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Saxonite.Net.Standard.Base.Mgr
{
//=======================================================================
partial class SaxAccountMgr
{
//*******************************************************************
// Account Mgr - User Config
//*******************************************************************
// Utilities.
public List<SaxUserConfig> GetConfigsForUser(SysId userAccountId)
{
SaxUserConfig.Params prmUserConfig = new SaxUserConfig.Params();
prmUserConfig.UserAccountIdsIncluded.Add(userAccountId);
List<SaxUserConfig> userConfigs = AccountMgr.GetUserConfigList(prmUserConfig);
return userConfigs;
}
//-------------------------------------------------------------------
// Create item.
public abstract SaxUserConfig CreateUserConfig(SysId userAccountId, Sax.UserConfigType configType);
//-------------------------------------------------------------------
// Item exists.
public bool UserConfigExists(SysId userAccountId)
{
ClearErrorState();
if (!SysId.IsValid(userAccountId)) return false;
SaxUserConfig.Params prmUserConfig = new SaxUserConfig.Params();
prmUserConfig.UserAccountIdsIncluded.Add(userAccountId);
return GetUserConfigCount(prmUserConfig) == 1;
}
//-------------------------------------------------------------------
// Retrieve individual items.
public abstract SaxUserConfig GetUserConfig(SaxUserConfig.Params prmUserConfig);
public SaxUserConfig GetUserConfig(SysId userAccountId, Sax.UserConfigType configType)
{
ClearErrorState();
if (!SysId.IsValid(userAccountId) || configType <= 0) return null;
SaxUserConfig.Params prmUserConfig = new SaxUserConfig.Params();
prmUserConfig.UserAccountIdsIncluded.Add(userAccountId);
prmUserConfig.ConfigType = configType;
return GetUserConfig(prmUserConfig);
}
//-------------------------------------------------------------------
// Validate item data.
public bool IsValidUserConfig(SaxUserConfig userConfig)
{
ClearErrorState();
if (userConfig == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
return IsValidUserConfigData(userConfig.GetData(), new SaxUserConfig.ErrField());
}
public virtual bool IsValidUserConfigData(SaxUserConfig.Data data, SaxUserConfig.ErrField errField)
{
ClearErrorState();
// User Account.
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.UserAccountId))
{
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("User Account Id must be specified");
}
// Config Type.
if (errField.ConfigType != SacsHierarchyItem.ValidValue.Ignore && data.ConfigType <= 0)
{
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Config type must be specified");
}
return true;
}
//-------------------------------------------------------------------
// Item database interface.
public abstract bool InsertUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo);
public abstract bool UpdateUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo);
public virtual bool UserConfigCanBeDeleted(SaxUserConfig userConfig)
{
ClearErrorState();
return true;
}
public abstract bool DeleteUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo);
//-------------------------------------------------------------------
// Item list.
public abstract ColumnDfn GetUserConfigColumnDfn(SaxUserConfig.Column columnId, String caption = "", int width = 0);
public abstract List<String> GetUserConfigQueryFilter(SaxUserConfig.Params prmUserConfig);
public abstract long GetUserConfigCount(SaxUserConfig.Params prmUserConfig);
public abstract List<SaxUserConfig> GetUserConfigList(SaxUserConfig.Params prmUserConfig);
public abstract DbResultSet ExecuteUserConfigQuery(List<ColumnDfn> columns, SaxUserConfig.Params prmUserConfig);
//-------------------------------------------------------------------
/// <summary>
/// Extract and format result set data value where specific handling is required.
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
/// </summary>
public virtual DataValue GetUserConfigDataValue(ColumnDfn column, NamedValue.Map values)
{
DataValue value = new DataValue();
switch ((SaxUserConfig.Column)column.Id)
{
//-----------------------------------------------------------
// User Display Name.
case SaxUserConfig.Column.User_DisplayName:
{
String userTitle = values.GetValue(GetUserConfigColumnDfn(SaxUserConfig.Column.User_Title).DataName).ToString();
String userFirstName = values.GetValue(GetUserConfigColumnDfn(SaxUserConfig.Column.User_FirstName).DataName).ToString();
String userLastName = values.GetValue(GetUserConfigColumnDfn(SaxUserConfig.Column.User_LastName).DataName).ToString();
value = new DataValue(SaxUserAccount.GetDisplayName(userTitle, userFirstName, userLastName));
}
break;
//-----------------------------------------------------------
}
return value;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -68,6 +68,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
// Application codes.
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return Internals.SportSpecialityLabelCodes; } }
public List<TypeCodeDesc> SportContactTypeCodes { get { return Internals.SportContactTypeCodes; } }
public List<TypeCodeDesc> SportParticipationCodes { get { return Internals.SportParticipationCodes; } }
public List<TypeCodeDesc> SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } }
public List<TypeCodeDesc> RegionTypeCodes { get { return Internals.RegionTypeCodes; } }