using Sarand.BusinessMgr.Net.Standard.Base.Consoles; using Sarand.BusinessMgr.Net.Standard.Base.Core; using Sarand.BusinessMgr.Net.Standard.Base.Mgr; using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control; using Sarand.Net.Standard.Base.App; using Sarand.Net.Standard.Base.CodeTypes; using Sarand.Net.Standard.Base.Core; using Sarand.Net.Standard.Base.Diary; using Sarand.Net.Standard.Base.Interfaces; using Sarand.Net.Standard.Base.ItemData; using Sarand.Net.Standard.Base.ItemDocs; 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; namespace Sarand.BusinessMgr.Net.Standard.Base.App { //======================================================================= public abstract partial class SbmSystem : SacsSystem { //------------------------------------------------------------------- // Data members. private static short assetCommodityTypeAllowed = -1; //------------------------------------------------------------------- // Extended logging options. public enum ExtendedLogginOption { SecurityProfile, DbQueryExecution, Printing, } public static readonly String ExtendedLogging_SecurityProfile = "SecurityProfile"; public static readonly String ExtendedLogging_DbQueryExecution = "DbQueryExecution"; public static readonly String ExtendedLogging_Printing = "Printing"; private List extendedLoggingOptions; public object StringList { get; } //------------------------------------------------------------------- // Construction - use derived objects. protected SbmSystem(PropertySet properties) { // Configure extended logging. extendedLoggingOptions = StringListUtil.Split(properties.GetPropertyValue("Logging", "ExtendedLogging")); } //------------------------------------------------------------------- // Application definitions. public static Sbm.SessionConfig GetSessionConfigType(String consoleProperty) { if (consoleProperty.ContainsCI("Sarand")) return Sbm.SessionConfig.Sarand; if (consoleProperty.ContainsCI("MPE")) return Sbm.SessionConfig.MPE; if (consoleProperty.ContainsCI("BPE")) return Sbm.SessionConfig.BPE; if (consoleProperty.ContainsCI("Cadix") || consoleProperty.ContainsCI("CUL")) return Sbm.SessionConfig.Cadix; return Sbm.SessionConfig.Generic; } public static String GetCopyrightNotice(bool html = false) { return (html ? "©" : "(c)") + "2002- " + DateTime.Today.Year + "Sarand Ltd"; } public static bool IsSysAdminSession() { // Dev mode. if (IsDevHost()) return true; // Production servers. if (UserName.ContainsCI("Sarand")) { if (ComputerName.EqualsCI("SS-APP-S1")) return true; if (ComputerName.EqualsCI("SS-APP-S2")) return true; if (ComputerName.EqualsCI("SS-APP-LG1")) return true; } // Development. if (ComputerName.ContainsCI("Sarand")) return true; return false; } //------------------------------------------------------------------- // S y s t e m C o d e s //------------------------------------------------------------------- public static List GetSystemCodes(Sbm.SystemCode systemCode) { List codes = systemCodes.GetValueOrDefault(systemCode); if (codes == null) SaLogger.Warn($"{SysUtil.Fn} Unrecognised system code type: {systemCode}."); return codes; } //------------------------------------------------------------------- // D a t a M a n a g e r s //------------------------------------------------------------------- public abstract SbmAccountMgr CreateAccountMgr(SbmInternals internals); public abstract SbmAccountMgr CreateAccountMgr(ISbmUserOrganisationContext userContext); public abstract SbmAssetMgr CreateAssetMgr(SbmInternals internals); public abstract SbmAssetMgr CreateAssetMgr(ISbmUserOrganisationContext userContext); public abstract SbmCommodityMgr CreateCommodityMgr(SbmInternals internals); public abstract SbmCommodityMgr CreateCommodityMgr(ISbmUserOrganisationContext userContext); public abstract SbmPriceMgr CreatePriceMgr(SbmInternals internals); public abstract SbmPriceMgr CreatePriceMgr(ISbmUserOrganisationContext userContext); public abstract SbmDataItemMgr CreateDataItemMgr(SbmInternals internals); public abstract SbmDataItemMgr CreateDataItemMgr(ISbmUserOrganisationContext userContext); public abstract SbmProcessMgr CreateProcessMgr(SbmInternals internals); public abstract SbmProcessMgr CreateProcessMgr(ISbmUserOrganisationContext userContext); public abstract SbmStockMgr CreateStockMgr(SbmInternals internals); public abstract SbmStockMgr CreateStockMgr(ISbmUserOrganisationContext userContext); public abstract SbmTransactionMgr CreateTransactionMgr(SbmInternals internals); public abstract SbmTransactionMgr CreateTransactionMgr(ISbmUserOrganisationContext userContext); // Control. public abstract SbmcAccountMgr CreateControlAccountMgr(); public abstract SbmcInstanceMgr CreateControlInstanceMgr(); public abstract SbmcItemMgr CreateControlItemMgr(); //------------------------------------------------------------------- // Consoles. public abstract SbmSessionConsole CreateSessionConsole(ISbmUserOrganisationContext userContext); public abstract SaDiaryConsole CreateDiaryConsole(ISbmUserOrganisationContext userContext); public abstract SaSecurityConsole CreateSecurityConsole(ISbmUserOrganisationContext userContext); public abstract SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserOrganisationContext userContext); public abstract SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserOrganisationContext userContext); public abstract SaItemDataConsole CreateItemDataConsole(ISbmUserOrganisationContext userContext); public abstract SaItemDocConsole CreateItemDocConsole(ISbmUserOrganisationContext userContext); public abstract SaItemOptionConsole CreateItemOptionConsole(ISbmUserOrganisationContext userContext); public abstract SaInterfaceConsole CreateInterfaceConsole(ISbmUserOrganisationContext userContext); public abstract SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserOrganisationContext userContext); public abstract SbmEmailConsole CreateEmailConsole(ISbmUserOrganisationContext userContext, SbmEmailConfig emailConfig); //------------------------------------------------------------------- // A p p l i c a t i o n P r o p e r t i e s //------------------------------------------------------------------- public bool IsExtendedLogging(ExtendedLogginOption extendedLoggingOption) { if (extendedLoggingOptions == null) return false; if (extendedLoggingOption == ExtendedLogginOption.SecurityProfile) return extendedLoggingOptions.ContainsCI(ExtendedLogging_SecurityProfile); if (extendedLoggingOption == ExtendedLogginOption.DbQueryExecution) return extendedLoggingOptions.ContainsCI(ExtendedLogging_DbQueryExecution); if (extendedLoggingOption == ExtendedLogginOption.Printing) return extendedLoggingOptions.ContainsCI(ExtendedLogging_Printing); return false; } //------------------------------------------------------------------- } //======================================================================= }