This commit is contained in:
Andy Howard
2024-11-19 09:47:00 +00:00
parent c5ee285e27
commit 8b872cc8f3
214 changed files with 7924 additions and 5519 deletions
@@ -19,9 +19,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
{
//-------------------------------------------------------------------
// Data members.
private SbmConfigConsole configConsole;
private SaItemOptionConsole itemOptionConsole;
private SaUpdateLogConsole updateLogConsole;
private SbmInternals internals;
private readonly List<TypeCodeDesc> dataItemTypes;
private readonly List<TypeCodeDesc> interfaceDataTypes;
@@ -37,9 +35,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
{
if (disposing)
{
if (configConsole != null) configConsole.Dispose(); configConsole = null;
if (itemOptionConsole != null) itemOptionConsole.Dispose(); itemOptionConsole = null;
if (updateLogConsole != null) updateLogConsole.Dispose(); updateLogConsole = null;
if (internals != null) internals.Dispose(); internals = null;
}
base.Dispose(disposing);
}
@@ -48,35 +44,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
// Properties.
public ISbmUserContext_Core UserContext { get; }
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
private SbmInternals Internals { get { if (internals == null) internals = new SbmInternals(UserContext); return internals; } }
public override short InterfaceDataType { get { return (short)Sbm.ItemType.Interface; } }
// Consoles.
private SbmConfigConsole ConfigConsole
{
get
{
if (configConsole == null)
configConsole = SbmGlobals.Application.CreateConfigConsole(UserContext.SessionContext);
return configConsole;
}
}
public override SaItemOptionConsole ItemOptionConsole
{
get
{
if (itemOptionConsole == null)
itemOptionConsole = SbmGlobals.Application.CreateItemOptionConsole(UserContext);
return itemOptionConsole;
}
}
public override SaUpdateLogConsole UpdateLogConsole
{
get
{
if (updateLogConsole == null)
updateLogConsole = SbmGlobals.Application.CreateUpdateLogConsole(UserContext);
return updateLogConsole;
}
}
private SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
public override SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
public override SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
//---------------------------------------------------------------
// Utilities.
@@ -129,7 +102,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
}
public bool InterfaceTypeValidForContextCategory(SaInterfaceCategory interfaceCategory, short interfaceType)
{
return ConfigConsole.AllowInterface(UserContext, interfaceCategory, interfaceType);
return SessionConsole.AllowInterface(interfaceCategory, interfaceType);
}
//-------------------------------------------------------------------
@@ -19,8 +19,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
{
//-------------------------------------------------------------------
// Data members.
private SbmConfigConsole configConsole;
private SaUpdateLogConsole updateLogConsole;
private SbmInternals internals;
private List<TypeCodeDesc> securityRights;
//-------------------------------------------------------------------
@@ -34,8 +33,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
{
if (disposing)
{
if (configConsole != null) configConsole.Dispose(); configConsole = null;
if (updateLogConsole != null) updateLogConsole.Dispose(); updateLogConsole = null;
if (internals != null) internals.Dispose(); internals = null;
}
base.Dispose(disposing);
}
@@ -44,27 +42,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
// Properties.
public ISbmUserContext_Core UserContext { get; }
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
private SbmInternals Internals { get { if (internals == null) internals = new SbmInternals(UserContext); return internals; } }
public override short SecurityItemDataType { get { return (short)Sbm.ItemType.SecurityItem; } }
public override short SecurityLinkDataType { get { return (short)Sbm.ItemType.SecurityLink; } }
// Consoles.
private SbmConfigConsole ConfigConsole
{
get
{
if (configConsole == null)
configConsole = SbmGlobals.Application.CreateConfigConsole(UserContext.SessionContext);
return configConsole;
}
}
public override SaUpdateLogConsole UpdateLogConsole
{
get
{
if (updateLogConsole == null)
updateLogConsole = SbmGlobals.Application.CreateUpdateLogConsole(UserContext);
return updateLogConsole;
}
}
private SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
public override SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
//-------------------------------------------------------------------
// Utilities.
@@ -77,28 +60,28 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
if (securityRights == null)
{
securityRights = new List<TypeCodeDesc>();
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowContacts))
if (SessionConsole != null && SessionConsole.AllowOption(Sbm.ConfigOption.AllowContacts))
{
securityRights.Add(Sbm.SecurityRight.Affiliate_Create, "AffIns", "Affiliates - Create");
securityRights.Add(Sbm.SecurityRight.Affiliate_Update, "AffUpd", "Affiliates - Update");
securityRights.Add(Sbm.SecurityRight.Association_Create, "AssIns", "Associations - Create");
securityRights.Add(Sbm.SecurityRight.Association_Update, "AssUpd", "Associations - Update");
}
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowCommodities))
if (SessionConsole != null && SessionConsole.AllowOption(Sbm.ConfigOption.AllowCommodities))
{
securityRights.Add(Sbm.SecurityRight.Commodity_Create, "CmdIns", "Commodities - Create");
securityRights.Add(Sbm.SecurityRight.Commodity_Update, "CmdUpd", "Commodities - Update");
if (configConsole.GetStockControlConfig(UserContext).AllowStockControl())
if (SessionConsole.GetStockControlConfig().AllowStockControl())
{
securityRights.Add(Sbm.SecurityRight.StockTake, "CmdStkTak", "Commodities - Stock Take");
}
}
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowAssets))
if (SessionConsole != null && SessionConsole.AllowOption(Sbm.ConfigOption.AllowAssets))
{
securityRights.Add(Sbm.SecurityRight.Asset_Create, "AssetIns", "Assets - Create");
securityRights.Add(Sbm.SecurityRight.Asset_Update, "AssetUpd", "Assets - Update");
}
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowTransactions))
if (SessionConsole != null && SessionConsole.AllowOption(Sbm.ConfigOption.AllowTransactions))
{
securityRights.Add(Sbm.SecurityRight.Transaction_Create, "TraIns", "Transactions - Create");
securityRights.Add(Sbm.SecurityRight.Transaction_Update, "TraUpd", "Transactions - Update");
@@ -109,7 +92,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
securityRights.Add(Sbm.SecurityRight.Security_Admin, "SecAdm", "Admin - Security");
securityRights.Add(Sbm.SecurityRight.Database_Admin, "DbAdm", "Admin - Database");
securityRights.Add(Sbm.SecurityRight.ReferenceData_Admin, "RefAdm", "Admin - Reference data");
if (configConsole != null && configConsole.AllowInterfaces(UserContext))
if (SessionConsole != null && SessionConsole.AllowInterfaces())
{
securityRights.Add(Sbm.SecurityRight.InterfaceConfig, "IntCfg", "Interfaces - Configuration");
securityRights.Add(Sbm.SecurityRight.InterfaceByCategory, "IntCategory", "Interfaces - Allow by category");
@@ -118,11 +101,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
securityRights.Add(Sbm.SecurityRight.Financial_View, "FinLst", "Financials - View");
securityRights.Add(Sbm.SecurityRight.Financial_ViewByType, "FinType", "Financials - View by type");
securityRights.Add(Sbm.SecurityRight.Financial_UpdateByType, "FinTypeUpd", "Financials - Update by type");
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.TimeRecording))
if (SessionConsole != null && SessionConsole.AllowOption(Sbm.ConfigOption.TimeRecording))
{
securityRights.Add(Sbm.SecurityRight.TimesheetManager, "TimMgr", "Manage - Timesheets");
}
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowTasks))
if (SessionConsole != null && SessionConsole.AllowOption(Sbm.ConfigOption.AllowTasks))
{
securityRights.Add(Sbm.SecurityRight.TaskManager, "TskMgr", "Manage - Tasks");
}
@@ -144,7 +127,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
bool bValidTransType = false;
if (!bValidTransType) bValidTransType = (transType == Sbm.TransactionType.SalesQuote);
if (!bValidTransType) bValidTransType = (transType == Sbm.TransactionType.SalesOrder);
if (fullList || bValidTransType && configConsole.AllowTransactionType(UserContext, transType))
if (fullList || bValidTransType && SessionConsole.AllowTransactionType(transType))
{
// Retrieve status categories for transaction type:
foreach (TypeCodeDesc transactionStatus in GetTransactionStatusCats(transType))
@@ -152,7 +135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
SbmTransaction.StatusCat transStatusCat = (SbmTransaction.StatusCat)transactionStatus.Type;
String sDesc = transactionType.Desc + " - " + transactionType.Desc;
SysId transactionTypeIdStatus = GetTransactionTypeStatusId(transType, transStatusCat);
if (fullList || configConsole.AllowTransactionType(UserContext, transType))
if (fullList || SessionConsole.AllowTransactionType(transType))
transactionTypesStatus.Add(transactionTypeIdStatus, transactionStatus.Desc);
}
}
@@ -219,36 +202,36 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
switch (secRight.Type)
{
case (int)Sbm.SecurityRight.Transaction_ByType:
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.TransactionType);
RegisterSecurityRight(secRight.Type, secRight.Code, secRight.Desc, (short)Sbm.ItemType.TransactionType);
break;
case (int)Sbm.SecurityRight.Transaction_UpdateByTypeStatus:
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.TransactionTypeStatus);
RegisterSecurityRight(secRight.Type, secRight.Code, secRight.Desc, (short)Sbm.ItemType.TransactionTypeStatus);
break;
case (int)Sbm.SecurityRight.InterfaceByCategory:
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.InterfaceCategory);
RegisterSecurityRight(secRight.Type, secRight.Code, secRight.Desc, (short)Sbm.ItemType.InterfaceCategory);
break;
case (int)Sbm.SecurityRight.Financial_ViewByType:
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.FinancialType);
RegisterSecurityRight(secRight.Type, secRight.Code, secRight.Desc, (short)Sbm.ItemType.FinancialType);
break;
case (int)Sbm.SecurityRight.Financial_UpdateByType:
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.FinancialType);
RegisterSecurityRight(secRight.Type, secRight.Code, secRight.Desc, (short)Sbm.ItemType.FinancialType);
break;
default:
RegisterSecurityRight(secRight.Code, secRight.Desc);
RegisterSecurityRight(secRight.Type, secRight.Code, secRight.Desc);
break;
}
}
//---------------------------------------------------------------
// Register the security data item types.
if (configConsole != null)
if (SessionConsole != null)
{
// Transaction types:
List<SysIdString> transactionTypesDesc = new List<SysIdString>();
List<SysIdString> transactionTypesDescAllowed = new List<SysIdString>();
foreach (TypeCodeDesc transactionType in SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.TransactionType))
{
if (configConsole.AllowTransactionType(UserContext, (Sbm.TransactionType)transactionType.Type))
if (SessionConsole.AllowTransactionType((Sbm.TransactionType)transactionType.Type))
transactionTypesDescAllowed.Add(new SysId(transactionType.Type), transactionType.Desc);
transactionTypesDesc.Add(new SysId(transactionType.Type), transactionType.Desc);
}
@@ -264,7 +247,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
List<SysIdString> interfaceCategoriesDescAllowed = new List<SysIdString>();
foreach (TypeCodeDesc interfaceCategory in SacsSystem.GetCodesOfType(SaSysCodeType.InterfaceCategory))
{
if (configConsole.AllowInterfaceCategory(UserContext, (SaInterfaceCategory)interfaceCategory.Type))
if (SessionConsole.AllowInterfaceCategory((SaInterfaceCategory)interfaceCategory.Type))
interfaceCategoriesDescAllowed.Add(new SysId(interfaceCategory.Type), interfaceCategory.Desc);
interfaceCategoriesDesc.Add(new SysId(interfaceCategory.Type), interfaceCategory.Desc);
}