Consolidate User Context

This commit is contained in:
2021-08-04 21:32:35 +01:00
parent b8cfd87860
commit afd38cea03
126 changed files with 2240 additions and 634 deletions
@@ -1,5 +1,6 @@
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
using Sarand.BusinessMgr.Net.Standard.Base.Core;
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.CodeTypes;
@@ -58,7 +59,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Construction.
public SbmInternals(SbmUserContext userContext)
public SbmInternals(ISbmUserContext userContext)
{
UserContext = userContext;
}
@@ -96,9 +97,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Session properties.
public SbmApplication Application { get { return SbmGlobals.Application; } }
public SbmUserContext UserContext { get; }
public ISbmUserContext UserContext { get; }
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
public SbmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } }
public ISbmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } }
public SbmAccountsDfn AccountsDfn { get { if (accountsDfn == null) accountsDfn = new SbmAccountsDfn(UserContext); { return accountsDfn; } } }
// Database.
public ISacsDatabase BusMgrDatabase { get { return Application.GetBusMgrDatabase(SessionContext); } }
@@ -114,6 +115,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
return new List<TypeCodeDesc>(systemCodeCache.GetValueOrDefault(systemCode, new List<TypeCodeDesc>()));
}
public List<TypeCodeDesc> AffiliateTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.AffiliateType); } }
public List<TypeCodeDesc> CommodityTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.CommodityType); } }
//-------------------------------------------------------------------
// Managers.