Add project files.
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Standard.Base.Mgr;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Saxonite.Net.Standard.Base.Consoles;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaxInternals : SacsDisposable
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private class Managers
|
||||
{
|
||||
public SaxReferenceMgr referenceMgr = null;
|
||||
public SaxAccountMgr accountMgr = null;
|
||||
public SaxActivityMgr activityMgr = null;
|
||||
public SaxItemDataMgr itemDataMgr = null;
|
||||
}
|
||||
private readonly Managers mgr = new Managers();
|
||||
private class Consoles
|
||||
{
|
||||
public SaxEmailConsole emailConsole;
|
||||
}
|
||||
private readonly Consoles con = new Consoles();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SaxInternals(SaxSessionContext sessionContext)
|
||||
{
|
||||
if (sessionContext == null)
|
||||
throw new NotSupportedException("Unable to create Internals with invalid session context");
|
||||
System = SaxGlobals.System;
|
||||
SessionContext = sessionContext;
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (mgr.referenceMgr != null) mgr.referenceMgr.Dispose(); mgr.referenceMgr = null;
|
||||
if (mgr.accountMgr != null) mgr.accountMgr.Dispose(); mgr.accountMgr = null;
|
||||
if (mgr.activityMgr != null) mgr.activityMgr.Dispose(); mgr.activityMgr = null;
|
||||
if (mgr.itemDataMgr != null) mgr.itemDataMgr.Dispose(); mgr.itemDataMgr = null;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SaxSystem System { get; }
|
||||
public SaxSessionContext SessionContext { get; }
|
||||
public ISacsDatabase CoreDatabase { get { return SaxGlobals.App.GetCoreDatabase(SessionContext); } }
|
||||
public IDatabaseInfo CreateCoreDbInfo()
|
||||
{
|
||||
return SaxGlobals.App.CreateCoreDbInfo(SessionContext);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// System codes.
|
||||
private readonly Dictionary<Sax.CodeType, List<TypeCodeDesc>> codeTypes = new Dictionary<Sax.CodeType, List<TypeCodeDesc>>();
|
||||
public List<TypeCodeDesc> RegionTypes { get { return GetCodesOfType(Sax.CodeType.RegionType); } }
|
||||
public List<TypeCodeDesc> UserRoles { get { return GetCodesOfType(Sax.CodeType.UserRole); } }
|
||||
public List<TypeCodeDesc> OrganisationTypes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
|
||||
public List<TypeCodeDesc> OrganisationCategories { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
|
||||
public List<TypeCodeDesc> OrganisationRoles { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
|
||||
{
|
||||
if (!codeTypes.ContainsKey(codeType))
|
||||
codeTypes.Add(codeType, SaxSystem.GetCodesOfType(codeType));
|
||||
return new List<TypeCodeDesc>(codeTypes[codeType]);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Consoles.
|
||||
public SaxDataCacheConsole DataCacheConsole { get { return SaxGlobals.ConsoleHelper.GetDataCacheConsole(SessionContext); } }
|
||||
public SaxConsoleHelper ConsoleHelper { get { return SaxGlobals.App.ConsoleHelper; } }
|
||||
public SaxEmailConsole EmailConsole { get { if (con.emailConsole == null) con.emailConsole = ConsoleHelper.CreateEmailConsole(SessionContext); return con.emailConsole; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Business components.
|
||||
public SaxReferenceMgr ReferenceMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.referenceMgr == null)
|
||||
mgr.referenceMgr = System.CreateReferenceMgr(SessionContext);
|
||||
return mgr.referenceMgr;
|
||||
}
|
||||
}
|
||||
public SaxAccountMgr AccountMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.accountMgr == null)
|
||||
mgr.accountMgr = System.CreateAccountMgr(SessionContext);
|
||||
return mgr.accountMgr;
|
||||
}
|
||||
}
|
||||
public SaxActivityMgr ActivityMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.activityMgr == null)
|
||||
mgr.activityMgr = System.CreateActivityMgr(SessionContext);
|
||||
return mgr.activityMgr;
|
||||
}
|
||||
}
|
||||
public SaxItemDataMgr ItemDataMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.itemDataMgr == null)
|
||||
mgr.itemDataMgr = System.CreateItemDataMgr(SessionContext);
|
||||
return mgr.itemDataMgr;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user