Session Console and Internals.
This commit is contained in:
@@ -24,8 +24,8 @@ using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmApplication_Web : SbmApplication
|
||||
//=======================================================================
|
||||
public abstract class SbmApplication_Web : SbmApplication
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -98,39 +98,39 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create consoles.
|
||||
public override SbmSessionConsole CreateSessionConsole(ISbmUserContext_Core userContext)
|
||||
public override SbmSessionConsole CreateSessionConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return SbmSessionConsole.CreateConsole(userContext);
|
||||
}
|
||||
public override SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext)
|
||||
public override SaDiaryConsole CreateDiaryConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaSecurityConsole CreateSecurityConsole(ISbmUserContext_Core userContext)
|
||||
public override SaSecurityConsole CreateSecurityConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return new SbmSecurityConsole_Web(userContext);
|
||||
}
|
||||
public override SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext_Core userContext)
|
||||
public override SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return new SbmCodeTypeConsole_Web(userContext);
|
||||
}
|
||||
public override SaItemDataConsole CreateItemDataConsole(ISbmUserContext_Core userContext)
|
||||
public override SaItemDataConsole CreateItemDataConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaItemDocConsole CreateItemDocConsole(ISbmUserContext_Core userContext)
|
||||
public override SaItemDocConsole CreateItemDocConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaItemOptionConsole CreateItemOptionConsole(ISbmUserContext_Core userContext)
|
||||
public override SaItemOptionConsole CreateItemOptionConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return new SbmItemOptionConsole_Web(userContext);
|
||||
}
|
||||
public override SaInterfaceConsole CreateInterfaceConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaInterfaceConsole CreateInterfaceConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserContext_Core userContext)
|
||||
public override SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return new SbmUpdateLogConsole_Web(userContext);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
@@ -16,10 +18,17 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
protected const String ParamContext_Config = "Config";
|
||||
protected const String ParamContext_ConfigPrefix = "Config-";
|
||||
protected const String ApplicationOptionValue_Allow = "Allow";
|
||||
protected const String ApplicationOptionValue_Disallow = "Disallow";
|
||||
protected const String ParamContext_OptionAllowed = "OptionAllowed";
|
||||
protected const String ParamContext_AffiliateTypeAllowed = "AffiliateTypeAllowed";
|
||||
protected const String ParamContext_AssociationTypeAllowed = "AssociationTypeAllowed";
|
||||
protected const String ParamContext_TransactionTypeAllowed = "TransactionTypeAllowed";
|
||||
protected const String ParamContext_TransactionCreation = "TransactionCreation";
|
||||
protected const String ParamContext_TransactionReferencePrefix = "TransactionReferencePrefix";
|
||||
protected const String ParamContext_StockControl = "StockControl";
|
||||
protected const String ParamContext_InterfaceCategoryAllowed = "InterfaceCategoryAllowed";
|
||||
protected const String ParamContext_InterfaceTypeAllowed = "InterfaceTYpeAllowed";
|
||||
protected const String ParamContext_DefaultValue = "DefaultValue";
|
||||
protected const String ParamContext_ColumnChangeLogged = "ColumnChangeLogged";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -39,17 +48,10 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
// Owner/Instance configuration parameters.
|
||||
public enum ConfigParamType
|
||||
{
|
||||
// Affiliate types.
|
||||
AllowedAffiliateTypes,
|
||||
DisallowedAffiliateTypes,
|
||||
// Association types.
|
||||
AllowedAssociationTypes,
|
||||
DisallowedAssociationTypes,
|
||||
// Transaction types.
|
||||
AllowedTransactionTypes,
|
||||
DisallowedTransactionTypes,
|
||||
// Application options.
|
||||
ApplicationOption,
|
||||
AffiliateTypeAllowed,
|
||||
AssociationTypeAllowed,
|
||||
TransactionTypeAllowed,
|
||||
ApplicationOptionAllowed,
|
||||
}
|
||||
public class ConfigParamData
|
||||
{
|
||||
@@ -60,52 +62,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
public bool Password { get; set; }
|
||||
}
|
||||
|
||||
public bool IsConfigParamOfType(ConfigParamType configParam, SbmcItemParam itemParam)
|
||||
{
|
||||
switch (configParam)
|
||||
{
|
||||
// Affiliate types.
|
||||
case ConfigParamType.AllowedAffiliateTypes:
|
||||
case ConfigParamType.DisallowedAffiliateTypes:
|
||||
// Association types.
|
||||
case ConfigParamType.AllowedAssociationTypes:
|
||||
case ConfigParamType.DisallowedAssociationTypes:
|
||||
// Transaction types.
|
||||
case ConfigParamType.AllowedTransactionTypes:
|
||||
case ConfigParamType.DisallowedTransactionTypes:
|
||||
return itemParam.Context.EqualsCI(ParamContext_Config) && itemParam.Name.EqualsCI(configParam.ToString());
|
||||
// Application options.
|
||||
case ConfigParamType.ApplicationOption:
|
||||
return itemParam.Context.EqualsCI($"{ParamContext_ConfigPrefix}{ConfigParamType.ApplicationOption.ToString()}");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ConfigParamData GetConfigParamData(ConfigParamType configParam)
|
||||
{
|
||||
switch (configParam)
|
||||
{
|
||||
// Affiliate types.
|
||||
case ConfigParamType.AllowedAffiliateTypes:
|
||||
case ConfigParamType.DisallowedAffiliateTypes:
|
||||
// Association types.
|
||||
case ConfigParamType.AllowedAssociationTypes:
|
||||
case ConfigParamType.DisallowedAssociationTypes:
|
||||
// Transaction types.
|
||||
case ConfigParamType.AllowedTransactionTypes:
|
||||
case ConfigParamType.DisallowedTransactionTypes:
|
||||
return new ConfigParamData() { ConfigParam = configParam, Context = ParamContext_Config, Name = configParam.ToString() };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ConfigParamData GetAllowOptionConfigParamData(Sbm.ConfigOption option)
|
||||
{
|
||||
ConfigParamData configParamData = new ConfigParamData() { ConfigParam = ConfigParamType.ApplicationOption, Context = $"{ParamContext_ConfigPrefix}{ConfigParamType.ApplicationOption.ToString()}", Name = option.ToString() };
|
||||
configParamData.Values.UnionWith(new List<String>() { ApplicationOptionValue_Allow, ApplicationOptionValue_Disallow });
|
||||
return configParamData;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Populate Repository Configuration parameters.
|
||||
private void PopulateControlParams()
|
||||
@@ -138,74 +94,93 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
private void PopulateControlParam(SbmcItemParam itemParam)
|
||||
{
|
||||
// Affiliate types.
|
||||
if (IsConfigParamOfType(ConfigParamType.AllowedAffiliateTypes, itemParam))
|
||||
AffiliateTypes_Allowed.UnionWith(EnumUtil.ParseEnums<Sbm.AffiliateType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
|
||||
else if (IsConfigParamOfType(ConfigParamType.DisallowedAffiliateTypes, itemParam))
|
||||
AffiliateTypes_Disallowed.UnionWith(EnumUtil.ParseEnums<Sbm.AffiliateType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
|
||||
// Association types.
|
||||
else if (IsConfigParamOfType(ConfigParamType.AllowedAssociationTypes, itemParam))
|
||||
AssociationTypes_Allowed.UnionWith(EnumUtil.ParseEnums<Sbm.AssociationType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
|
||||
else if (IsConfigParamOfType(ConfigParamType.DisallowedAssociationTypes, itemParam))
|
||||
AssociationTypes_Disallowed.UnionWith(EnumUtil.ParseEnums<Sbm.AssociationType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
|
||||
// Transaction types.
|
||||
else if (IsConfigParamOfType(ConfigParamType.AllowedTransactionTypes, itemParam))
|
||||
TransactionTypes_Allowed.UnionWith(EnumUtil.ParseEnums<Sbm.TransactionType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
|
||||
else if (IsConfigParamOfType(ConfigParamType.DisallowedTransactionTypes, itemParam))
|
||||
TransactionTypes_Disallowed.UnionWith(EnumUtil.ParseEnums<Sbm.TransactionType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
|
||||
// Application options.
|
||||
else if (IsConfigParamOfType(ConfigParamType.ApplicationOption, itemParam))
|
||||
if (itemParam.Context.EqualsCI(ParamContext_OptionAllowed))
|
||||
{
|
||||
// Application options.
|
||||
Sbm.ConfigOption option = EnumUtil.ParseEnum(itemParam.Name, Sbm.ConfigOption.Unknown);
|
||||
if (option != Sbm.ConfigOption.Unknown)
|
||||
{
|
||||
if (itemParam.Value.EqualsCI(ApplicationOptionValue_Allow))
|
||||
if (StringUtil.ToBool(itemParam.Value))
|
||||
ApplicationOptions_Allowed.Add(option);
|
||||
else if (itemParam.Value.EqualsCI(ApplicationOptionValue_Disallow))
|
||||
ApplicationOptions_Disallowed.Add(option);
|
||||
else
|
||||
SaLogger.Warn($"{SysUtil.Fn} Unrecognised application option value: {itemParam.Value}. Option: {option}.");
|
||||
ApplicationOptions_Disallowed.Add(option);
|
||||
}
|
||||
else
|
||||
SaLogger.Warn($"{SysUtil.Fn} Unrecognised application option: {itemParam.Name}.");
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Unrecognised application option: {itemParam.Name}.");
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_AffiliateTypeAllowed))
|
||||
{
|
||||
// Affiliate types.
|
||||
Sbm.AffiliateType affiliateType = EnumUtil.ParseEnum(itemParam.Name, Sbm.AffiliateType.Unknown);
|
||||
if (affiliateType != AffiliateType.Unknown)
|
||||
{
|
||||
if (StringUtil.ToBool(itemParam.Value))
|
||||
AffiliateTypes_Allowed.Add(affiliateType);
|
||||
else
|
||||
AffiliateTypes_Disallowed.Add(affiliateType);
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Unrecognised Affiliate type: {itemParam.Name}.");
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_AssociationTypeAllowed))
|
||||
{
|
||||
// Association types.
|
||||
Sbm.AssociationType associationType = EnumUtil.ParseEnum(itemParam.Name, Sbm.AssociationType.Unknown);
|
||||
if (associationType != AssociationType.Unknown)
|
||||
{
|
||||
if (StringUtil.ToBool(itemParam.Value))
|
||||
AssociationTypes_Allowed.Add(associationType);
|
||||
else
|
||||
AssociationTypes_Disallowed.Add(associationType);
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Unrecognised Association type: {itemParam.Name}.");
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_TransactionTypeAllowed))
|
||||
{
|
||||
// Transaction types.
|
||||
Sbm.TransactionType transactionType = EnumUtil.ParseEnum(itemParam.Name, Sbm.TransactionType.Unknown);
|
||||
if (transactionType != TransactionType.Unknown)
|
||||
{
|
||||
if (StringUtil.ToBool(itemParam.Value))
|
||||
TransactionTypes_Allowed.Add(transactionType);
|
||||
else
|
||||
TransactionTypes_Disallowed.Add(transactionType);
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Unrecognised Transaction type: {itemParam.Name}.");
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_TransactionCreation))
|
||||
{
|
||||
// Transaction Creation.
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_TransactionReferencePrefix))
|
||||
{
|
||||
// Transaction Reference Prefix.
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_StockControl))
|
||||
{
|
||||
// Stock Control.
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_InterfaceCategoryAllowed))
|
||||
{
|
||||
// Interface Category.
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_InterfaceTypeAllowed))
|
||||
{
|
||||
// Interface Type.
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_DefaultValue))
|
||||
{
|
||||
// Default Value.
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_ColumnChangeLogged))
|
||||
{
|
||||
// Update Log.
|
||||
}
|
||||
else SaLogger.Debug($"{SysUtil.Fn} Unrecognised option. Context: {itemParam.Context}. Name: {itemParam.Name}.");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Allowed data component types.
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
// Supported affiliate types.
|
||||
private readonly HashSet<Sbm.AffiliateType> AffiliateTypes_Allowed = new HashSet<Sbm.AffiliateType>();
|
||||
private readonly HashSet<Sbm.AffiliateType> AffiliateTypes_Disallowed = new HashSet<Sbm.AffiliateType>();
|
||||
public override bool AllowAffiliateType(Sbm.AffiliateType affiliateType, bool defaultResponse)
|
||||
{
|
||||
if (AffiliateTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (AffiliateTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Supported affiliate types.
|
||||
private readonly HashSet<Sbm.AssociationType> AssociationTypes_Allowed = new HashSet<Sbm.AssociationType>();
|
||||
private readonly HashSet<Sbm.AssociationType> AssociationTypes_Disallowed = new HashSet<Sbm.AssociationType>();
|
||||
public override bool AllowAssociationType(Sbm.AssociationType affiliateType, bool defaultResponse)
|
||||
{
|
||||
if (AssociationTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (AssociationTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Supported affiliate types.
|
||||
private readonly HashSet<Sbm.TransactionType> TransactionTypes_Allowed = new HashSet<Sbm.TransactionType>();
|
||||
private readonly HashSet<Sbm.TransactionType> TransactionTypes_Disallowed = new HashSet<Sbm.TransactionType>();
|
||||
public override bool AllowTransactionType(Sbm.TransactionType affiliateType, bool defaultResponse)
|
||||
{
|
||||
if (TransactionTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (TransactionTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Configuration rules.
|
||||
//-------------------------------------------------------------------
|
||||
// Application options.
|
||||
|
||||
// Supported application options.
|
||||
private readonly HashSet<Sbm.ConfigOption> ApplicationOptions_Allowed = new HashSet<Sbm.ConfigOption>();
|
||||
@@ -217,6 +192,54 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Contacts.
|
||||
|
||||
// Supported Affiliate types.
|
||||
private readonly HashSet<Sbm.AffiliateType> AffiliateTypes_Allowed = new HashSet<Sbm.AffiliateType>();
|
||||
private readonly HashSet<Sbm.AffiliateType> AffiliateTypes_Disallowed = new HashSet<Sbm.AffiliateType>();
|
||||
public override bool AllowAffiliateType(Sbm.AffiliateType affiliateType, bool defaultResponse)
|
||||
{
|
||||
if (AffiliateTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (AffiliateTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Supported Association types.
|
||||
private readonly HashSet<Sbm.AssociationType> AssociationTypes_Allowed = new HashSet<Sbm.AssociationType>();
|
||||
private readonly HashSet<Sbm.AssociationType> AssociationTypes_Disallowed = new HashSet<Sbm.AssociationType>();
|
||||
public override bool AllowAssociationType(Sbm.AssociationType affiliateType, bool defaultResponse)
|
||||
{
|
||||
if (AssociationTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (AssociationTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Supported Transaction types.
|
||||
private readonly HashSet<Sbm.TransactionType> TransactionTypes_Allowed = new HashSet<Sbm.TransactionType>();
|
||||
private readonly HashSet<Sbm.TransactionType> TransactionTypes_Disallowed = new HashSet<Sbm.TransactionType>();
|
||||
public override bool AllowTransactionType(Sbm.TransactionType affiliateType, bool defaultResponse)
|
||||
{
|
||||
if (TransactionTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (TransactionTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Interfaces.
|
||||
|
||||
private readonly HashSet<SaInterfaceCategory> InterfaceCategories_Allowed = new HashSet<SaInterfaceCategory>();
|
||||
private readonly HashSet<SaInterfaceCategory> InterfaceCategories_Disallowed = new HashSet<SaInterfaceCategory>();
|
||||
/// <summary>
|
||||
/// Whether the Interface Category is allowed.
|
||||
/// </summary>
|
||||
public override bool AllowInterfaceCategory(SaInterfaceCategory interfaceCategory, bool defaultResponse)
|
||||
{
|
||||
if (InterfaceCategories_Allowed.Contains(interfaceCategory)) return false;
|
||||
if (InterfaceCategories_Disallowed.Contains(interfaceCategory)) return true;
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -39,28 +39,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
private SbmSessionContext_Web SessionContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Allowed data component types.
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
// Supported affiliate types.
|
||||
public override bool AllowAffiliateType(Sbm.AffiliateType affiliateType, bool defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Supported affiliate types.
|
||||
public override bool AllowAssociationType(Sbm.AssociationType affiliateType, bool defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Supported affiliate types.
|
||||
public override bool AllowTransactionType(Sbm.TransactionType affiliateType, bool defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Configuration rules.
|
||||
//-------------------------------------------------------------------
|
||||
// Application options.
|
||||
|
||||
// Supported application options.
|
||||
public override bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse)
|
||||
@@ -68,6 +49,38 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Contacts.
|
||||
|
||||
// Supported Affiliate types.
|
||||
public override bool AllowAffiliateType(Sbm.AffiliateType affiliateType, bool defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Supported Association types.
|
||||
public override bool AllowAssociationType(Sbm.AssociationType affiliateType, bool defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Transactions.
|
||||
|
||||
// Supported Transaction types.
|
||||
public override bool AllowTransactionType(Sbm.TransactionType affiliateType, bool defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Interfaces.
|
||||
|
||||
public override bool AllowInterfaceCategory(SaInterfaceCategory interfaceCategory, bool defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Microsoft.AspNetCore.Html;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -140,11 +142,11 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode codeType)
|
||||
{
|
||||
if (!codes.ContainsKey(codeType))
|
||||
codes.Add(codeType, SbmSystem.GetCodesOfType(null, codeType));
|
||||
codes.Add(codeType, SbmSystem.GetSystemCodes(codeType));
|
||||
return codes.GetValueOrDefault(codeType, new List<TypeCodeDesc>());
|
||||
}
|
||||
}
|
||||
private CodeCache codes = new CodeCache();
|
||||
private readonly CodeCache systemCodes = new CodeCache();
|
||||
|
||||
// Status.
|
||||
public String GetStatusCaption(SaStatus status)
|
||||
@@ -158,7 +160,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
if ((int)affiliateType < 1) return "";
|
||||
// ToDo Affiliate Type localisation.
|
||||
List<TypeCodeDesc> affiliateTypeCodes = codes.GetCodesOfType(Sbm.SystemCode.AffiliateType);
|
||||
List<TypeCodeDesc> affiliateTypeCodes = systemCodes.GetCodesOfType(Sbm.SystemCode.AffiliateType);
|
||||
return affiliateTypeCodes.GetDescForType(affiliateType, affiliateTypeCodes.GetCodeForType(affiliateType));
|
||||
}
|
||||
|
||||
@@ -167,7 +169,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
if ((int)associationType < 1) return "";
|
||||
// ToDo Association Type localisation.
|
||||
List<TypeCodeDesc> associationTypeCodes = codes.GetCodesOfType(Sbm.SystemCode.AssociationType);
|
||||
List<TypeCodeDesc> associationTypeCodes = systemCodes.GetCodesOfType(Sbm.SystemCode.AssociationType);
|
||||
return associationTypeCodes.GetDescForType(associationType, associationTypeCodes.GetCodeForType(associationType));
|
||||
}
|
||||
|
||||
@@ -176,10 +178,19 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
if ((int)assetType < 1) return "";
|
||||
// ToDo Asset Type localisation.
|
||||
List<TypeCodeDesc> assetTypeCodes = codes.GetCodesOfType(Sbm.SystemCode.AssetType);
|
||||
List<TypeCodeDesc> assetTypeCodes = systemCodes.GetCodesOfType(Sbm.SystemCode.AssetType);
|
||||
return assetTypeCodes.GetDescForType(assetType, assetTypeCodes.GetCodeForType(assetType));
|
||||
}
|
||||
|
||||
// Transaction Type.
|
||||
public String GetTransactionTypeCaption(Sbm.TransactionType transactionType)
|
||||
{
|
||||
if ((int)transactionType < 1) return "";
|
||||
// ToDo Transaction Type localisation.
|
||||
List<TypeCodeDesc> transactionTypeCodes = systemCodes.GetCodesOfType(Sbm.SystemCode.TransactionType);
|
||||
return transactionTypeCodes.GetDescForType(transactionType, transactionTypeCodes.GetCodeForType(transactionType));
|
||||
}
|
||||
|
||||
// To be completed.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -9,7 +10,7 @@ using System.Text;
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmUserContext_Web : SbmUserContext
|
||||
public class SbmUserContext_Web : SbmUserContext_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmCodeTypeConsole_Web(ISbmUserContext_Core userContext) : base(userContext)
|
||||
public SbmCodeTypeConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmItemOptionConsole_Web : SbmItemOptionConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmItemOptionConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
/// <summary>
|
||||
/// 'Show Item Options' dialog only for desktop and mobile applications.
|
||||
/// </summary>
|
||||
protected override ShowItemOptionsDialogFunction ShowItemOptionsDialogFn => throw new NotImplementedException();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSecurityConsole_Web(ISbmUserContext_Core userContext) : base(userContext)
|
||||
public SbmSecurityConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmUpdateLogConsole_Web(ISbmUserContext_Core userContext) : base(userContext)
|
||||
public SbmUpdateLogConsole_Web(ISbmUserOrganisationContext userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
protected SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
|
||||
public App.SbmAppConfig AppConfig { get { return App.AppConfig; } }
|
||||
public abstract SbmSessionContext SessionContext { get; }
|
||||
public abstract ISbmUserContext_Core UserContext_Core { 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; } }
|
||||
@@ -98,7 +98,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
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.GetCodesOfType(systemCode); }
|
||||
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; } }
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
public SbmSessionData SessionData { get { return SessionData_Web; } }
|
||||
public SbmSessionData_Web SessionData_Web { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return SessionData?.SessionContext ?? null; } }
|
||||
public abstract ISbmUserContext_Core UserContext_Core { get; }
|
||||
public abstract ISbmUserOrganisationContext UserContext_Core { get; }
|
||||
public DbUpdateInfo DbUpdateInfo { get { return SessionData?.DbUpdateInfo ?? new DbUpdateInfo(null, "", SbmSystem.ComputerName); } }
|
||||
public SbmLocaliser Localiser { get; }
|
||||
// Request properties.
|
||||
@@ -108,7 +108,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
protected SbmStockControlConfig StockControlConfig { get { return Internals.StockControlConfig; } }
|
||||
protected SbmRequirementCostingConfig RequirementCostingConfig { get { return Internals.RequirementCostingConfig; } }
|
||||
// System codes.
|
||||
protected List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode systemCode) { return Internals.GetCodesOfType(systemCode); }
|
||||
protected List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode systemCode) { return Internals.GetSystemCodes(systemCode); }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security.
|
||||
|
||||
Reference in New Issue
Block a user