This commit is contained in:
2021-07-02 09:28:37 +01:00
parent 03873bbdf4
commit 03ea1058be
64 changed files with 3038 additions and 250 deletions
@@ -95,6 +95,7 @@ namespace Saxonite.Net.Standard.Base.App
public List<TypeCodeDesc> OrganisationTypeCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
public List<TypeCodeDesc> OrganisationCategoryCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
public List<TypeCodeDesc> OrganisationRoleCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
public List<TypeCodeDesc> AddressTypeCodes { get { return GetCodesOfType(Sax.CodeType.AddressType); } }
public List<TypeCodeDesc> OpportunityTypeCodes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
public List<TypeCodeDesc> ActivityReactionCodes { get { return GetCodesOfType(Sax.CodeType.ActivityReaction); } }
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
@@ -210,6 +211,7 @@ namespace Saxonite.Net.Standard.Base.App
QueryRegionsToCache(regionIds);
foreach (SysId regionId in regionIds)
{
if (!SysId.IsValid(regionId)) continue;
SaxRegion region = GetRegion(regionCache.GetValue(regionId, null));
if (region != null)
regions.Add(region);
@@ -284,6 +286,7 @@ namespace Saxonite.Net.Standard.Base.App
QuerySportsToCache(sportIds);
foreach (SysId sportId in sportIds)
{
if (!SysId.IsValid(sportId)) continue;
SaxSport sport = GetSport(sportCache.GetValue(sportId, null));
if (sport != null)
sports.Add(sport);
@@ -298,6 +301,50 @@ namespace Saxonite.Net.Standard.Base.App
return sport;
}
//-------------------------------------------------------------------
// Common Data Components
//-------------------------------------------------------------------
// User Accounts.
private readonly Dictionary<SysId, SaxUserAccount> userAccountCache = new Dictionary<SysId, SaxUserAccount>();
public SaxUserAccount GetUserAccount(SysId userAccountId)
{
if (!SysId.IsValid(userAccountId)) return null;
if (!userAccountCache.ContainsKey(userAccountId))
userAccountCache.Add(userAccountId, AccountMgr.GetUserAccountById(userAccountId));
return userAccountCache.GetValue(userAccountId, null);
}
public String GetUserAccountEmailAddress(SysId userAccountId)
{
SaxUserAccount userAccount = GetUserAccount(userAccountId);
return userAccount?.EmailAddress ?? "";
}
public String GetUserAccountDisplayName(SysId userAccountId)
{
SaxUserAccount userAccount = GetUserAccount(userAccountId);
return userAccount?.GetDisplayName() ?? "";
}
//-------------------------------------------------------------------
// User Accounts.
private readonly Dictionary<SysId, SaxOrganisation> organisationCache = new Dictionary<SysId, SaxOrganisation>();
public SaxOrganisation GetOrganisation(SysId organisationId)
{
if (!SysId.IsValid(organisationId)) return null;
if (!organisationCache.ContainsKey(organisationId))
organisationCache.Add(organisationId, AccountMgr.GetOrganisationById(organisationId));
return organisationCache.GetValue(organisationId, null);
}
public String GetOrganisationName(SysId organisationId)
{
SaxOrganisation organisation = GetOrganisation(organisationId);
return organisation?.Name ?? "";
}
public SysId GetOrganisationRegionId(SysId organisationId)
{
SaxOrganisation organisation = GetOrganisation(organisationId);
return organisation?.RegionIdPrimary ?? new SysId();
}
//-------------------------------------------------------------------
}
//=======================================================================