Session data.

This commit is contained in:
Andy Howard
2025-01-22 08:01:51 +00:00
parent 61ecd59794
commit f375e0d175
121 changed files with 3743 additions and 2126 deletions
@@ -96,45 +96,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
catch (Exception) { }
}
//-------------------------------------------------------------------
// Create consoles.
public override SbmSessionConsole CreateSessionConsole(ISbmUserOrganisationContext userContext)
{
return SbmSessionConsole.CreateConsole(userContext);
}
public override SaDiaryConsole CreateDiaryConsole(ISbmUserOrganisationContext userContext)
{
return null;
}
public override SaSecurityConsole CreateSecurityConsole(ISbmUserOrganisationContext userContext)
{
return new SbmSecurityConsole_Web(userContext);
}
public override SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserOrganisationContext userContext)
{
return new SbmCodeTypeConsole_Web(userContext);
}
public override SaItemDataConsole CreateItemDataConsole(ISbmUserOrganisationContext userContext)
{
return null;
}
public override SaItemDocConsole CreateItemDocConsole(ISbmUserOrganisationContext userContext)
{
return null;
}
public override SaItemOptionConsole CreateItemOptionConsole(ISbmUserOrganisationContext userContext)
{
return new SbmItemOptionConsole_Web(userContext);
}
public override SaInterfaceConsole CreateInterfaceConsole(ISbmUserOrganisationContext userContext)
{
return null;
}
public override SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserOrganisationContext userContext)
{
return new SbmUpdateLogConsole_Web(userContext);
}
//-------------------------------------------------------------------
}
//=======================================================================
+10 -29
View File
@@ -1,12 +1,5 @@
using Newtonsoft.Json;
using Sarand.BusinessMgr.Net.Standard.Base.App;
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
using Sarand.BusinessMgr.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Security;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.BusinessMgr.Net.Core.Web.App
{
@@ -14,12 +7,18 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
public abstract class SbmSessionData_Web : SbmSessionData
{
//-------------------------------------------------------------------
// Protected construction - for JSON deserialisation.
protected SbmSessionData_Web(long sessionIdx, int itemIdx, SbmSessionContext sessionContext) :
base(sessionIdx, itemIdx, sessionContext)
/// <summary>
/// Protected construction - for JSON deserialisation and non-session data (eg. prior to logon).
/// <para>- Session index persistent to record sequence in which Session Data objects created.</para>
/// <para>- Session index should be zero for non-session data, eg. background tasks.</para>
/// </summary>
protected SbmSessionData_Web(long sessionIdx, SbmSessionContext sessionContext) :
base(sessionIdx, sessionContext)
{
}
// Protected construction.
/// <summary>
/// Session Data constructor - prior to storage against session.
/// </summary>
protected SbmSessionData_Web(SbmSessionContext sessionContext) :
base(sessionContext)
{
@@ -31,24 +30,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
[JsonIgnore]
public abstract bool KeepLoggedIn { get; }
//-------------------------------------------------------------------
// ToDo: Organisation configuration.
public String GetOrganisationOption(Sbm.OrganisationOption option, String context) { return null; }
public String GetOrganisationOption(String optionName, String context) { return null; }
public String GetOwnerOption_Value(Sbm.OrgOption_Value eCol) { return null; }
public String GetOwnerOption_Folder(Sbm.OrgOption_Folder eCol) { return null; }
public bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption eCol) { return false; }
public String GetOwnerOption_Caption(Sbm.OrgOption_Caption eCol, String defautValue) { return defautValue; }
public bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx eCol) { return false; }
public bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn eCol) { return false; }
public String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String defautValue) { return defautValue; }
public int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int defautValue) { return defautValue; }
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int defautValue) { return defautValue; }
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int defautValue) { return defautValue; }
public int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int defautValue = 2) { return defautValue; }
public Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityTypeContext) { return Sbm.CommodityType.Unknown; }
public SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation eLoc) { return null; }
//-------------------------------------------------------------------
}
//=======================================================================
+1 -1
View File
@@ -14,7 +14,7 @@ using System.Text;
namespace Sarand.BusinessMgr.Net.Core.Web.App
{
//=======================================================================
public class SbmSystem_Web : SbmSystem_Dbas
public abstract class SbmSystem_Web : SbmSystem_Dbas
{
//-------------------------------------------------------------------
// Data members.
@@ -1,37 +0,0 @@
using Sarand.BusinessMgr.Net.Standard.Base.App;
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
using Sarand.BusinessMgr.Net.Standard.Dbas.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Security;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.BusinessMgr.Net.Core.Web.App
{
//=======================================================================
public class SbmUserContext_Web : SbmUserContext_Dbas
{
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SbmUserContext_Web(SbmSessionContext sessionContext) : base(sessionContext)
{
}
//-------------------------------------------------------------------
// Properties.
//-------------------------------------------------------------------
// Modify properties - internal only.
public void RefreshUser(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
{
base.SetUserData(securityItemUser, affiliateUser, supervisedOwners);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging.Abstractions;
using Sacs.Web.Components;
using Sarand.BusinessMgr.Net.Core.Web.App;
using Sarand.BusinessMgr.Net.Standard.Base.App;
@@ -20,12 +19,7 @@ using Sarand.Net.Standard.Base.ItemOptions;
using Sarand.Net.Standard.Base.ReferenceData;
using Sarand.Net.Standard.Base.Security;
using Sarand.Net.Standard.Base.UpdateLog;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
{
@@ -34,8 +28,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
{
//-------------------------------------------------------------------
// Data members.
private SbmInternals internals;
private SbmInternals_Control internals_Control;
//-------------------------------------------------------------------
// Protected construction.
@@ -52,10 +44,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
{
if (disposing)
{
if (internals != null) internals.Dispose();
internals = null;
if (internals_Control != null) internals_Control.Dispose();
internals_Control = null;
}
base.Dispose(disposing);
}
@@ -67,41 +55,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
public App.SbmAppConfig AppConfig { get { return App.AppConfig; } }
public abstract SbmSessionContext SessionContext { get; }
public abstract ISbmUserOrganisationContext UserContext_Core { get; }
// Business components.
public SbmInternals Internals { get { if (internals == null && UserContext_Core != null) { internals = new SbmInternals(UserContext_Core); } return internals; } }
public SbmInternals_Control Internals_Control { get { if (internals_Control == null) { internals_Control = new SbmInternals_Control(); } return internals_Control; } }
// Managers.
public SbmAccountMgr AccountMgr { get { return Internals.AccountMgr; } }
public SbmAssetMgr AssetMgr { get { return Internals.AssetMgr; } }
public SbmCommodityMgr CommodityMgr { get { return Internals.CommodityMgr; } }
public SbmPriceMgr PriceMgr { get { return Internals.PriceMgr; } }
public SbmTransactionMgr TransactionMgr { get { return Internals.TransactionMgr; } }
public SbmStockMgr StockMgr { get { return Internals.StockMgr; } }
public SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
public SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
// Control.
protected SbmcAccountMgr ControlAccountMgr { get { return Internals_Control.ControlAccountMgr; } }
protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } }
protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } }
// Consoles.
public SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
public SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
public SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
public SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
public SaInterfaceConsole InterfaceConsole { get { return Internals.InterfaceConsole; } }
public SaItemDocConsole ItemDocConsole { get { return Internals.ItemDocConsole; } }
public SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
public SaItemDataConsole ItemDataConsole { get { return Internals.ItemDataConsole; } }
// Configurations.
public SbmStockControlConfig StockControlConfig { get { return Internals.StockControlConfig; } }
public SbmRequirementCostingConfig RequirementCostingConfig { get { return Internals.RequirementCostingConfig; } }
// System codes.
public List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode systemCode) { return Internals.GetSystemCodes(systemCode); }
// Email.
public SaEmailConfig EmailConfig { get { return Internals.EmailConfig; } }
public SbmEmailConsole EmailConsole { get { return Internals.EmailConsole; } }
//-------------------------------------------------------------------
// Action execution events.
@@ -271,44 +271,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
return new SelectList(codes, "Code", "Desc");
}
/// <summary>List of Address Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAddressTypeCodesForSelect()
{
return new SelectList(GetCodesOfType(Sbm.SystemCode.AddressType), "Code", "Desc");
}
/// <summary>List of Affiliate Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAffiliateTypeCodesForSelect()
{
return new SelectList(GetCodesOfType(Sbm.SystemCode.AffiliateType), "Code", "Desc");
}
/// <summary>List of Association Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAssociationTypeCodesForSelect()
{
List<TypeCodeDesc> associationTypes = GetCodesOfType(Sbm.SystemCode.AssociationType);
associationTypes.RemoveAll(item => item.Type == (short)Sbm.AssociationType.Internal);
foreach (Sbm.AssociationType associationType in EnumUtil.GetValues<Sbm.AssociationType>())
{
if (!SessionConsole.AllowAssociationType(associationType))
associationTypes.RemoveAll(item => item.Type == (short)associationType);
}
return new SelectList(associationTypes, "Code", "Desc");
}
/// <summary>List of Commodity Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetCommodityTypeCodesForSelect()
{
return new SelectList(GetCodesOfType(Sbm.SystemCode.CommodityType), "Code", "Desc");
}
/// <summary>List of Asset Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAssetTypeCodesForSelect()
{
return new SelectList(GetCodesOfType(Sbm.SystemCode.AssetType), "Code", "Desc");
}
//-------------------------------------------------------------------
// Form properties.
/// <summary>