Files
Saxonite/SaxoniteStandardBase/Base/Consoles/SaxDataCacheConsole.cs
T
2021-10-14 21:08:07 +01:00

77 lines
2.8 KiB
C#

using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.Consoles
{
//=======================================================================
public abstract class SaxDataCacheConsole : SacsDisposable
{
//-------------------------------------------------------------------
// Protected construction.
protected SaxDataCacheConsole(SaxSessionContext sessionContext)
{
SessionContext = sessionContext;
}
protected override void Dispose(bool disposing) { }
//-------------------------------------------------------------------
// Properties.
protected SaxSessionContext SessionContext { get; }
//-------------------------------------------------------------------
// Utilities.
public abstract void PopulateCachedDataToInternals(SaxInternals internals);
/// <summary>
/// Encrypted Ids are stored in cache to ensure that they are consistent throughout a user's session
/// by persisting them through the life of the cache (application restart).
/// <para>Required as the encrypted values are compared in javascript.</para>
/// <para>Candidate encrypted value supplied by calling routine as cache doesn't know how to encrypt - used if Id not previously encrypted.</para>
/// </summary>
public abstract String GetEncryptedId(Sax.DataItemType itemType, SysId id, String candidateValue);
//-------------------------------------------------------------------
// Regions.
/// <summary>
/// Get the cached list of regions.
/// </summary>
public abstract List<SaxRegion.Data> GetAllRegions();
/// <summary>
/// Get the cached list of active regions.
/// </summary>
public abstract List<SaxRegion.Data> GetActiveRegions();
/// <summary>
/// Persistent encrypted Region Ids.
/// </summary>
public String GetEncryptedRegionId(SysId regionId, String candidateValue)
{
return GetEncryptedId(Sax.DataItemType.Region, regionId, candidateValue);
}
//-------------------------------------------------------------------
// Sports.
/// <summary>
/// Get the cached list of sports.
/// </summary>
public abstract List<SaxSport.Data> GetAllSports();
/// <summary>
/// Get the cached list of active sports.
/// </summary>
public abstract List<SaxSport.Data> GetActiveSports();
/// <summary>
/// Persistent encrypted Sport Ids.
/// </summary>
public String GetEncryptedSportId(SysId sportId, String candidateValue)
{
return GetEncryptedId(Sax.DataItemType.Sport, sportId, candidateValue);
}
//-------------------------------------------------------------------
}
//=======================================================================
}