Portal signin via Control Instance
This commit is contained in:
+9
-3
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35303.130
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SacsStandardBase", "..\..\Common-VS\Workspace\SacsStandardBase\SacsStandardBase.csproj", "{DD291122-8616-4200-BF75-EAFFD9F099C7}"
|
||||
EndProject
|
||||
@@ -30,7 +30,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaBusinessMgrCoreWebControl
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaBusinessMgrCoreWebPortal", "SaBusinessMgrCoreWebPortal\SaBusinessMgrCoreWebPortal.csproj", "{C7BA3DCA-5A4E-4541-899C-BF8208E276D5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaBusMgrTest_Portal", "SaBusMgrTest_Portal\SaBusMgrTest_Portal.csproj", "{3C833156-A879-420A-BA5B-CB828C209A5A}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaBusMgrTest_Portal", "SaBusMgrTest_Portal\SaBusMgrTest_Portal.csproj", "{3C833156-A879-420A-BA5B-CB828C209A5A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaBusMgrTest_Control", "SaBusMgrTest_Control\SaBusMgrTest_Control.csproj", "{264F31D7-1C54-4CD2-86E8-8D001FC19730}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -86,6 +88,10 @@ Global
|
||||
{3C833156-A879-420A-BA5B-CB828C209A5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3C833156-A879-420A-BA5B-CB828C209A5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3C833156-A879-420A-BA5B-CB828C209A5A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{264F31D7-1C54-4CD2-86E8-8D001FC19730}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{264F31D7-1C54-4CD2-86E8-8D001FC19730}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{264F31D7-1C54-4CD2-86E8-8D001FC19730}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{264F31D7-1C54-4CD2-86E8-8D001FC19730}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// I n t e r f a c e O p t i o n D e f i n i t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
public static List<SaItemOptionDfn> GetInterfaceItemOptionDfns(ISbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
public static List<SaItemOptionDfn> GetInterfaceItemOptionDfns(ISbmUserContext_Core userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
{
|
||||
switch (interfaceCategory)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s i n g O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
public static List<SaProcess_Base.GroupData> GetProcessingOptions(ISbmUserContext userContext, SaInterface interfaceObj)
|
||||
public static List<SaProcess_Base.GroupData> GetProcessingOptions(ISbmUserContext_Core userContext, SaInterface interfaceObj)
|
||||
{
|
||||
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return new List<SaProcess_Base.GroupData>();
|
||||
List<SaProcess_Base.GroupData> optionGroups = null;
|
||||
@@ -90,7 +90,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// C o n f i g u r e P r o c e s s
|
||||
//-------------------------------------------------------------------
|
||||
public static SbmInterfaceProcess ConfigureProcess(ISbmUserContext userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
||||
public static SbmInterfaceProcess ConfigureProcess(ISbmUserContext_Core userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
||||
{
|
||||
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return null;
|
||||
switch (interfaceObj.Category)
|
||||
@@ -120,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s I n t e r f a c e
|
||||
//-------------------------------------------------------------------
|
||||
public static bool ProcessInterface(ISbmUserContext userContext, SaInterface interfaceObj)
|
||||
public static bool ProcessInterface(ISbmUserContext_Core userContext, SaInterface interfaceObj)
|
||||
{
|
||||
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return false;
|
||||
switch (interfaceObj.Category)
|
||||
@@ -149,7 +149,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
// I n v o k e P r o c e s s D e f i n i t i o n
|
||||
//-------------------------------------------------------------------
|
||||
// Invoke process based on definition from command line argument.
|
||||
public static bool InvokeProcessDefinition(ISbmUserContext userContext, SacsProcessDefinition processDfn)
|
||||
public static bool InvokeProcessDefinition(ISbmUserContext_Core userContext, SacsProcessDefinition processDfn)
|
||||
{
|
||||
//----------------------------------------------------------------
|
||||
// Log process definition.
|
||||
@@ -186,11 +186,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve interface.
|
||||
private static SaInterface GetSystemInterfaceByType(ISbmUserContext userContext, short interfaceType, String caption)
|
||||
private static SaInterface GetSystemInterfaceByType(ISbmUserContext_Core userContext, short interfaceType, String caption)
|
||||
{
|
||||
return GetInterfaceByCategoryType(userContext, SaInterfaceCategory.System, interfaceType, caption);
|
||||
}
|
||||
private static SaInterface GetInterfaceByCategoryType(ISbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType, String caption)
|
||||
private static SaInterface GetInterfaceByCategoryType(ISbmUserContext_Core userContext, SaInterfaceCategory interfaceCategory, short interfaceType, String caption)
|
||||
{
|
||||
SaInterface saInterface = null;
|
||||
SaInterface.Params prmInterface = new SaInterface.Params();
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
}
|
||||
public new class Config : SbmProcess_Base.Config
|
||||
{
|
||||
protected Config(ISbmUserContext userContext) : base(userContext)
|
||||
protected Config(ISbmUserContext_Core userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
public SysId InterfaceId { get; set; }
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
// Configuration.
|
||||
public new class Config : SbmInterfaceProcess.Config
|
||||
{
|
||||
public Config(ISbmUserContext userContext) : base(userContext)
|
||||
public Config(ISbmUserContext_Core userContext) : base(userContext)
|
||||
{
|
||||
ItemType = Sbm.ItemType.Commodity;
|
||||
ProcessType = ProcessType.ExportData;
|
||||
@@ -1072,7 +1072,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
Export_Commodities,
|
||||
}
|
||||
/// <summary>Configure processing options.</summary>
|
||||
public static List<SaProcess_Base.GroupData> GetProcessingOptions(ISbmUserContext userContext, SaInterface interfaceObj)
|
||||
public static List<SaProcess_Base.GroupData> GetProcessingOptions(ISbmUserContext_Core userContext, SaInterface interfaceObj)
|
||||
{
|
||||
List<SaProcess_Base.GroupData> optionGroups = new List<SaProcess_Base.GroupData>();
|
||||
|
||||
@@ -1087,7 +1087,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Process interface using selected options.</summary>
|
||||
public static SbmInterfaceProcess ConfigureProcess(ISbmUserContext userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
||||
public static SbmInterfaceProcess ConfigureProcess(ISbmUserContext_Core userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
||||
{
|
||||
if (processGroup.OptionGroup.Type == (int)InterfaceProcessGroup.Export)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@ using Sarand.Net.Standard.Base.ItemOptions;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Proc.Procs;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
{
|
||||
@@ -38,11 +40,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
public new class Config : SaProcess.Config
|
||||
{
|
||||
protected Config(ISbmUserContext userContext) : base(userContext.DbUpdateInfo)
|
||||
protected Config(ISbmUserContext_Core userContext) : base(userContext.DbUpdateInfo)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public ISbmUserContext_Core UserContext { get; }
|
||||
/// <summary>Specific type of data item being handled.</summary>
|
||||
public Sbm.ItemType ItemType { get; set; } = Sbm.ItemType.Unknown;
|
||||
/// <summary>Format to import/export data.</summary>
|
||||
@@ -104,7 +106,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
}
|
||||
// Context.
|
||||
public ISbmUserContext UserContext { get { return config.UserContext; } }
|
||||
public ISbmUserContext_Core UserContext { get { return config.UserContext; } }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
protected SbmInternals Internals
|
||||
{
|
||||
@@ -119,11 +121,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
}
|
||||
protected SbmAccountsDfn AccountsDfn { get { return Internals.AccountsDfn; } }
|
||||
protected DbUpdateInfo DbUpdateInfo { get { return Internals.DbUpdateInfo; } }
|
||||
protected new DbUpdateInfo DbUpdateInfo { get { return Internals.DbUpdateInfo; } }
|
||||
// Excel export.
|
||||
public static Color ExcelColumnHeadingColor { get; } = Color.LightYellow;
|
||||
// Security.
|
||||
protected ISbmSecurityProfile SecurityProfile { get { return Internals.SecurityProfile; } }
|
||||
protected ISbmSecurityProfile_Core SecurityProfile { get { return Internals.SecurityProfile; } }
|
||||
protected bool UserCanUpdateContacts { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateContacts); } }
|
||||
protected bool UserCanCreateContacts { get { return (SecurityProfile != null && SecurityProfile.UserCanCreateContacts); } }
|
||||
protected bool UserCanViewFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanViewFinancials()); } }
|
||||
@@ -155,12 +157,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
// Configurations.
|
||||
protected SbmStockControlConfig StockControlConfig { get { return Internals.StockControlConfig; } }
|
||||
protected SbmRequirementCostingConfig RequirementCostingConfig { get { return Internals.RequirementCostingConfig; } }
|
||||
// Currencies.
|
||||
// Reference data.
|
||||
protected List<SaCurrency> GetCurrencies()
|
||||
{
|
||||
return Internals.GetCurrencies();
|
||||
}
|
||||
|
||||
protected SaCurrency GetCurrencyById(SysId currencyId)
|
||||
{
|
||||
return Internals.GetCurrencyById(currencyId);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
// Configuration.
|
||||
public new class Config : SbmProcess_Base.Config
|
||||
{
|
||||
public Config(ISbmUserContext userContext) : base(userContext)
|
||||
public Config(ISbmUserContext_Core userContext) : base(userContext)
|
||||
{
|
||||
ItemType = Sbm.ItemType.Commodity;
|
||||
DataFormat = DataFormatType.Excel;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
// Configuration.
|
||||
public new class Config : SbmReport_Base.Config
|
||||
{
|
||||
protected Config(ISbmUserContext userContext) :
|
||||
protected Config(ISbmUserContext_Core userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -21,144 +21,25 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
public SbmAppConfig(String context, ConfigurationSection configSection, SbmAppConfig defaultConfig)
|
||||
{
|
||||
Context = context;
|
||||
populateDefaults(defaultConfig);
|
||||
PopulateDefaults(defaultConfig);
|
||||
PopulateConfig(configSection);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
private void populateDefaults(SbmAppConfig defaultConfig)
|
||||
{
|
||||
if (defaultConfig == null) return;
|
||||
Security.Password.MinLength = defaultConfig.Security.Password.MinLength;
|
||||
Security.SignIn.KeepLoggedIn.Allowed = defaultConfig.Security.SignIn.KeepLoggedIn.Allowed;
|
||||
Security.SignIn.KeepLoggedIn.CookieExpiresDays = defaultConfig.Security.SignIn.KeepLoggedIn.CookieExpiresDays;
|
||||
}
|
||||
private void PopulateConfig(ConfigurationSection configSection)
|
||||
{
|
||||
if (configSection != null)
|
||||
{
|
||||
// Environments.
|
||||
foreach (ConfigurationSection environmentSection in configSection.GetSection("Environments").GetChildren())
|
||||
environments.Add(StringUtil.TrimAll(environmentSection.Value));
|
||||
Instance = StringUtil.OnEmpty(configSection["Instance"], Instance);
|
||||
// Security.
|
||||
IConfigurationSection securitySection = configSection.GetSection("Security");
|
||||
if (securitySection.Exists())
|
||||
{
|
||||
// Security - Password.
|
||||
IConfigurationSection securityPasswordSection = securitySection.GetSection("Password");
|
||||
if (securityPasswordSection.Exists())
|
||||
{
|
||||
Security.Password.MinLength = StringUtil.ToInt(securityPasswordSection["MinLength"], Security.Password.MinLength);
|
||||
}
|
||||
// Security - Sign-Up.
|
||||
IConfigurationSection securitySignUpSection = securitySection.GetSection("SignUp");
|
||||
if (securitySignUpSection.Exists())
|
||||
{
|
||||
}
|
||||
// Security - Sign-In.
|
||||
IConfigurationSection securitySignInSection = securitySection.GetSection("SignIn");
|
||||
if (securitySignInSection.Exists())
|
||||
{
|
||||
IConfigurationSection keepLoggedInSection = securitySignInSection.GetSection("SignIn");
|
||||
if (keepLoggedInSection.Exists())
|
||||
{
|
||||
Security.SignIn.KeepLoggedIn.Allowed = StringUtil.ToBool(StringUtil.OnEmpty(keepLoggedInSection["Allowed"], Security.SignIn.KeepLoggedIn.Allowed.ToString()));
|
||||
Security.SignIn.KeepLoggedIn.CookieExpiresDays = StringUtil.ToInt(keepLoggedInSection["CookieExpiresDays"], Security.SignIn.KeepLoggedIn.CookieExpiresDays);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Email.
|
||||
IConfigurationSection emailSection = configSection.GetSection("Email");
|
||||
if (emailSection.Exists())
|
||||
{
|
||||
Email.Context = emailSection["Context"];
|
||||
PopulateEmailConfig(Email.ContactUs, emailSection.GetSection("ContactUs"));
|
||||
PopulateEmailConfig(Email.Signup_Activate, emailSection.GetSection("Signup").GetSection("Activate"));
|
||||
PopulateEmailConfig(Email.Signup_Welcome, emailSection.GetSection("Signup").GetSection("Welcome"));
|
||||
}
|
||||
|
||||
// Documents.
|
||||
IConfigurationSection documentsSection = configSection.GetSection("Documents");
|
||||
if (documentsSection.Exists())
|
||||
{
|
||||
Documents.RootFolder = StringUtil.OnEmpty(documentsSection["RootFolder"], Documents.RootFolder);
|
||||
}
|
||||
|
||||
// Logging.
|
||||
IConfigurationSection loggingSection = configSection.GetSection("Logging");
|
||||
if (loggingSection.Exists())
|
||||
{
|
||||
Logging.RootFolder = StringUtil.OnEmpty(loggingSection["RootFolder"], Logging.RootFolder);
|
||||
}
|
||||
|
||||
// Control database.
|
||||
IConfigurationSection controlDatabaseSection = configSection.GetSection("ControlDatabase");
|
||||
if (controlDatabaseSection.Exists())
|
||||
{
|
||||
ControlDatabase = new DatabaseConfig();
|
||||
extractDatabaseConfig(ControlDatabase, controlDatabaseSection);
|
||||
}
|
||||
// Template database.
|
||||
IConfigurationSection templateDatabaseSection = configSection.GetSection("TemplateDatabase");
|
||||
if (templateDatabaseSection.Exists())
|
||||
{
|
||||
TemplateDatabase = new DatabaseConfig();
|
||||
extractDatabaseConfig(TemplateDatabase, templateDatabaseSection);
|
||||
}
|
||||
// BusinessMgr databases.
|
||||
IConfigurationSection busMgrDatabasesSection = configSection.GetSection("BusMgrDatabases");
|
||||
if (busMgrDatabasesSection.Exists())
|
||||
{
|
||||
foreach (IConfigurationSection busMgrDbSection in busMgrDatabasesSection.GetChildren())
|
||||
{
|
||||
SbmAppConfig.DatabaseConfig dbConfig = new SbmAppConfig.DatabaseConfig();
|
||||
extractDatabaseConfig(dbConfig, busMgrDbSection);
|
||||
BusMgrDatabases.Add(dbConfig);
|
||||
}
|
||||
}
|
||||
|
||||
// Variants.
|
||||
foreach (ConfigurationSection variantSection in configSection.GetSection("Variants").GetChildren())
|
||||
{
|
||||
// Variants override selected values but must match the application root folder to identify a specific instance.
|
||||
String applicationRootPath = variantSection["ApplicationRootFolder"];
|
||||
if (StringUtil.IsEmpty(applicationRootPath)) continue;
|
||||
if (!SbmSystem.ApplicationFolder.EqualsCI(applicationRootPath)) continue;
|
||||
PopulateConfig(variantSection);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void PopulateEmailConfig(EmailConfig.SpecificEmailConfig config, IConfigurationSection emailSection)
|
||||
{
|
||||
if (!emailSection.Exists()) return;
|
||||
foreach (var addressTo in emailSection.GetSection("AddressesTo").GetChildren())
|
||||
config.AddressesTo.Add(StringUtil.TrimAll(addressTo.Value));
|
||||
foreach (var addressCc in emailSection.GetSection("AddressesCc").GetChildren())
|
||||
config.AddressesCc.Add(StringUtil.TrimAll(addressCc.Value));
|
||||
foreach (var addressBcc in emailSection.GetSection("AddressesBcc").GetChildren())
|
||||
config.AddressesBcc.Add(StringUtil.TrimAll(addressBcc.Value));
|
||||
}
|
||||
private void extractDatabaseConfig(DatabaseConfig database, IConfigurationSection databaseSection)
|
||||
{
|
||||
if (!databaseSection.Exists()) return;
|
||||
IConfigurationSection identifiersSection = databaseSection.GetSection("Identifiers");
|
||||
if (identifiersSection.Exists())
|
||||
{
|
||||
foreach (var identifier in identifiersSection.GetChildren())
|
||||
database.Identifiers.Add(StringUtil.TrimAll(identifier.Value));
|
||||
}
|
||||
database.Location = StringUtil.OnEmpty(databaseSection["Location"], database.Location);
|
||||
database.User = StringUtil.OnEmpty(databaseSection["User"], database.User);
|
||||
database.Password = StringUtil.OnEmpty(databaseSection["Password"], database.Password);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Properties.
|
||||
public String Context { get; }
|
||||
public List<String> Environments { get { return new List<String>(environments); } }
|
||||
public String Instance { get; set; } = "";
|
||||
// URLs.
|
||||
public class URLConfig
|
||||
{
|
||||
public class PortalConfig
|
||||
{
|
||||
public String Root { get; set; }
|
||||
}
|
||||
public PortalConfig Portal { get; } = new PortalConfig();
|
||||
}
|
||||
public URLConfig URL { get; } = new URLConfig();
|
||||
// Security.
|
||||
public class SecurityConfig
|
||||
{
|
||||
@@ -232,6 +113,155 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
public LoggingConfig Logging { get; } = new LoggingConfig();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
private void PopulateDefaults(SbmAppConfig defaultConfig)
|
||||
{
|
||||
if (defaultConfig == null) return;
|
||||
Security.Password.MinLength = defaultConfig.Security.Password.MinLength;
|
||||
Security.SignIn.KeepLoggedIn.Allowed = defaultConfig.Security.SignIn.KeepLoggedIn.Allowed;
|
||||
Security.SignIn.KeepLoggedIn.CookieExpiresDays = defaultConfig.Security.SignIn.KeepLoggedIn.CookieExpiresDays;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
private void PopulateConfig(ConfigurationSection configSection)
|
||||
{
|
||||
if (configSection != null)
|
||||
{
|
||||
// Environments.
|
||||
foreach (ConfigurationSection environmentSection in configSection.GetSection("Environments").GetChildren())
|
||||
environments.Add(StringUtil.TrimAll(environmentSection.Value));
|
||||
Instance = StringUtil.OnEmpty(configSection["Instance"], Instance);
|
||||
|
||||
// URLs.
|
||||
IConfigurationSection urls = configSection.GetSection("URLs");
|
||||
if (urls.Exists())
|
||||
{
|
||||
IConfigurationSection portalUrls = urls.GetSection("Portal");
|
||||
if (portalUrls.Exists())
|
||||
{
|
||||
URL.Portal.Root = portalUrls["Root"];
|
||||
}
|
||||
}
|
||||
|
||||
// Security.
|
||||
IConfigurationSection securitySection = configSection.GetSection("Security");
|
||||
if (securitySection.Exists())
|
||||
{
|
||||
// Security - Password.
|
||||
IConfigurationSection securityPasswordSection = securitySection.GetSection("Password");
|
||||
if (securityPasswordSection.Exists())
|
||||
{
|
||||
Security.Password.MinLength = StringUtil.ToInt(securityPasswordSection["MinLength"], Security.Password.MinLength);
|
||||
}
|
||||
// Security - Sign-Up.
|
||||
IConfigurationSection securitySignUpSection = securitySection.GetSection("SignUp");
|
||||
if (securitySignUpSection.Exists())
|
||||
{
|
||||
}
|
||||
// Security - Sign-In.
|
||||
IConfigurationSection securitySignInSection = securitySection.GetSection("SignIn");
|
||||
if (securitySignInSection.Exists())
|
||||
{
|
||||
IConfigurationSection keepLoggedInSection = securitySignInSection.GetSection("SignIn");
|
||||
if (keepLoggedInSection.Exists())
|
||||
{
|
||||
Security.SignIn.KeepLoggedIn.Allowed = StringUtil.ToBool(StringUtil.OnEmpty(keepLoggedInSection["Allowed"], Security.SignIn.KeepLoggedIn.Allowed.ToString()));
|
||||
Security.SignIn.KeepLoggedIn.CookieExpiresDays = StringUtil.ToInt(keepLoggedInSection["CookieExpiresDays"], Security.SignIn.KeepLoggedIn.CookieExpiresDays);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Email.
|
||||
IConfigurationSection emailSection = configSection.GetSection("Email");
|
||||
if (emailSection.Exists())
|
||||
{
|
||||
Email.Context = emailSection["Context"];
|
||||
PopulateEmailConfig(Email.ContactUs, emailSection.GetSection("ContactUs"));
|
||||
PopulateEmailConfig(Email.Signup_Activate, emailSection.GetSection("Signup").GetSection("Activate"));
|
||||
PopulateEmailConfig(Email.Signup_Welcome, emailSection.GetSection("Signup").GetSection("Welcome"));
|
||||
}
|
||||
|
||||
// Documents.
|
||||
IConfigurationSection documentsSection = configSection.GetSection("Documents");
|
||||
if (documentsSection.Exists())
|
||||
{
|
||||
Documents.RootFolder = StringUtil.OnEmpty(documentsSection["RootFolder"], Documents.RootFolder);
|
||||
}
|
||||
|
||||
// Logging.
|
||||
IConfigurationSection loggingSection = configSection.GetSection("Logging");
|
||||
if (loggingSection.Exists())
|
||||
{
|
||||
Logging.RootFolder = StringUtil.OnEmpty(loggingSection["RootFolder"], Logging.RootFolder);
|
||||
}
|
||||
|
||||
// Control database.
|
||||
IConfigurationSection controlDatabaseSection = configSection.GetSection("ControlDatabase");
|
||||
if (controlDatabaseSection.Exists())
|
||||
{
|
||||
ControlDatabase = new DatabaseConfig();
|
||||
ExtractDatabaseConfig(ControlDatabase, controlDatabaseSection);
|
||||
}
|
||||
|
||||
// Template database.
|
||||
IConfigurationSection templateDatabaseSection = configSection.GetSection("TemplateDatabase");
|
||||
if (templateDatabaseSection.Exists())
|
||||
{
|
||||
TemplateDatabase = new DatabaseConfig();
|
||||
ExtractDatabaseConfig(TemplateDatabase, templateDatabaseSection);
|
||||
}
|
||||
|
||||
// BusinessMgr databases.
|
||||
IConfigurationSection busMgrDatabasesSection = configSection.GetSection("BusMgrDatabases");
|
||||
if (busMgrDatabasesSection.Exists())
|
||||
{
|
||||
foreach (IConfigurationSection busMgrDbSection in busMgrDatabasesSection.GetChildren())
|
||||
{
|
||||
SbmAppConfig.DatabaseConfig dbConfig = new SbmAppConfig.DatabaseConfig();
|
||||
ExtractDatabaseConfig(dbConfig, busMgrDbSection);
|
||||
BusMgrDatabases.Add(dbConfig);
|
||||
}
|
||||
}
|
||||
|
||||
// Variants.
|
||||
foreach (ConfigurationSection variantSection in configSection.GetSection("Variants").GetChildren())
|
||||
{
|
||||
// Variants override selected values but must match the application root folder to identify a specific instance.
|
||||
String applicationRootPath = variantSection["ApplicationRootFolder"];
|
||||
if (StringUtil.IsEmpty(applicationRootPath)) continue;
|
||||
if (!SbmSystem.ApplicationFolder.EqualsCI(applicationRootPath)) continue;
|
||||
PopulateConfig(variantSection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
private void PopulateEmailConfig(EmailConfig.SpecificEmailConfig config, IConfigurationSection emailSection)
|
||||
{
|
||||
if (!emailSection.Exists()) return;
|
||||
foreach (var addressTo in emailSection.GetSection("AddressesTo").GetChildren())
|
||||
config.AddressesTo.Add(StringUtil.TrimAll(addressTo.Value));
|
||||
foreach (var addressCc in emailSection.GetSection("AddressesCc").GetChildren())
|
||||
config.AddressesCc.Add(StringUtil.TrimAll(addressCc.Value));
|
||||
foreach (var addressBcc in emailSection.GetSection("AddressesBcc").GetChildren())
|
||||
config.AddressesBcc.Add(StringUtil.TrimAll(addressBcc.Value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
private void ExtractDatabaseConfig(DatabaseConfig database, IConfigurationSection databaseSection)
|
||||
{
|
||||
if (!databaseSection.Exists()) return;
|
||||
IConfigurationSection identifiersSection = databaseSection.GetSection("Identifiers");
|
||||
if (identifiersSection.Exists())
|
||||
{
|
||||
foreach (var identifier in identifiersSection.GetChildren())
|
||||
database.Identifiers.Add(StringUtil.TrimAll(identifier.Value));
|
||||
}
|
||||
database.Location = StringUtil.OnEmpty(databaseSection["Location"], database.Location);
|
||||
database.User = StringUtil.OnEmpty(databaseSection["User"], database.User);
|
||||
database.Password = StringUtil.OnEmpty(databaseSection["Password"], database.Password);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -3,6 +3,7 @@ using Sarand.BusinessMgr.Net.Core.Web.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -101,46 +102,42 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
return SbmConfigConsole.CreateConsole(sessionContext);
|
||||
}
|
||||
public override SaDiaryConsole CreateDiaryConsole(ISbmUserContext userContext)
|
||||
public override SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaSecurityConsole CreateSecurityConsole(ISbmUserContext userContext)
|
||||
public override SaSecurityConsole CreateSecurityConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return new SbmSecurityConsole_Web(userContext);
|
||||
}
|
||||
public override SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext userContext)
|
||||
public override SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return new SbmCodeTypeConsole_Web(userContext);
|
||||
}
|
||||
public override SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext userContext)
|
||||
public override SaItemDataConsole CreateItemDataConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaItemDataConsole CreateItemDataConsole(ISbmUserContext userContext)
|
||||
public override SaItemDocConsole CreateItemDocConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaItemDocConsole CreateItemDocConsole(ISbmUserContext userContext)
|
||||
public override SaItemOptionConsole CreateItemOptionConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaItemOptionConsole CreateItemOptionConsole(ISbmUserContext userContext)
|
||||
public override SaInterfaceConsole CreateInterfaceConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaInterfaceConsole CreateInterfaceConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserContext userContext)
|
||||
public override SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return new SbmUpdateLogConsole_Web(userContext);
|
||||
}
|
||||
public override SbmEmailConsole CreateEmailConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmEmailConsole_Web(EmailConfig);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
using DocumentFormat.OpenXml.Drawing.Diagrams;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmInstanceConfig_Web : SbmInstanceConfig
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly SysId controlOwnerId;
|
||||
private readonly SysId controlRepositoryId;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmInstanceConfig_Web(SysId controlOwnerId, SysId controlRepositoryId)
|
||||
{
|
||||
this.controlOwnerId = controlOwnerId;
|
||||
this.controlRepositoryId = controlRepositoryId;
|
||||
PopulateControlParams();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Populate Repository Configuration parameters.
|
||||
private void PopulateControlParams()
|
||||
{
|
||||
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
|
||||
{
|
||||
SbmcItemMgr controlItemMgr = SbmGlobals_Web.System.CreateControlItemMgr();
|
||||
if (controlItemMgr != null)
|
||||
{
|
||||
disposables.Add(controlItemMgr);
|
||||
PopulateControlParams(controlItemMgr, new ItemId((short)SbmcHierarchyItem.ItemType.Owner, controlOwnerId));
|
||||
PopulateControlParams(controlItemMgr, new ItemId((short)SbmcHierarchyItem.ItemType.Repository, controlRepositoryId));
|
||||
}
|
||||
}
|
||||
}
|
||||
private void PopulateControlParams(SbmcItemMgr controlItemMgr, ItemId paramItemId)
|
||||
{
|
||||
if (!ItemId.IsValid(paramItemId)) return;
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
// Query item params.
|
||||
SbmcItemParam.Params prmParam = new SbmcItemParam.Params();
|
||||
prmParam.ItemIdsIncluded.Add(paramItemId);
|
||||
prmParam.StatusCat = SbmcItemParam.StatusCat.ActiveOnly;
|
||||
List<SbmcItemParam> itemParams = controlItemMgr.GetItemParamList(prmParam);
|
||||
disposables.AddRange(itemParams);
|
||||
foreach (SbmcItemParam itemParam in itemParams)
|
||||
PopulateControlParam(itemParam);
|
||||
}
|
||||
}
|
||||
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))
|
||||
{
|
||||
Sbm.ConfigOption option = EnumUtil.ParseEnum(itemParam.Name, Sbm.ConfigOption.Unknown);
|
||||
if (option != Sbm.ConfigOption.Unknown)
|
||||
{
|
||||
if (itemParam.Value.EqualsCI(ApplicationOptionValue_Allow))
|
||||
ApplicationOptions_Allowed.Add(option);
|
||||
else if (itemParam.Value.EqualsCI(ApplicationOptionValue_Disallow))
|
||||
ApplicationOptions_Disallowed.Add(option);
|
||||
else if (itemParam.Value.EqualsCI(ApplicationOptionValue_Default))
|
||||
ApplicationOptions_Default.Add(option);
|
||||
else
|
||||
SaLogger.Warn($"{SysUtil.Fn} Unrecognised application option value: {itemParam.Value}. Option: {option}.");
|
||||
}
|
||||
else
|
||||
SaLogger.Warn($"{SysUtil.Fn} Unrecognised application option: {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)
|
||||
{
|
||||
if (AffiliateTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (AffiliateTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (AssociationTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (AssociationTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (TransactionTypes_Disallowed.Contains(affiliateType)) return false;
|
||||
if (TransactionTypes_Allowed.Contains(affiliateType)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
// Supported application options.
|
||||
private readonly HashSet<Sbm.ConfigOption> ApplicationOptions_Allowed = new HashSet<Sbm.ConfigOption>();
|
||||
private readonly HashSet<Sbm.ConfigOption> ApplicationOptions_Disallowed = new HashSet<Sbm.ConfigOption>();
|
||||
private readonly HashSet<Sbm.ConfigOption> ApplicationOptions_Default = new HashSet<Sbm.ConfigOption>();
|
||||
public override bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse)
|
||||
{
|
||||
if (ApplicationOptions_Disallowed.Contains(option)) return false;
|
||||
if (ApplicationOptions_Allowed.Contains(option)) return true;
|
||||
if (ApplicationOptions_Default.Contains(option)) return defaultResponse;
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -28,14 +28,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
// Properties.
|
||||
public abstract IStringLocalizer MainProperties { get; }
|
||||
public virtual List<IStringLocalizer> AlternativeProperties { get; } = new List<IStringLocalizer>();
|
||||
private HashSet<String> MissingKeysLogged { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Generic phrase translation.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Retrieve localised text.</summary>
|
||||
public LocalizedString GetText(string key)
|
||||
public LocalizedString GetText(string key, bool logMissingKey = true)
|
||||
{
|
||||
return GetText(key, new object[] { });
|
||||
return GetText(key, new object[] { }, logMissingKey );
|
||||
}
|
||||
public LocalizedString GetText(string key, object param)
|
||||
{
|
||||
@@ -45,21 +46,25 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
return GetText(key, new object[] { param1, param2 });
|
||||
}
|
||||
public LocalizedString GetText(string key, object[] parameters)
|
||||
public LocalizedString GetText(string key, object[] parameters, bool logMissingKey = true)
|
||||
{
|
||||
LocalizedString text = MainProperties.GetString(key, parameters);
|
||||
if (text.ResourceNotFound)
|
||||
{
|
||||
SaLogger.Debug($"{SysUtil.Fn} Key not found: {key}");
|
||||
// Look up key in alternative property files.
|
||||
foreach (IStringLocalizer properties in AlternativeProperties ?? new List<IStringLocalizer>())
|
||||
{
|
||||
text = properties.GetString(key, parameters);
|
||||
if (!text.ResourceNotFound)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return text;
|
||||
if (text.ResourceNotFound)
|
||||
{
|
||||
// Look up key in alternative property files.
|
||||
foreach (IStringLocalizer properties in AlternativeProperties ?? new List<IStringLocalizer>())
|
||||
{
|
||||
text = parameters == null || parameters.IsEmpty() ? properties.GetString(key) : properties.GetString(key, parameters);
|
||||
if (!text.ResourceNotFound)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (text.ResourceNotFound && logMissingKey && !MissingKeysLogged.Contains(key))
|
||||
{
|
||||
MissingKeysLogged.Add(key);
|
||||
SaLogger.Debug($"{SysUtil.Fn} Key not found: {key}");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Square bracket indexing.
|
||||
@@ -127,12 +132,17 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Specific phrase translation.
|
||||
// Code descriptions.
|
||||
//-------------------------------------------------------------------
|
||||
private class CodeCache
|
||||
{
|
||||
public List<TypeCodeDesc> affiliateTypeCodes;
|
||||
// To be completed.
|
||||
public Dictionary<Sbm.SystemCode, List<TypeCodeDesc>> codes { get; } = new Dictionary<Sbm.SystemCode, List<TypeCodeDesc>>();
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode codeType)
|
||||
{
|
||||
if (!codes.ContainsKey(codeType))
|
||||
codes.Add(codeType, SbmSystem.GetCodesOfType(null, codeType));
|
||||
return codes.GetValueOrDefault(codeType, new List<TypeCodeDesc>());
|
||||
}
|
||||
}
|
||||
private CodeCache codes = new CodeCache();
|
||||
|
||||
@@ -144,13 +154,21 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
|
||||
// Affiliate Type.
|
||||
public String GetAffiliateTypeTypeCaption(Sbm.AffiliateType participation)
|
||||
public String GetAffiliateTypeCaption(Sbm.AffiliateType affiliateType)
|
||||
{
|
||||
if ((int)participation < 1) return "";
|
||||
if (codes.affiliateTypeCodes == null)
|
||||
codes.affiliateTypeCodes = SbmSystem.GetCodesOfType(null, Sbm.SystemCode.AffiliateType);
|
||||
if ((int)affiliateType < 1) return "";
|
||||
// ToDo Affiliate Type localisation.
|
||||
return codes.affiliateTypeCodes.GetDescForType(participation);
|
||||
List<TypeCodeDesc> affiliateTypeCodes = codes.GetCodesOfType(Sbm.SystemCode.AffiliateType);
|
||||
return affiliateTypeCodes.GetDescForType(affiliateType, affiliateTypeCodes.GetCodeForType(affiliateType));
|
||||
}
|
||||
|
||||
// Asset Type.
|
||||
public String GetAssetTypeCaption(Sbm.AssetType assetType)
|
||||
{
|
||||
if ((int)assetType < 1) return "";
|
||||
// ToDo Asset Type localisation.
|
||||
List<TypeCodeDesc> assetTypeCodes = codes.GetCodesOfType(Sbm.SystemCode.AssetType);
|
||||
return assetTypeCodes.GetDescForType(assetType, assetTypeCodes.GetCodeForType(assetType));
|
||||
}
|
||||
|
||||
// To be completed.
|
||||
|
||||
@@ -11,32 +11,25 @@ using System.Text;
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmSessionData_Web : SbmSessionData, ISbmUserContext
|
||||
public abstract class SbmSessionData_Web : SbmSessionData
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction - for JSON deserialisation.
|
||||
protected SbmSessionData_Web(long sessionIdx, int itemIdx, SbmSessionContext sessionContext) :
|
||||
base(sessionIdx, itemIdx, sessionContext)
|
||||
{
|
||||
securityProfile = new SbmSecurityProfile(this, false);
|
||||
}
|
||||
// Protected construction.
|
||||
protected SbmSessionData_Web(SbmSessionContext sessionContext) :
|
||||
base(sessionContext)
|
||||
{
|
||||
securityProfile = new SbmSecurityProfile(this, false);
|
||||
}
|
||||
// Protected construction.
|
||||
protected SbmSessionData_Web(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations, SbmAssociation associationOrganisation, SbmAffiliate affiliateOrganisation) :
|
||||
base(sessionContext, securityItemUser, affiliateUser, supervisedOrganisations, associationOrganisation, affiliateOrganisation)
|
||||
{
|
||||
securityProfile = new SbmSecurityProfile(this, false);
|
||||
}
|
||||
// Protected construction.
|
||||
protected SbmSessionData_Web(SbmSessionContext sessionContext) :
|
||||
base(sessionContext)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security Profile.
|
||||
private readonly SbmSecurityProfile securityProfile;
|
||||
public ISbmSecurityProfile SecurityProfile { get { return securityProfile; } }
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
[JsonIgnore]
|
||||
public abstract bool KeepLoggedIn { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// ToDo: Organisation configuration.
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.App;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
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 SbmCodeTypeConsole_Web : SbmCodeTypeConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmCodeTypeConsole_Web(ISbmUserContext_Core userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected override MaintainCodeTypesFunction MaintainCodeTypesFn => throw new NotImplementedException();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction.
|
||||
public SbmEmailConsole_Web(SbmEmailConfig emailConfig) :
|
||||
protected SbmEmailConsole_Web(SbmEmailConfig emailConfig) :
|
||||
base(emailConfig)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSecurityConsole_Web(ISbmUserContext userContext) : base(userContext)
|
||||
public SbmSecurityConsole_Web(ISbmUserContext_Core 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 userContext) : base(userContext)
|
||||
public SbmUpdateLogConsole_Web(ISbmUserContext_Core userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -7,6 +7,7 @@ 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.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -31,14 +32,14 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
//=======================================================================
|
||||
public abstract class SbmController_Base : SaController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmInternals internals;
|
||||
private SbmSysParamCache sysParamCache = null;
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmInternals internals;
|
||||
private SbmInternals_Control internals_Control;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction.
|
||||
protected SbmController_Base(SbmLocaliser localiser)
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction.
|
||||
protected SbmController_Base(SbmLocaliser localiser)
|
||||
{
|
||||
Localiser = localiser;
|
||||
|
||||
@@ -51,26 +52,26 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (sysParamCache != null) sysParamCache.Dispose();
|
||||
sysParamCache = null;
|
||||
if (internals != null) internals.Dispose();
|
||||
internals = null;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
if (internals != null) internals.Dispose();
|
||||
internals = null;
|
||||
if (internals_Control != null) internals_Control.Dispose();
|
||||
internals_Control = null;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
protected SbmLocaliser Localiser { get; }
|
||||
public SbmLocaliser Localiser { get; }
|
||||
protected SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
|
||||
public SbmAppConfig AppConfig { get { return App.AppConfig; } }
|
||||
public abstract SbmSessionContext SessionContext { get; }
|
||||
public abstract ISbmUserContext UserContext { get; }
|
||||
// Business components.
|
||||
public SbmInternals Internals { get { if (internals == null) internals = new SbmInternals(UserContext); return internals; } }
|
||||
protected SbmSysParamCache SysParamCache { get { if (sysParamCache == null) sysParamCache = new SbmSysParamCache(UserContext); return sysParamCache; } }
|
||||
// Managers.
|
||||
public SbmAccountMgr AccountMgr { get { return Internals.AccountMgr; } }
|
||||
public abstract ISbmUserContext_Core UserContext_Core { get; }
|
||||
// Business components.
|
||||
public SbmInternals Internals { get { if (internals == 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; } }
|
||||
@@ -78,6 +79,10 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
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 SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } }
|
||||
public SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
|
||||
@@ -103,24 +108,12 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
//-------------------------------------------------------------------
|
||||
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : ""));
|
||||
|
||||
//if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : ""));
|
||||
base.OnActionExecuting(filterContext);
|
||||
}
|
||||
public override void OnActionExecuted(ActionExecutedContext filterContext)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : ""));
|
||||
|
||||
// ToDo Store system params.
|
||||
if (sysParamCache != null)
|
||||
{
|
||||
if (sysParamCache.Modified)
|
||||
{
|
||||
sysParamCache.Store();
|
||||
SaLogger.Info($"{SysUtil.Fn} User params stored.");
|
||||
}
|
||||
}
|
||||
|
||||
//if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : ""));
|
||||
base.OnActionExecuted(filterContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,14 +66,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override SbmSessionContext SessionContext { get { return SessionData?.SessionContext ?? null; } }
|
||||
public override ISbmUserContext UserContext { get { return SessionData; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Action execution events.
|
||||
//-------------------------------------------------------------------
|
||||
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : ""));
|
||||
//if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : ""));
|
||||
|
||||
// Refreh model properties.
|
||||
SbmModel_Base baseModel = ViewData.Model as SbmModel_Base;
|
||||
@@ -83,7 +82,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
}
|
||||
public override void OnActionExecuted(ActionExecutedContext filterContext)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : ""));
|
||||
//if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : ""));
|
||||
|
||||
// Refreh model properties.
|
||||
SbmModel_Base baseModel = ViewData.Model as SbmModel_Base;
|
||||
@@ -133,10 +132,21 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
model.RedirectLocation.Home_SessionExpired = GetRedirectLocation(RedirectLocation.WebAppHome_SessionExpired);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Online encryption parameters.
|
||||
//-------------------------------------------------------------------
|
||||
// Portal Request Password encryption parameters (key & IV) are defined in
|
||||
// the base Controller so that they can be shared with the Admin application.
|
||||
// NB IV value is generated from the key and fixed so that it doesn't change when the application restarts.
|
||||
// IV Must be regenerated if key is changed.
|
||||
protected static String Base64Key_RequestPassword_Portal { get; } = SacsEncryptionHelper.EncodePlainKey("[5Abus1neSSmGR~Request#Password}", SacsEncryptionHelper.KeyLength);
|
||||
//private static String Base64IV_RequestPassword_Generated_Portal = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_RequestPassword_Portal);
|
||||
protected static String Base64IV_RequestPassword_Portal { get; } = "8TRhBayBJZmACQ6pld1F9A==";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Session.
|
||||
//-------------------------------------------------------------------
|
||||
public bool ValidUserSession { get { return SessionData?.ValidUserSession ?? false; } }
|
||||
public bool ValidUserSession { get { return SessionData?.ValidUser ?? false; } }
|
||||
public DbUpdateInfo DbUpdateInfo { get { return SessionData?.DbUpdateInfo ?? new DbUpdateInfo(null, "", SbmSystem.ComputerName); } }
|
||||
// Referrer.
|
||||
public String Referer { get { return Request.Headers["Referer"].ToString(); } }
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
|
||||
//-------------------------------------------------------------------
|
||||
// Session Contexts.
|
||||
//-------------------------------------------------------------------
|
||||
public static SbmSessionContext GetSessionContext (ushort idx)
|
||||
public static SbmSessionContext GetSessionContext(ushort idx)
|
||||
{
|
||||
SbmApplication_Web app = SbmGlobals_Web.Application;
|
||||
return app.GetSessionContext(idx);
|
||||
@@ -57,10 +57,10 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
|
||||
continue;
|
||||
}
|
||||
// Verify Db Identifier.
|
||||
List<string> dbIdentifiers = app.GetDbIdentifiers(sessionContext);
|
||||
HashSet<string> dbIdentifiers = app.GetDbIdentifiers(sessionContext);
|
||||
if (!dbIdentifiers.ContainsCI(dbIdentifier))
|
||||
continue;
|
||||
ISacsDatabase db = app.GetBusMgrDatabase(sessionContext);
|
||||
ISacsDatabase db = app.GetBusMgrDatabase(sessionContext);
|
||||
if (db == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Database for idx: " + sessionContextIdx);
|
||||
|
||||
@@ -5,7 +5,10 @@ using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Controllers;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
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.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -25,76 +28,95 @@ using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmModel_Base : SaModel
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmInternals internals;
|
||||
//=======================================================================
|
||||
public abstract class SbmModel_Base : SaModel
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmInternals internals;
|
||||
private SbmInternals_Control internals_Control;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction.
|
||||
protected SbmModel_Base(SbmLocaliser localiser)
|
||||
{
|
||||
Localiser = localiser;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction.
|
||||
protected SbmModel_Base(SbmLocaliser localiser)
|
||||
{
|
||||
Localiser = localiser;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application properties.
|
||||
private SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
|
||||
protected SbmAppConfig AppConfig { get { return App.AppConfig; } }
|
||||
protected SbmSystem_Web System { get { return App.System_Web; } }
|
||||
public String SessionCookieName { get { return App.SessionCookieName; } }
|
||||
public SbmSessionData SessionData { get { return SessionData_Web; } }
|
||||
public SbmSessionData_Web SessionData_Web { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return SessionData?.SessionContext ?? null; } }
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (internals != null) internals.Dispose();
|
||||
internals = null;
|
||||
if (internals_Control != null) internals_Control.Dispose();
|
||||
internals_Control = null;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application properties.
|
||||
private SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
|
||||
protected SbmAppConfig AppConfig { get { return App.AppConfig; } }
|
||||
protected SbmSystem_Web System { get { return App.System_Web; } }
|
||||
public String SessionCookieName { get { return App.SessionCookieName; } }
|
||||
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 DbUpdateInfo DbUpdateInfo { get { return SessionData?.DbUpdateInfo ?? new DbUpdateInfo(null, "", SbmSystem.ComputerName); } }
|
||||
public SbmLocaliser Localiser { get; }
|
||||
// Request properties.
|
||||
public SbmController_Web Controller { get; set; }
|
||||
public CultureInfo SessionCulture { get { return Controller?.SessionCulture ?? CultureInfo.InvariantCulture; } }
|
||||
public SbmLocaliser Localiser { get; }
|
||||
// Request properties.
|
||||
public SbmController_Web Controller { get; set; }
|
||||
public CultureInfo SessionCulture { get { return Controller?.SessionCulture ?? CultureInfo.InvariantCulture; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Page configuration.
|
||||
public String InstanceVersion { get { return !StringUtil.IsEmpty(App.AppConfig.Instance) ? App.AppConfig.Instance + " v" + Sbm.Version.GetFullVersion() : "v" + Sbm.Version.GetAppVersion(); } }
|
||||
//-------------------------------------------------------------------
|
||||
// Page configuration.
|
||||
public String InstanceVersion { get { return !StringUtil.IsEmpty(App.AppConfig.Instance) ? App.AppConfig.Instance + " v" + Sbm.Version.GetFullVersion() : "v" + Sbm.Version.GetAppVersion(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Business components.
|
||||
// NB Keep these accessors protected to avoid them being called by teh model binding logic before the session data is ready.
|
||||
protected SbmInternals Internals { get { if (internals == null) internals = new SbmInternals(SessionData_Web); return internals; } }
|
||||
// Managers.
|
||||
protected SbmAccountMgr AccountMgr { get { return Internals.AccountMgr; } }
|
||||
protected SbmAssetMgr AssetMgr { get { return Internals.AssetMgr; } }
|
||||
protected SbmCommodityMgr CommodityMgr { get { return Internals.CommodityMgr; } }
|
||||
protected SbmPriceMgr PriceMgr { get { return Internals.PriceMgr; } }
|
||||
protected SbmTransactionMgr TransactionMgr { get { return Internals.TransactionMgr; } }
|
||||
protected SbmStockMgr StockMgr { get { return Internals.StockMgr; } }
|
||||
protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
|
||||
protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
|
||||
//-------------------------------------------------------------------
|
||||
// Business components.
|
||||
// NB Keep these accessors protected to avoid them being called by the model binding logic before the session data is ready.
|
||||
protected SbmInternals Internals { get { if (internals == 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.
|
||||
protected SbmAccountMgr AccountMgr { get { return Internals.AccountMgr; } }
|
||||
protected SbmAssetMgr AssetMgr { get { return Internals.AssetMgr; } }
|
||||
protected SbmCommodityMgr CommodityMgr { get { return Internals.CommodityMgr; } }
|
||||
protected SbmPriceMgr PriceMgr { get { return Internals.PriceMgr; } }
|
||||
protected SbmTransactionMgr TransactionMgr { get { return Internals.TransactionMgr; } }
|
||||
protected SbmStockMgr StockMgr { get { return Internals.StockMgr; } }
|
||||
protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
|
||||
protected 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.
|
||||
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } }
|
||||
protected SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
|
||||
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
|
||||
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
|
||||
protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
|
||||
protected SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
|
||||
protected SaInterfaceConsole InterfaceConsole { get { return Internals.InterfaceConsole; } }
|
||||
protected SaItemDocConsole ItemDocConsole { get { return Internals.ItemDocConsole; } }
|
||||
protected SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
|
||||
protected SaItemDataConsole ItemDataConsole { get { return Internals.ItemDataConsole; } }
|
||||
// Configurations.
|
||||
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 SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
|
||||
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
|
||||
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
|
||||
protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
|
||||
protected SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
|
||||
protected SaInterfaceConsole InterfaceConsole { get { return Internals.InterfaceConsole; } }
|
||||
protected SaItemDocConsole ItemDocConsole { get { return Internals.ItemDocConsole; } }
|
||||
protected SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
|
||||
protected SaItemDataConsole ItemDataConsole { get { return Internals.ItemDataConsole; } }
|
||||
// Configurations.
|
||||
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); }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security.
|
||||
public bool ValidUserSession { get { return SessionData?.ValidUserSession ?? false; } }
|
||||
public bool AwaitingLogin { get { return !ValidUserSession; } }
|
||||
public bool KeepLoggedIn { get { return !AwaitingLogin && SessionData.KeepLoggedIn; } }
|
||||
/// <summary>Maximum length allowed for password entry: sign-up, change password etc.</summary>
|
||||
public int PasswordMaxLength { get; } = 32;
|
||||
//-------------------------------------------------------------------
|
||||
// Security.
|
||||
public bool ValidUserSession { get { return SessionData?.ValidUser ?? false; } }
|
||||
public bool AwaitingLogin { get { return !ValidUserSession; } }
|
||||
public bool KeepLoggedIn { get { return !AwaitingLogin && SessionData_Web.KeepLoggedIn; } }
|
||||
/// <summary>Maximum length allowed for password entry: sign-up, change password etc.</summary>
|
||||
public int PasswordMaxLength { get; } = 32;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
@@ -113,105 +135,133 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Form control value max length - code type tables.
|
||||
/// <para>In many cases the database columns allow plenty of extra space for the value, in case they need to be encrypted.</para>
|
||||
/// <para>Hence, several cases where the value entered in the control isn't allowed the full database length.</para>
|
||||
/// </summary>
|
||||
public int GetControlMaxLength(SaCodeTypeDbDfn.ColumnIdx column)
|
||||
{
|
||||
int maxLength = (int)SaCodeTypeDbDfn.GetColTextLen(column);
|
||||
switch (column)
|
||||
{
|
||||
case SaCodeTypeDbDfn.ColumnIdx.SaCodeType_Name:
|
||||
case SaCodeTypeDbDfn.ColumnIdx.SaCode_Description:
|
||||
return Math.Min(maxLength, 100);
|
||||
}
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Form control value max length - BusinessMgr tables.
|
||||
/// <para>In many cases the database columns allow plenty of extra space for the value, in case they need to be encrypted.</para>
|
||||
/// <para>Hence, several cases where the value entered in the control isn't allowed the full database length.</para>
|
||||
/// </summary>
|
||||
public int GetControlMaxLength(SbmDbDfn.ColumnIdx column)
|
||||
{
|
||||
int maxLength = (int)SbmDbDfn.GetColTextLen(column);
|
||||
switch (column)
|
||||
{
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_Email:
|
||||
return Math.Min(maxLength, 100);
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_FirstName:
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_LastName:
|
||||
return Math.Min(maxLength, 40);
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_Name:
|
||||
return Math.Min(maxLength, 80);
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_PhoneMain:
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_PhoneMobile:
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_PhoneAlt:
|
||||
return Math.Min(maxLength, 20);
|
||||
case SbmDbDfn.ColumnIdx.Address_Postcode:
|
||||
return Math.Min(maxLength, 16);
|
||||
}
|
||||
return maxLength;
|
||||
}
|
||||
{
|
||||
int maxLength = (int)SbmDbDfn.GetColTextLen(column);
|
||||
switch (column)
|
||||
{
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_Email:
|
||||
return Math.Min(maxLength, 100);
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_FirstName:
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_LastName:
|
||||
return Math.Min(maxLength, 40);
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_Name:
|
||||
return Math.Min(maxLength, 80);
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_PhoneMain:
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_PhoneMobile:
|
||||
case SbmDbDfn.ColumnIdx.Affiliate_PhoneAlt:
|
||||
return Math.Min(maxLength, 20);
|
||||
case SbmDbDfn.ColumnIdx.Address_Postcode:
|
||||
return Math.Min(maxLength, 16);
|
||||
}
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copyright notice.
|
||||
public HtmlString CopyrightNotice
|
||||
{
|
||||
get
|
||||
{
|
||||
int initialYear = 2020;
|
||||
int currentYear = DateTime.Today.Year;
|
||||
return Localiser.GetHtmlText("copyright.symbol.year.html", (initialYear != currentYear ? initialYear + "-" : "") + currentYear.ToString());
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Copyright notice.
|
||||
public HtmlString CopyrightNotice
|
||||
{
|
||||
get
|
||||
{
|
||||
int initialYear = 2020;
|
||||
int currentYear = DateTime.Today.Year;
|
||||
return Localiser.GetHtmlText("copyright.symbol.year.html", (initialYear != currentYear ? initialYear + "-" : "") + currentYear.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Display data - Dates.
|
||||
public String FormatDateForDisplay(DateTime value)
|
||||
{
|
||||
return DateUtil.Format(value, "d-MMM-yy", SessionCulture);
|
||||
}
|
||||
public String FormatDateTimeForDisplay(DateTime value)
|
||||
{
|
||||
return StringUtil.TrimAll(DateUtil.Format(value, "d-MMM-yy HH:mm", SessionCulture));
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Display data - Dates.
|
||||
public String FormatDateForDisplay(DateTime? value)
|
||||
{
|
||||
return DateUtil.Format(value, "d-MMM-yy", SessionCulture);
|
||||
}
|
||||
public String FormatDateTimeForDisplay(DateTime? value)
|
||||
{
|
||||
return StringUtil.TrimAll(DateUtil.Format(value, "d-MMM-yy HH:mm", SessionCulture));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Form data - Dates.
|
||||
// Format may depend on locale, but as long as these methods are used consistently,
|
||||
// there should be consistent formatting, display and parsing of date values.
|
||||
public String CalendarDateFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
// JQuery-UI DatePicker date format.
|
||||
// Format:
|
||||
// d Single digit day of month
|
||||
// dd Double digit day of month
|
||||
// D 3 letter day of week abbreviation.
|
||||
// DD Day of week.
|
||||
// m Single digit month.
|
||||
// mm Double digit month.
|
||||
// M 3 letter month abbreviation.
|
||||
// MM Month name.
|
||||
// yy 4 digit year.
|
||||
// Examples:
|
||||
// dd/mm/yy 07/04/2012
|
||||
// dd-M-yy 07-Apr-2012
|
||||
// d-M-yy 7-Apr-2012
|
||||
return "dd-M-yy";
|
||||
}
|
||||
}
|
||||
public String FormatDateForForm(DateTime value)
|
||||
{
|
||||
return DateUtil.Format(value, "dd-MMM-yyyy");
|
||||
}
|
||||
public DateTime ParseDateFromForm(String value)
|
||||
{
|
||||
return DateUtil.ParseExact(value, "dd-MMM-yyyy");
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Form data - Dates.
|
||||
// Format may depend on locale, but as long as these methods are used consistently,
|
||||
// there should be consistent formatting, display and parsing of date values.
|
||||
public String CalendarDateFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
// JQuery-UI DatePicker date format.
|
||||
// Format:
|
||||
// d Single digit day of month
|
||||
// dd Double digit day of month
|
||||
// D 3 letter day of week abbreviation.
|
||||
// DD Day of week.
|
||||
// m Single digit month.
|
||||
// mm Double digit month.
|
||||
// M 3 letter month abbreviation.
|
||||
// MM Month name.
|
||||
// yy 4 digit year.
|
||||
// Examples:
|
||||
// dd/mm/yy 07/04/2012
|
||||
// dd-M-yy 07-Apr-2012
|
||||
// d-M-yy 7-Apr-2012
|
||||
return "dd-M-yy";
|
||||
}
|
||||
}
|
||||
public String FormatDateForForm(DateTime value)
|
||||
{
|
||||
return DateUtil.Format(value, "dd-MMM-yyyy");
|
||||
}
|
||||
public DateTime ParseDateFromForm(String value)
|
||||
{
|
||||
return DateUtil.ParseExact(value, "dd-MMM-yyyy");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Link URLs.
|
||||
public class LinksData
|
||||
{
|
||||
public String Facebook { get; } = "https://www.facebook.com/BusinessMgr/";
|
||||
public String LinkedIn { get; } = "https://www.linkedin.com/company/BusinessMgr/about/";
|
||||
}
|
||||
public LinksData Links { get; } = new LinksData();
|
||||
//-------------------------------------------------------------------
|
||||
// Link URLs.
|
||||
public class LinksData
|
||||
{
|
||||
public String Facebook { get; } = "https://www.facebook.com/BusinessMgr/";
|
||||
public String LinkedIn { get; } = "https://www.linkedin.com/company/BusinessMgr/about/";
|
||||
}
|
||||
public LinksData Links { get; } = new LinksData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Form data.
|
||||
// NB Use methods rathe rthan accessors for properties that depend on session data
|
||||
// to avoid the model binding logic invoking a getter before it's ready for use.
|
||||
|
||||
/// <summary>List of Address Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> GetCodeTypesForSelect()
|
||||
{
|
||||
List<CodeDesc> codeTypes = new List<CodeDesc>();
|
||||
SaCodeType.Params prmCodeType = new SaCodeType.Params();
|
||||
prmCodeType.SortColumns.Add(CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.Name));
|
||||
foreach (SaCodeType codeType in CodeTypeConsole.GetCodeTypeList(prmCodeType))
|
||||
codeTypes.Add(codeType.Code, codeType.Name);
|
||||
return new SelectList(codeTypes, "Code", "Desc");
|
||||
}
|
||||
|
||||
/// <summary>List of Address Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> GetAddressTypeCodesForSelect()
|
||||
{
|
||||
@@ -220,15 +270,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
|
||||
/// <summary>List of Affiliate Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> GetAffiliateTypeCodesForSelect()
|
||||
{
|
||||
return new SelectList(GetCodesOfType(Sbm.SystemCode.AffiliateType), "Code", "Desc");
|
||||
}
|
||||
{
|
||||
return new SelectList(GetCodesOfType(Sbm.SystemCode.AffiliateType), "Code", "Desc");
|
||||
}
|
||||
|
||||
/// <summary>List of Association Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> GetAssociationTypeCodesForSelect()
|
||||
{
|
||||
return new SelectList(GetCodesOfType(Sbm.SystemCode.AssociationType), "Code", "Desc");
|
||||
}
|
||||
/// <summary>List of Association Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> GetAssociationTypeCodesForSelect()
|
||||
{
|
||||
return new SelectList(GetCodesOfType(Sbm.SystemCode.AssociationType), "Code", "Desc");
|
||||
}
|
||||
|
||||
/// <summary>List of Commodity Types for dropdown.</summary>
|
||||
public IEnumerable<SelectListItem> GetCommodityTypeCodesForSelect()
|
||||
@@ -237,6 +287,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
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>
|
||||
@@ -245,9 +302,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
/// <para>Populates value on logout form to identify default site for next login.</para>
|
||||
/// </summary>
|
||||
public ushort SessionIdx { get { return SessionContext?.Index ?? 0; } }
|
||||
public String FormAction { get; set; }
|
||||
public String FormAction { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
|
||||
@@ -314,6 +314,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
/// </summary>
|
||||
public enum ConfigOption
|
||||
{
|
||||
Unknown,
|
||||
//---------------------------------------------------------------
|
||||
// Application.
|
||||
/// <summary>Display system menu [Default: True for debug session]</summary>
|
||||
@@ -1879,11 +1880,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
};
|
||||
public enum VehicleOdometerUnits
|
||||
{
|
||||
OdoUnits_Any = -1,
|
||||
OdoUnits_Unknown = 0,
|
||||
Any = -1,
|
||||
Unknown = 0,
|
||||
// NB Do not change the positive values, as tied to the database.
|
||||
OdoUnits_Mile = 10,
|
||||
OdoUnits_Kilometre = 11,
|
||||
Mile = 10,
|
||||
Kilometre = 11,
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
@@ -16,10 +17,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// A p p l i c a t i o n V i e w s
|
||||
//-------------------------------------------------------------------
|
||||
// Jul-2021 ConfigConsole parameter added to avoid local creation. To be reviewed/replaced.
|
||||
public static bool IsViewApplicable(ISbmUserContext userContext, SbmConfigConsole configConsole, Sbm.View view)
|
||||
public static bool IsViewApplicable(ISbmUserContext_Core userContext, SbmConfigConsole configConsole, Sbm.View view)
|
||||
{
|
||||
//SbmConfigConsole configConsole = SbmGlobals.GetConfigConsole(userContext.SessionContext);
|
||||
ISbmSecurityProfile securityProfile = userContext.SecurityProfile;
|
||||
ISbmSecurityProfile_Core securityProfile = userContext.SecurityProfile_Core;
|
||||
switch (view)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
@@ -264,7 +265,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// A p p l i c a t i o n M e n u
|
||||
//-------------------------------------------------------------------
|
||||
public static bool IsMenuOptionApplicable(ISbmUserContext userContext, SbmConfigConsole configConsole, Sbm.MenuOption menuOption)
|
||||
public static bool IsMenuOptionApplicable(ISbmUserContext_Core userContext, SbmConfigConsole configConsole, Sbm.MenuOption menuOption)
|
||||
{
|
||||
if (!userContext.ValidUser)
|
||||
{
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public abstract ISacsDatabase GetControlDatabase();
|
||||
public abstract ISacsDatabase GetTemplateDatabase();
|
||||
// Business Mgr Database.
|
||||
public abstract List<string> GetDbIdentifiers(SbmSessionContext sessionContext);
|
||||
public abstract ISacsDatabase GetBusMgrDatabase(SbmSessionContext sessionContext);
|
||||
public abstract HashSet<string> GetDbIdentifiers(SbmSessionContext sessionContext);
|
||||
public abstract ISacsDatabase GetBusMgrDatabase(SbmSessionContext sessionContext);
|
||||
public IDatabaseInfo CreateBusMgrDbInfo(SbmSessionContext sessionContext)
|
||||
{
|
||||
return GetBusMgrDatabase(sessionContext).CreateDbInfo();
|
||||
@@ -83,16 +83,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Create consoles.
|
||||
public abstract SbmConfigConsole CreateConfigConsole(SbmSessionContext sessionContext);
|
||||
public abstract SaDiaryConsole CreateDiaryConsole(ISbmUserContext userContext);
|
||||
public abstract SaSecurityConsole CreateSecurityConsole(ISbmUserContext userContext);
|
||||
public abstract SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext userContext);
|
||||
public abstract SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext userContext);
|
||||
public abstract SaItemDataConsole CreateItemDataConsole(ISbmUserContext userContext);
|
||||
public abstract SaItemDocConsole CreateItemDocConsole(ISbmUserContext userContext);
|
||||
public abstract SaItemOptionConsole CreateItemOptionConsole(ISbmUserContext userContext);
|
||||
public abstract SaInterfaceConsole CreateInterfaceConsole(ISbmUserContext userContext);
|
||||
public abstract SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserContext userContext);
|
||||
public abstract SbmEmailConsole CreateEmailConsole(ISbmUserContext userContext);
|
||||
public abstract SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SaSecurityConsole CreateSecurityConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SaItemDataConsole CreateItemDataConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SaItemDocConsole CreateItemDocConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SaItemOptionConsole CreateItemOptionConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SaInterfaceConsole CreateInterfaceConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserContext_Core userContext);
|
||||
public abstract SbmEmailConsole CreateEmailConsole(ISbmUserContext_Core userContext);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public virtual String LinkSuffix { get { return ""; } }
|
||||
//---------------------------------------------------------------
|
||||
// Utilities.
|
||||
public virtual bool Refresh(ISbmUserContext userContext)
|
||||
public virtual bool Refresh(ISbmUserContext_Core userContext)
|
||||
{
|
||||
ItemCount = 0;
|
||||
switch (LinkType)
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 6-Jun-2024 17:06:27
|
||||
// Code generated by Sarand Database Utilities Mon 21-Oct-2024 18:34:08
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
@@ -17,8 +17,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public enum TableIdx
|
||||
{
|
||||
Unknown = 0,
|
||||
Database,
|
||||
DatabaseAccount,
|
||||
ItemParam,
|
||||
Owner,
|
||||
Repository,
|
||||
UserAccount,
|
||||
}
|
||||
|
||||
@@ -27,34 +28,53 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public enum ColumnIdx
|
||||
{
|
||||
Unknown = 0,
|
||||
Database_Id,
|
||||
Database_ServerName,
|
||||
Database_InstanceName,
|
||||
Database_DatabaseName,
|
||||
Database_UserName,
|
||||
Database_Password,
|
||||
Database_OrganisationName,
|
||||
Database_Notes,
|
||||
Database_Flags,
|
||||
Database_Status,
|
||||
Database_CreateOn,
|
||||
Database_CreateBy,
|
||||
Database_CreateHost,
|
||||
Database_UpdateOn,
|
||||
Database_UpdateBy,
|
||||
Database_UpdateHost,
|
||||
DatabaseAccount_Id,
|
||||
DatabaseAccount_DatabaseId,
|
||||
DatabaseAccount_EmailAddress,
|
||||
DatabaseAccount_Notes,
|
||||
DatabaseAccount_Flags,
|
||||
DatabaseAccount_Status,
|
||||
DatabaseAccount_CreateOn,
|
||||
DatabaseAccount_CreateBy,
|
||||
DatabaseAccount_CreateHost,
|
||||
DatabaseAccount_UpdateOn,
|
||||
DatabaseAccount_UpdateBy,
|
||||
DatabaseAccount_UpdateHost,
|
||||
ItemParam_Id,
|
||||
ItemParam_ItemType,
|
||||
ItemParam_ItemId,
|
||||
ItemParam_Context,
|
||||
ItemParam_Name,
|
||||
ItemParam_Value,
|
||||
ItemParam_Notes,
|
||||
ItemParam_Flags,
|
||||
ItemParam_Status,
|
||||
ItemParam_CreateOn,
|
||||
ItemParam_CreateBy,
|
||||
ItemParam_CreateHost,
|
||||
ItemParam_UpdateOn,
|
||||
ItemParam_UpdateBy,
|
||||
ItemParam_UpdateHost,
|
||||
Owner_Id,
|
||||
Owner_Name,
|
||||
Owner_ContactName,
|
||||
Owner_ContactEmailAddress,
|
||||
Owner_ContactPhoneMain,
|
||||
Owner_ContactPhoneAlt,
|
||||
Owner_Notes,
|
||||
Owner_Flags,
|
||||
Owner_Status,
|
||||
Owner_CreateOn,
|
||||
Owner_CreateBy,
|
||||
Owner_CreateHost,
|
||||
Owner_UpdateOn,
|
||||
Owner_UpdateBy,
|
||||
Owner_UpdateHost,
|
||||
Repository_Id,
|
||||
Repository_OwnerId,
|
||||
Repository_Context,
|
||||
Repository_ServerName,
|
||||
Repository_InstanceName,
|
||||
Repository_DatabaseName,
|
||||
Repository_UserName,
|
||||
Repository_Password,
|
||||
Repository_Notes,
|
||||
Repository_Flags,
|
||||
Repository_Status,
|
||||
Repository_CreateOn,
|
||||
Repository_CreateBy,
|
||||
Repository_CreateHost,
|
||||
Repository_UpdateOn,
|
||||
Repository_UpdateBy,
|
||||
Repository_UpdateHost,
|
||||
UserAccount_Id,
|
||||
UserAccount_EmailAddress,
|
||||
UserAccount_Title,
|
||||
@@ -84,8 +104,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 3;
|
||||
private static readonly int columnCount = 53;
|
||||
private static readonly int tableCount = 4;
|
||||
private static readonly int columnCount = 72;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -257,8 +277,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
private static readonly TableDfn[] tables =
|
||||
{
|
||||
new TableDfn("dbo","Database"),
|
||||
new TableDfn("dbo","DatabaseAccount"),
|
||||
new TableDfn("dbo","ItemParam"),
|
||||
new TableDfn("dbo","Owner"),
|
||||
new TableDfn("dbo","Repository"),
|
||||
new TableDfn("dbo","UserAccount"),
|
||||
};
|
||||
|
||||
@@ -285,13 +306,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"Id",4,4,true,10),
|
||||
new ColumnDfn(1,"ServerName",0,-9,false,200),
|
||||
new ColumnDfn(1,"InstanceName",0,-9,false,200),
|
||||
new ColumnDfn(1,"DatabaseName",0,-9,false,200),
|
||||
new ColumnDfn(1,"UserName",0,-9,false,100),
|
||||
new ColumnDfn(1,"Password",0,-9,false,100),
|
||||
new ColumnDfn(1,"OrganisationName",0,-9,false,200),
|
||||
new ColumnDfn(1,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(1,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(1,"ItemId",5,-5,false,19),
|
||||
new ColumnDfn(1,"Context",0,-9,false,200),
|
||||
new ColumnDfn(1,"Name",0,-9,false,200),
|
||||
new ColumnDfn(1,"Value",0,-9,false,0),
|
||||
new ColumnDfn(1,"Notes",0,-9,false,4000),
|
||||
new ColumnDfn(1,"Flags",3,5,false,5),
|
||||
new ColumnDfn(1,"Status",0,12,false,3),
|
||||
new ColumnDfn(1,"CreateOn",9,93,false,23),
|
||||
@@ -301,9 +321,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
new ColumnDfn(1,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(1,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(2,"Id",4,4,true,10),
|
||||
new ColumnDfn(2,"DatabaseId",4,4,false,10),
|
||||
new ColumnDfn(2,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(2,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(2,"Name",0,-9,false,200),
|
||||
new ColumnDfn(2,"ContactName",0,-9,false,200),
|
||||
new ColumnDfn(2,"ContactEmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(2,"ContactPhoneMain",0,-9,false,100),
|
||||
new ColumnDfn(2,"ContactPhoneAlt",0,-9,false,100),
|
||||
new ColumnDfn(2,"Notes",0,-9,false,4000),
|
||||
new ColumnDfn(2,"Flags",3,5,false,5),
|
||||
new ColumnDfn(2,"Status",0,12,false,3),
|
||||
new ColumnDfn(2,"CreateOn",9,93,false,23),
|
||||
@@ -313,22 +336,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
new ColumnDfn(2,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(2,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(3,"Id",4,4,true,10),
|
||||
new ColumnDfn(3,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(3,"Title",0,-9,false,20),
|
||||
new ColumnDfn(3,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(3,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(3,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(3,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(3,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(3,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(3,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(3,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(3,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(3,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(3,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(3,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(3,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(3,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(3,"OwnerId",4,4,false,10),
|
||||
new ColumnDfn(3,"Context",0,-9,false,100),
|
||||
new ColumnDfn(3,"ServerName",0,-9,false,200),
|
||||
new ColumnDfn(3,"InstanceName",0,-9,false,200),
|
||||
new ColumnDfn(3,"DatabaseName",0,-9,false,200),
|
||||
new ColumnDfn(3,"UserName",0,-9,false,100),
|
||||
new ColumnDfn(3,"Password",0,-9,false,100),
|
||||
new ColumnDfn(3,"Notes",0,-9,false,4000),
|
||||
new ColumnDfn(3,"Flags",3,5,false,5),
|
||||
new ColumnDfn(3,"Status",0,12,false,3),
|
||||
new ColumnDfn(3,"CreateOn",9,93,false,23),
|
||||
@@ -337,6 +352,31 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
new ColumnDfn(3,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(3,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(3,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(4,"Id",4,4,true,10),
|
||||
new ColumnDfn(4,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(4,"Title",0,-9,false,20),
|
||||
new ColumnDfn(4,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(4,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(4,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(4,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(4,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(4,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(4,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(4,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(4,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(4,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(4,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(4,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(4,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(4,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(4,"Flags",3,5,false,5),
|
||||
new ColumnDfn(4,"Status",0,12,false,3),
|
||||
new ColumnDfn(4,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(4,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(4,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(4,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(4,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(4,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.SbmInstanceConfig;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
//=======================================================================
|
||||
/// <summary>
|
||||
/// Application configuration associated with an instance.
|
||||
/// </summary>
|
||||
public abstract class SbmInstanceConfig
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// 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 ApplicationOptionValue_Default= "Default";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner/Instance configuration parameters.
|
||||
public enum ConfigParamType
|
||||
{
|
||||
// Affiliate types.
|
||||
AllowedAffiliateTypes,
|
||||
DisallowedAffiliateTypes,
|
||||
// Association types.
|
||||
AllowedAssociationTypes,
|
||||
DisallowedAssociationTypes,
|
||||
// Transaction types.
|
||||
AllowedTransactionTypes,
|
||||
DisallowedTransactionTypes,
|
||||
// Application options.
|
||||
ApplicationOption,
|
||||
}
|
||||
public class ConfigParamData
|
||||
{
|
||||
public ConfigParamType ConfigParam { get; set; }
|
||||
public String Context { get; set; }
|
||||
public String Name { get; set; }
|
||||
public HashSet<String> Values { get; } = new HashSet<string>();
|
||||
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, ApplicationOptionValue_Default });
|
||||
return configParamData;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application options.
|
||||
//-------------------------------------------------------------------
|
||||
public abstract bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Allowed data component types.
|
||||
//-------------------------------------------------------------------
|
||||
// Supported affiliate types.
|
||||
public abstract bool AllowAffiliateType(Sbm.AffiliateType type);
|
||||
// Supported Association types.
|
||||
public abstract bool AllowAssociationType(Sbm.AssociationType type);
|
||||
// Supported Transaction types.
|
||||
public abstract bool AllowTransactionType(Sbm.TransactionType type);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Allow Option.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
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.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -18,6 +19,7 @@ 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
|
||||
{
|
||||
@@ -52,14 +54,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Configurations.
|
||||
private SbmStockControlConfig stockControlConfig;
|
||||
private SbmRequirementCostingConfig requirementCostingConfig;
|
||||
// Currency.
|
||||
// Reference data.
|
||||
private List<SaCurrency> currencies = null;
|
||||
private List<SaTaxCode> taxCodes = null;
|
||||
private List<SaUnitMeasure> unitsOfMeasure = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmInternals(ISbmUserContext userContext)
|
||||
public SbmInternals(ISbmUserContext_Core userContext)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
@@ -76,6 +78,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (stockMgr != null) stockMgr.Dispose();
|
||||
if (processMgr != null) processMgr.Dispose();
|
||||
if (dataItemMgr != null) dataItemMgr.Dispose();
|
||||
// Reference data.
|
||||
if (currencies != null) currencies.ClearAndDispose();
|
||||
if (taxCodes != null) taxCodes.ClearAndDispose();
|
||||
if (unitsOfMeasure != null) unitsOfMeasure.ClearAndDispose();
|
||||
@@ -97,9 +100,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Session properties.
|
||||
public SbmApplication Application { get { return SbmGlobals.Application; } }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public ISbmUserContext_Core UserContext { get; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
public ISbmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } }
|
||||
public ISbmSecurityProfile_Core SecurityProfile { get { return UserContext.SecurityProfile_Core; } }
|
||||
public SbmAccountsDfn AccountsDfn { get { if (accountsDfn == null) accountsDfn = new SbmAccountsDfn(UserContext); { return accountsDfn; } } }
|
||||
// Database.
|
||||
public ISacsDatabase BusMgrDatabase { get { return Application.GetBusMgrDatabase(SessionContext); } }
|
||||
@@ -117,6 +120,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public List<TypeCodeDesc> AffiliateTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.AffiliateType); } }
|
||||
public List<TypeCodeDesc> AssociationTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.AssociationType); } }
|
||||
public List<TypeCodeDesc> CommodityTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.CommodityType); } }
|
||||
public List<TypeCodeDesc> AssetTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.AssetType); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Code types.
|
||||
private Dictionary<Sbm.ApplCodeType, List<SaCode>> codeTypeCodes { get; } = new Dictionary<Sbm.ApplCodeType, List<SaCode>>();
|
||||
public String GetCodeTypeCode(Sbm.ApplCodeType codeType)
|
||||
{
|
||||
return SbmSystem.GetCodeTypeCode(codeType);
|
||||
}
|
||||
public List<SaCode> GetCodesForCodeType(Sbm.ApplCodeType codeType, bool activeOnly = true)
|
||||
{
|
||||
if (!codeTypeCodes.ContainsKey(codeType))
|
||||
codeTypeCodes.Add(codeType, CodeTypeConsole.GetCodesForCodeType(GetCodeTypeCode(codeType), false));
|
||||
return new List<SaCode>(codeTypeCodes.GetValueOrDefault(codeType, new List<SaCode>()).Where(c => !activeOnly || c.IsStatusActive));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Managers.
|
||||
@@ -291,7 +309,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public SaEmailConfig EmailConfig { get { return Application.EmailConfig; } }
|
||||
public SbmEmailConsole EmailConsole
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
if (emailConsole == null)
|
||||
emailConsole = Application.CreateEmailConsole(UserContext);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
@@ -12,7 +13,7 @@ using System.Collections.Generic;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmSecurityProfile : SaErrorStateItem, ISbmSecurityProfile
|
||||
public class SbmSecurityProfile : SaErrorStateItem, ISbmSecurityProfile_Core
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -24,7 +25,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSecurityProfile(ISbmUserContext userContext, bool includeHostSecurityProfile)
|
||||
public SbmSecurityProfile(ISbmUserContext_Core userContext, bool includeHostSecurityProfile)
|
||||
{
|
||||
this.UserContext = userContext;
|
||||
this.includeHostSecurityProfile = includeHostSecurityProfile;
|
||||
@@ -38,7 +39,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
[JsonIgnore]
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public ISbmUserContext_Core UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Refresh profile.
|
||||
|
||||
@@ -28,12 +28,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
SessionIdx = sessionIdx;
|
||||
ItemIdx = itemIdx;
|
||||
SessionContext = sessionContext;
|
||||
userData = CreateUserData(SessionContext, null, null, null);
|
||||
organisationData = new OrganisationData(null, null);
|
||||
}
|
||||
/// <summary>
|
||||
/// Plain constructor - Contorl application.
|
||||
/// <para>SessionContext must be supplied.</para>
|
||||
/// Plain constructor.
|
||||
/// <para>- SessionContext must be supplied.</para>
|
||||
/// </summary>
|
||||
protected SbmSessionData(SbmSessionContext sessionContext)
|
||||
{
|
||||
@@ -41,19 +39,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
ItemIdx = 1000;
|
||||
SessionContext = sessionContext;
|
||||
}
|
||||
/// <summary>
|
||||
/// Primary constructor - on user login.
|
||||
/// <para>SessionContext and UserAccount must be supplied.</para>
|
||||
/// <para>Roles list is optional.</para>
|
||||
/// </summary>
|
||||
protected SbmSessionData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations, SbmAssociation associationOrganisation, SbmAffiliate affiliateOrganisation)
|
||||
{
|
||||
SessionIdx = ++sessionIdxRoot;
|
||||
ItemIdx = 1000;
|
||||
SessionContext = sessionContext;
|
||||
userData = CreateUserData(SessionContext, securityItemUser, affiliateUser, supervisedOrganisations);
|
||||
organisationData = new OrganisationData(associationOrganisation, affiliateOrganisation);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
@@ -66,115 +51,45 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
// Session context.
|
||||
public SbmSessionContext SessionContext { get; }
|
||||
|
||||
// User properties.
|
||||
[JsonIgnore]
|
||||
public bool ValidUserSession { get { return SysId.IsValid(User.AffiliateId) && SysId.IsValid(User.AffiliateId); } }
|
||||
public abstract String UserEmailAddress { get; }
|
||||
[JsonIgnore]
|
||||
public DbUpdateInfo DbUpdateInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DbUpdateInfo(User.AffiliateId, StringUtil.OnEmpty(userData.DisplayName, userData.EmailAddress), SbmSystem.ComputerName);
|
||||
}
|
||||
}
|
||||
public abstract String UserDisplayName { get; }
|
||||
[JsonIgnore]
|
||||
public abstract bool ValidUser { get; }
|
||||
[JsonIgnore]
|
||||
public abstract DbUpdateInfo DbUpdateInfo { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User.
|
||||
public class UserData : ISbmUserContext.IUserData
|
||||
public class UserData
|
||||
{
|
||||
protected UserData() { }
|
||||
protected UserData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations)
|
||||
protected UserData(SbmSessionContext sessionContext)
|
||||
{
|
||||
if (securityItemUser != null)
|
||||
{
|
||||
SecurityItemId = securityItemUser.Id;
|
||||
}
|
||||
if (affiliateUser != null)
|
||||
{
|
||||
AffiliateId = affiliateUser.Id;
|
||||
Refresh(securityItemUser, affiliateUser, supervisedOrganisations);
|
||||
if (sessionContext.Application == Sbm.Application.WebControl)
|
||||
KeepLoggedIn = affiliateUser.KeepLoggedIn_Control;
|
||||
else if (sessionContext.Application == Sbm.Application.WebPortal)
|
||||
KeepLoggedIn = affiliateUser.KeepLoggedIn_Portal;
|
||||
else Debugger.Break();
|
||||
}
|
||||
this.supervisedOrganisations = supervisedOrganisations ?? new List<SysIdString>();
|
||||
}
|
||||
protected UserData(UserData userData)
|
||||
{
|
||||
SecurityItemId = userData.SecurityItemId;
|
||||
AffiliateId = userData.AffiliateId;
|
||||
Title = userData.Title;
|
||||
FirstName = userData.FirstName;
|
||||
LastName = userData.LastName;
|
||||
DisplayName = userData.DisplayName;
|
||||
EmailAddress = userData.EmailAddress;
|
||||
supervisedOrganisations = userData.supervisedOrganisations;
|
||||
KeepLoggedIn = userData.KeepLoggedIn;
|
||||
}
|
||||
// Properties.
|
||||
public SysId SecurityItemId { get; protected set; }
|
||||
public SysId AffiliateId { get; protected set; }
|
||||
public String Title { get; protected set; }
|
||||
public String FirstName { get; protected set; }
|
||||
public String LastName { get; protected set; }
|
||||
public String DisplayName { get; protected set; }
|
||||
public String EmailAddress { get; protected set; }
|
||||
/// <summary>User managed associations - Id and display name.</summary>
|
||||
public List<SysIdString> SupervisedOrganisations { get { return new List<SysIdString>(supervisedOrganisations); } }
|
||||
protected List<SysIdString> supervisedOrganisations { get; } = new List<SysIdString>();
|
||||
public bool KeepLoggedIn { get; protected set; }
|
||||
public bool UserAccountSupplied { get; protected set; }
|
||||
// Refresh properties.
|
||||
protected bool Refresh(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations)
|
||||
protected bool Refresh()
|
||||
{
|
||||
// Check that user matches the session.
|
||||
if (!SysId.IsValid(SecurityItemId) || !SysId.IsValid(securityItemUser?.Id ?? null) || !SecurityItemId.Equals(securityItemUser.Id)) return false;
|
||||
if (!SysId.IsValid(AffiliateId) || !SysId.IsValid(affiliateUser?.Id ?? null) || !AffiliateId.Equals(affiliateUser.Id)) return false;
|
||||
// Refresh properties.
|
||||
EmailAddress = securityItemUser.EmailAddress;
|
||||
Title = affiliateUser.Title;
|
||||
FirstName = affiliateUser.FirstName;
|
||||
LastName = affiliateUser.LastName;
|
||||
DisplayName = affiliateUser.GetDisplayName();
|
||||
this.supervisedOrganisations.Clear();
|
||||
this.supervisedOrganisations.AddRange(supervisedOrganisations);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
protected abstract UserData CreateUserData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations);
|
||||
|
||||
[JsonProperty("User")]
|
||||
protected UserData userData;
|
||||
[JsonIgnore]
|
||||
/// <summary>User account details.</summary>
|
||||
public ISbmUserContext.IUserData User { get { return userData; } }
|
||||
public bool ValidUser { get { return SysId.IsValid(userData.SecurityItemId) && SysId.IsValid(userData.AffiliateId); } }
|
||||
public bool KeepLoggedIn { get { return userData.KeepLoggedIn; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation.
|
||||
public class OrganisationData : ISbmUserContext.IOrganisationData
|
||||
{
|
||||
private OrganisationData() { }
|
||||
public OrganisationData(SbmAssociation associationOrganisation, SbmAffiliate affiliateOrganisation)
|
||||
{
|
||||
AffiliateId = affiliateOrganisation?.Id ?? null;
|
||||
AffiliateType = affiliateOrganisation?.AffiliateType ?? Sbm.AffiliateType.Unknown;
|
||||
AssociationId = associationOrganisation?.Id ?? null;
|
||||
DisplayName = affiliateOrganisation?.GetDisplayName() ?? "";
|
||||
InterfaceContext = SbmAccountMgr.GetInterfaceContext(AffiliateId);
|
||||
}
|
||||
public SysId AffiliateId { get; protected set; }
|
||||
public Sbm.AffiliateType AffiliateType { get; protected set; }
|
||||
public SysId AssociationId { get; protected set; }
|
||||
public String DisplayName { get; protected set; }
|
||||
public String InterfaceContext { get; }
|
||||
}
|
||||
[JsonProperty("Organisation")]
|
||||
protected OrganisationData organisationData;
|
||||
[JsonIgnore]
|
||||
public ISbmUserContext.IOrganisationData Organisation { get { return organisationData; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
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.App;
|
||||
@@ -53,17 +54,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Protected Construction - use derived objects.
|
||||
protected SbmSessionProfile(SbmSessionContext sessionContext)
|
||||
protected SbmSessionProfile(SbmSessionContext sessionContext, SysId affiliateIdUser)
|
||||
{
|
||||
userContext = new SbmUserContext_Internal(sessionContext);
|
||||
SysParamCache = new SbmSysParamCache(userContext);
|
||||
SysParamCache = new SbmSysParamCache(userContext, affiliateIdUser);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get { return userContext; } }
|
||||
public SbmSessionContext SessionContext { get { return userContext.SessionContext; } }
|
||||
public ISbmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } }
|
||||
public ISbmSecurityProfile_Core SecurityProfile { get { return UserContext.SecurityProfile_Core; } }
|
||||
protected SaItemOption.Cache OrganisationConfigOptionsCache { get { return UserContext.OrganisationConfigOptionsCache; } }
|
||||
// User parameters.
|
||||
protected SbmSysParamCache SysParamCache { get; }
|
||||
|
||||
@@ -49,9 +49,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSysParamCache(ISbmUserContext userContext)
|
||||
public SbmSysParamCache(ISbmUserContext_Core userContext, SysId affiliateIdUser)
|
||||
{
|
||||
this.UserContext = userContext;
|
||||
this.AffiliateIdUser = affiliateIdUser;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
@@ -63,8 +64,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public SysId AffiliateIdUser { get { return UserContext.User.AffiliateId; } }
|
||||
public ISbmUserContext_Core UserContext { get; }
|
||||
public SysId AffiliateIdUser { get; }
|
||||
public bool Modified { get; private set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -108,7 +109,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
/// <summary>Retrieve the value for the user parameter.</summary>
|
||||
public String GetUserParamValue(String name, SysId affiliateIdTarget = null, SysId associationId = null)
|
||||
{
|
||||
if (!SysId.IsValid(UserContext.User.AffiliateId)) return "";
|
||||
if (!SysId.IsValid(AffiliateIdUser)) return "";
|
||||
return GetParam(name, affiliateIdTarget, associationId)?.Value ?? "";
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public bool SetUserParamValue(String name, String value, SysId affiliateIdTarget = null, SysId associationId = null)
|
||||
{
|
||||
bool success = false;
|
||||
if (!SysId.IsValid(UserContext.User.AffiliateId)) return false;
|
||||
if (!SysId.IsValid(AffiliateIdUser)) return false;
|
||||
SbmSysParam sysParam = GetParam(name, affiliateIdTarget, associationId);
|
||||
if (sysParam != null)
|
||||
{
|
||||
@@ -146,7 +147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return userSysParams.Find
|
||||
(item => item.Category == Sbm.SysParamCategory.UserParam &&
|
||||
item.Name.EqualsCI(name) &&
|
||||
item.AffiliateIdOwner.Equals(UserContext.User.AffiliateId) &&
|
||||
item.AffiliateIdOwner.Equals(AffiliateIdUser) &&
|
||||
SysId.ToInt(item.AffiliateIdTarget) == SysId.ToInt(affiliateIdTarget) &&
|
||||
SysId.ToInt(item.AssociationId) == SysId.ToInt(associationId));
|
||||
}
|
||||
@@ -159,14 +160,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
using (SbmAccountMgr accountMgr = CreateAccountMgr())
|
||||
{
|
||||
// Retrieve a matching parameter from the database.
|
||||
sysParam = accountMgr.GetSysParam(Sbm.SysParamCategory.UserParam, name, UserContext.User.AffiliateId, affiliateIdTarget, associationId);
|
||||
sysParam = accountMgr.GetSysParam(Sbm.SysParamCategory.UserParam, name, AffiliateIdUser, affiliateIdTarget, associationId);
|
||||
if (sysParam == null)
|
||||
{
|
||||
// Parameter not found - create a new one.
|
||||
sysParam = accountMgr.CreateSysParam(Sbm.SysParamCategory.UserParam, name);
|
||||
if (sysParam != null)
|
||||
{
|
||||
sysParam.AffiliateIdOwner = UserContext.User.AffiliateId;
|
||||
sysParam.AffiliateIdOwner = AffiliateIdUser;
|
||||
sysParam.AffiliateIdTarget = affiliateIdTarget;
|
||||
sysParam.AssociationId = associationId;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -24,7 +25,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// R e g i s t e r C o d e T y p e s
|
||||
//-------------------------------------------------------------------
|
||||
public static void RegisterCodeTypes(SbmConfigConsole configConsole, SaCodeTypeConsole codeTypeConsole, ISbmUserContext userContext)
|
||||
public static void RegisterCodeTypes(SbmConfigConsole configConsole, SaCodeTypeConsole codeTypeConsole, ISbmUserContext_Core userContext)
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
// C o m m o d i t i e s
|
||||
|
||||
@@ -384,8 +384,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
fuelTypes.Add(Sbm.VehicleFuelType.Electric, "ELEC", "Electric");
|
||||
fuelTypes.Add(Sbm.VehicleFuelType.Hybrid, "HYBRID", "Hybrid");
|
||||
// OdometerUnits.
|
||||
odometerUnits.Add(Sbm.VehicleOdometerUnits.OdoUnits_Mile, "MILE", "Miles");
|
||||
odometerUnits.Add(Sbm.VehicleOdometerUnits.OdoUnits_Kilometre, "KM", "Kilometres");
|
||||
odometerUnits.Add(Sbm.VehicleOdometerUnits.Mile, "MILE", "Miles");
|
||||
odometerUnits.Add(Sbm.VehicleOdometerUnits.Kilometre, "KM", "Kilometres");
|
||||
// DiscountType.
|
||||
discountTypes.Add(Sbm.DiscountType.NoDiscount, "NoDisc", "No Discount");
|
||||
discountTypes.Add(Sbm.DiscountType.ValueDiscount, "ValDisc", "Value discount");
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
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.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -75,14 +77,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// S y s t e m C o d e s
|
||||
//-------------------------------------------------------------------
|
||||
private static String GetOwnerOption_Caption(ISbmUserContext userContext, Sbm.OrgOption_Caption orgOption_Caption, String defaultValue)
|
||||
private static String GetOwnerOption_Caption(ISbmUserContext_Core userContext, Sbm.OrgOption_Caption orgOption_Caption, String defaultValue)
|
||||
{
|
||||
// In case user context not specified, eg. Security Console initialising list of transaction types before user logged in.
|
||||
if (userContext != null)
|
||||
return userContext.GetOwnerOption_Caption(orgOption_Caption, defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
public static List<TypeCodeDesc> GetCodesOfType(ISbmUserContext userContext, Sbm.SystemCode systemCode)
|
||||
public static List<TypeCodeDesc> GetCodesOfType(ISbmUserContext_Core userContext, Sbm.SystemCode systemCode)
|
||||
{
|
||||
SbmConfigConsole configConsole = null; // SbmGlobals.GetConfigConsole(userContext.SessionContext);
|
||||
switch (systemCode)
|
||||
@@ -481,14 +483,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a M a n a g e r s
|
||||
//-------------------------------------------------------------------
|
||||
public abstract SbmAccountMgr CreateAccountMgr(ISbmUserContext userContext);
|
||||
public abstract SbmAssetMgr CreateAssetMgr(ISbmUserContext userContext);
|
||||
public abstract SbmCommodityMgr CreateCommodityMgr(ISbmUserContext userContext);
|
||||
public abstract SbmPriceMgr CreatePriceMgr(ISbmUserContext userContext);
|
||||
public abstract SbmDataItemMgr CreateDataItemMgr(ISbmUserContext userContext);
|
||||
public abstract SbmProcessMgr CreateProcessMgr(ISbmUserContext userContext);
|
||||
public abstract SbmStockMgr CreateStockMgr(ISbmUserContext userContext);
|
||||
public abstract SbmTransactionMgr CreateTransactionMgr(ISbmUserContext userContext);
|
||||
public abstract SbmAccountMgr CreateAccountMgr(ISbmUserContext_Core userContext);
|
||||
public abstract SbmAssetMgr CreateAssetMgr(ISbmUserContext_Core userContext);
|
||||
public abstract SbmCommodityMgr CreateCommodityMgr(ISbmUserContext_Core userContext);
|
||||
public abstract SbmPriceMgr CreatePriceMgr(ISbmUserContext_Core userContext);
|
||||
public abstract SbmDataItemMgr CreateDataItemMgr(ISbmUserContext_Core userContext);
|
||||
public abstract SbmProcessMgr CreateProcessMgr(ISbmUserContext_Core userContext);
|
||||
public abstract SbmStockMgr CreateStockMgr(ISbmUserContext_Core userContext);
|
||||
public abstract SbmTransactionMgr CreateTransactionMgr(ISbmUserContext_Core userContext);
|
||||
// Control.
|
||||
public abstract SbmcAccountMgr CreateControlAccountMgr();
|
||||
public abstract SbmcInstanceMgr CreateControlInstanceMgr();
|
||||
public abstract SbmcItemMgr CreateControlItemMgr();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A p p l i c a t i o n P r o p e r t i e s
|
||||
|
||||
@@ -14,12 +14,13 @@ using System.Collections.Generic;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmUserContext : ISbmUserContext
|
||||
public class SbmUserContext : ISbmUserContext_Core
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
// User profile.
|
||||
public class UserData : ISbmUserContext.IUserData
|
||||
public class UserData
|
||||
{
|
||||
protected UserData() { }
|
||||
protected readonly List<SysIdString> supervisedOwners = new List<SysIdString>();
|
||||
@@ -63,8 +64,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
this.supervisedOwners.AddRange(supervisedOwners);
|
||||
}
|
||||
}
|
||||
|
||||
// Owner profile - selected organisation to manage.
|
||||
public class OrganisationData : ISbmUserContext.IOrganisationData
|
||||
public class OrganisationData
|
||||
{
|
||||
internal OrganisationData() { }
|
||||
// Organisation options.
|
||||
@@ -135,15 +137,38 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmSessionContext SessionContext { get; protected set; }
|
||||
public ISbmUserContext.IUserData User { get { return userData; } }
|
||||
public bool ValidUser { get { return SysId.IsValid(userData.SecurityItemId) && SysId.IsValid(userData.AffiliateId); } }
|
||||
public ISbmUserContext.IOrganisationData Organisation { get { return organisationData; } }
|
||||
public DbUpdateInfo DbUpdateInfo { get { return new DbUpdateInfo(User?.AffiliateId, User?.DisplayName ?? "", SacsSystem.ComputerName); } }
|
||||
|
||||
// User properties.
|
||||
public UserData User { get { return userData; } }
|
||||
/// <summary>User Security Item Id.</summary>
|
||||
public SysId UserSecurityItemId { get { return User?.SecurityItemId; } }
|
||||
/// <summary>User Affiliate Id.</summary>
|
||||
public SysId UserAffiliateId { get { return User?.AffiliateId; } }
|
||||
/// <summary>User display name.</summary>
|
||||
public String UserDisplayName { get { return userData?.DisplayName; } }
|
||||
/// <summary>User email address.</summary>
|
||||
public String UserEmailAddress { get { return userData?.EmailAddress; } }
|
||||
public bool ValidUser { get { return SysId.IsValid(userData.SecurityItemId) && SysId.IsValid(userData?.AffiliateId); } }
|
||||
public DbUpdateInfo DbUpdateInfo { get { return new DbUpdateInfo(userData?.AffiliateId, userData?.DisplayName ?? "", SacsSystem.ComputerName); } }
|
||||
|
||||
// Organisation properties.
|
||||
public OrganisationData Organisation { get { return organisationData; } }
|
||||
/// <summary>Organisation Affiliate Id.</summary>
|
||||
public SysId OrganisationAffiliateId { get { return Organisation?.AffiliateId; } }
|
||||
/// <summary>Organisation Affiliate Type.</summary>
|
||||
public Sbm.AffiliateType OrganisationAffiliateType { get { return Organisation?.AffiliateType ?? Sbm.AffiliateType.Unknown; } }
|
||||
/// <summary>Organisation 'Internal' Association Id.</summary>
|
||||
public SysId OrganisationAssociationId { get { return Organisation?.AssociationId; } }
|
||||
/// <summary>Organisation display name.</summary>
|
||||
public String OrganisationDisplayName { get { return Organisation?.DisplayName; } }
|
||||
/// <summary>Organisation Interface context - to qualify interfaces belonging to the organisation.</summary>
|
||||
public String OrganisationInterfaceContext { get { return Organisation?.InterfaceContext; } }
|
||||
public List<SysIdString> SupervisedOrganisations { get { return new List<SysIdString>(userData.SupervisedOrganisations); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security profile.
|
||||
private SbmSecurityProfile securityProfile { get; set; }
|
||||
public ISbmSecurityProfile SecurityProfile { get { return securityProfile; } }
|
||||
public ISbmSecurityProfile_Core SecurityProfile_Core { get { return securityProfile; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation configuration.
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmcHierarchyItem : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcHierarchyItem() : base()
|
||||
{
|
||||
}
|
||||
protected SbmcHierarchyItem(SysId id) : base(id)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item types.
|
||||
public enum ItemType
|
||||
{
|
||||
Unknown = 0,
|
||||
UserAccount = 2000,
|
||||
Owner = 2010,
|
||||
Repository = 2020,
|
||||
ItemParam = 2120,
|
||||
}
|
||||
|
||||
public static String getItemTypeCaption(ItemType itemType)
|
||||
{
|
||||
switch (itemType)
|
||||
{
|
||||
case ItemType.UserAccount: return "User account";
|
||||
case ItemType.ItemParam: return "Item param";
|
||||
}
|
||||
return itemType.ToString();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.SbmSysParamCache;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmcItemParam : SbmcHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Hidden,
|
||||
Pos,
|
||||
Id,
|
||||
// Item.
|
||||
ItemType,
|
||||
ItemType_Caption,
|
||||
ItemId,
|
||||
Item_Caption,
|
||||
// Param.
|
||||
Context,
|
||||
Name,
|
||||
Value,
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public ItemId ItemId { get; set; } = new ItemId();
|
||||
public String Context { get; set; } = "";
|
||||
public String Name { get; set; } = "";
|
||||
public String Value { get; set; } = "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = SbmcItemParam.DefaultStatus;
|
||||
}
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
set { CheckChanged(data.ItemId, value); data.ItemId = value ?? new ItemId(); }
|
||||
}
|
||||
public String Context
|
||||
{
|
||||
get { return data.Context; }
|
||||
set { CheckChanged(data.Context, value); data.Context = value; }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
public String Value
|
||||
{
|
||||
get { return data.Value; }
|
||||
set { CheckChanged(data.Value, value); data.Value = value; }
|
||||
}
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
this.ItemId = data.ItemId;
|
||||
Context = data.Context;
|
||||
Name = data.Name;
|
||||
Value = data.Value;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
// Identifies the field that has invalid data.
|
||||
public ValidValue ItemId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Name { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Context { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Value { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
public static readonly Byte Flag_Password = 0x01;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcItemParam(SysId id, ItemId itemId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemId = itemId;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item status.
|
||||
private static readonly List<SaStatus> ownerStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(ownerStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Active:
|
||||
return DataValue.TriStateType.Green;
|
||||
case SaStatus.OnHold:
|
||||
return DataValue.TriStateType.Amber;
|
||||
case SaStatus.Inactive:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Deleted:
|
||||
return DataValue.TriStateType.Purple;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public static List<SbmcHierarchyItem.ItemType> ValidItemTypes =>
|
||||
new List<ItemType>()
|
||||
{
|
||||
ItemType.Owner,
|
||||
ItemType.Repository
|
||||
};
|
||||
|
||||
public static bool IsPasswordValue(String paramContext, String paramName, ushort flags)
|
||||
{
|
||||
if (GetFlag(flags, Flag_Password)) return true;
|
||||
if (paramContext.ContainsCI("password") || paramName.ContainsCI("password")) return true;
|
||||
if (paramContext.ContainsCI("pword") || paramName.ContainsCI("pword")) return true;
|
||||
if (paramContext.ContainsCI("secret") || paramName.ContainsCI("secret")) return true;
|
||||
return false;
|
||||
}
|
||||
public bool IsPasswordValue()
|
||||
{
|
||||
return IsPasswordValue(Context, Name, Flags);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
if (ItemId.IsValid(ItemId) && (ItemId.Type != data.ItemId.Type || SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id)))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
// ItemParam.
|
||||
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
protected set { data.ItemId = value; }
|
||||
}
|
||||
public String Context
|
||||
{
|
||||
get { return data.Context; }
|
||||
set { data.Context = value; }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { data.Name = value; }
|
||||
}
|
||||
public String Value
|
||||
{
|
||||
get { return data.Value; }
|
||||
set { data.Value = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
public bool IsPrimary
|
||||
{
|
||||
get { return GetFlag(Flag_Password); }
|
||||
set { SetFlag(Flag_Password, value); }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
|
||||
/// <summary> Status filter options.</summary>
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
ActiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a list of items.</summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<ItemId> ItemIdsIncluded { get; } = new HashSet<ItemId>();
|
||||
/// <summary>Generic search value - name, contact, email, phone etc.</summary>
|
||||
public String Search { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
/// <summary>Contact status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Table aliases.
|
||||
public String Alias_Item_Owner { get; set; }
|
||||
public String Alias_Item_Repository { get; set; }
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list.
|
||||
public static class SbmcItemParamList
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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.Standard.Base.Bus.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmcOwner : SbmcHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Hidden,
|
||||
Pos,
|
||||
// Owner.
|
||||
Id,
|
||||
Name,
|
||||
ContactName,
|
||||
ContactEmailAddress,
|
||||
ContactPhoneMain,
|
||||
ContactPhoneAlt,
|
||||
// Repositories.
|
||||
RepositoryCount,
|
||||
// Common.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public String Name { get; set; } = "";
|
||||
public String ContactName { get; set; } = "";
|
||||
public String ContactEmailAddress { get; set; } = "";
|
||||
public String ContactPhoneMain { get; set; } = "";
|
||||
public String ContactPhoneAlt { get; set; } = "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = SbmcOwner.DefaultStatus;
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
public String ContactName
|
||||
{
|
||||
get { return data.ContactName; }
|
||||
set { CheckChanged(data.ContactName, value); data.ContactName = value; }
|
||||
}
|
||||
public String ContactEmailAddress
|
||||
{
|
||||
get { return data.ContactEmailAddress; }
|
||||
set { CheckChanged(data.ContactEmailAddress, value); data.ContactEmailAddress = value; }
|
||||
}
|
||||
public String ContactPhoneMain
|
||||
{
|
||||
get { return data.ContactPhoneMain; }
|
||||
set { CheckChanged(data.ContactPhoneMain, value); data.ContactPhoneMain = value; }
|
||||
}
|
||||
public String ContactPhoneAlt
|
||||
{
|
||||
get { return data.ContactPhoneAlt; }
|
||||
set { CheckChanged(data.ContactPhoneAlt, value); data.ContactPhoneAlt = value; }
|
||||
}
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
Name = data.Name;
|
||||
ContactName = data.ContactName;
|
||||
ContactEmailAddress = data.ContactEmailAddress;
|
||||
ContactPhoneMain = data.ContactPhoneMain;
|
||||
ContactPhoneAlt = data.ContactPhoneAlt;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
// Identifies the field that has invalid data.
|
||||
public ValidValue Name { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ContactName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ContactEmailAddress { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ContactPhoneMain { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ContactPhoneAlt { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcOwner(SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner status.
|
||||
private static readonly List<SaStatus> ownerStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.OnHold,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(ownerStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Active:
|
||||
return DataValue.TriStateType.Green;
|
||||
case SaStatus.OnHold:
|
||||
return DataValue.TriStateType.Amber;
|
||||
case SaStatus.Inactive:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Deleted:
|
||||
return DataValue.TriStateType.Purple;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
// Owner.
|
||||
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { data.Name = value; }
|
||||
}
|
||||
public String ContactName
|
||||
{
|
||||
get { return data.ContactName; }
|
||||
set { data.ContactName = value; }
|
||||
}
|
||||
public String ContactEmailAddress
|
||||
{
|
||||
get { return data.ContactEmailAddress; }
|
||||
set { data.ContactEmailAddress = value; }
|
||||
}
|
||||
public String ContactPhoneMain
|
||||
{
|
||||
get { return data.ContactPhoneMain; }
|
||||
set { data.ContactPhoneMain = value; }
|
||||
}
|
||||
public String ContactPhoneAlt
|
||||
{
|
||||
get { return data.ContactPhoneAlt; }
|
||||
set { data.ContactPhoneAlt = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
|
||||
/// <summary> Status filter options.</summary>
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
ActiveOnly,
|
||||
OnHoldOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a list of items.</summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
|
||||
/// <summary>Generic search value - name, contact, email, phone etc.</summary>
|
||||
public String Search { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
/// <summary>Contact status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list.
|
||||
public static class SbmcOwnerList
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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.Standard.Base.Bus.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmcRepository : SbmcHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Hidden,
|
||||
Pos,
|
||||
// Repository.
|
||||
Id,
|
||||
Context,
|
||||
ServerName,
|
||||
InstanceName,
|
||||
DatabaseName,
|
||||
UserName,
|
||||
// Owner.
|
||||
OwnerId,
|
||||
OwnerName,
|
||||
ContactName,
|
||||
ContactEmailAddress,
|
||||
ContactPhoneMain,
|
||||
ContactPhoneAlt,
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public SysId OwnerId { get; set; }
|
||||
public String Context { get; set; } = "";
|
||||
public String ServerName { get; set; } = "";
|
||||
public String InstanceName { get; set; } = "";
|
||||
public String DatabaseName { get; set; }
|
||||
public String UserName { get; set; } = "";
|
||||
public String Password { get; set; } = "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = SbmcRepository.DefaultStatus;
|
||||
}
|
||||
public SysId OwnerId
|
||||
{
|
||||
get { return data.OwnerId; }
|
||||
set { CheckChanged(data.OwnerId, value); data.OwnerId = value; }
|
||||
}
|
||||
public String Context
|
||||
{
|
||||
get { return data.Context; }
|
||||
set { CheckChanged(data.Context, value); data.Context = value; }
|
||||
}
|
||||
public String ServerName
|
||||
{
|
||||
get { return data.ServerName; }
|
||||
set { CheckChanged(data.ServerName, value); data.ServerName = value; }
|
||||
}
|
||||
public String InstanceName
|
||||
{
|
||||
get { return data.InstanceName; }
|
||||
set { CheckChanged(data.InstanceName, value); data.InstanceName = value; }
|
||||
}
|
||||
public String DatabaseName
|
||||
{
|
||||
get { return data.DatabaseName; }
|
||||
set { CheckChanged(data.DatabaseName, value); data.DatabaseName = value; }
|
||||
}
|
||||
public String UserName
|
||||
{
|
||||
get { return data.UserName; }
|
||||
set { CheckChanged(data.UserName, value); data.UserName = value; }
|
||||
}
|
||||
public String Password
|
||||
{
|
||||
get { return data.Password; }
|
||||
set { CheckChanged(data.Password, value); data.Password = value; }
|
||||
}
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
OwnerId = data.OwnerId;
|
||||
Context = data.Context;
|
||||
ServerName = data.ServerName;
|
||||
InstanceName = data.InstanceName;
|
||||
DatabaseName = data.DatabaseName;
|
||||
UserName = data.UserName;
|
||||
Password = data.Password;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
// Identifies the field that has invalid data.
|
||||
public ValidValue OwnerId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Context { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ServerName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue InstanceName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DatabaseName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UserName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Password { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcRepository(SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository status.
|
||||
private static readonly List<SaStatus> repositoryStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.OnHold,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(repositoryStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Active:
|
||||
return DataValue.TriStateType.Green;
|
||||
case SaStatus.OnHold:
|
||||
return DataValue.TriStateType.Amber;
|
||||
case SaStatus.Inactive:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Deleted:
|
||||
return DataValue.TriStateType.Purple;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
// Owner.
|
||||
|
||||
public SysId OwnerId
|
||||
{
|
||||
get { return data.OwnerId; }
|
||||
set { data.OwnerId = value; }
|
||||
}
|
||||
|
||||
// Repository.
|
||||
|
||||
public String Context
|
||||
{
|
||||
get { return data.Context; }
|
||||
set { data.Context = value; }
|
||||
}
|
||||
public String ServerName
|
||||
{
|
||||
get { return data.ServerName; }
|
||||
set { data.ServerName = value; }
|
||||
}
|
||||
public String InstanceName
|
||||
{
|
||||
get { return data.InstanceName; }
|
||||
set { data.InstanceName = value; }
|
||||
}
|
||||
public String DatabaseName
|
||||
{
|
||||
get { return data.DatabaseName; }
|
||||
set { data.DatabaseName = value; }
|
||||
}
|
||||
|
||||
// Credentials.
|
||||
|
||||
public String UserName
|
||||
{
|
||||
get { return data.UserName; }
|
||||
set { data.UserName = value; }
|
||||
}
|
||||
public String Password
|
||||
{
|
||||
get { return data.Password; }
|
||||
set { data.Password = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
|
||||
/// <summary> Status filter options.</summary>
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
ActiveOnly,
|
||||
OnHoldOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a list of items.</summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
|
||||
/// <summary>Repository owners.</summary>
|
||||
public HashSet<SysId> OwnerIdsIncluded { get; } = new HashSet<SysId>();
|
||||
/// <summary>Repository contexts.</summary>
|
||||
public HashSet<String> ContextsIncluded { get; set; } = new HashSet<String>();
|
||||
/// <summary>Generic search value - context, server, instance, database etc.</summary>
|
||||
public String Search { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
/// <summary>Contact status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Table alises.
|
||||
public String Alias_Owner { get; set; }
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list.
|
||||
public static class SbmcRepositoryList
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,425 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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.Standard.Base.Bus.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmcUserAccount : SbmcHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Hidden,
|
||||
Pos,
|
||||
// User Account.
|
||||
Id,
|
||||
EmailAddress,
|
||||
DisplayName,
|
||||
Title,
|
||||
FirstName,
|
||||
LastName,
|
||||
Initials,
|
||||
PhoneMain,
|
||||
PhoneMobile,
|
||||
PhoneAlt,
|
||||
// Security.
|
||||
LastLoginOn,
|
||||
LastLoginAt,
|
||||
LastInvalidLoginOn,
|
||||
LastInvalidLoginAt,
|
||||
InvalidLoginCount,
|
||||
// Common.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public String EmailAddress { get; set; } = "";
|
||||
public String Title { get; set; } = "";
|
||||
public String FirstName { get; set; } = "";
|
||||
public String Initials { get; set; } = "";
|
||||
public String LastName { get; set; } = "";
|
||||
public String PhoneMain { get; set; } = "";
|
||||
public String PhoneMobile { get; set; } = "";
|
||||
public String PhoneAlt { get; set; } = "";
|
||||
public String PasswordToken { get; set; }
|
||||
public String PasswordHashed { get; set; } = "";
|
||||
public List<String> PasswordHistory { get; } = new List<string>();
|
||||
public DateTime? PasswordChangedAt { get; set; }
|
||||
public DateTime? LastLoginAt { get; set; }
|
||||
public DateTime? LastInvalidLoginAt { get; set; }
|
||||
public short InvalidLoginCount { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
//Status = SbmAccountMgr.AffiliateStatusDefault;
|
||||
}
|
||||
public String EmailAddress
|
||||
{
|
||||
get { return data.EmailAddress; }
|
||||
set { CheckChanged(data.EmailAddress, value); data.EmailAddress = value; }
|
||||
}
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { CheckChanged(data.Title, value); data.Title = value; }
|
||||
}
|
||||
public String FirstName
|
||||
{
|
||||
get { return data.FirstName; }
|
||||
set { CheckChanged(data.FirstName, value); data.FirstName = value; }
|
||||
}
|
||||
public String Initials
|
||||
{
|
||||
get { return data.Initials; }
|
||||
set { CheckChanged(data.Initials, value); data.Initials = value; }
|
||||
}
|
||||
public String LastName
|
||||
{
|
||||
get { return data.LastName; }
|
||||
set { CheckChanged(data.LastName, value); data.LastName = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { CheckChanged(data.PhoneMain, value); data.PhoneMain = value; }
|
||||
}
|
||||
public String PhoneMobile
|
||||
{
|
||||
get { return data.PhoneMobile; }
|
||||
set { CheckChanged(data.PhoneMobile, value); data.PhoneMobile = value; }
|
||||
}
|
||||
public String PhoneAlt
|
||||
{
|
||||
get { return data.PhoneAlt; }
|
||||
set { CheckChanged(data.PhoneAlt, value); data.PhoneAlt = value; }
|
||||
}
|
||||
public String PasswordToken
|
||||
{
|
||||
get { return data.PasswordToken; }
|
||||
set { CheckChanged(data.PasswordToken, value); data.PasswordToken = value; }
|
||||
}
|
||||
public String PasswordHashed
|
||||
{
|
||||
get { return data.PasswordHashed; }
|
||||
set { CheckChanged(data.PasswordHashed, value); data.PasswordHashed = value; }
|
||||
}
|
||||
public List<String> PasswordHistory
|
||||
{
|
||||
get { return data.PasswordHistory; }
|
||||
set
|
||||
{
|
||||
CheckChanged(data.PasswordHistory, value);
|
||||
data.PasswordHistory.Clear();
|
||||
data.PasswordHistory.AddRange((value ?? new List<String>()).FindAll(item => !StringUtil.IsEmpty(StringUtil.TrimAll(item))));
|
||||
}
|
||||
}
|
||||
public DateTime? PasswordChangedAt
|
||||
{
|
||||
get { return data.PasswordChangedAt; }
|
||||
set { CheckChangedNullable(data.PasswordChangedAt, value); data.PasswordChangedAt = value; }
|
||||
}
|
||||
public DateTime? LastLoginAt
|
||||
{
|
||||
get { return data.LastLoginAt; }
|
||||
set { CheckChangedNullable(data.LastLoginAt, value); data.LastLoginAt = value; }
|
||||
}
|
||||
public DateTime? LastInvalidLoginAt
|
||||
{
|
||||
get { return data.LastInvalidLoginAt; }
|
||||
set { CheckChangedNullable(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; }
|
||||
}
|
||||
public short InvalidLoginCount
|
||||
{
|
||||
get { return data.InvalidLoginCount; }
|
||||
set { CheckChanged(data.InvalidLoginCount, value); data.InvalidLoginCount = value; }
|
||||
}
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
EmailAddress = data.EmailAddress;
|
||||
Title = data.Title;
|
||||
LastName = data.LastName;
|
||||
Initials = data.Initials;
|
||||
FirstName = data.FirstName;
|
||||
PhoneMain = data.PhoneMain;
|
||||
PhoneMobile = data.PhoneMobile;
|
||||
PhoneAlt = data.PhoneAlt;
|
||||
PasswordToken = data.PasswordToken;
|
||||
PasswordHashed = data.PasswordHashed;
|
||||
PasswordHistory = data.PasswordHistory;
|
||||
PasswordChangedAt = data.PasswordChangedAt;
|
||||
LastLoginAt = data.LastLoginAt;
|
||||
LastInvalidLoginAt = data.LastInvalidLoginAt;
|
||||
InvalidLoginCount = data.InvalidLoginCount;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
// Identifies the field that has invalid data.
|
||||
public ValidValue EmailAddress { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Title { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FirstName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Initials { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LastName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneMain { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneMobile { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneAlt { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PasswordToken { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PasswordHashed { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PasswordHistory { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PasswordChangedAt { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LastLoginAt { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LastInvalidLoginAt { get; set; } = ValidValue.Valid;
|
||||
public ValidValue InvalidLoginCount { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
public static readonly String PasswordHistoryDelim = ",";
|
||||
public static readonly Byte Flag_KeepLoggedIn = 0x01;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcUserAccount(SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Affiliate status.
|
||||
private static readonly List<SaStatus> affiliateStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(affiliateStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Active:
|
||||
return DataValue.TriStateType.Green;
|
||||
case SaStatus.Inactive:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Deleted:
|
||||
return DataValue.TriStateType.Purple;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
public String EmailAddress
|
||||
{
|
||||
get { return data.EmailAddress; }
|
||||
set { data.EmailAddress = value; }
|
||||
}
|
||||
|
||||
// Name.
|
||||
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { data.Title = value; }
|
||||
}
|
||||
public String FirstName
|
||||
{
|
||||
get { return data.FirstName; }
|
||||
set { data.FirstName = value; }
|
||||
}
|
||||
public String Initials
|
||||
{
|
||||
get { return data.Initials; }
|
||||
set { data.Initials = value; }
|
||||
}
|
||||
public String LastName
|
||||
{
|
||||
get { return data.LastName; }
|
||||
set { data.LastName = value; }
|
||||
}
|
||||
|
||||
public String GetFullName(String title, String first, String last)
|
||||
{
|
||||
// <Title> <FirstName> <LastName>:
|
||||
List<String> Names = new List<string>();
|
||||
Names.Add(title);
|
||||
Names.Add(first);
|
||||
Names.Add(last);
|
||||
return Names.Concat(" ", null, null, true, true);
|
||||
}
|
||||
public String GetFullName()
|
||||
{
|
||||
return GetFullName(Title, FirstName, LastName);
|
||||
}
|
||||
public static String GetDisplayName(String firstName, String lastName)
|
||||
{
|
||||
// <LastName>, <FirstName>.
|
||||
List<String> Names = new List<string>();
|
||||
Names.Add(lastName);
|
||||
Names.Add(firstName);
|
||||
Names.RemoveBlanks();
|
||||
return Names.Concat(", ");
|
||||
}
|
||||
public String GetDisplayName()
|
||||
{
|
||||
return GetDisplayName(FirstName, LastName);
|
||||
}
|
||||
|
||||
// Phone numbers.
|
||||
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { data.PhoneMain = value; }
|
||||
}
|
||||
public String PhoneMobile
|
||||
{
|
||||
get { return data.PhoneMobile; }
|
||||
set { data.PhoneMobile = value; }
|
||||
}
|
||||
public String PhoneAlt
|
||||
{
|
||||
get { return data.PhoneAlt; }
|
||||
set { data.PhoneAlt = value; }
|
||||
}
|
||||
|
||||
// Security.
|
||||
|
||||
public String PasswordToken
|
||||
{
|
||||
get { return data.PasswordToken; }
|
||||
set { data.PasswordToken = value; }
|
||||
}
|
||||
public String PasswordHashed
|
||||
{
|
||||
get { return data.PasswordHashed; }
|
||||
set { data.PasswordHashed = value; }
|
||||
}
|
||||
public List<String> PasswordHistory
|
||||
{
|
||||
get { return data.PasswordHistory; }
|
||||
set { data.PasswordHistory = value; }
|
||||
}
|
||||
public DateTime? PasswordChangedAt
|
||||
{
|
||||
get { return data.PasswordChangedAt; }
|
||||
set { data.PasswordChangedAt = value; }
|
||||
}
|
||||
public DateTime? LastLoginAt
|
||||
{
|
||||
get { return data.LastLoginAt; }
|
||||
set { data.LastLoginAt = value; }
|
||||
}
|
||||
public DateTime? LastInvalidLoginAt
|
||||
{
|
||||
get { return data.LastInvalidLoginAt; }
|
||||
set { data.LastInvalidLoginAt = value; }
|
||||
}
|
||||
public short InvalidLoginCount
|
||||
{
|
||||
get { return data.InvalidLoginCount; }
|
||||
set { data.InvalidLoginCount = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
public bool KeepLoggedIn
|
||||
{
|
||||
get { return GetFlag(Flag_KeepLoggedIn); }
|
||||
set { SetFlag(Flag_KeepLoggedIn, value); }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
|
||||
/// <summary> Status filter options.</summary>
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
ActiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a list of items.</summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
|
||||
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
|
||||
/// <summary>Generic search value - email, name, phone etc.</summary>
|
||||
public String Search { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
public String EmailAddress { get; set; }
|
||||
public String EmailAddressPartial { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
/// <summary>Contact status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list.
|
||||
public static class SbmcUserAccountList
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -155,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
}
|
||||
private class QBooksParams
|
||||
{
|
||||
public QBooksParams(ISbmUserContext userContext)
|
||||
public QBooksParams(ISbmUserContext_Core userContext)
|
||||
{
|
||||
}
|
||||
// QuickBooks interface definitions.
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
}
|
||||
private class SageParams
|
||||
{
|
||||
public SageParams(ISbmUserContext userContext, SbmInternals internals)
|
||||
public SageParams(ISbmUserContext_Core userContext, SbmInternals internals)
|
||||
{
|
||||
UserContext = userContext;
|
||||
this.internals = internals;
|
||||
@@ -249,7 +249,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
SalesOrderColumnSources.Add(SageDbDfn.GetColumnName(SageDbDfn.ColumnIdx.SalesOrder_Notes1), "Notes line 1");
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
private ISbmUserContext UserContext { get; }
|
||||
private ISbmUserContext_Core UserContext { get; }
|
||||
private readonly SbmInternals internals;
|
||||
// Sage interface definitions.
|
||||
public SaInterface.Data dfnInt_Sage { get; set; } = new SaInterface.Data();
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmAccountsDfn(ISbmUserContext userContext)
|
||||
public SbmAccountsDfn(ISbmUserContext_Core userContext)
|
||||
{
|
||||
UserContext = userContext;
|
||||
internals = new SbmInternals(userContext);
|
||||
@@ -82,7 +82,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public ISbmUserContext_Core UserContext { get; }
|
||||
protected SaInterfaceConsole InterfaceConsole { get { return internals.InterfaceConsole; } }
|
||||
protected SaItemOptionConsole ItemOptionConsole { get { return internals.ItemOptionConsole; } }
|
||||
|
||||
@@ -730,7 +730,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
// Retrieve accounts interfaces.
|
||||
SaInterface.Params prmInterface_Accounts = new SaInterface.Params();
|
||||
prmInterface_Accounts.Context = UserContext.Organisation.InterfaceContext;
|
||||
prmInterface_Accounts.Context = UserContext.OrganisationInterfaceContext;
|
||||
prmInterface_Accounts.InterfaceCategory = SaInterfaceCategory.Accounts;
|
||||
prmInterface_Accounts.ActiveOnly = true;
|
||||
prmInterface_Accounts.StatusCat = SaInterface.StatusCat.ActiveOnly;
|
||||
|
||||
@@ -355,7 +355,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAddress(ISbmUserContext userContext, SysId id, Sbm.ItemType itemType, SysId itemId, Sbm.AddressType addressType) :
|
||||
protected SbmAddress(ISbmUserContext_Core userContext, SysId id, Sbm.ItemType itemType, SysId itemId, Sbm.AddressType addressType) :
|
||||
base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
@@ -698,7 +698,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String DeliveryBookInCode { get; set; }
|
||||
public bool PrimaryOnly { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAffiliate(ISbmUserContext userContext, SysId id, Sbm.AffiliateType affiliateType) : base(userContext, id)
|
||||
protected SbmAffiliate(ISbmUserContext_Core userContext, SysId id, Sbm.AffiliateType affiliateType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateType = affiliateType;
|
||||
@@ -779,7 +779,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
// Interfaces.
|
||||
public SysId InterfaceIdExcludeSystemUsers { get; set; }
|
||||
/// <summary>Contact status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -376,7 +376,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAsset(ISbmUserContext userContext, SysId id, SysId assetCatId) : base(userContext, id)
|
||||
protected SbmAsset(ISbmUserContext_Core userContext, SysId id, SysId assetCatId) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Id = id;
|
||||
@@ -388,22 +388,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
// Asset status.
|
||||
private static readonly List<SaStatus> assetStatuses = new List<SaStatus>()
|
||||
{
|
||||
/*SaStatus.Provisional,*/
|
||||
SaStatus.Active,
|
||||
/*SaStatus.Actioned,*/
|
||||
SaStatus.Cancelled,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> AssetStatuses { get { return new List<SaStatus>(assetStatuses); } }
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(assetStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Active:
|
||||
return DataValue.TriStateType.Green;
|
||||
case SaStatus.Cancelled:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Disabled:
|
||||
case SaStatus.Inactive:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Deleted:
|
||||
return DataValue.TriStateType.Purple;
|
||||
@@ -620,6 +617,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
Any,
|
||||
ActiveOnly,
|
||||
NotDeleted,
|
||||
Deleted,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -631,6 +630,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Asset.
|
||||
public SysId AssetCatId { get; set; }
|
||||
public String Search { get; set; }
|
||||
public Sbm.ItemType ItemType { get; set; }
|
||||
public String SerialNumber { get; set; }
|
||||
public String SerialNumberPartial { get; set; }
|
||||
@@ -640,7 +640,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public SysId ProcessIdActive { get; set; }
|
||||
public bool RestrictToActive { get; set; }
|
||||
/// <summary>Asset status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
// AssetCategory.
|
||||
AffIdOwner,
|
||||
AssetType,
|
||||
Type_Desc,
|
||||
AssetType_Desc,
|
||||
Code,
|
||||
DescBrief,
|
||||
IncomeType,
|
||||
@@ -215,9 +215,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
private readonly Data data = new Data();
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAssetCategory(ISbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
protected SbmAssetCategory(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.AssetType assetType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffIdOwner = affiliateIdOwner;
|
||||
AssetType = assetType;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
@@ -225,22 +227,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
// AssetCategory status.
|
||||
private static readonly List<SaStatus> assetCategoryStatuses = new List<SaStatus>()
|
||||
{
|
||||
/*SaStatus.Provisional,*/
|
||||
SaStatus.Active,
|
||||
/*SaStatus.Actioned,*/
|
||||
SaStatus.Cancelled,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> AssetCategoryStatuses { get { return new List<SaStatus>(assetCategoryStatuses); } }
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(assetCategoryStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Active:
|
||||
return DataValue.TriStateType.Green;
|
||||
case SaStatus.Cancelled:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Disabled:
|
||||
case SaStatus.Inactive:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Deleted:
|
||||
return DataValue.TriStateType.Purple;
|
||||
@@ -259,6 +258,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
if (SysId.IsValid(AffIdOwner) && SysId.ToInt(AffIdOwner) != SysId.ToInt(data.AffIdOwner))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Owner Affiliate Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
@@ -368,6 +369,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
Deleted,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -375,23 +378,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
// AssetCategory.
|
||||
public Sbm.AssetType AssetType { get; set; }
|
||||
public String Search { get; set; }
|
||||
public String Code { get; set; }
|
||||
public String CodePartial { get; set; }
|
||||
public String DescBrief { get; set; }
|
||||
public String DescBriefPartial { get; set; }
|
||||
public bool RestrictToActive { get; set; }
|
||||
/// <summary>Asset Category status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
List<StringPair> values = new List<StringPair>();
|
||||
return values;
|
||||
}
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
private readonly Data data = new Data();
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAssetProcess(ISbmUserContext userContext, SysId id, SysId assetId, SysId processId) : base(userContext, id)
|
||||
protected SbmAssetProcess(ISbmUserContext_Core userContext, SysId id, SysId assetId, SysId processId) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Id = id;
|
||||
@@ -216,6 +216,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -231,7 +233,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String Seq { get; set; }
|
||||
public bool RestrictToActive { get; set; }
|
||||
/// <summary>Asset Process status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -504,7 +504,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAssociation(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.AssociationType associationType, SysId affiliateIdTarget) : base(userContext, id)
|
||||
protected SbmAssociation(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.AssociationType associationType, SysId affiliateIdTarget) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -902,7 +902,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public List<String> DeliveryCourierCodes { get; } = new List<String>();
|
||||
public List<String> DeliveryBookInCodes { get; } = new List<String>();
|
||||
/// <summary>Association must have a transaction active at some time between the specified dates (one date can be specified for open ended period).</summary>
|
||||
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.Any;
|
||||
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.NotDeleted;
|
||||
/// <summary>Has transactions active from.</summary>
|
||||
public DateTime TransActiveFrom { get; set; } = DateTime.MinValue;
|
||||
/// <summary>Has transactions active up to (inclusive).</summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
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;
|
||||
@@ -1085,7 +1086,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCommodity(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.CommodityType commodityType, String code) : base(userContext, id)
|
||||
protected SbmCommodity(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.CommodityType commodityType, String code) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -1874,7 +1875,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
/// <summary>Commodity status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues(ISbmUserContext userContext)
|
||||
public List<StringPair> GetDisplayValues(ISbmUserContext_Core userContext)
|
||||
{
|
||||
SbmAccountMgr accountMgr = null;
|
||||
List<StringPair> lValue = new List<StringPair>();
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCommodityCustomer(ISbmUserContext userContext, SysId commodityId, SysId assocIdCustomer) : base(userContext)
|
||||
protected SbmCommodityCustomer(ISbmUserContext_Core userContext, SysId commodityId, SysId assocIdCustomer) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
CommodityId = commodityId;
|
||||
@@ -221,6 +221,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -239,7 +241,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String ProductCodePartial { get; set; }
|
||||
public bool RestrictToActive { get; set; } = true;
|
||||
/// <summary>Commodity Customer status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCommoditySupplier(ISbmUserContext userContext, SysId commodityId, SysId assocIdSupplier) : base(userContext)
|
||||
protected SbmCommoditySupplier(ISbmUserContext_Core userContext, SysId commodityId, SysId assocIdSupplier) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
CommodityId = commodityId;
|
||||
@@ -209,7 +209,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any, Active,
|
||||
Any,
|
||||
ActiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -227,7 +230,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public SysId CurrencyIdCost { get; set; }
|
||||
public bool RestrictToActive { get; set; } = true;
|
||||
/// <summary>Commodity Supplier status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -395,7 +395,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmConstituent(ISbmUserContext userContext, SysId id, SysId affIdOwner, SysId assocId, Sbm.ConstituentType constituentType) : base(userContext)
|
||||
protected SbmConstituent(ISbmUserContext_Core userContext, SysId id, SysId affIdOwner, SysId assocId, Sbm.ConstituentType constituentType) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
Id = id;
|
||||
@@ -680,7 +680,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public DateTime UpdatedSince { get; set; }
|
||||
public bool UseJobNumber { get; set; }
|
||||
/// <summary>Constituent status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmContainer(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ContainerCategory containerCategory, Sbm.ContainerType containerType) : base(userContext, id)
|
||||
protected SbmContainer(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.ContainerCategory containerCategory, Sbm.ContainerType containerType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -275,6 +275,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
Any,
|
||||
ActiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -322,7 +324,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public bool HasItems { get; set; }
|
||||
public SaStatus ContainerStatus { get; set; }
|
||||
/// <summary>Container status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmContainerItem(ISbmUserContext userContext, SysId containerId, Sbm.ItemType itemType, SysId itemId) : base(userContext)
|
||||
protected SbmContainerItem(ISbmUserContext_Core userContext, SysId containerId, Sbm.ItemType itemType, SysId itemId) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
ContainerId = containerId;
|
||||
@@ -265,7 +265,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
ActiveOnly
|
||||
ActiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>Item list parameters.</summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
@@ -296,7 +298,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public SaStatus ContainerStatus { get; set; }
|
||||
public bool ContainerHasItems { get; set; } = false;
|
||||
/// <summary>Container Item status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -134,13 +134,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmCostEstimate(ISbmUserContext userContext, Sbm.CostEstimateCategory costEstimateCategory) : base(userContext)
|
||||
public SbmCostEstimate(ISbmUserContext_Core userContext, Sbm.CostEstimateCategory costEstimateCategory) : base(userContext)
|
||||
{
|
||||
CostEstimateCategory = costEstimateCategory;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Conversion from ItemLink.
|
||||
public SbmCostEstimate(ISbmUserContext userContext, String archive) : base(userContext)
|
||||
public SbmCostEstimate(ISbmUserContext_Core userContext, String archive) : base(userContext)
|
||||
{
|
||||
String[] data = archive.Split(new String[] { delimArchive }, StringSplitOptions.None);
|
||||
costEstimateCategory = (Sbm.CostEstimateCategory)(data.Length > 0 ? StringUtil.ToShort(data[0]) : 0);
|
||||
@@ -442,7 +442,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public static void SetCommodityCosts(this List<SbmCostEstimate> values, ISbmUserContext userContext, SbmCommodity commodity, decimal quantity)
|
||||
public static void SetCommodityCosts(this List<SbmCostEstimate> values, ISbmUserContext_Core userContext, SbmCommodity commodity, decimal quantity)
|
||||
{
|
||||
// Retrieve costs from commodity and remove unwanted costs (for other quantities).
|
||||
List<SbmCostEstimate> costEstimatesCommodity = commodity.GetCostEstimates();
|
||||
|
||||
@@ -9,18 +9,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmHierarchyItem(ISbmUserContext userContext) : base()
|
||||
protected SbmHierarchyItem(ISbmUserContext_Core userContext) : base()
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
protected SbmHierarchyItem(ISbmUserContext userContext, SysId id) : base(id)
|
||||
protected SbmHierarchyItem(ISbmUserContext_Core userContext, SysId id) : base(id)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public ISbmUserContext_Core UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemBatch(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ItemBatchType itemBatchType, String refs) : base(userContext, id)
|
||||
protected SbmItemBatch(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.ItemBatchType itemBatchType, String refs) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -213,6 +213,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -229,7 +231,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String DescBrief { get; set; }
|
||||
public bool NotCompleted { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemLink(ISbmUserContext userContext, SysId id, Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeFrom, SysId itemIdFrom, Sbm.ItemType itemTypeTo, SysId itemIdTo) : base(userContext, id)
|
||||
protected SbmItemLink(ISbmUserContext_Core userContext, SysId id, Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeFrom, SysId itemIdFrom, Sbm.ItemType itemTypeTo, SysId itemIdTo) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemLinkType = itemLinkType;
|
||||
@@ -357,6 +357,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -376,7 +378,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public DateTime Completed { get; set; }
|
||||
public String DataContent { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -92,12 +92,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmItemPrice(ISbmUserContext userContext) : base(userContext)
|
||||
public SbmItemPrice(ISbmUserContext_Core userContext) : base(userContext)
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Conversion from ItemLink.
|
||||
public SbmItemPrice(ISbmUserContext userContext, String archive) : base(userContext)
|
||||
public SbmItemPrice(ISbmUserContext_Core userContext, String archive) : base(userContext)
|
||||
{
|
||||
String[] data = archive.Split(new String[] { delimArchive }, StringSplitOptions.None);
|
||||
type = (data.Length > 1 ? data[1] : "");
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemProcess(ISbmUserContext userContext, Sbm.ItemType itemType, SysId itemId, SysId processId) : base(userContext)
|
||||
protected SbmItemProcess(ISbmUserContext_Core userContext, Sbm.ItemType itemType, SysId itemId, SysId processId) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemType = itemType;
|
||||
@@ -334,11 +334,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Item Processses</summary>
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Item Processes</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any, ActiveOnly,
|
||||
Any,
|
||||
ActiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -354,7 +357,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public SysId ProcessId { get; set; }
|
||||
public bool RestrictToActive { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmLocation(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.LocationCategory locationCategory) : base(userContext, id)
|
||||
protected SbmLocation(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.LocationCategory locationCategory) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -212,6 +212,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
Any,
|
||||
ActiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -231,7 +233,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public bool RestrictToSalesStock { get; set; } = false;
|
||||
public bool RestrictToCalculateStock { get; set; } = false;
|
||||
/// <summary>Location status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public static readonly Byte Flag_DiaryEntry = 0x01;
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmMovement(ISbmUserContext userContext, SysId id, Sbm.ItemType itemType, SysId itemId, Sbm.MovementType movementType) : base(userContext, id)
|
||||
protected SbmMovement(ISbmUserContext_Core userContext, SysId id, Sbm.ItemType itemType, SysId itemId, Sbm.MovementType movementType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemType = itemType;
|
||||
@@ -296,6 +296,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -326,7 +328,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public SysId MovementIdSource { get; set; }
|
||||
public SaStatus Status { get; set; }
|
||||
/// <summary>Movement status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmPortfolioItem(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.PortfolioItemType portfolioItemType) : base(userContext, id)
|
||||
protected SbmPortfolioItem(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.PortfolioItemType portfolioItemType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -346,7 +346,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String CodePartial { get; set; }
|
||||
public String ShortCut { get; set; }
|
||||
/// <summary>Portfolio Item status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmPrice(ISbmUserContext userContext, SysId priceSetId, SysId commodityId, Sbm.PriceType priceType) : base(userContext)
|
||||
protected SbmPrice(ISbmUserContext_Core userContext, SysId priceSetId, SysId commodityId, Sbm.PriceType priceType) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
PriceSetId = priceSetId;
|
||||
@@ -274,6 +274,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
Any,
|
||||
ActiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -289,7 +291,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Sbm.PriceRounderMethod RounderMethod { get; set; } = Sbm.PriceRounderMethod.Unknown;
|
||||
public Sbm.PriceRounderDirection RounderDirection { get; set; } = Sbm.PriceRounderDirection.Unknown;
|
||||
/// <summary>Price status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmPriceSet(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, String reference, Sbm.PriceType priceType) : base(userContext, id)
|
||||
protected SbmPriceSet(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, String reference, Sbm.PriceType priceType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -221,7 +221,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
ActiveOnly
|
||||
ActiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -238,7 +240,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String Name { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
/// <summary>Price Set status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmProcess(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ProcessCategory processCategory) : base(userContext, id)
|
||||
protected SbmProcess(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.ProcessCategory processCategory) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -702,7 +702,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmRequirement(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId associationId, SysId transactionId, Sbm.RequirementType requirementType) : base(userContext, id)
|
||||
protected SbmRequirement(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, SysId associationId, SysId transactionId, Sbm.RequirementType requirementType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -1251,7 +1251,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public SysId TransReqntSourceId { get; set; } // Identifies the transaction to which the source requirement belongs.
|
||||
public Sbm.TransactionType TransactionType { get; set; } = Sbm.TransactionType.Any;
|
||||
public SysId TransLocationIdStock { get; set; }
|
||||
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.Any;
|
||||
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.NotDeleted;
|
||||
public String TransRefPartial { get; set; }
|
||||
public String TransRefExtPartial { get; set; }
|
||||
public String TransDescBriefPartial { get; set; }
|
||||
|
||||
@@ -140,14 +140,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmRequirementCosts(ISbmUserContext userContext)
|
||||
public SbmRequirementCosts(ISbmUserContext_Core userContext)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public ISbmUserContext_Core UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Calculation.
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmStockLevel(ISbmUserContext userContext, SysId id, SysId idCommodity, SysId idLocation, Sbm.StockLevelType type, Sbm.StockLevelSource source) : base(userContext, id)
|
||||
protected SbmStockLevel(ISbmUserContext_Core userContext, SysId id, SysId idCommodity, SysId idLocation, Sbm.StockLevelType type, Sbm.StockLevelSource source) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
CommodityId = idCommodity;
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSysParam(ISbmUserContext userContext, SysId id, Sbm.SysParamCategory category, String name) : base(userContext, id)
|
||||
protected SbmSysParam(ISbmUserContext_Core userContext, SysId id, Sbm.SysParamCategory category, String name) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Category = category;
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSystemAccount(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.SystemAccountType systemAccountType, SysId interfaceId, SysId associationId) : base(userContext, id)
|
||||
protected SbmSystemAccount(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, Sbm.SystemAccountType systemAccountType, SysId interfaceId, SysId associationId) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSystemAccountUser(ISbmUserContext userContext, SysId accountId, SysId userId) : base(userContext)
|
||||
protected SbmSystemAccountUser(ISbmUserContext_Core userContext, SysId accountId, SysId userId) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
AccountId = accountId;
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSystemUser(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId interfaceId, SysId affiliateId) : base(userContext, id)
|
||||
protected SbmSystemUser(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, SysId interfaceId, SysId affiliateId) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -647,7 +648,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmTransaction(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId associationId, Sbm.TransactionType transactionType) : base(userContext, id)
|
||||
protected SbmTransaction(ISbmUserContext_Core userContext, SysId id, SysId affiliateIdOwner, SysId associationId, Sbm.TransactionType transactionType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Id = id;
|
||||
@@ -789,7 +790,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status Categories.
|
||||
public static List<TypeCodeDesc> GetTransactionStatusCats(ISbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
public static List<TypeCodeDesc> GetTransactionStatusCats(ISbmUserContext_Core userContext, Sbm.TransactionType transactionType)
|
||||
{
|
||||
List<TypeCodeDesc> statusCats = new List<TypeCodeDesc>();
|
||||
List<TypeCodeDesc> statusCatsFull = SbmSystem.GetCodesOfType(userContext, Sbm.SystemCode.TransactionStatusCat);
|
||||
@@ -850,7 +851,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
return GetTaxEffectiveDate(UserContext, TransactionType, Status, Raised, InProgress, Closed);
|
||||
}
|
||||
public static DateTime GetTaxEffectiveDate(ISbmUserContext userContext, Sbm.TransactionType transactionType, SaStatus status, DateTime raised, DateTime inProgress, DateTime closed)
|
||||
public static DateTime GetTaxEffectiveDate(ISbmUserContext_Core userContext, Sbm.TransactionType transactionType, SaStatus status, DateTime raised, DateTime inProgress, DateTime closed)
|
||||
{
|
||||
// Original thinking was that the status would have an effect on the tax point.
|
||||
SbmTransaction.StatusCat transactionStatusCat = GetCategoryForStatus(status);
|
||||
@@ -1603,8 +1604,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public abstract bool HasPendingStockMovements();
|
||||
public abstract bool HasDiaryLinks();
|
||||
//public abstract void SetDefaults(class SbmRequirement *) const;
|
||||
public abstract long GetRequirementCount(SbmRequirement.StatusCat requirementStatusCat = SbmRequirement.StatusCat.Any);
|
||||
public abstract List<SbmRequirement> GetRequirements(SbmRequirement.StatusCat requirementStatusCat = SbmRequirement.StatusCat.Any);
|
||||
public abstract long GetRequirementCount(SbmRequirement.StatusCat requirementStatusCat = SbmRequirement.StatusCat.NotDeleted);
|
||||
public abstract List<SbmRequirement> GetRequirements(SbmRequirement.StatusCat requirementStatusCat = SbmRequirement.StatusCat.NotDeleted);
|
||||
public abstract bool ItemsRequireJobNumber();
|
||||
public abstract bool UpdateRequirements(List<SbmRequirement> requirements);
|
||||
public abstract bool CommitAssociatedData();
|
||||
|
||||
@@ -90,12 +90,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmTransactionPayment(ISbmUserContext userContext) : base(userContext)
|
||||
public SbmTransactionPayment(ISbmUserContext_Core userContext) : base(userContext)
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Conversion from ItemLink.
|
||||
public SbmTransactionPayment(ISbmUserContext userContext, String archive) : base(userContext)
|
||||
public SbmTransactionPayment(ISbmUserContext_Core userContext, String archive) : base(userContext)
|
||||
{
|
||||
String[] data = archive.Split(new String[] { delimArchive }, StringSplitOptions.None);
|
||||
type = (data.Length > 1 ? data[1] : "");
|
||||
|
||||
@@ -333,7 +333,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmVehicle(ISbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
protected SbmVehicle(ISbmUserContext_Core userContext, SysId id) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
//Database = database;
|
||||
@@ -348,7 +348,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
SaStatus.Cancelled,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> VehicleStatuses { get { return new List<SaStatus>(vehicleStatuses); } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(vehicleStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Sbm.VehicleType VehicleType { get; set; } = Sbm.VehicleType.Unknown;
|
||||
public String VehicleCategoryCode { get; set; } = "";
|
||||
public Sbm.VehicleFuelType FuelType { get; set; } = Sbm.VehicleFuelType.Unknown;
|
||||
public Sbm.VehicleOdometerUnits OdometerUnits { get; set; } = Sbm.VehicleOdometerUnits.OdoUnits_Unknown;
|
||||
public Sbm.VehicleOdometerUnits OdometerUnits { get; set; } = Sbm.VehicleOdometerUnits.Unknown;
|
||||
public short Seats { get; set; } = 0;
|
||||
public decimal Weight { get; set; } = 0.0m;
|
||||
public String InsuranceCode { get; set; } = "";
|
||||
@@ -236,7 +236,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public static readonly Byte Flag_DescBriefFixed = 0x01;
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmVehicleClass(ISbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
protected SbmVehicleClass(ISbmUserContext_Core userContext, SysId id) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Status = DefaultStatus;
|
||||
@@ -247,22 +247,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
private static readonly List<SaStatus> vehicleClassStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.Cancelled,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> VehicleClassStatuses { get { return new List<SaStatus>(vehicleClassStatuses); } }
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(vehicleClassStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Active:
|
||||
return DataValue.TriStateType.Green;
|
||||
case SaStatus.Awaiting:
|
||||
case SaStatus.Inactive:
|
||||
return DataValue.TriStateType.Amber;
|
||||
case SaStatus.Disabled:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Cancelled:
|
||||
return DataValue.TriStateType.Red;
|
||||
case SaStatus.Deleted:
|
||||
return DataValue.TriStateType.Purple;
|
||||
}
|
||||
@@ -420,7 +417,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
Any,
|
||||
ActiveOnly,
|
||||
CancelledOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -428,9 +427,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// VehicleClass.
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
/// <summary>Generic property search - make, model, derivative etc.</summary>
|
||||
public String Search { get; set; }
|
||||
// Item properties.
|
||||
public String MakeCode { get; set; }
|
||||
public String Model { get; set; }
|
||||
public String ModelPartial { get; set; }
|
||||
@@ -438,9 +439,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String DescBriefPartial { get; set; }
|
||||
public String Derivative { get; set; }
|
||||
public String VehicleCategoryCode { get; set; }
|
||||
public bool RestrictToActive { get; set; }
|
||||
/// <summary>Vehicle Class status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues()
|
||||
{
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmVehicleEvent(ISbmUserContext userContext, SysId vehicleId, Sbm.VehicleEventType vehicleEventType) : base(userContext, vehicleId)
|
||||
protected SbmVehicleEvent(ISbmUserContext_Core userContext, SysId vehicleId, Sbm.VehicleEventType vehicleEventType) : base(userContext, vehicleId)
|
||||
{
|
||||
base.SetData(data);
|
||||
VehicleId = vehicleId;
|
||||
@@ -201,7 +201,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
SaStatus.Cancelled,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> VehicleEventStatuses { get { return new List<SaStatus>(vehicleEventStatuses); } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(vehicleEventStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmVehicleFeature(ISbmUserContext userContext, SysId vehicleId, Sbm.VehicleFeatureSource vehicleFeatureSource, Sbm.VehicleFeatureType vehicleFeatureType) : base(userContext)
|
||||
protected SbmVehicleFeature(ISbmUserContext_Core userContext, SysId vehicleId, Sbm.VehicleFeatureSource vehicleFeatureSource, Sbm.VehicleFeatureType vehicleFeatureType) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
VehicleId = vehicleId;
|
||||
@@ -179,7 +179,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
SaStatus.Cancelled,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> VehicleFeatureStatuses { get { return new List<SaStatus>(vehicleFeatureStatuses); } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(vehicleFeatureStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
|
||||
+49
-48
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Procs;
|
||||
using Sarand.Net.Standard.Accounts.QuickBooks.App;
|
||||
@@ -12,7 +13,7 @@ using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmConfigConsole : SacsDisposable
|
||||
@@ -144,7 +145,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application Configuration. - AllowOption.
|
||||
public virtual bool AllowOption(ISbmUserContext userContext, Sbm.ConfigOption option)
|
||||
public virtual bool AllowOption(ISbmUserContext_Core userContext, Sbm.ConfigOption option)
|
||||
{
|
||||
switch (option)
|
||||
{
|
||||
@@ -191,7 +192,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// O r g a n i s a t i o n
|
||||
//-------------------------------------------------------------------
|
||||
// Allows validation of organisation name is required. Default: true.
|
||||
// Allows validation of organisation name if required. Default: true.
|
||||
public virtual bool OwnerIsValid()
|
||||
{
|
||||
return true;
|
||||
@@ -322,24 +323,24 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// I t e m s
|
||||
//-------------------------------------------------------------------
|
||||
// Item Data Interface.
|
||||
public virtual bool CanUpdateItemData(ISbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
public virtual bool CanUpdateItemData(ISbmUserContext_Core userContext, Sbm.ItemDataType itemDataType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool DoUpdateItemData(ISbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
public virtual bool DoUpdateItemData(ISbmUserContext_Core userContext, Sbm.ItemDataType itemDataType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool CanRemoveItemData(ISbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
public virtual bool CanRemoveItemData(ISbmUserContext_Core userContext, Sbm.ItemDataType itemDataType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update Log.
|
||||
public virtual bool IsColumnChangeLogged(ISbmUserContext userContext, SbmDbDfn.ColumnIdx column)
|
||||
public virtual bool IsColumnChangeLogged(ISbmUserContext_Core userContext, SbmDbDfn.ColumnIdx column)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -352,21 +353,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A l l o w T y p e s
|
||||
// Allowed data component types.
|
||||
//-------------------------------------------------------------------
|
||||
// Supported Data Item Types.
|
||||
// Supported affiliate types (all allowed by default).
|
||||
public virtual bool AllowAffiliateType(ISbmUserContext userContext, Sbm.AffiliateType type)
|
||||
public virtual bool AllowAffiliateType(ISbmUserContext_Core userContext, Sbm.AffiliateType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Supported Association types (all allowed by default).
|
||||
public virtual bool AllowAssociationType(ISbmUserContext userContext, Sbm.AssociationType type)
|
||||
public virtual bool AllowAssociationType(ISbmUserContext_Core userContext, Sbm.AssociationType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Supported Transaction types.
|
||||
public virtual bool AllowTransactionType(ISbmUserContext userContext, Sbm.TransactionType type)
|
||||
public virtual bool AllowTransactionType(ISbmUserContext_Core userContext, Sbm.TransactionType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -391,7 +392,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// D a t a O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
// Application Configuration. - Display and caption for data attributes.
|
||||
public virtual bool DisplayAttribute(ISbmUserContext userContext, SbmDbDfn.ColumnIdx column)
|
||||
public virtual bool DisplayAttribute(ISbmUserContext_Core userContext, SbmDbDfn.ColumnIdx column)
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
@@ -435,7 +436,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Alternative data value captions.
|
||||
public virtual String GetAttributeCaption(ISbmUserContext userContext, SbmDbDfn.ColumnIdx column, string Default)
|
||||
public virtual String GetAttributeCaption(ISbmUserContext_Core userContext, SbmDbDfn.ColumnIdx column, string Default)
|
||||
{
|
||||
String Caption = "";
|
||||
if (column != SbmDbDfn.ColumnIdx.Unknown)
|
||||
@@ -450,7 +451,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// T r a n s a c t i o n O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
// Job Tracking Options.
|
||||
public virtual String GetDefaultQuoteDescIntro(ISbmUserContext userContext)
|
||||
public virtual String GetDefaultQuoteDescIntro(ISbmUserContext_Core userContext)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@@ -470,17 +471,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Transaction.
|
||||
public virtual bool CanCreateTransactionLocally(ISbmUserContext userContext, Sbm.TransactionType type)
|
||||
public virtual bool CanCreateTransactionLocally(ISbmUserContext_Core userContext, Sbm.TransactionType type)
|
||||
{
|
||||
if (!AllowTransactionType(userContext, type)) return false;
|
||||
// Refresh options.
|
||||
if (dfnSageInt.AffiliateId_Owner != userContext.Organisation.AffiliateId || dfnQBooksInt.AffiliateId_Owner != userContext.Organisation.AffiliateId)
|
||||
if (dfnSageInt.AffiliateId_Owner != userContext.OrganisationAffiliateId || dfnQBooksInt.AffiliateId_Owner != userContext.OrganisationAffiliateId)
|
||||
{
|
||||
// Reset the accounts interface configurations.
|
||||
dfnSageInt.ClearConfig();
|
||||
dfnSageInt.AffiliateId_Owner = userContext.Organisation.AffiliateId;
|
||||
dfnSageInt.AffiliateId_Owner = userContext.OrganisationAffiliateId;
|
||||
dfnQBooksInt.ClearConfig();
|
||||
dfnQBooksInt.AffiliateId_Owner = userContext.Organisation.AffiliateId;
|
||||
dfnQBooksInt.AffiliateId_Owner = userContext.OrganisationAffiliateId;
|
||||
// Identify the interfaces.
|
||||
SbmAccountsDfn accountsDfn = new SbmAccountsDfn(userContext);
|
||||
dfnSageInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.SageLine50);
|
||||
@@ -552,7 +553,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
System, Manual, Option
|
||||
}
|
||||
public virtual AssignTransRefMethod TransactionAssignRefMethod(ISbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
public virtual AssignTransRefMethod TransactionAssignRefMethod(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes)
|
||||
{
|
||||
return AssignTransRefMethod.System;
|
||||
}
|
||||
@@ -560,20 +561,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
ByOwnerType, ByType
|
||||
}
|
||||
public virtual AssignTransRefSource TransactionAssignRefSource(ISbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
public virtual AssignTransRefSource TransactionAssignRefSource(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes)
|
||||
{
|
||||
return AssignTransRefSource.ByOwnerType;
|
||||
}
|
||||
|
||||
// By default all types of transaction have their own Id sequence.
|
||||
// Override this method to allow different types of transaction to share Id sequence.
|
||||
public virtual Sbm.TransactionType GetTransactionTypeForNextId(ISbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
public virtual Sbm.TransactionType GetTransactionTypeForNextId(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes)
|
||||
{
|
||||
return transTypes;
|
||||
}
|
||||
|
||||
// NextId key value.
|
||||
public virtual String GetTransactionNextIdKey(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType eType)
|
||||
public virtual String GetTransactionNextIdKey(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType eType)
|
||||
{
|
||||
idAssoc = new SysId();
|
||||
Sbm.TransactionType transTypes = GetTransactionTypeForNextId(userContext, eType);
|
||||
@@ -589,7 +590,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
// Set the minimum Id for transactions of the specified type.
|
||||
public virtual bool SetMinTransactionId(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long iId)
|
||||
public virtual bool SetMinTransactionId(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long iId)
|
||||
{
|
||||
bool set = false;
|
||||
if (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) != null)
|
||||
@@ -603,7 +604,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// The implementation in this class will generate simple numeric values for the owner
|
||||
// and global options that can be formatted (eg. to fixed length) by overwridden versions.
|
||||
public virtual String GetTransactionCreateRef
|
||||
(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
||||
(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
||||
{
|
||||
String Ref = "";
|
||||
if (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) != null)
|
||||
@@ -616,7 +617,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
public virtual String FormatTransactionCreateRef
|
||||
(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt)
|
||||
(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt)
|
||||
{
|
||||
String Ref = "";
|
||||
if (RefInt > 0)
|
||||
@@ -632,7 +633,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return Ref;
|
||||
}
|
||||
|
||||
public virtual int GetTransactionRefSeqLength(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
||||
public virtual int GetTransactionRefSeqLength(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
@@ -646,7 +647,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Raise Transaction.
|
||||
public virtual bool CanRaiseTransaction(ISbmUserContext userContext, Sbm.TransactionType typeFrom, Sbm.TransactionType typeTo)
|
||||
public virtual bool CanRaiseTransaction(ISbmUserContext_Core userContext, Sbm.TransactionType typeFrom, Sbm.TransactionType typeTo)
|
||||
{
|
||||
if (!AllowTransactionType(userContext, typeFrom) || !AllowTransactionType(userContext, typeTo)) return false;
|
||||
if (!CanCreateTransactionLocally(userContext, typeTo)) return false;
|
||||
@@ -742,7 +743,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseFrom(ISbmUserContext userContext, Sbm.TransactionType typeFrom)
|
||||
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseFrom(ISbmUserContext_Core userContext, Sbm.TransactionType typeFrom)
|
||||
{
|
||||
// Build the list of transaction types that are allowed to be raised from the specified type.
|
||||
List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>();
|
||||
@@ -757,7 +758,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseTo(ISbmUserContext userContext, Sbm.TransactionType typeTo)
|
||||
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseTo(ISbmUserContext_Core userContext, Sbm.TransactionType typeTo)
|
||||
{
|
||||
// Build the list of transaction types that are allowed to be raised to the specified type.
|
||||
List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>();
|
||||
@@ -775,7 +776,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Prepare Requirements Transaction. - Prepare copied list of requirements, eg. when raising from another transaction.
|
||||
public virtual bool PrepareCopiedRequirements(ISbmUserContext userContext, SbmTransaction transSource, List<SbmRequirement> requireList, Sbm.TransactionType type)
|
||||
public virtual bool PrepareCopiedRequirements(ISbmUserContext_Core userContext, SbmTransaction transSource, List<SbmRequirement> requireList, Sbm.TransactionType type)
|
||||
{
|
||||
type = new Sbm.TransactionType();
|
||||
//transSource; requireList; type;
|
||||
@@ -784,7 +785,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Remove Transaction.- By default, not allowed if transaction has requirements.
|
||||
public virtual bool CanRemoveTransactionWithRequirements(ISbmUserContext userContext, SbmTransaction transaction, int requirementCount)
|
||||
public virtual bool CanRemoveTransactionWithRequirements(ISbmUserContext_Core userContext, SbmTransaction transaction, int requirementCount)
|
||||
{
|
||||
if (transaction == null || !SysId.IsValid(transaction.Id)) return false;
|
||||
return (requirementCount < 1);
|
||||
@@ -792,7 +793,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Tax Effective Date. - TransTypes that should use the 'In Progress' date as tax point as opposed to the 'Raised' date.
|
||||
public virtual bool UseInProgressTaxDateAsTaxPoint(ISbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
public virtual bool UseInProgressTaxDateAsTaxPoint(ISbmUserContext_Core userContext, Sbm.TransactionType transactionType)
|
||||
{
|
||||
switch (transactionType)
|
||||
{
|
||||
@@ -810,14 +811,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// R e q u i r e m e n t O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
// Requirement Actions.
|
||||
public virtual bool SearchCommodityOnCreateRequirement(ISbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
public virtual bool SearchCommodityOnCreateRequirement(ISbmUserContext_Core userContext, Sbm.TransactionType transactionType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Requirement Costing.
|
||||
public virtual SbmRequirementCostingConfig GetRequirementCostingConfig(ISbmUserContext userContext)
|
||||
public virtual SbmRequirementCostingConfig GetRequirementCostingConfig(ISbmUserContext_Core userContext)
|
||||
{
|
||||
SbmRequirementCostingConfig cfgRequirementCosting = new SbmRequirementCostingConfig();
|
||||
return cfgRequirementCosting;
|
||||
@@ -827,21 +828,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// C o m m o d i t y O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
// Commodity Management.
|
||||
public virtual Sbm.CommodityType GetCommodityTypeDefault(ISbmUserContext userContext, Sbm.OrgOption_CommodityType commodityType)
|
||||
public virtual Sbm.CommodityType GetCommodityTypeDefault(ISbmUserContext_Core userContext, Sbm.OrgOption_CommodityType commodityType)
|
||||
{
|
||||
// Default = 'Stock'.
|
||||
return Sbm.CommodityType.Stock;
|
||||
}
|
||||
|
||||
// Clean-up imported data (default no action).
|
||||
public virtual bool CleanupImportedCommodity(ISbmUserContext userContext, SbmCommodity commodity)
|
||||
public virtual bool CleanupImportedCommodity(ISbmUserContext_Core userContext, SbmCommodity commodity)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Stock Control
|
||||
public virtual SbmStockControlConfig GetStockControlConfig(ISbmUserContext userContext)
|
||||
public virtual SbmStockControlConfig GetStockControlConfig(ISbmUserContext_Core userContext)
|
||||
{
|
||||
SbmStockControlConfig cfgStockControl = new SbmStockControlConfig();
|
||||
return cfgStockControl;
|
||||
@@ -851,11 +852,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// R e p o r t i n g
|
||||
//-------------------------------------------------------------------
|
||||
// Available reports (over and above standard).
|
||||
public virtual List<SbmReport_Base> GetReports(ISbmUserContext userContext, Sbm.View view)
|
||||
public virtual List<SbmReport_Base> GetReports(ISbmUserContext_Core userContext, Sbm.View view)
|
||||
{
|
||||
return new List<SbmReport_Base>();
|
||||
}
|
||||
public virtual bool ItemHasDiaryReports(ISbmUserContext userContext/*SaItemId &*/)
|
||||
public virtual bool ItemHasDiaryReports(ISbmUserContext_Core userContext/*SaItemId &*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -881,7 +882,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
/// <summary>Sales Invoice report horizontal lines [Bool]</summary>
|
||||
RptSalesInvoiceHorizontalLines = 111,
|
||||
}
|
||||
public virtual DataValue GetDefaultProcessParam(ISbmUserContext userContext, ProcessParam prm)
|
||||
public virtual DataValue GetDefaultProcessParam(ISbmUserContext_Core userContext, ProcessParam prm)
|
||||
{
|
||||
switch (prm)
|
||||
{
|
||||
@@ -894,18 +895,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Automated processes.
|
||||
public virtual bool PerformProcess(ISbmUserContext userContext, Sbm.ProcessType type)
|
||||
public virtual bool PerformProcess(ISbmUserContext_Core userContext, Sbm.ProcessType type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Available data import/export processes (over and above standard).
|
||||
public virtual List<ISbmProcess_DataImport> GetImportProcesses(ISbmUserContext userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
||||
public virtual List<ISbmProcess_DataImport> GetImportProcesses(ISbmUserContext_Core userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
||||
{
|
||||
return new List<ISbmProcess_DataImport>();
|
||||
}
|
||||
|
||||
public virtual List<ISbmProcess_DataExport> GetExportProcesses(ISbmUserContext userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
||||
public virtual List<ISbmProcess_DataExport> GetExportProcesses(ISbmUserContext_Core userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
||||
{
|
||||
return new List<ISbmProcess_DataExport>();
|
||||
}
|
||||
@@ -924,7 +925,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public String ItemDesc { get; }
|
||||
public String ItemText { get; }
|
||||
};
|
||||
public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(ISbmUserContext userContext, SbmRequirement requirement)
|
||||
public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(ISbmUserContext_Core userContext, SbmRequirement requirement)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -932,7 +933,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// I n t e r f a c e O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
public virtual bool AllowInterfaces(ISbmUserContext userContext)
|
||||
public virtual bool AllowInterfaces(ISbmUserContext_Core userContext)
|
||||
{
|
||||
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Website)) return true;
|
||||
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Accounts)) return true;
|
||||
@@ -941,7 +942,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool AllowInterfaceCategory(ISbmUserContext userContext, SaInterfaceCategory interfaceCategory)
|
||||
public virtual bool AllowInterfaceCategory(ISbmUserContext_Core userContext, SaInterfaceCategory interfaceCategory)
|
||||
{
|
||||
// By default, only website and file interfaces are allowed.
|
||||
switch (interfaceCategory)
|
||||
@@ -953,7 +954,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool AllowInterface(ISbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
public virtual bool AllowInterface(ISbmUserContext_Core userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
{
|
||||
if (!AllowInterfaceCategory(userContext, interfaceCategory)) return false;
|
||||
switch (interfaceCategory)
|
||||
@@ -43,7 +43,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
/// Replace dynamic tags in email message body.
|
||||
/// <para></para>
|
||||
/// </summary>
|
||||
public void ReplaceDynamicEmailBodyTags(SaEmailData emailData, ISbmUserContext userContext)
|
||||
public void ReplaceDynamicEmailBodyTags(SaEmailData emailData, ISbmUserContext_Core userContext)
|
||||
{
|
||||
// Replace core tags, eg. main stylesheet.
|
||||
SaEmailConsole.ReplaceDynamicEmailTags(emailData);
|
||||
@@ -53,21 +53,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
if (EmailContainsTag(emailData, EmailTag_MainStylesheet))
|
||||
{
|
||||
// Tag replacement is expanded to avoid reading main stylesheet resource unless required.
|
||||
ReplaceDynamicEmailTag(emailData, EmailTag_MainStylesheet, "<style>\n" + SbmResourceHelper.GetTextResource(SbmResourceHelper.TextResource.Email_Main_Css) + "</style>");
|
||||
ReplaceDynamicEmailTag(emailData, EmailTag_MainStylesheet, "<style>\n" + SbmResourceHelper.GetResourceText(SbmResourceHelper.TextResource.Email_Main_Css) + "</style>");
|
||||
}
|
||||
|
||||
// Partial content - Header.
|
||||
if (EmailContainsTag(emailData, EmailTag_Header))
|
||||
{
|
||||
// Tag replacement is expanded to avoid reading Header resource unless required.
|
||||
ReplaceDynamicEmailTag(emailData, EmailTag_Header, SbmResourceHelper.GetTextResource(SbmResourceHelper.TextResource.Email_Header_Html));
|
||||
ReplaceDynamicEmailTag(emailData, EmailTag_Header, SbmResourceHelper.GetResourceText(SbmResourceHelper.TextResource.Email_Header_Html));
|
||||
}
|
||||
|
||||
// Partial content - Footer.
|
||||
if (EmailContainsTag(emailData, EmailTag_Footer))
|
||||
{
|
||||
// Tag replacement is expanded to avoid reading Footer resource unless required.
|
||||
ReplaceDynamicEmailTag(emailData, EmailTag_Footer, SbmResourceHelper.GetTextResource(SbmResourceHelper.TextResource.Email_Footer_Html));
|
||||
ReplaceDynamicEmailTag(emailData, EmailTag_Footer, SbmResourceHelper.GetResourceText(SbmResourceHelper.TextResource.Email_Footer_Html));
|
||||
}
|
||||
|
||||
// Session data is optional.
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
@@ -9,7 +10,7 @@ using System.Text;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Core
|
||||
{
|
||||
//=======================================================================
|
||||
public interface ISbmSecurityProfile
|
||||
public interface ISbmSecurityProfile_Core
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// User properties.
|
||||
@@ -1,9 +1,9 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Core
|
||||
{
|
||||
@@ -11,77 +11,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Core
|
||||
public interface ISbmUserContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Session Context - Identifies database connections etc.</summary>
|
||||
SbmSessionContext SessionContext { get; }
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User data - account details.</summary>
|
||||
public interface IUserData
|
||||
{
|
||||
/// <summary>User Security Item Id.</summary>
|
||||
SysId SecurityItemId { get; }
|
||||
/// <summary>User Affiliate Id.</summary>
|
||||
SysId AffiliateId { get; }
|
||||
/// <summary>User first name.</summary>
|
||||
String FirstName { get; }
|
||||
/// <summary>User last name.</summary>
|
||||
String LastName { get; }
|
||||
/// <summary>User display name.</summary>
|
||||
String DisplayName { get; }
|
||||
/// <summary>User email address.</summary>
|
||||
String EmailAddress { get; }
|
||||
/// <summary>User managed organisations - Affiliate Id and display name.</summary>
|
||||
List<SysIdString> SupervisedOrganisations { get; }
|
||||
}
|
||||
/// <summary>User display name.</summary>
|
||||
String UserDisplayName { get; }
|
||||
|
||||
/// <summary>Current user account details.</summary>
|
||||
IUserData User { get; }
|
||||
/// <summary>User email address.</summary>
|
||||
String UserEmailAddress { get; }
|
||||
|
||||
/// <summary>Does the context represent a valid user account.</summary>
|
||||
bool ValidUser { get; }
|
||||
|
||||
/// <summary>Database update info - user session specific properties for database inserts/updates.</summary>
|
||||
DbUpdateInfo DbUpdateInfo { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Security profile - what the user is allowed to do based on security roles and groups.</summary>
|
||||
ISbmSecurityProfile SecurityProfile { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User data - logged in account details.</summary>
|
||||
public interface IOrganisationData
|
||||
{
|
||||
/// <summary>Organisation Affiliate Id.</summary>
|
||||
SysId AffiliateId { get; }
|
||||
/// <summary>Organisation Affiliate Type.</summary>
|
||||
Sbm.AffiliateType AffiliateType { get; }
|
||||
/// <summary>Organisation display name.</summary>
|
||||
String DisplayName { get; }
|
||||
/// <summary>Organisation Interface context - to qualify interfaces belonging to the organisation.</summary>
|
||||
public String InterfaceContext { get; }
|
||||
/// <summary>Organisation 'Internal' Association Id.</summary>
|
||||
public SysId AssociationId { get; }
|
||||
}
|
||||
|
||||
/// <summary>Current selected organisation.</summary>
|
||||
IOrganisationData Organisation { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation configuration.
|
||||
String GetOrganisationOption(Sbm.OrganisationOption option, String context);
|
||||
String GetOrganisationOption(String optionName, String context);
|
||||
String GetOwnerOption_Value(Sbm.OrgOption_Value eCol);
|
||||
String GetOwnerOption_Folder(Sbm.OrgOption_Folder eCol);
|
||||
bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption eCol);
|
||||
String GetOwnerOption_Caption(Sbm.OrgOption_Caption eCol, String defaultValue);
|
||||
bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx eCol);
|
||||
bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn eCol);
|
||||
String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String defautValue);
|
||||
int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int defautValue);
|
||||
int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int defautValue);
|
||||
int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int defautValue);
|
||||
int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int defautValue = 2);
|
||||
Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityTypeContext);
|
||||
SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation eLoc);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Core
|
||||
{
|
||||
//=======================================================================
|
||||
public interface ISbmUserContext_Core : ISbmUserContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Session Context - Identifies database connections etc.</summary>
|
||||
SbmSessionContext SessionContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User properties.
|
||||
/// <summary>User Security Item Id.</summary>
|
||||
SysId UserSecurityItemId { get; }
|
||||
/// <summary>User Affiliate Id.</summary>
|
||||
SysId UserAffiliateId { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Security profile - what the user is allowed to do based on security roles and groups.</summary>
|
||||
ISbmSecurityProfile_Core SecurityProfile_Core { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation properties.
|
||||
|
||||
/// <summary>Organisation Affiliate Id.</summary>
|
||||
SysId OrganisationAffiliateId { get; }
|
||||
|
||||
/// <summary>Organisation Affiliate Type.</summary>
|
||||
Sbm.AffiliateType OrganisationAffiliateType { get; }
|
||||
|
||||
/// <summary>Organisation 'Internal' Association Id.</summary>
|
||||
SysId OrganisationAssociationId { get; }
|
||||
|
||||
/// <summary>Organisation display name.</summary>
|
||||
String OrganisationDisplayName { get; }
|
||||
|
||||
/// <summary>Organisation Interface context - to qualify interfaces belonging to the organisation.</summary>
|
||||
String OrganisationInterfaceContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation configuration.
|
||||
String GetOrganisationOption(Sbm.OrganisationOption option, String context);
|
||||
String GetOrganisationOption(String optionName, String context);
|
||||
String GetOwnerOption_Value(Sbm.OrgOption_Value eCol);
|
||||
String GetOwnerOption_Folder(Sbm.OrgOption_Folder eCol);
|
||||
bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption eCol);
|
||||
String GetOwnerOption_Caption(Sbm.OrgOption_Caption eCol, String defaultValue);
|
||||
bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx eCol);
|
||||
bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn eCol);
|
||||
String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String defautValue);
|
||||
int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int defautValue);
|
||||
int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int defautValue);
|
||||
int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int defautValue);
|
||||
int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int defautValue = 2);
|
||||
Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityTypeContext);
|
||||
SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation eLoc);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Text resources.
|
||||
public static String GetTextResource(TextResource textResource)
|
||||
public static String GetResourceText(TextResource textResource)
|
||||
{
|
||||
String partialPath = "";
|
||||
String resourceFilename = "";
|
||||
@@ -102,7 +102,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Image resources.
|
||||
public static byte[] GetImageResource(ImageResource imageResource)
|
||||
public static byte[] GetResourceImage(ImageResource imageResource)
|
||||
{
|
||||
String partialPath = "";
|
||||
String resourceFilename = "";
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmInternals_Control : SacsDisposable
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly SbmSystem system = SbmGlobals.System;
|
||||
private class MgrData
|
||||
{
|
||||
public SbmcAccountMgr controlAccountMgr;
|
||||
public SbmcInstanceMgr controlInstanceMgr;
|
||||
public SbmcItemMgr controlItemMgr;
|
||||
}
|
||||
private MgrData mgr { get; } = new MgrData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmInternals_Control()
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (mgr.controlAccountMgr != null) mgr.controlAccountMgr.Dispose();
|
||||
if (mgr.controlInstanceMgr != null) mgr.controlInstanceMgr.Dispose();
|
||||
if (mgr.controlItemMgr != null) mgr.controlItemMgr.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Control managers.
|
||||
public SbmcAccountMgr ControlAccountMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.controlAccountMgr == null)
|
||||
mgr.controlAccountMgr = system.CreateControlAccountMgr();
|
||||
return mgr.controlAccountMgr;
|
||||
}
|
||||
}
|
||||
public SbmcInstanceMgr ControlInstanceMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.controlInstanceMgr == null)
|
||||
mgr.controlInstanceMgr = system.CreateControlInstanceMgr();
|
||||
return mgr.controlInstanceMgr;
|
||||
}
|
||||
}
|
||||
public SbmcItemMgr ControlItemMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.controlItemMgr == null)
|
||||
mgr.controlItemMgr = system.CreateControlItemMgr();
|
||||
return mgr.controlItemMgr;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class SbmcAccountMgr : SbmcControlMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcAccountMgr() : base()
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Mail;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SbmcAccountMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual userAccounts.
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount exists.
|
||||
public bool UserAccountExistsById(SysId userAccountId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(userAccountId)) return false;
|
||||
SbmcUserAccount.Params prmUserAccount = new SbmcUserAccount.Params();
|
||||
prmUserAccount.IdsIncluded.Add(userAccountId);
|
||||
prmUserAccount.StatusCat = SbmcUserAccount.StatusCat.Any;
|
||||
return GetUserAccountCount(prmUserAccount) == 1;
|
||||
}
|
||||
public bool UserAccountExistsByUserId(SysId userAccountIdOwner)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(userAccountIdOwner)) return false;
|
||||
SbmcUserAccount.Params prmUserAccount = new SbmcUserAccount.Params();
|
||||
prmUserAccount.IdsIncluded.Add(userAccountIdOwner);
|
||||
prmUserAccount.StatusCat = SbmcUserAccount.StatusCat.Any;
|
||||
return GetUserAccountCount(prmUserAccount) == 1;
|
||||
}
|
||||
public bool OrganisationExistsByName(String organisationName, SysId userAccountIdExclude)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!StringUtil.IsEmpty(organisationName) || !SysId.IsValid(userAccountIdExclude)) return false;
|
||||
SbmcUserAccount.Params prmUserAccount = new SbmcUserAccount.Params();
|
||||
prmUserAccount.Name = organisationName;
|
||||
prmUserAccount.IdsExcluded.Add(userAccountIdExclude);
|
||||
prmUserAccount.StatusCat = SbmcUserAccount.StatusCat.Any;
|
||||
return GetUserAccountCount(prmUserAccount) == 1;
|
||||
}
|
||||
public bool IndividualExistsByName(String firstName, String lastName, SysId userAccountIdExclude)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!StringUtil.IsEmpty(firstName) || !StringUtil.IsEmpty(lastName) || !SysId.IsValid(userAccountIdExclude)) return false;
|
||||
SbmcUserAccount.Params prmUserAccount = new SbmcUserAccount.Params();
|
||||
prmUserAccount.Name = firstName;
|
||||
prmUserAccount.Name = lastName;
|
||||
prmUserAccount.IdsExcluded.Add(userAccountIdExclude);
|
||||
prmUserAccount.StatusCat = SbmcUserAccount.StatusCat.Any;
|
||||
return GetUserAccountCount(prmUserAccount) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get UserAccount.
|
||||
public abstract SbmcUserAccount GetUserAccount(SbmcUserAccount.Params prm);
|
||||
public SbmcUserAccount GetUserAccountById(SysId userAccountId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(userAccountId)) return null;
|
||||
SbmcUserAccount.Params prmUserAccount = new SbmcUserAccount.Params();
|
||||
prmUserAccount.IdsIncluded.Add(userAccountId);
|
||||
prmUserAccount.StatusCat = SbmcUserAccount.StatusCat.Any;
|
||||
return GetUserAccount(prmUserAccount);
|
||||
}
|
||||
public SbmcUserAccount GetUserAccountByEmailAddress(String emailAddress)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (StringUtil.IsBlank(emailAddress)) return null;
|
||||
SbmcUserAccount.Params prmUserAccount = new SbmcUserAccount.Params();
|
||||
prmUserAccount.EmailAddress = emailAddress;
|
||||
prmUserAccount.StatusCat = SbmcUserAccount.StatusCat.Any;
|
||||
return GetUserAccount(prmUserAccount);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create UserAccount.
|
||||
public abstract SbmcUserAccount CreateUserAccount();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate UserAccount data.
|
||||
public bool IsValidUserAccount(SbmcUserAccount userAccount)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (userAccount == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUserAccountData(userAccount.GetData(), new SbmcUserAccount.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUserAccountData(SbmcUserAccount.Data data, SbmcUserAccount.ErrField errField)
|
||||
{
|
||||
// UserAccount properties.
|
||||
ClearErrorState();
|
||||
if (data == null) return SetErrorState("item not specified");
|
||||
|
||||
// Name.
|
||||
if (errField.Title != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Title, "title", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_Title)))
|
||||
{
|
||||
errField.Title = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.FirstName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.FirstName, "first name", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_FirstName)))
|
||||
{
|
||||
errField.FirstName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Initials != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Initials, "initials", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_Initials)))
|
||||
{
|
||||
errField.Initials = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.LastName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.LastName, "last name", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_LastName), true))
|
||||
{
|
||||
errField.LastName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Phone numbers.
|
||||
if (errField.PhoneMain != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PhoneMain, "phone number", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_PhoneMain)))
|
||||
{
|
||||
errField.PhoneMain = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.PhoneMobile != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PhoneMobile, "mobile number", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_PhoneMobile)))
|
||||
{
|
||||
errField.PhoneMobile = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.PhoneAlt != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PhoneAlt, "alt number", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_PhoneAlt)))
|
||||
{
|
||||
errField.PhoneAlt = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.UserAccount_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SbmcUserAccount.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount database interface.
|
||||
public abstract bool InsertUserAccount(SbmcUserAccount userAccount, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUserAccount(SbmcUserAccount userAccount, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UserAccountCanBeDeleted(SbmcUserAccount userAccount)
|
||||
{
|
||||
if (userAccount == null) return SetErrorState("item not specified");
|
||||
//ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUserAccount(SbmcUserAccount userAccount, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserAccount list.
|
||||
public abstract ColumnDfn GetUserAccountColumnDfn(SbmcUserAccount.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUserAccountQueryFilter(SbmcUserAccount.Params prm);
|
||||
public abstract long GetUserAccountCount(SbmcUserAccount.Params prm);
|
||||
public abstract List<SbmcUserAccount> GetUserAccountList(SbmcUserAccount.Params prm);
|
||||
public abstract DbResultSet ExecuteUserAccountQuery(List<ColumnDfn> columns, SbmcUserAccount.Params prm);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a V a l u e s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public DataValue GetUserAccountDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SbmcUserAccount.Column)column.Id)
|
||||
{
|
||||
// Notes.
|
||||
case SbmcUserAccount.Column.Notes:
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
break;
|
||||
|
||||
// Status.
|
||||
case SbmcUserAccount.Column.Status_Desc:
|
||||
case SbmcUserAccount.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SbmcUserAccount.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDescForCode(statusCode));
|
||||
else if (column.Id == (int)SbmcUserAccount.Column.Status_Ind)
|
||||
value = new DataValue(SbmcUserAccount.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
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.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmcControlMgr : SbmItemMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmInternals_Control internals = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Static initialisation.
|
||||
static SbmcControlMgr()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcControlMgr()
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (internals != null) internals.Dispose();
|
||||
internals = null;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
protected SbmInternals_Control Internals_Control { get { if (internals == null) internals = new SbmInternals_Control(); return internals; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Control managers.
|
||||
protected SbmcAccountMgr ControlAccountMgr { get { return Internals_Control.ControlAccountMgr; } }
|
||||
protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } }
|
||||
protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get suitable display test to identity Control data item.
|
||||
/// </summary>
|
||||
/// <param name="itemId"></param>
|
||||
/// <returns></returns>
|
||||
public String GetItemCaption(ItemId itemId)
|
||||
{
|
||||
if (ItemId.IsValid(itemId))
|
||||
{
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
if (itemId.Type == (short)SbmcHierarchyItem.ItemType.UserAccount)
|
||||
{
|
||||
SbmcUserAccount userAccount = ControlAccountMgr.GetUserAccountById(itemId.Id);
|
||||
disposables.Add(userAccount);
|
||||
if (userAccount != null)
|
||||
return userAccount.GetDisplayName();
|
||||
return $"UserAccount #{itemId.Id}";
|
||||
}
|
||||
if (itemId.Type == (short)SbmcHierarchyItem.ItemType.Owner)
|
||||
{
|
||||
SbmcOwner owner = ControlInstanceMgr.GetOwnerById(itemId.Id);
|
||||
disposables.Add(owner);
|
||||
if (owner != null)
|
||||
return owner.Name;
|
||||
return $"Owner #{itemId.Id}";
|
||||
}
|
||||
if (itemId.Type == (short)SbmcHierarchyItem.ItemType.Repository)
|
||||
{
|
||||
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(itemId.Id);
|
||||
disposables.Add(repository);
|
||||
if (repository != null)
|
||||
return repository.Context;
|
||||
return $"Repository #{itemId.Id}";
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Collections.Generic;
|
||||
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm.Config;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class SbmcInstanceMgr : SbmcControlMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcInstanceMgr() : base()
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Mail;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
// Control Instance Manager - Owners.
|
||||
//=======================================================================
|
||||
partial class SbmcInstanceMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Owner exists.
|
||||
public bool OwnerExistsById(SysId ownerId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(ownerId)) return false;
|
||||
SbmcOwner.Params prmOwner = new SbmcOwner.Params();
|
||||
prmOwner.IdsIncluded.Add(ownerId);
|
||||
prmOwner.StatusCat = SbmcOwner.StatusCat.Any;
|
||||
return GetOwnerCount(prmOwner) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Owner.
|
||||
public abstract SbmcOwner GetOwner(SbmcOwner.Params prm);
|
||||
public SbmcOwner GetOwnerById(SysId ownerId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(ownerId)) return null;
|
||||
SbmcOwner.Params prmOwner = new SbmcOwner.Params();
|
||||
prmOwner.IdsIncluded.Add(ownerId);
|
||||
prmOwner.StatusCat = SbmcOwner.StatusCat.Any;
|
||||
return GetOwner(prmOwner);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Owner.
|
||||
public abstract SbmcOwner CreateOwner();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate Owner data.
|
||||
public bool IsValidOwner(SbmcOwner owner)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (owner == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidOwnerData(owner.GetData(), new SbmcOwner.ErrField());
|
||||
}
|
||||
public virtual bool IsValidOwnerData(SbmcOwner.Data data, SbmcOwner.ErrField errField)
|
||||
{
|
||||
// Owner properties.
|
||||
ClearErrorState();
|
||||
if (data == null) return SetErrorState("item not specified");
|
||||
|
||||
// Contact.
|
||||
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Name, "name", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Owner_Name), true))
|
||||
{
|
||||
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ContactName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ContactName, "contact", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Owner_ContactName)))
|
||||
{
|
||||
errField.ContactName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ContactEmailAddress != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ContactEmailAddress, "contact email", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Owner_ContactEmailAddress)))
|
||||
{
|
||||
errField.ContactEmailAddress = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ContactPhoneMain != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ContactPhoneMain, "contact phone", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Owner_ContactPhoneMain)))
|
||||
{
|
||||
errField.ContactPhoneMain = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ContactPhoneAlt != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ContactPhoneAlt, "contact alt phone", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Owner_ContactPhoneAlt)))
|
||||
{
|
||||
errField.ContactPhoneAlt = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Owner_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Owner_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SbmcOwner.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner owner interface.
|
||||
public abstract bool InsertOwner(SbmcOwner owner, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateOwner(SbmcOwner owner, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool OwnerCanBeDeleted(SbmcOwner owner)
|
||||
{
|
||||
if (owner == null) return SetErrorState("item not specified");
|
||||
//ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteOwner(SbmcOwner owner, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Owner list.
|
||||
public abstract ColumnDfn GetOwnerColumnDfn(SbmcOwner.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetOwnerQueryFilter(SbmcOwner.Params prm);
|
||||
public abstract long GetOwnerCount(SbmcOwner.Params prm);
|
||||
public abstract List<SbmcOwner> GetOwnerList(SbmcOwner.Params prm);
|
||||
public abstract DbResultSet ExecuteOwnerQuery(List<ColumnDfn> columns, SbmcOwner.Params prm);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a V a l u e s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public DataValue GetOwnerDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SbmcOwner.Column)column.Id)
|
||||
{
|
||||
// Notes.
|
||||
case SbmcOwner.Column.Notes:
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
break;
|
||||
|
||||
// Status.
|
||||
case SbmcOwner.Column.Status_Desc:
|
||||
case SbmcOwner.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SbmcOwner.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDescForCode(statusCode));
|
||||
else if (column.Id == (int)SbmcOwner.Column.Status_Ind)
|
||||
value = new DataValue(SbmcOwner.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Mail;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
// Control - Instance Manager - Repositories.
|
||||
//=======================================================================
|
||||
partial class SbmcInstanceMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Repository exists.
|
||||
public bool RepositoryExistsById(SysId repositoryId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(repositoryId)) return false;
|
||||
SbmcRepository.Params prmRepository = new SbmcRepository.Params();
|
||||
prmRepository.IdsIncluded.Add(repositoryId);
|
||||
prmRepository.StatusCat = SbmcRepository.StatusCat.Any;
|
||||
return GetRepositoryCount(prmRepository) == 1;
|
||||
}
|
||||
public bool RepositoryExistsByContext(String context)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!StringUtil.IsBlank(context)) return false;
|
||||
SbmcRepository.Params prmRepository = new SbmcRepository.Params();
|
||||
prmRepository.ContextsIncluded.Add(context);
|
||||
prmRepository.StatusCat = SbmcRepository.StatusCat.Any;
|
||||
return GetRepositoryCount(prmRepository) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Repository.
|
||||
public abstract SbmcRepository GetRepository(SbmcRepository.Params prm);
|
||||
public SbmcRepository GetRepositoryById(SysId repositoryId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(repositoryId)) return null;
|
||||
SbmcRepository.Params prmRepository = new SbmcRepository.Params();
|
||||
prmRepository.IdsIncluded.Add(repositoryId);
|
||||
prmRepository.StatusCat = SbmcRepository.StatusCat.Any;
|
||||
return GetRepository(prmRepository);
|
||||
}
|
||||
public SbmcRepository GetRepositoryByContext(String context)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (StringUtil.IsBlank(context)) return null;
|
||||
SbmcRepository.Params prmRepository = new SbmcRepository.Params();
|
||||
prmRepository.ContextsIncluded.Add(context);
|
||||
prmRepository.StatusCat = SbmcRepository.StatusCat.Any;
|
||||
return GetRepository(prmRepository);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Repository.
|
||||
public abstract SbmcRepository CreateRepository();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate Repository data.
|
||||
public bool IsValidRepository(SbmcRepository repository)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (repository == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidRepositoryData(repository.GetData(), new SbmcRepository.ErrField());
|
||||
}
|
||||
public virtual bool IsValidRepositoryData(SbmcRepository.Data data, SbmcRepository.ErrField errField)
|
||||
{
|
||||
// Repository properties.
|
||||
ClearErrorState();
|
||||
if (data == null) return SetErrorState("item not specified");
|
||||
|
||||
// Owner.
|
||||
if (!SysId.IsValid(data.OwnerId)) return SetErrorState("Owner must be specified");
|
||||
|
||||
// Repository.
|
||||
if (errField.Context != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Context, "context", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Repository_Context), true))
|
||||
{
|
||||
errField.Context = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ServerName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ServerName, "server", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Repository_ServerName), true))
|
||||
{
|
||||
errField.ServerName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.InstanceName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.InstanceName, "instance", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Repository_InstanceName)))
|
||||
{
|
||||
errField.InstanceName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.DatabaseName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DatabaseName, "database", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Repository_DatabaseName), true))
|
||||
{
|
||||
errField.DatabaseName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Credentials.
|
||||
|
||||
if (errField.UserName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.UserName, "user", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Repository_UserName)))
|
||||
{
|
||||
errField.UserName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Password != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Password, "password", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Repository_Password)))
|
||||
{
|
||||
errField.Password = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Repository_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.Repository_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SbmcRepository.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository repository interface.
|
||||
public abstract bool InsertRepository(SbmcRepository repository, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateRepository(SbmcRepository repository, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool RepositoryCanBeDeleted(SbmcRepository repository)
|
||||
{
|
||||
if (repository == null) return SetErrorState("item not specified");
|
||||
//ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteRepository(SbmcRepository repository, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Repository list.
|
||||
public abstract ColumnDfn GetRepositoryColumnDfn(SbmcRepository.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetRepositoryQueryFilter(SbmcRepository.Params prm);
|
||||
public abstract long GetRepositoryCount(SbmcRepository.Params prm);
|
||||
public abstract List<SbmcRepository> GetRepositoryList(SbmcRepository.Params prm);
|
||||
public abstract DbResultSet ExecuteRepositoryQuery(List<ColumnDfn> columns, SbmcRepository.Params prm);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a V a l u e s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public DataValue GetRepositoryDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SbmcRepository.Column)column.Id)
|
||||
{
|
||||
// Notes.
|
||||
case SbmcRepository.Column.Notes:
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
break;
|
||||
|
||||
// Status.
|
||||
case SbmcRepository.Column.Status_Desc:
|
||||
case SbmcRepository.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SbmcRepository.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDescForCode(statusCode));
|
||||
else if (column.Id == (int)SbmcRepository.Column.Status_Ind)
|
||||
value = new DataValue(SbmcRepository.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class SbmcItemMgr : SbmcControlMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmcItemMgr() : base()
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Mail;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
|
||||
{
|
||||
//=======================================================================
|
||||
// Control Item Manager - ItemParams.
|
||||
//=======================================================================
|
||||
partial class SbmcItemMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool ItemParamExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SbmcItemParam.Params prmItemParam = new SbmcItemParam.Params();
|
||||
prmItemParam.IdsIncluded.Add(id);
|
||||
prmItemParam.StatusCat = SbmcItemParam.StatusCat.NotDeleted;
|
||||
return GetItemParamCount(prmItemParam) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get item.
|
||||
public abstract SbmcItemParam GetItemParam(SbmcItemParam.Params prm);
|
||||
public SbmcItemParam GetItemParamById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SbmcItemParam.Params prmItemParam = new SbmcItemParam.Params();
|
||||
prmItemParam.IdsIncluded.Add(id);
|
||||
prmItemParam.StatusCat = SbmcItemParam.StatusCat.NotDeleted;
|
||||
return GetItemParam(prmItemParam);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SbmcItemParam CreateItemParam(ItemId itemId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidItemParam(SbmcItemParam itemParam)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (itemParam == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidItemParamData(itemParam.GetData(), new SbmcItemParam.ErrField());
|
||||
}
|
||||
public virtual bool IsValidItemParamData(SbmcItemParam.Data data, SbmcItemParam.ErrField errField)
|
||||
{
|
||||
// Item properties.
|
||||
ClearErrorState();
|
||||
if (data == null) return SetErrorState("item not specified");
|
||||
|
||||
// Item.
|
||||
|
||||
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!ItemId.IsValid(data.ItemId))
|
||||
{
|
||||
errField.Context = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be specified");
|
||||
}
|
||||
if (!SbmcItemParam.ValidItemTypes.Contains((SbmcHierarchyItem.ItemType)data.ItemId.Type))
|
||||
{
|
||||
errField.Context = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid item type specified");
|
||||
}
|
||||
}
|
||||
|
||||
// Param.
|
||||
|
||||
if (errField.Context != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Context, "context", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.ItemParam_Context), true))
|
||||
{
|
||||
errField.Context = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Name, "name", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.ItemParam_Name), true))
|
||||
{
|
||||
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Value != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Value, "contact email", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.ItemParam_Value)))
|
||||
{
|
||||
errField.Value = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.ItemParam_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SbmDbDfn_Control.GetColTextLen(SbmDbDfn_Control.ColumnIdx.ItemParam_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SbmcItemParam.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item interface.
|
||||
public abstract bool InsertItemParam(SbmcItemParam itemParam, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateItemParam(SbmcItemParam itemParam, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool ItemParamCanBeDeleted(SbmcItemParam itemParam)
|
||||
{
|
||||
if (itemParam == null) return SetErrorState("item not specified");
|
||||
//ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteItemParam(SbmcItemParam itemParam, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetItemParamColumnDfn(SbmcItemParam.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetItemParamQueryFilter(SbmcItemParam.Params prm);
|
||||
public abstract long GetItemParamCount(SbmcItemParam.Params prm);
|
||||
public abstract List<SbmcItemParam> GetItemParamList(SbmcItemParam.Params prm);
|
||||
public abstract DbResultSet ExecuteItemParamQuery(List<ColumnDfn> columns, SbmcItemParam.Params prm);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a V a l u e s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public DataValue GetItemParamDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SbmcItemParam.Column)column.Id)
|
||||
{
|
||||
// Item Type caption.
|
||||
case SbmcItemParam.Column.ItemType_Caption:
|
||||
{
|
||||
short itemTypeValue = (short)values.GetValue(column.DataName).AsLong();
|
||||
SbmcHierarchyItem.ItemType itemType = (SbmcHierarchyItem.ItemType)itemTypeValue;
|
||||
value = new DataValue(SbmcHierarchyItem.getItemTypeCaption(itemType));
|
||||
}
|
||||
break;
|
||||
|
||||
// Item caption.
|
||||
case SbmcItemParam.Column.Item_Caption:
|
||||
{
|
||||
value = new DataValue(values.GetValue(column.DataName).AsString());
|
||||
if (StringUtil.IsBlank(value.ToString()))
|
||||
{
|
||||
short itemType = (short)values.GetValue(GetItemParamColumnDfn(SbmcItemParam.Column.ItemType).DataName).AsLong();
|
||||
SysId itemId = new SysId(values.GetValue(GetItemParamColumnDfn(SbmcItemParam.Column.ItemId).DataName).AsLong());
|
||||
value = new DataValue($"[{GetItemCaption(new ItemId(itemType, itemId))}]");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Value.
|
||||
case SbmcItemParam.Column.Value:
|
||||
String paramContext = values.GetValue(GetItemParamColumnDfn(SbmcItemParam.Column.Context).DataName).AsString();
|
||||
String paramName = values.GetValue(GetItemParamColumnDfn(SbmcItemParam.Column.Name).DataName).AsString();
|
||||
ushort paramFlags = (ushort)values.GetValue(GetItemParamColumnDfn(SbmcItemParam.Column.Flags).DataName).AsLong();
|
||||
if (SbmcItemParam.IsPasswordValue(paramContext, paramName, paramFlags))
|
||||
value = new DataValue("******");
|
||||
else value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
break;
|
||||
|
||||
// Notes.
|
||||
case SbmcItemParam.Column.Notes:
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
break;
|
||||
|
||||
// Status.
|
||||
case SbmcItemParam.Column.Status_Desc:
|
||||
case SbmcItemParam.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SbmcItemParam.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDescForCode(statusCode));
|
||||
else if (column.Id == (int)SbmcItemParam.Column.Status_Ind)
|
||||
value = new DataValue(SbmcItemParam.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
value = new DataValue(column.FormatValue(values));
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class SbmAccountMgr : SbmItemMgr
|
||||
public abstract partial class SbmAccountMgr : SbmCoreMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -35,7 +35,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAccountMgr(ISbmUserContext userContext) :
|
||||
protected SbmAccountMgr(ISbmUserContext_Core userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.ItemOptions;
|
||||
|
||||
@@ -6,14 +6,14 @@ using System.Collections.Generic;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class SbmAssetMgr : SbmItemMgr
|
||||
public abstract partial class SbmAssetMgr : SbmCoreMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAssetMgr(ISbmUserContext userContext) :
|
||||
protected SbmAssetMgr(ISbmUserContext_Core userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -98,169 +98,126 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
errField.SerialNumber = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.RefExt != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.RefExt, "RefExt", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_RefExt), true))
|
||||
if (errField.RefExt != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.RefExt, "RefExt", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_RefExt)))
|
||||
{
|
||||
errField.RefExt = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.DescBrief != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DescBrief, "DescBrief", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_DescBrief), true))
|
||||
if (errField.DescBrief != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DescBrief, "DescBrief", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_DescBrief)))
|
||||
{
|
||||
errField.DescBrief = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Item.
|
||||
if (errField.ItemType != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if ((int)data.ItemId.Type < 1)
|
||||
{
|
||||
errField.ItemType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item type must be supplied");
|
||||
}
|
||||
}
|
||||
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.ItemId.Id))
|
||||
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be specified");
|
||||
}
|
||||
if (errField.PurchaseOn != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.PurchaseOn))
|
||||
|
||||
// Purchase.
|
||||
if (errField.PurchaseOn != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.PurchaseOn = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.AssocIdSupplier != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.AssocIdSupplier) < 1)
|
||||
if (errField.AssocIdSupplier != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.AssocIdSupplier = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Assoc Id Supplier must be supplied");
|
||||
}
|
||||
if (errField.PurchaseInvoiceRef != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PurchaseInvoiceRef, "Purchase Invoice Ref", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_PurchaseInvoiceRef), true))
|
||||
if (errField.PurchaseInvoiceRef != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PurchaseInvoiceRef, "Purchase Invoice Ref", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_PurchaseInvoiceRef)))
|
||||
{
|
||||
errField.PurchaseInvoiceRef = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.PaymentTerms != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.PaymentTerms = SacsHierarchyItem.ValidValue.Invalid;
|
||||
}
|
||||
if (errField.AmountPurchase != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
}
|
||||
if (errField.TaxCodeIdPurchase != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
}
|
||||
if (errField.AmountPurchaseGross != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
}
|
||||
if (errField.AmountSettlementGross != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
}
|
||||
if (errField.AmountEnhancementGross != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
}
|
||||
|
||||
// Sale.
|
||||
if (errField.AssocIdCustomer != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
}
|
||||
if (errField.SellCategoryCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SellCategoryCode, "Sell category code", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_SellCategoryCode)))
|
||||
{
|
||||
errField.SellCategoryCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.AmountPurchase != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountPurchase < 1)
|
||||
if (errField.AmountSell != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.AmountPurchase = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.TaxCodeIdPurchase != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.TaxCodeIdPurchase) < 1)
|
||||
if (errField.TaxCodeIdSell != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.TaxCodeIdPurchase = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Taxcode Id Purchase must be supplied");
|
||||
}
|
||||
if (errField.AmountPurchaseGross != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountPurchaseGross < 1)
|
||||
if (errField.AmountSellGross != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.AmountPurchaseGross = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.AmountSettlementGross != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountSettlementGross < 1)
|
||||
if (errField.TaxCodeIdProfit != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.AmountSettlementGross = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.AmountPurchaseGross != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountPurchaseGross < 1)
|
||||
if (errField.SoldOn != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.AmountPurchaseGross = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.AssocIdCustomer != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.AssocIdCustomer) < 1)
|
||||
if (errField.AmountSold != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.AssocIdCustomer = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Assoc Id Customer must be supplied");
|
||||
}
|
||||
if (errField.PurchaseInvoiceRef != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PurchaseInvoiceRef, "Purchase Invoice Ref", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_PurchaseInvoiceRef), true))
|
||||
if (errField.AmountSoldGross != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.PurchaseInvoiceRef = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.AmountSell != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountSell < 1)
|
||||
{
|
||||
errField.AmountSell = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.TaxCodeIdSell != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.TaxCodeIdSell) < 1)
|
||||
{
|
||||
errField.TaxCodeIdSell = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Aff Id Owner must be supplied");
|
||||
}
|
||||
if (errField.AmountSellGross != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountSellGross < 1)
|
||||
{
|
||||
errField.AmountSellGross = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.TaxCodeIdProfit != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.TaxCodeIdProfit) < 1)
|
||||
{
|
||||
errField.TaxCodeIdProfit = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Aff Id Owner must be supplied");
|
||||
}
|
||||
if (errField.SoldOn != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.SoldOn))
|
||||
{
|
||||
errField.SoldOn = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.AmountSold != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountSold < 1)
|
||||
{
|
||||
errField.AmountSold = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.AmountSoldGross != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountSoldGross < 1)
|
||||
{
|
||||
errField.AmountSoldGross = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.DisposeCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DisposeCode, "dispose code", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_DisposeCode), true))
|
||||
|
||||
// Disposal.
|
||||
if (errField.DisposeCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DisposeCode, "dispose code", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_DisposeCode)))
|
||||
{
|
||||
errField.DisposeCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.DisposeOn != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.DisposeOn))
|
||||
{
|
||||
errField.DisposeOn = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.DueBackOn != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.DueBackOn))
|
||||
|
||||
// Rental.
|
||||
if (errField.DueBackOn != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.DueBackOn = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.AmountRentalCost != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountRentalCost < 1)
|
||||
if (errField.AmountRentalCost != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.AmountRentalCost = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.UomIdRentalCost != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.UomIdRentalCost) < 1)
|
||||
if (errField.UomIdRentalCost != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.UomIdRentalCost = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Uom Id Rental Cost must be supplied");
|
||||
}
|
||||
if (errField.TaxCodeIdRentalCost != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.TaxCodeIdRentalCost) < 1)
|
||||
if (errField.TaxCodeIdRentalCost != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.TaxCodeIdRentalCost = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Taxcode Id Rental Cost must be supplied");
|
||||
}
|
||||
if (errField.AmountRentalPrice != SacsHierarchyItem.ValidValue.Ignore && (short)data.AmountRentalPrice < 1)
|
||||
if (errField.AmountRentalPrice != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.AmountRentalPrice = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Tax Rate must be supplied");
|
||||
}
|
||||
if (errField.UomIdRentalPrice != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.UomIdRentalPrice) < 1)
|
||||
if (errField.UomIdRentalPrice != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.UomIdRentalPrice = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Uom Id Rental Cost must be supplied");
|
||||
}
|
||||
if (errField.TaxCodeIdRentalPrice != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.TaxCodeIdRentalPrice) < 1)
|
||||
if (errField.TaxCodeIdRentalPrice != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.TaxCodeIdRentalPrice = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Taxcode Id Rental Price must be supplied");
|
||||
}
|
||||
if (errField.ProcessIdNext != SacsHierarchyItem.ValidValue.Ignore && SysId.ToInt(data.ProcessIdNext) < 1)
|
||||
|
||||
// Processes.
|
||||
if (errField.ProcessIdNext != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
errField.ProcessIdNext = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Taxcode Id Rental Price must be supplied");
|
||||
}
|
||||
|
||||
// Common.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SbmDbDfn.GetColTextLen(SbmDbDfn.ColumnIdx.SaAsset_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
@@ -273,7 +230,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SbmAsset.AssetStatuses.Contains(data.Status))
|
||||
if (!SbmAsset.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user