Session Console and Internals.

This commit is contained in:
Andy Howard
2025-01-16 13:19:58 +00:00
parent ee988b1f76
commit 61ecd59794
187 changed files with 4681 additions and 3647 deletions
+96 -30
View File
@@ -1,4 +1,5 @@
using Sarand.Net.Standard.Base.App;
using Newtonsoft.Json.Serialization;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using System;
@@ -324,20 +325,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
/// <summary>Display dialog bar.</summary>
DialogBar = 11,
// Core application modules.
AllowConsoleView = 20, /* Default: True */
AllowOrganisationUpdate, /* Default: True */
AllowContacts, /* Default: True */
AllowProcesses, /* Default: True */
AllowAssets,
AllowVehicles,
AllowComputerHardware,
AllowCommodities, /* Default: True */
AllowCommodityAssociations,
AllowPortfolios,
AllowPriceSets,
AllowTransactions, /* Default: True */
AllowItemDocuments,
AllowFinancialsAccessControl,
ConsoleView = 20, /* Default: True */
OrganisationUpdate, /* Default: True */
Contacts, /* Default: True */
ComputerHardware,
Commodities, /* Default: True */
CommodityAssociations,
Processes, /* Default: True */
Assets,
Vehicles,
Portfolios,
PriceSets,
Transactions, /* Default: True */
ItemDocuments,
FinancialsAccessControl,
//---------------------------------------------------------------
// Navigation (view) options.
DiaryView = 60, /* Default: True */
@@ -346,7 +347,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
AnyTransactionView,
Jobs = 70,
TimeRecording,
AllowTasks,
Tasks,
//---------------------------------------------------------------
// Associations.
AssocMaxTransAmount = 100,
@@ -366,21 +367,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
TransactionUpperRefExt,
ShowSiteAddrOnTransView,
ShowTransRefInDropdown,
AllowRaiseOrderWithQuoteRef,
RaiseOrderWithQuoteRef,
TransactionEstimatedAmount,
TransactionPayments,
TransactionDeliveryCosts,
TransactionSplitTimes,
AllowFixedSalesQuoteToWordExport,
FixedSalesQuoteToWordExport,
//---------------------------------------------------------------
// Requirements.
AllowPurchasingPlanning = 220,
AllowProductionControl,
AllowDeliveryPlanning,
PurchasingPlanning = 220,
ProductionControl,
DeliveryPlanning,
/// <summary>For quicker addition of items to order (all with quantity=0).</summary>
AllowOrderSelectCommodities,
OrderSelectCommodities,
/// <summary>Direct update from main view (default: true).</summary>
AllowRequirementUpdateInline,
RequirementUpdateInline,
/// <summary>Using cost and labour codes (unit and job).</summary>
EstimateSalesQuotesByCosts,
/// <summary>To derive processes for commodities from quote cost estimates.</summary>
@@ -738,13 +739,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
ItemDataType,
// Contacts.
AffiliateType,
AssociationType,
AssociationStatusCat,
AddressType,
AssociationType,
SystemAccountType,
// Transactions.
TransactionType,
/// <summary>Ref. SbmTransaction.StatusCat</summary>
TransactionStatusCat,
RequirementType,
TaskCodeType,
@@ -753,19 +752,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
ConstituentStatusCat,
// Miscellaneous.
ItemLinkData,
SysParamCategory,
// Commodities.
CommodityType,
CommodityStatusCat,
PortfolioItemType,
LocationCategory,
LocationFilter,
ContainerCategory,
ContainerType,
// Stock.
LocationCategory,
LocationFilter,
MovementType,
StockLevelType,
StockLevelSource,
SysParamCategory,
// Processes.
ProcessCategory,
ProcessType,
@@ -782,8 +781,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
VehicleTransType,
FuelType,
OdometerUnits,
// Reference.
RegionType,
// Unit of measure.
UnitMeasureCategory,
UnitMeasureType,
FinancialType,
@@ -1138,6 +1137,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Asset_Sale,
Asset_Rental,
}
//-------------------------------------------------------------------
public enum OrgOption_Caption
{
@@ -1174,6 +1174,71 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
MenuOpt_ProformaPurchaseInvoices,
MenuOpt_PurchaseInvoices,
}
public static Sbm.OrgOption_Caption TransTypeToOrgOption(Sbm.TransactionType transactionType)
{
switch (transactionType)
{
case TransactionType.Project: return Sbm.OrgOption_Caption.TransType_Project;
case TransactionType.SalesLead: return Sbm.OrgOption_Caption.TransType_SalesLead;
case TransactionType.SalesQuote: return Sbm.OrgOption_Caption.TransType_SalesQuote;
case TransactionType.SalesPO: return Sbm.OrgOption_Caption.TransType_SalesPO;
case TransactionType.ProformaSalesOrder: return Sbm.OrgOption_Caption.TransType_ProformaSalesOrder;
case TransactionType.SalesOrder: return Sbm.OrgOption_Caption.TransType_SalesOrder;
case TransactionType.SalesDispatch: return Sbm.OrgOption_Caption.TransType_SalesDispatch;
case TransactionType.ProformaSalesInvoice: return Sbm.OrgOption_Caption.TransType_ProformaSalesInvoice;
case TransactionType.SalesInvoice: return Sbm.OrgOption_Caption.TransType_SalesInvoice;
case TransactionType.PurchaseQuote: return Sbm.OrgOption_Caption.TransType_PurchaseQuote;
case TransactionType.PurchaseSO: return Sbm.OrgOption_Caption.TransType_PurchaseSO;
case TransactionType.ProformaPurchaseOrder: return Sbm.OrgOption_Caption.TransType_ProformaPurchaseOrder;
case TransactionType.PurchaseOrder: return Sbm.OrgOption_Caption.TransType_PurchaseOrder;
case TransactionType.PurchaseDelivery: return Sbm.OrgOption_Caption.TransType_PurchaseDelivery;
case TransactionType.ProformaPurchaseInvoice: return Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice;
case TransactionType.PurchaseInvoice: return Sbm.OrgOption_Caption.TransType_PurchaseInvoice;
}
return 0;
}
public static Sbm.TransactionType OrgOptionToTransType(Sbm.OrgOption_Caption caption)
{
switch (caption)
{
case Sbm.OrgOption_Caption.TransType_Project: return TransactionType.Project;
case Sbm.OrgOption_Caption.TransType_SalesLead: return TransactionType.SalesLead;
case Sbm.OrgOption_Caption.TransType_SalesQuote: return TransactionType.SalesQuote;
case Sbm.OrgOption_Caption.TransType_SalesPO: return TransactionType.SalesPO;
case Sbm.OrgOption_Caption.TransType_ProformaSalesOrder: return TransactionType.ProformaSalesOrder;
case Sbm.OrgOption_Caption.TransType_SalesOrder: return TransactionType.SalesOrder;
case Sbm.OrgOption_Caption.TransType_SalesDispatch: return TransactionType.SalesDispatch;
case Sbm.OrgOption_Caption.TransType_ProformaSalesInvoice: return TransactionType.ProformaSalesInvoice;
case Sbm.OrgOption_Caption.TransType_SalesInvoice: return TransactionType.SalesInvoice;
case Sbm.OrgOption_Caption.TransType_PurchaseQuote: return TransactionType.PurchaseQuote;
case Sbm.OrgOption_Caption.TransType_PurchaseSO: return TransactionType.PurchaseSO;
case Sbm.OrgOption_Caption.TransType_ProformaPurchaseOrder: return TransactionType.ProformaPurchaseOrder;
case Sbm.OrgOption_Caption.TransType_PurchaseOrder: return TransactionType.PurchaseOrder;
case Sbm.OrgOption_Caption.TransType_PurchaseDelivery: return TransactionType.PurchaseDelivery;
case Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice: return TransactionType.ProformaPurchaseInvoice;
case Sbm.OrgOption_Caption.TransType_PurchaseInvoice: return TransactionType.PurchaseInvoice;
case Sbm.OrgOption_Caption.MenuOpt_Projects: return TransactionType.Project;
case Sbm.OrgOption_Caption.MenuOpt_SalesLeads: return TransactionType.SalesLead;
case Sbm.OrgOption_Caption.MenuOpt_SalesQuotes: return TransactionType.SalesQuote;
case Sbm.OrgOption_Caption.MenuOpt_SalesPOs: return TransactionType.SalesPO;
case Sbm.OrgOption_Caption.MenuOpt_ProformaSalesOrders: return TransactionType.ProformaSalesOrder;
case Sbm.OrgOption_Caption.MenuOpt_SalesOrders: return TransactionType.SalesOrder;
case Sbm.OrgOption_Caption.MenuOpt_SalesDispatches: return TransactionType.SalesDispatch;
case Sbm.OrgOption_Caption.MenuOpt_ProformaSalesInvoices: return TransactionType.ProformaSalesInvoice;
case Sbm.OrgOption_Caption.MenuOpt_SalesInvoices: return TransactionType.SalesInvoice;
case Sbm.OrgOption_Caption.MenuOpt_PurchaseQuotes: return TransactionType.PurchaseQuote;
case Sbm.OrgOption_Caption.MenuOpt_PurchaseSOs: return TransactionType.PurchaseSO;
case Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseOrders: return TransactionType.ProformaPurchaseOrder;
case Sbm.OrgOption_Caption.MenuOpt_PurchaseOrders: return TransactionType.PurchaseOrder;
case Sbm.OrgOption_Caption.MenuOpt_PurchaseDeliveries: return TransactionType.PurchaseDelivery;
case Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseInvoices: return TransactionType.ProformaPurchaseInvoice;
case Sbm.OrgOption_Caption.MenuOpt_PurchaseInvoices: return TransactionType.PurchaseInvoice;
}
return 0;
}
//-------------------------------------------------------------------
public enum OrgOption_ShowColumn
{
@@ -1633,6 +1698,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Personal = -2, // Task management only.
NotInternal = -1,
Any = 0,
Unknown = Any,
// NB Do not change the positive values, as tied to the database.
Internal = 1,
Customer = 2,
+95 -95
View File
@@ -21,9 +21,9 @@ 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 SessionConfig parameter added to avoid local creation. To be reviewed/replaced.
public static bool IsViewApplicable(SbmSessionConsole sessionConfig, Sbm.View view)
public static bool IsViewApplicable(SbmSessionConsole sessionConsole, Sbm.View view)
{
ISbmSecurityProfile_Core securityProfile = sessionConfig.UserContext.SecurityProfile_Core;
ISbmSecurityProfile_Core securityProfile = sessionConsole.UserContext.SecurityProfile_Core;
switch (view)
{
//-----------------------------------------------------------
@@ -32,210 +32,210 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
case Sbm.View.Main:
return true;
case Sbm.View.Console:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowConsoleView)) return false;
if (!sessionConfig.GetConsoleViewDfn().HasContent()) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.ConsoleView)) return false;
if (!sessionConsole.GetConsoleViewDfn().HasContent()) return false;
return true;
case Sbm.View.Diary:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.DiaryView)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.DiaryView)) return false;
return true;
//-----------------------------------------------------------
// Contacts.
case Sbm.View.Contacts_Affiliates:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
return true;
case Sbm.View.Contacts_ContactGroups:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
return true;
case Sbm.View.Contacts_Associations:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AnyAssociationView)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.AnyAssociationView)) return false;
return true;
case Sbm.View.Contacts_Associations_Customer:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
return true;
case Sbm.View.Contacts_Associations_Supplier:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
return true;
case Sbm.View.Contacts_Associations_Associate:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Associate)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Associate)) return false;
return true;
case Sbm.View.Contacts_Associations_Stockist:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Stockist)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Stockist)) return false;
return true;
case Sbm.View.Contacts_Associations_FinanceAgency:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.FinanceAgency)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.FinanceAgency)) return false;
return true;
case Sbm.View.Contacts_Associations_Member:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Member)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Member)) return false;
return true;
case Sbm.View.Contacts_Associations_Contractor:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Contractor)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Contractor)) return false;
return true;
//-----------------------------------------------------------
// Commodities.
case Sbm.View.Commodities:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Commodities)) return false;
return true;
case Sbm.View.Commodity_Locations:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Commodities)) return false;
return true;
case Sbm.View.Commodity_Containers:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Commodities)) return false;
return true;
case Sbm.View.Commodity_Portfolio:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Commodities)) return false;
return true;
case Sbm.View.Commodity_SalesBudget:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Commodities)) return false;
return true;
case Sbm.View.PriceSets:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Commodities)) return false;
//if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowPriceSets)) return false;
return true;
//-----------------------------------------------------------
// Assets.
case Sbm.View.AssetCategories:
case Sbm.View.Assets:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Assets)) return false;
return true;
case Sbm.View.VehicleClasses:
case Sbm.View.Vehicles:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Assets)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Vehicles)) return false;
return true;
//-----------------------------------------------------------
// Transactions.
case Sbm.View.Transactions:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AnyTransactionView)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.AnyTransactionView)) return false;
return true;
case Sbm.View.Transactions_Project:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.Project)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.Project)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.Project)) return false;
return true;
case Sbm.View.Transactions_PurchaseQuote:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseQuote)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseQuote)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseQuote)) return false;
return true;
case Sbm.View.Transactions_ProformaPurchaseOrder:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaPurchaseOrder)) return false;
return true;
case Sbm.View.Transactions_PurchaseOrder:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseOrder)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseOrder)) return false;
return true;
case Sbm.View.Transactions_PurchaseSO:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseSO)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseSO)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseSO)) return false;
return true;
case Sbm.View.Transactions_PurchaseDelivery:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseDelivery)) return false;
return true;
case Sbm.View.Transactions_ProformaPurchaseInvoice:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaPurchaseInvoice)) return false;
return true;
case Sbm.View.Transactions_PurchaseInvoice:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseInvoice)) return false;
return true;
case Sbm.View.Transactions_SalesLead:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesLead)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesLead)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesLead)) return false;
return true;
case Sbm.View.Transactions_SalesQuote:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesQuote)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesQuote)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesQuote)) return false;
return true;
case Sbm.View.Transactions_ProformaSalesOrder:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaSalesOrder)) return false;
return true;
case Sbm.View.Transactions_SalesOrder:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesOrder)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesOrder)) return false;
return true;
case Sbm.View.Transactions_SalesPO:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesPO)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesPO)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesPO)) return false;
return true;
case Sbm.View.Transactions_SalesDispatch:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesDispatch)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesDispatch)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesDispatch)) return false;
return true;
case Sbm.View.Transactions_ProformaSalesInvoice:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesInvoice)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesInvoice)) return false;
return true;
case Sbm.View.Transactions_SalesInvoice:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesInvoice)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesInvoice)) return false;
return true;
//-----------------------------------------------------------
// Planning.
case Sbm.View.Transactions_PurchasingPlanning:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowPurchasingPlanning)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.PurchasingPlanning)) return false;
return true;
case Sbm.View.Transactions_ProductionControl:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowProductionControl)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.ProductionControl)) return false;
return true;
case Sbm.View.Transactions_DeliveryPlanning:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowDeliveryPlanning)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Transactions)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.DeliveryPlanning)) return false;
return true;
//-----------------------------------------------------------
// Other.
case Sbm.View.SystemAccounts:
case Sbm.View.SystemUsers:
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConsole.AllowOption(Sbm.ConfigOption.Contacts)) return false;
// Interfaces must be available.
using (SaInterfaceConsole interfaceConsole = SbmGlobals.Application.CreateInterfaceConsole(sessionConfig.UserContext))
using (SaInterfaceConsole interfaceConsole = SbmGlobals.Application.CreateInterfaceConsole(sessionConsole.UserContext))
{
if (interfaceConsole == null || !interfaceConsole.DatabaseIsValid) return false;
// System Account & User tables must be available.
ISacsDatabase busMgrDb = SbmGlobals.Application.GetBusMgrDatabase(sessionConfig.UserContext.SessionContext);
ISacsDatabase busMgrDb = SbmGlobals.Application.GetBusMgrDatabase(sessionConsole.UserContext.SessionContext);
if (!SbmGlobals.Application.DbTableExists(busMgrDb, SbmDbDfn.TableIdx.SystemAccount)) return false;
if (!SbmGlobals.Application.DbTableExists(busMgrDb, SbmDbDfn.TableIdx.SystemUser)) return false;
}
@@ -268,17 +268,17 @@ 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(SbmSessionConsole sessionConfig, Sbm.MenuOption menuOption)
public static bool IsMenuOptionApplicable(SbmSessionConsole sessionConsole, Sbm.MenuOption menuOption)
{
if (!sessionConfig.UserContext.ValidUser)
if (!sessionConsole.UserContext.ValidUser)
{
// ToDo Only Login menu option available.
return false;
}
Sbm.View view = GetViewForMenuOption(sessionConfig.UserContext.SessionContext, menuOption);
Sbm.View view = GetViewForMenuOption(sessionConsole.UserContext.SessionContext, menuOption);
if (view != Sbm.View.Unknown)
// View options.
return IsViewApplicable(sessionConfig, GetViewForMenuOption(sessionConfig.UserContext.SessionContext, menuOption));
return IsViewApplicable(sessionConsole, GetViewForMenuOption(sessionConsole.UserContext.SessionContext, menuOption));
// Non-view options.
switch (menuOption)
@@ -296,7 +296,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-----------------------------------------------------------
// Actions.
case Sbm.MenuOption.Timesheet:
return sessionConfig.AllowOption(Sbm.ConfigOption.TimeRecording);
return sessionConsole.AllowOption(Sbm.ConfigOption.TimeRecording);
//-----------------------------------------------------------
}
SaLogger.Warn($"{SysUtil.Fn} Unsupport menu option - {menuOption.ToString()}");
+14 -12
View File
@@ -58,8 +58,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
return GetBusMgrDatabase(sessionContext).CreateDbInfo();
}
// Instance configuration.
// Instance and Organisation profiles.
public abstract SbmInstanceConfig GetInstanceConfig(SbmSessionContext sessionContext);
public abstract SbmInstanceDataCache GetInstanceDataCache(SbmSessionContext sessionContext);
public abstract SbmOrganisationConfig GetOrganisationConfig(ISbmUserOrganisationContext userContext);
// Database utilities.
public IDatabaseInfo CreateDbInfo(ISacsDatabase db)
{
@@ -84,17 +86,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Create consoles.
public abstract SbmSessionConsole CreateSessionConsole(ISbmUserContext_Core 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);
public abstract SbmSessionConsole CreateSessionConsole(ISbmUserOrganisationContext userContext);
public abstract SaDiaryConsole CreateDiaryConsole(ISbmUserOrganisationContext userContext);
public abstract SaSecurityConsole CreateSecurityConsole(ISbmUserOrganisationContext userContext);
public abstract SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserOrganisationContext userContext);
public abstract SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserOrganisationContext userContext);
public abstract SaItemDataConsole CreateItemDataConsole(ISbmUserOrganisationContext userContext);
public abstract SaItemDocConsole CreateItemDocConsole(ISbmUserOrganisationContext userContext);
public abstract SaItemOptionConsole CreateItemOptionConsole(ISbmUserOrganisationContext userContext);
public abstract SaInterfaceConsole CreateInterfaceConsole(ISbmUserOrganisationContext userContext);
public abstract SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserOrganisationContext userContext);
public abstract SbmEmailConsole CreateEmailConsole(ISbmUserOrganisationContext userContext);
//-------------------------------------------------------------------
}
@@ -101,7 +101,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public virtual String LinkSuffix { get { return ""; } }
//---------------------------------------------------------------
// Utilities.
public virtual bool Refresh(ISbmUserContext_Core userContext)
public virtual bool Refresh(ISbmUserOrganisationContext userContext)
{
ItemCount = 0;
switch (LinkType)
@@ -1,6 +1,7 @@
using Org.BouncyCastle.Math.EC;
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
using Sarand.BusinessMgr.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
@@ -13,25 +14,42 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
//=======================================================================
/// <summary>
/// Application configuration associated with an instance.
/// Application and Owner configuration associated with an instance.
/// </summary>
public abstract class SbmInstanceConfig
public abstract class SbmInstanceConfig : ISbmInstanceConfig
{
//-------------------------------------------------------------------
// Construction.
protected SbmInstanceConfig() { }
//-------------------------------------------------------------------
// Application options.
public abstract bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse);
//-------------------------------------------------------------------
// Allowed data component types.
// Contacts.
// Supported affiliate types.
public abstract bool AllowAffiliateType(Sbm.AffiliateType type, bool defaultResponse);
// Supported Association types.
public abstract bool AllowAssociationType(Sbm.AssociationType type, bool defaultResponse);
//-------------------------------------------------------------------
// Transactions.
// Supported Transaction types.
public abstract bool AllowTransactionType(Sbm.TransactionType type, bool defaultResponse);
//-------------------------------------------------------------------
// Interfaces.
/// <summary>
/// Whether the Interface Category is allowed.
/// </summary>
public abstract bool AllowInterfaceCategory(SaInterfaceCategory interfaceCategory, bool defaultResponse);
//-------------------------------------------------------------------
}
//=======================================================================
@@ -0,0 +1,32 @@
using Sarand.BusinessMgr.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.ItemOptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
//=======================================================================
/// <summary>
/// Practically persistant/static data stored in instance database, eg. Owner configuration options.
/// </summary>
public abstract class SbmInstanceDataCache : SacsDisposable
{
//-------------------------------------------------------------------
// Construction.
public SbmInstanceDataCache() { }
protected override void Dispose(bool disposing)
{
}
//-------------------------------------------------------------------
// Retrieve Item Options for Owner Organisation configuration.
public abstract List<SaItemOption> GetOwnerOptions(ISbmUserOrganisationContext userContext);
//-------------------------------------------------------------------
}
//=======================================================================
}
+255 -105
View File
@@ -20,37 +20,58 @@ using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using static Sarand.BusinessMgr.Net.Standard.Base.App.Sbm;
namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
//=======================================================================
public class SbmInternals : SacsDisposable
public class SbmInternals : SacsDisposable, ISbmOrganisationConfig
{
//-------------------------------------------------------------------
// Definitions.
/// <summary>
/// Internal User Context for read-only database access when this class is used outside of user specific sessions.
/// <para>- data caches etc.</para>
/// </summary>
private class SbmUserContext_Internal : SbmUserContext
{
public SbmUserContext_Internal(SbmSessionContext sessionContext) : base(sessionContext) { }
}
//-------------------------------------------------------------------
// Data members.
private readonly SbmSystem system = SbmGlobals.System;
private SbmAccountsDfn accountsDfn;
// Managers.
private SbmAccountMgr accountMgr;
private SbmAssetMgr assetMgr;
private SbmCommodityMgr commodityMgr;
private SbmPriceMgr priceMgr;
private SbmTransactionMgr transactionMgr;
private SbmStockMgr stockMgr;
private SbmProcessMgr processMgr;
private SbmDataItemMgr dataItemMgr;
private class Managers
{
public SbmAccountMgr accountMgr;
public SbmAssetMgr assetMgr;
public SbmCommodityMgr commodityMgr;
public SbmPriceMgr priceMgr;
public SbmTransactionMgr transactionMgr;
public SbmStockMgr stockMgr;
public SbmProcessMgr processMgr;
public SbmDataItemMgr dataItemMgr;
}
private readonly Managers mgr = new Managers();
// Consoles.
private SbmSessionConsole sessionConsole;
private SaDiaryConsole diaryConsole;
private SaSecurityConsole securityConsole;
private SaCodeTypeConsole codeTypeConsole;
private SaReferenceDataConsole referenceDataConsole;
private SaUpdateLogConsole updateLogConsole;
private SaInterfaceConsole interfaceConsole;
private SaItemDocConsole itemDocConsole;
private SaItemOptionConsole itemOptionConsole;
private SaItemDataConsole itemDataConsole;
public SbmEmailConsole emailConsole;
private class Consoles
{
public SbmSessionConsole sessionConsole;
public SaDiaryConsole diaryConsole;
public SaSecurityConsole securityConsole;
public SaCodeTypeConsole codeTypeConsole;
public SaReferenceDataConsole referenceDataConsole;
public SaUpdateLogConsole updateLogConsole;
public SaInterfaceConsole interfaceConsole;
public SaItemDocConsole itemDocConsole;
public SaItemOptionConsole itemOptionConsole;
public SaItemDataConsole itemDataConsole;
public SbmEmailConsole emailConsole;
}
private readonly Consoles con = new Consoles();
// Configurations.
private SbmStockControlConfig stockControlConfig;
private SbmRequirementCostingConfig requirementCostingConfig;
@@ -61,46 +82,53 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Construction.
public SbmInternals(ISbmUserContext_Core userContext)
public SbmInternals(SbmSessionContext sessionContext)
{
UserContext = new SbmUserContext_Internal(sessionContext);
ReadOnly = true;
}
public SbmInternals(ISbmUserOrganisationContext userContext)
{
UserContext = userContext;
ReadOnly = false;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
// Managers.
if (accountMgr != null) accountMgr.Dispose();
if (assetMgr != null) assetMgr.Dispose();
if (commodityMgr != null) commodityMgr.Dispose();
if (priceMgr != null) priceMgr.Dispose();
if (transactionMgr != null) transactionMgr.Dispose();
if (stockMgr != null) stockMgr.Dispose();
if (processMgr != null) processMgr.Dispose();
if (dataItemMgr != null) dataItemMgr.Dispose();
if (mgr.accountMgr != null) mgr.accountMgr.Dispose();
if (mgr.assetMgr != null) mgr.assetMgr.Dispose();
if (mgr.commodityMgr != null) mgr.commodityMgr.Dispose();
if (mgr.priceMgr != null) mgr.priceMgr.Dispose();
if (mgr.transactionMgr != null) mgr.transactionMgr.Dispose();
if (mgr.stockMgr != null) mgr.stockMgr.Dispose();
if (mgr.processMgr != null) mgr.processMgr.Dispose();
if (mgr.dataItemMgr != null) mgr.dataItemMgr.Dispose();
// Reference data.
if (currencies != null) currencies.ClearAndDispose();
if (taxCodes != null) taxCodes.ClearAndDispose();
if (unitsOfMeasure != null) unitsOfMeasure.ClearAndDispose();
// Consoles.
if (sessionConsole != null) sessionConsole.Dispose();
if (diaryConsole != null) diaryConsole.Dispose();
if (securityConsole != null) securityConsole.Dispose();
if (codeTypeConsole != null) codeTypeConsole.Dispose();
if (referenceDataConsole != null) referenceDataConsole.Dispose();
if (updateLogConsole != null) updateLogConsole.Dispose();
if (interfaceConsole != null) interfaceConsole.Dispose();
if (itemDocConsole != null) itemDocConsole.Dispose();
if (itemOptionConsole != null) itemOptionConsole.Dispose();
if (itemDataConsole != null) itemDataConsole.Dispose();
if (itemDataConsole != null) itemDataConsole.Dispose();
if (con.sessionConsole != null) con.sessionConsole.Dispose();
if (con.diaryConsole != null) con.diaryConsole.Dispose();
if (con.securityConsole != null) con.securityConsole.Dispose();
if (con.codeTypeConsole != null) con.codeTypeConsole.Dispose();
if (con.referenceDataConsole != null) con.referenceDataConsole.Dispose();
if (con.updateLogConsole != null) con.updateLogConsole.Dispose();
if (con.interfaceConsole != null) con.interfaceConsole.Dispose();
if (con.itemDocConsole != null) con.itemDocConsole.Dispose();
if (con.itemOptionConsole != null) con.itemOptionConsole.Dispose();
if (con.itemDataConsole != null) con.itemDataConsole.Dispose();
if (con.itemDataConsole != null) con.itemDataConsole.Dispose();
}
}
//-------------------------------------------------------------------
// Session properties.
public SbmApplication Application { get { return SbmGlobals.Application; } }
public ISbmUserContext_Core UserContext { get; }
public bool ReadOnly { get; }
public ISbmUserOrganisationContext UserContext { get; }
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
public ISbmSecurityProfile_Core SecurityProfile { get { return UserContext.SecurityProfile_Core; } }
public SbmAccountsDfn AccountsDfn { get { if (accountsDfn == null) accountsDfn = new SbmAccountsDfn(UserContext); { return accountsDfn; } } }
@@ -111,17 +139,75 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// System codes.
private Dictionary<Sbm.SystemCode, List<TypeCodeDesc>> systemCodeCache = new Dictionary<Sbm.SystemCode, List<TypeCodeDesc>>();
public List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode systemCode)
public List<TypeCodeDesc> GetSystemCodes(Sbm.SystemCode systemCode)
{
if (!systemCodeCache.ContainsKey(systemCode))
systemCodeCache.Add(systemCode, SbmSystem.GetCodesOfType(UserContext, systemCode));
{
List<TypeCodeDesc> codes = new List<TypeCodeDesc>();
foreach (TypeCodeDesc code in SbmSystem.GetSystemCodes(systemCode))
{
switch (systemCode)
{
case Sbm.SystemCode.AffiliateType:
if (!SessionConsole.AllowAffiliateType((Sbm.AffiliateType)code.Type)) continue;
break;
case Sbm.SystemCode.AssociationType:
if (!SessionConsole.AllowAssociationType((Sbm.AssociationType)code.Type)) continue;
break;
case Sbm.SystemCode.TransactionType:
if (!SessionConsole.AllowTransactionType((Sbm.TransactionType)code.Type)) continue;
break;
case Sbm.SystemCode.CommodityType:
if (code.Type == (int)Sbm.CommodityType.Asset && (!SessionConsole.AllowOption(Sbm.ConfigOption.Assets) || !AssetMgr.AssetDatabaseIsValid())) continue;
break;
case Sbm.SystemCode.ProcessCategory:
if (code.Type == (int)Sbm.ProcessCategory.Commodity && !SessionConsole.AllowOption(Sbm.ConfigOption.Commodities)) continue;
if (code.Type == (int)Sbm.ProcessCategory.Asset && (!SessionConsole.AllowOption(Sbm.ConfigOption.Assets) || !AssetMgr.AssetDatabaseIsValid())) continue;
break;
case Sbm.SystemCode.FinancialType:
if ((code.Type == (int)Sbm.FinancialType.CommoditySupply || code.Type == (int)Sbm.FinancialType.CommoditySales) && !SessionConsole.AllowOption(Sbm.ConfigOption.Commodities)) continue;
break;
case Sbm.SystemCode.InterfaceType_Website:
if (code.Type == (int)Sbm.InterfaceType_Website.WebStore && !SessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_Website.JoomlaVirtueMart && !SessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_Website.MiMoWeb && !SessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)code.Type)) continue;
break;
case Sbm.SystemCode.InterfaceType_System:
if (code.Type == (int)Sbm.InterfaceType_System.MSOutlook && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_System.PostcodeAnywhere && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_System.Bac && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_System.Pvh && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_System.Cap && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_System.Hpi && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_System.Anchor_OrderFulfilment && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Argos && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
if (code.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Homebase && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
break;
case Sbm.SystemCode.OrgOption_PeriodDays:
if (code.Type == (int)Sbm.OrgOption_PeriodDays.UpdateClosedTransaction_DispatchDetails && !SessionConsole.AllowOption(ConfigOption.DeliveryPlanning)) continue;
if (code.Type == (int)Sbm.OrgOption_PeriodDays.UpdateStockLevelsInPast && !SessionConsole.AllowInterface(SaInterfaceCategory.System, (short)code.Type)) continue;
break;
case Sbm.SystemCode.OrgOption_PeriodWeeks:
if (code.Type == (int)Sbm.OrgOption_PeriodWeeks.Timesheets && !SessionConsole.AllowOption(ConfigOption.TimeRecording)) continue;
if (code.Type == (int)Sbm.OrgOption_PeriodWeeks.UpdateTimeRecords_Control && !SessionConsole.AllowOption(ConfigOption.TimeRecording)) continue;
if (code.Type == (int)Sbm.OrgOption_PeriodWeeks.ImminentStockDue && !SessionConsole.GetOwnerOption_AllowOption(OrgOption_AllowOption.ImminentStock)) continue;
break;
case Sbm.SystemCode.OrgOption_Caption:
if (!SessionConsole.AllowTransactionType(Sbm.OrgOptionToTransType((Sbm.OrgOption_Caption)code.Type))) continue;
break;
}
codes.Add(code);
}
systemCodeCache.Add(systemCode, codes);
}
return new List<TypeCodeDesc>(systemCodeCache.GetValueOrDefault(systemCode, new List<TypeCodeDesc>()));
}
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); } }
public List<TypeCodeDesc> TransactionTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.TransactionType); } }
// Selection of specific system code types.
public List<TypeCodeDesc> AffiliateTypeCodes { get { return GetSystemCodes(Sbm.SystemCode.AffiliateType); } }
public List<TypeCodeDesc> AssociationTypeCodes { get { return GetSystemCodes(Sbm.SystemCode.AssociationType); } }
public List<TypeCodeDesc> CommodityTypeCodes { get { return GetSystemCodes(Sbm.SystemCode.CommodityType); } }
public List<TypeCodeDesc> AssetTypeCodes { get { return GetSystemCodes(Sbm.SystemCode.AssetType); } }
public List<TypeCodeDesc> TransactionTypeCodes { get { return GetSystemCodes(Sbm.SystemCode.TransactionType); } }
//-------------------------------------------------------------------
// Code types.
@@ -143,72 +229,72 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
get
{
if (accountMgr == null)
accountMgr = system.CreateAccountMgr(UserContext);
return accountMgr;
if (mgr.accountMgr == null)
mgr.accountMgr = system.CreateAccountMgr(this);
return mgr.accountMgr;
}
}
public SbmAssetMgr AssetMgr
{
get
{
if (assetMgr == null)
assetMgr = system.CreateAssetMgr(UserContext);
return assetMgr;
if (mgr.assetMgr == null)
mgr.assetMgr = system.CreateAssetMgr(this);
return mgr.assetMgr;
}
}
public SbmCommodityMgr CommodityMgr
{
get
{
if (commodityMgr == null)
commodityMgr = system.CreateCommodityMgr(UserContext);
return commodityMgr;
if (mgr.commodityMgr == null)
mgr.commodityMgr = system.CreateCommodityMgr(this);
return mgr.commodityMgr;
}
}
public SbmPriceMgr PriceMgr
{
get
{
if (priceMgr == null)
priceMgr = system.CreatePriceMgr(UserContext);
return priceMgr;
if (mgr.priceMgr == null)
mgr.priceMgr = system.CreatePriceMgr(this);
return mgr.priceMgr;
}
}
public SbmTransactionMgr TransactionMgr
{
get
{
if (transactionMgr == null)
transactionMgr = system.CreateTransactionMgr(UserContext);
return transactionMgr;
if (mgr.transactionMgr == null)
mgr.transactionMgr = system.CreateTransactionMgr(this);
return mgr.transactionMgr;
}
}
public SbmStockMgr StockMgr
{
get
{
if (stockMgr == null)
stockMgr = system.CreateStockMgr(UserContext);
return stockMgr;
if (mgr.stockMgr == null)
mgr.stockMgr = system.CreateStockMgr(this);
return mgr.stockMgr;
}
}
public SbmProcessMgr ProcessMgr
{
get
{
if (processMgr == null)
processMgr = system.CreateProcessMgr(UserContext);
return processMgr;
if (mgr.processMgr == null)
mgr.processMgr = system.CreateProcessMgr(this);
return mgr.processMgr;
}
}
public SbmDataItemMgr DataItemMgr
{
get
{
if (dataItemMgr == null)
dataItemMgr = SbmGlobals.System.CreateDataItemMgr(UserContext);
return dataItemMgr;
if (mgr.dataItemMgr == null)
mgr.dataItemMgr = SbmGlobals.System.CreateDataItemMgr(this);
return mgr.dataItemMgr;
}
}
@@ -218,90 +304,90 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
get
{
if (sessionConsole == null)
sessionConsole = Application.CreateSessionConsole(UserContext);
return sessionConsole;
if (con.sessionConsole == null)
con.sessionConsole = Application.CreateSessionConsole(UserContext);
return con.sessionConsole;
}
}
public SaDiaryConsole DiaryConsole
{
get
{
if (diaryConsole == null)
diaryConsole = Application.CreateDiaryConsole(UserContext);
return DiaryConsole;
if (con.diaryConsole == null)
con.diaryConsole = Application.CreateDiaryConsole(UserContext);
return con.diaryConsole;
}
}
public SaSecurityConsole SecurityConsole
{
get
{
if (securityConsole == null)
securityConsole = Application.CreateSecurityConsole(UserContext);
return securityConsole;
if (con.securityConsole == null)
con.securityConsole = Application.CreateSecurityConsole(UserContext);
return con.securityConsole;
}
}
public SaCodeTypeConsole CodeTypeConsole
{
get
{
if (codeTypeConsole == null)
codeTypeConsole = Application.CreateCodeTypeConsole(UserContext);
return codeTypeConsole;
if (con.codeTypeConsole == null)
con.codeTypeConsole = Application.CreateCodeTypeConsole(UserContext);
return con.codeTypeConsole;
}
}
public SaReferenceDataConsole ReferenceDataConsole
{
get
{
if (referenceDataConsole == null)
referenceDataConsole = Application.CreateReferenceDataConsole(UserContext);
return referenceDataConsole;
if (con.referenceDataConsole == null)
con.referenceDataConsole = Application.CreateReferenceDataConsole(UserContext);
return con.referenceDataConsole;
}
}
public SaUpdateLogConsole UpdateLogConsole
{
get
{
if (updateLogConsole == null)
updateLogConsole = Application.CreateUpdateLogConsole(UserContext);
return updateLogConsole;
if (con.updateLogConsole == null)
con.updateLogConsole = Application.CreateUpdateLogConsole(UserContext);
return con.updateLogConsole;
}
}
public SaInterfaceConsole InterfaceConsole
{
get
{
if (interfaceConsole == null)
interfaceConsole = Application.CreateInterfaceConsole(UserContext);
return interfaceConsole;
if (con.interfaceConsole == null)
con.interfaceConsole = Application.CreateInterfaceConsole(UserContext);
return con.interfaceConsole;
}
}
public SaItemDocConsole ItemDocConsole
{
get
{
if (itemDocConsole == null)
itemDocConsole = Application.CreateItemDocConsole(UserContext);
return itemDocConsole;
if (con.itemDocConsole == null)
con.itemDocConsole = Application.CreateItemDocConsole(UserContext);
return con.itemDocConsole;
}
}
public SaItemOptionConsole ItemOptionConsole
{
get
{
if (itemOptionConsole == null)
itemOptionConsole = Application.CreateItemOptionConsole(UserContext);
return itemOptionConsole;
if (con.itemOptionConsole == null)
con.itemOptionConsole = Application.CreateItemOptionConsole(UserContext);
return con.itemOptionConsole;
}
}
public SaItemDataConsole ItemDataConsole
{
get
{
if (itemDataConsole == null)
itemDataConsole = Application.CreateItemDataConsole(UserContext);
return itemDataConsole;
if (con.itemDataConsole == null)
con.itemDataConsole = Application.CreateItemDataConsole(UserContext);
return con.itemDataConsole;
}
}
@@ -312,9 +398,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
get
{
if (emailConsole == null)
emailConsole = Application.CreateEmailConsole(UserContext);
return emailConsole;
if (con.emailConsole == null)
con.emailConsole = Application.CreateEmailConsole(UserContext);
return con.emailConsole;
}
}
@@ -438,6 +524,70 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
return unitsOfMeasure.Find(item => item.Category == uomCategory && item.UnitType == uomType);
}
//-------------------------------------------------------------------
// Organisation configuration.
//-------------------------------------------------------------------
public String GetOrganisationOption(Sbm.OrganisationOption option, String context)
{
return SessionConsole.OrganisationConfig.GetOrganisationOption(option, context);
}
public String GetOrganisationOption(String optionName, String context)
{
return SessionConsole.OrganisationConfig.GetOrganisationOption(optionName, context);
}
public String GetOwnerOption_Value(Sbm.OrgOption_Value value)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_Value(value);
}
public String GetOwnerOption_Folder(Sbm.OrgOption_Folder folder)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_Folder(folder);
}
public bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption option)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_AllowOption(option);
}
public String GetOwnerOption_Caption(Sbm.OrgOption_Caption caption, String defaultValue)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_Caption(caption, defaultValue);
}
public bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx column)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_ShowField(column);
}
public bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn column)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_ShowColumn(column);
}
public String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx column, String defautValue)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_FieldLabel(column, defautValue);
}
public int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes limit, int defautValue)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_Minutes(limit, defautValue);
}
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays limit, int defautValue)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_UpdateLimit(limit, defautValue);
}
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks limit, int defautValue)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_UpdateLimit(limit, defautValue);
}
public int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals decimals, int defautValue = 2)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_NumericDecimals(decimals, defautValue);
}
public Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityType)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_CommodityType(commodityType);
}
public SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation stockLocation)
{
return SessionConsole.OrganisationConfig.GetOwnerOption_StockLocation(stockLocation);
}
//-------------------------------------------------------------------
}
//=======================================================================
@@ -0,0 +1,181 @@
using Sarand.BusinessMgr.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.ItemOptions;
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.App
{
//=======================================================================
public abstract class SbmOrganisationConfig : SacsDisposable, ISbmOrganisationConfig
{
//-------------------------------------------------------------------
// Data members.
private List<TypeCodeDesc> assocOptions;
private List<TypeCodeDesc> contextValues;
private List<TypeCodeDesc> contextFolders;
private List<TypeCodeDesc> contextAllowOptions;
private List<TypeCodeDesc> contextCaptions;
private List<TypeCodeDesc> contextShowColumns;
private List<TypeCodeDesc> contextShowFields;
private List<TypeCodeDesc> contextFieldLabels;
private List<TypeCodeDesc> contextMinutes;
private List<TypeCodeDesc> contextPeriodDays;
private List<TypeCodeDesc> contextPeriodWeeks;
private List<TypeCodeDesc> contextNumericDecimals;
private List<TypeCodeDesc> contextCommodityTypes;
private List<TypeCodeDesc> commodityTypes;
private List<TypeCodeDesc> contextSalesLocations;
//-------------------------------------------------------------------
// Construction.
protected SbmOrganisationConfig()
{
}
protected override void Dispose(bool disposing) { }
//-------------------------------------------------------------------
// Properties.
protected abstract ISbmUserOrganisationContext UserContext { get; }
protected abstract SbmInstanceDataCache InstanceDataCache { get; }
//-------------------------------------------------------------------
// Organisation configuration.
public String GetOrganisationOption(Sbm.OrganisationOption option, String context)
{
if (assocOptions == null) assocOptions = SbmSystem.GetSystemCodes(Sbm.SystemCode.AssociationOption);
String optionName = assocOptions.GetCodeForType(option);
return GetOrganisationOption(optionName, context);
}
public String GetOrganisationOption(String optionName, String context)
{
// Retrieve the requested value from the cache.
return InstanceDataCache.GetOwnerOptions(UserContext).GetOptionValue(optionName, context);
}
public String GetOwnerOption_Value(Sbm.OrgOption_Value value)
{
if (contextValues == null) contextValues = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_Value);
String context = contextValues.GetCodeForType(value);
return GetOrganisationOption(Sbm.OrganisationOption.Value, context).Trim();
}
public String GetOwnerOption_Folder(Sbm.OrgOption_Folder folder)
{
if (contextFolders == null) contextFolders = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_Folder);
String context = contextFolders.GetCodeForType(folder);
return GetOrganisationOption(Sbm.OrganisationOption.Folder, context).Trim();
}
public bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption option)
{
if (contextAllowOptions == null) contextAllowOptions = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_AllowOption);
String context = contextAllowOptions.GetCodeForType(option);
String value = GetOrganisationOption(Sbm.OrganisationOption.AllowOption, context).Trim();
return StringUtil.ToBool(value);
}
public String GetOwnerOption_Caption(Sbm.OrgOption_Caption caption, String defaultValue)
{
if (contextCaptions == null) contextCaptions = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_Caption);
String context = contextCaptions.GetCodeForType(caption);
String value = GetOrganisationOption(Sbm.OrganisationOption.Caption, context).Trim();
return (!value.IsEmpty() ? value : defaultValue);
}
public bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx column)
{
if (contextShowFields == null) contextShowFields = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_ShowField);
String context = contextShowFields.GetCodeForType(column);
if (context.IsEmpty()) return true; // Automatically show fields that are not in the 'Show Field' list.
String value = GetOrganisationOption(Sbm.OrganisationOption.ShowField, context).Trim();
return StringUtil.ToBool(value);
}
public bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn column)
{
if (contextShowColumns == null) contextShowColumns = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_ShowColumn);
String context = contextShowColumns.GetCodeForType(column);
String value = GetOrganisationOption(Sbm.OrganisationOption.ShowColumn, context).Trim();
return StringUtil.ToBool(value);
}
public String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx column, String defautValue)
{
if (contextFieldLabels == null) contextFieldLabels = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_FieldLabel);
String context = contextFieldLabels.GetCodeForType(column);
String value = GetOrganisationOption(Sbm.OrganisationOption.FieldLabel, context).Trim();
return (!value.IsEmpty() ? value : defautValue); // Return default if no label defined.
}
public int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes limit, int defautValue)
{
if (contextMinutes == null) contextMinutes = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_Minutes);
String context = contextMinutes.GetCodeForType(limit);
String value = GetOrganisationOption(Sbm.OrganisationOption.Minutes, context).Trim();
if (!value.IsEmpty())
{
int iUpdateLimit = value.ToShort();
if (iUpdateLimit > 0)
return iUpdateLimit;
}
return defautValue;
}
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays limit, int defautValue)
{
if (contextPeriodDays == null) contextPeriodDays = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_PeriodDays);
String context = contextPeriodDays.GetCodeForType(limit);
String value = GetOrganisationOption(Sbm.OrganisationOption.PeriodDays, context).Trim();
if (!value.IsEmpty())
{
int iUpdateLimit = value.ToShort();
if (iUpdateLimit > 0)
return iUpdateLimit;
}
return defautValue;
}
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks limit, int defautValue)
{
if (contextPeriodWeeks == null) contextPeriodWeeks = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_PeriodWeeks);
String context = contextPeriodWeeks.GetCodeForType(limit);
String value = GetOrganisationOption(Sbm.OrganisationOption.PeriodWeeks, context).Trim();
if (!value.IsEmpty())
{
int iUpdateLimit = value.ToShort();
if (iUpdateLimit > 0)
return iUpdateLimit;
}
return defautValue;
}
public int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals decimals, int defautValue = 2)
{
if (contextNumericDecimals == null) contextNumericDecimals = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_NumericDecimals);
String context = contextNumericDecimals.GetCodeForType(decimals);
String value = GetOrganisationOption(Sbm.OrganisationOption.NumericDecimals, context).Trim();
int iNumDecimals = defautValue;
if (!value.IsEmpty())
iNumDecimals = value.ToShort();
iNumDecimals = Math.Min(4, Math.Max(0, iNumDecimals));
return iNumDecimals;
}
public Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityType)
{
if (contextCommodityTypes == null) contextCommodityTypes = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_CommodityType);
if (commodityTypes == null) commodityTypes = SbmSystem.GetSystemCodes(Sbm.SystemCode.CommodityType);
String context = contextCommodityTypes.GetCodeForType(commodityType);
String value = GetOrganisationOption(Sbm.OrganisationOption.CommodityType, context).Trim();
Sbm.CommodityType eCmdType = (Sbm.CommodityType)commodityTypes.GetTypeForCode(value);
return eCmdType;
}
public SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation stockLocation)
{
if (contextSalesLocations == null) contextSalesLocations = SbmSystem.GetSystemCodes(Sbm.SystemCode.OrgOption_StockLocation);
String context = contextSalesLocations.GetCodeForType(stockLocation);
String value = GetOrganisationOption(Sbm.OrganisationOption.SalesLocation, context).Trim();
SysId idLoc = new SysId();
if (!StringUtil.IsEmpty(value))
idLoc = new SysId(StringUtil.ToInt(value));
return idLoc;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -27,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Construction.
[JsonConstructor]
private SbmSecurityProfile() { }
public SbmSecurityProfile(ISbmUserContext_Core userContext, bool includeHostSecurityProfile)
public SbmSecurityProfile(ISbmUserOrganisationContext userContext, bool includeHostSecurityProfile)
{
this.UserContext = userContext;
this.includeHostSecurityProfile = includeHostSecurityProfile;
@@ -41,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Properties.
[JsonIgnore]
public ISbmUserContext_Core UserContext { get; }
public ISbmUserOrganisationContext UserContext { get; }
//-------------------------------------------------------------------
// Refresh profile.
@@ -76,14 +76,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
this.hostSecurityProfile = hostSecurityProfile;
RefreshProfileSettings(sessionConsole);
}
private void RefreshProfileSettings(SbmSessionConsole sessionConfig)
private void RefreshProfileSettings(SbmSessionConsole sessionConsole)
{
RefreshAdminProfile(sessionConfig);
RefreshManageProfile(sessionConfig);
RefreshFinancialProfile(sessionConfig);
RefreshContactsProfile(sessionConfig);
RefreshTransactionProfile(sessionConfig);
RefreshItemTypeProfile(sessionConfig);
RefreshAdminProfile(sessionConsole);
RefreshManageProfile(sessionConsole);
RefreshFinancialProfile(sessionConsole);
RefreshContactsProfile(sessionConsole);
RefreshTransactionProfile(sessionConsole);
RefreshItemTypeProfile(sessionConsole);
// ToDo Commodities.
}
private void ClearProfile()
@@ -135,7 +135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public bool CanManageInterfaces { get; internal set; } = false;
}
public AdminProfile Admin { get; internal set; }
private void RefreshAdminProfile(SbmSessionConsole sessionConfig)
private void RefreshAdminProfile(SbmSessionConsole sessionConsole)
{
Admin.CanManageSecurity = UserHasSecurityRight(Sbm.SecurityRight.Security_Admin);
Admin.CanManageDatabase = UserHasSecurityRight(Sbm.SecurityRight.Database_Admin);
@@ -152,7 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public bool CanManageTimesheets { get; internal set; } = false;
}
public ManageProfile Manage { get; internal set; }
private void RefreshManageProfile(SbmSessionConsole sessionConfig)
private void RefreshManageProfile(SbmSessionConsole sessionConsole)
{
Manage.CanManageTasks = UserHasSecurityRight(Sbm.SecurityRight.TaskManager);
Manage.CanManageTimesheets = UserHasSecurityRight(Sbm.SecurityRight.TimesheetManager);
@@ -172,7 +172,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public bool FinancialsAccessControl { get; internal set; }
}
public FinancialProfile Financial { get; internal set; }
private void RefreshFinancialProfile(SbmSessionConsole sessionConfig)
private void RefreshFinancialProfile(SbmSessionConsole sessionConsole)
{
Financial.ViewFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_View);
Financial.UpdateFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_Update);
@@ -181,7 +181,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Financial.ViewCommoditySalesFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySales);
Financial.UpdateCommoditySalesFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySales);
// Config options.
Financial.FinancialsAccessControl = (sessionConfig != null && !sessionConfig.AllowOption(Sbm.ConfigOption.AllowFinancialsAccessControl));
Financial.FinancialsAccessControl = (sessionConsole != null && !sessionConsole.AllowOption(Sbm.ConfigOption.FinancialsAccessControl));
}
private bool UserCanAccessFinancialViewOfType(Sbm.FinancialType financialType)
@@ -245,7 +245,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public ContactsProfile Contacts { get; internal set; }
public bool UserCanCreateContacts() { return Contacts.Create; }
public bool UserCanUpdateContacts() { return Contacts.Update; }
private void RefreshContactsProfile(SbmSessionConsole sessionConfig)
private void RefreshContactsProfile(SbmSessionConsole sessionConsole)
{
Contacts.Update = (UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Update));
Contacts.Create = (Contacts.Update || UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Create));
@@ -285,7 +285,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
}
}
public TransactionsProfile Transaction { get; internal set; }
private void RefreshTransactionProfile(SbmSessionConsole sessionConfig)
private void RefreshTransactionProfile(SbmSessionConsole sessionConsole)
{
Transaction.Update = (UserHasSecurityRight(Sbm.SecurityRight.Transaction_Update));
Transaction.Create = (Transaction.Update || UserHasSecurityRight(Sbm.SecurityRight.Transaction_View));
@@ -324,21 +324,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public bool StockControl { get; internal set; }
}
public ItemTypesProfile ItemType { get; } = new ItemTypesProfile();
private void RefreshItemTypeProfile(SbmSessionConsole sessionConfig)
private void RefreshItemTypeProfile(SbmSessionConsole sessionConsole)
{
ItemType.Processes = sessionConfig.AllowOption(Sbm.ConfigOption.AllowProcesses);
ItemType.Contacts = sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts);
ItemType.Commodities = sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities);
ItemType.Portfolios = sessionConfig.AllowOption(Sbm.ConfigOption.AllowPortfolios);
ItemType.PriceSets = sessionConfig.AllowOption(Sbm.ConfigOption.AllowPriceSets);
ItemType.CommodityCustomers = sessionConfig.AllowOption(Sbm.ConfigOption.CommodityCustomers);
ItemType.CommoditySuppliers = sessionConfig.AllowOption(Sbm.ConfigOption.CommoditySuppliers);
ItemType.Transactions = sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions);
ItemType.Assets = sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets);
ItemType.Vehicles = sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles);
ItemType.StockLocations = sessionConfig.GetStockControlConfig().AllowStockLocations();
ItemType.StockContainers = sessionConfig.GetStockControlConfig().AllowStockContainers();
ItemType.StockControl = sessionConfig.GetStockControlConfig().AllowStockControl();
ItemType.Processes = sessionConsole.AllowOption(Sbm.ConfigOption.Processes);
ItemType.Contacts = sessionConsole.AllowOption(Sbm.ConfigOption.Contacts);
ItemType.Commodities = sessionConsole.AllowOption(Sbm.ConfigOption.Commodities);
ItemType.Portfolios = sessionConsole.AllowOption(Sbm.ConfigOption.Portfolios);
ItemType.PriceSets = sessionConsole.AllowOption(Sbm.ConfigOption.PriceSets);
ItemType.CommodityCustomers = sessionConsole.AllowOption(Sbm.ConfigOption.CommodityCustomers);
ItemType.CommoditySuppliers = sessionConsole.AllowOption(Sbm.ConfigOption.CommoditySuppliers);
ItemType.Transactions = sessionConsole.AllowOption(Sbm.ConfigOption.Transactions);
ItemType.Assets = sessionConsole.AllowOption(Sbm.ConfigOption.Assets);
ItemType.Vehicles = sessionConsole.AllowOption(Sbm.ConfigOption.Vehicles);
ItemType.StockLocations = sessionConsole.GetStockControlConfig().AllowStockLocations();
ItemType.StockContainers = sessionConsole.GetStockControlConfig().AllowStockContainers();
ItemType.StockControl = sessionConsole.GetStockControlConfig().AllowStockControl();
}
public bool ItemTypeIsAllowed(Sbm.ItemType itemType)
@@ -49,7 +49,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Construction.
public SbmSysParamCache(ISbmUserContext_Core userContext, SysId affiliateIdUser)
public SbmSysParamCache(ISbmUserOrganisationContext userContext, SysId affiliateIdUser)
{
this.UserContext = userContext;
this.AffiliateIdUser = affiliateIdUser;
@@ -64,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Properties.
public ISbmUserContext_Core UserContext { get; }
public ISbmUserOrganisationContext UserContext { get; }
public SysId AffiliateIdUser { get; }
public bool Modified { get; private set; }
@@ -25,17 +25,17 @@ 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(SbmSessionConsole sessionConfig, SaCodeTypeConsole codeTypeConsole)
public static void RegisterCodeTypes(SbmSessionConsole sessionConsole, SaCodeTypeConsole codeTypeConsole)
{
//---------------------------------------------------------------
// C o m m o d i t i e s
//---------------------------------------------------------------
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities))
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.Commodities))
{
// Commodity category.
SaCodeTypeDfn codeTypeCommodityCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.CommodityCategory), 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityCategory));
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityCategory.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityCategory));
// Commodity range.
SaCodeTypeDfn codeTypeCommodityRange = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityRange), codeTypes.GetDescForType(Sbm.ApplCodeType.CommodityRange), 12);
@@ -62,97 +62,97 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//codeTypeConsole.RegisterCodeType(codeTypeCommodityDelivery);
// Commodity material.
String commodityMaterialLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material");
String commodityMaterialLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material");
if (!commodityMaterialLabel.ContainsCI("Commodity")) commodityMaterialLabel = "Commodity " + commodityMaterialLabel;
SaCodeTypeDfn codeTypeCommodityMaterial = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityMaterial), commodityMaterialLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityMaterial);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityMaterial.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityMaterial));
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityMaterial.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityMaterial));
// Commodity finish.
String commodityFinishLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish");
String commodityFinishLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish");
if (!commodityFinishLabel.ContainsCI("Commodity")) commodityFinishLabel = "Commodity " + commodityFinishLabel;
SaCodeTypeDfn codeTypeCommodityFinish = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityFinish), commodityFinishLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityFinish);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityFinish.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityFinish));
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityFinish.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityFinish));
// Commodity promotion.
String commodityPromotionLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion");
String commodityPromotionLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion");
if (!commodityPromotionLabel.ContainsCI("Commodity")) commodityPromotionLabel = "Commodity " + commodityPromotionLabel;
SaCodeTypeDfn codeTypeCommodityPromotion = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityPromotion), commodityPromotionLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityPromotion);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityPromotion.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityPromotion));
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityPromotion.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityPromotion));
}
//---------------------------------------------------------------
// P r o c e s s e s
//---------------------------------------------------------------
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowProcesses))
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.Processes))
{
// Process type.
SaCodeTypeDfn codeTypeProcessType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ProcessType), codeTypes.GetDescForType(Sbm.ApplCodeType.ProcessType), 12);
codeTypeConsole.RegisterCodeType(codeTypeProcessType);
codeTypeConsole.RegisterCodesOfType(codeTypeProcessType.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.ProcessType));
codeTypeConsole.RegisterCodesOfType(codeTypeProcessType.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.ProcessType));
}
//---------------------------------------------------------------
// R e f e r r a l
//---------------------------------------------------------------
if (sessionConfig != null)
if (sessionConsole != null)
{
// Refer type.
SaCodeTypeDfn codeTypeReferType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ReferType), codeTypes.GetDescForType(Sbm.ApplCodeType.ReferType), 12);
codeTypeReferType.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeReferType);
codeTypeConsole.RegisterCodesOfType(codeTypeReferType.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.ReferType));
codeTypeConsole.RegisterCodesOfType(codeTypeReferType.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.ReferType));
}
//---------------------------------------------------------------
// T a s k s
//---------------------------------------------------------------
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowTasks))
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.Tasks))
{
// Task category.
SaCodeTypeDfn codeTypeTaskCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.TaskCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.TaskCategory), 12);
codeTypeTaskCategory.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeTaskCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeTaskCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.TaskCategory));
codeTypeConsole.RegisterCodesOfType(codeTypeTaskCategory.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.TaskCategory));
}
//---------------------------------------------------------------
// A s s e t s
//---------------------------------------------------------------
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets))
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.Assets))
{
// Asset sell category.
SaCodeTypeDfn codeTypeAssetSellCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AssetSellCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.AssetSellCategory), 8);
codeTypeConsole.RegisterCodeType(codeTypeAssetSellCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeAssetSellCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.AssetSellCategory));
codeTypeConsole.RegisterCodesOfType(codeTypeAssetSellCategory.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.AssetSellCategory));
}
//---------------------------------------------------------------
// V e h i c l e s
//---------------------------------------------------------------
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles))
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.Vehicles))
{
// Vehicle category.
SaCodeTypeDfn codeTypeVehicleCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleCategory), 8);
codeTypeConsole.RegisterCodeType(codeTypeVehicleCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleCategory));
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleCategory.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleCategory));
// Vehicle make.
SaCodeTypeDfn codeTypeVehicleMake = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleMake), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleMake), 8);
codeTypeConsole.RegisterCodeType(codeTypeVehicleMake);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleMake.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleMake));
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleMake.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleMake));
// Vehicle service history.
SaCodeTypeDfn codeTypeVehicleServiceHistory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleServiceHistory), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleServiceHistory), 12);
codeTypeConsole.RegisterCodeType(codeTypeVehicleServiceHistory);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleServiceHistory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleServiceHistory));
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleServiceHistory.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleServiceHistory));
// Vehicle insurance.
SaCodeTypeDfn codeTypeVehicleInsurance = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleInsurance), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleInsurance), 3);
codeTypeConsole.RegisterCodeType(codeTypeVehicleInsurance);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleInsurance.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleInsurance));
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleInsurance.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleInsurance));
// Vehicle tacho.
SaCodeTypeDfn codeTypeVehicleTacho = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleTacho), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleTacho), 8);
@@ -163,83 +163,83 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//---------------------------------------------------------------
// H P I V e h i c l e s
//---------------------------------------------------------------
if (sessionConfig != null && sessionConfig.AllowInterface(SaInterfaceCategory.System, (int)Sbm.InterfaceType_System.Hpi))
if (sessionConsole != null && sessionConsole.AllowInterface(SaInterfaceCategory.System, (int)Sbm.InterfaceType_System.Hpi))
{
// HPI vehicle make.
SaCodeTypeDfn codeTypeHpiVehicleMake = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleMake), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleMake), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleMake);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleMake.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleMake));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleMake.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleMake));
// HPI vehicle model.
SaCodeTypeDfn codeTypeHpiVehicleModel = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleModel), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleModel), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleModel);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleModel.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleModel));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleModel.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleModel));
// HPI vehicle colour.
SaCodeTypeDfn codeTypeHpiVehicleColour = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleColour), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleColour), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleColour);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleColour.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleColour));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleColour.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleColour));
// HPI vehicle fuel.
SaCodeTypeDfn codeTypeHpiVehicleFuel = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleFuel), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleFuel), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleFuel);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleFuel.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleFuel));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleFuel.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleFuel));
// HPI vehicle transmission.
SaCodeTypeDfn codeTypeHpiVehicleTrans = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleTrans), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleTrans), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleTrans);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleTrans.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleTrans));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleTrans.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleTrans));
}
//---------------------------------------------------------------
// C o n t a c t M a n a g e m e n t
//---------------------------------------------------------------
if (sessionConfig != null)
if (sessionConsole != null)
{
// Account manager.
String accountManagerLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountManagerCode, "Account manager");
String accountManagerLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountManagerCode, "Account manager");
SaCodeTypeDfn codeTypeAccountManager = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountManager), accountManagerLabel, 12, "Account management group");
codeTypeConsole.RegisterCodeType(codeTypeAccountManager);
// Account handler.
String accountHandlerLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountHandlerCode, "Account handler");
String accountHandlerLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountHandlerCode, "Account handler");
SaCodeTypeDfn codeTypeAccountHandler = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountHandler), accountHandlerLabel, 12, "Account handling group");
codeTypeConsole.RegisterCodeType(codeTypeAccountHandler);
// Account type.
String accountTypeLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountTypeCode, "Account type");
String accountTypeLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountTypeCode, "Account type");
SaCodeTypeDfn codeTypeAccountType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountType), accountTypeLabel, 12, "Grouping by nature of business");
codeTypeConsole.RegisterCodeType(codeTypeAccountType);
// Account rating.
String accountRatingLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountRatingCode, "Account rating");
String accountRatingLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountRatingCode, "Account rating");
SaCodeTypeDfn codeTypeAccountRating = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountRating), accountRatingLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeAccountRating);
// Contact title.
String contactTitleLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Affiliate_Title, "Contact title");
String contactTitleLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Affiliate_Title, "Contact title");
SaCodeTypeDfn codeTypeContactTitle = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactTitle), contactTitleLabel, 12);
codeTypeContactTitle.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeContactTitle);
codeTypeConsole.RegisterCodesOfType(codeTypeContactTitle.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.ContactTitle));
codeTypeConsole.RegisterCodesOfType(codeTypeContactTitle.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.ContactTitle));
// Contact area.
String contactAreaLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactAreaCode, "Contact area");
String contactAreaLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactAreaCode, "Contact area");
SaCodeTypeDfn codeTypeContactArea = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactArea), contactAreaLabel, 12, "Geographic region");
codeTypeConsole.RegisterCodeType(codeTypeContactArea);
// Contact handler.
String contactHandlerLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactHandlerCode, "Contact handler");
String contactHandlerLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactHandlerCode, "Contact handler");
SaCodeTypeDfn codeTypeContactHandler = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactHandler), contactHandlerLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeContactHandler);
// Contact method.
String contactMethodLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactMethodCode, "Contact method");
String contactMethodLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactMethodCode, "Contact method");
SaCodeTypeDfn codeTypeContactMethod = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactMethod), contactMethodLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeContactMethod);
// Contact call cycle.
String contactCallCycleLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactCallCycleCode, "Contact call cycle");
String contactCallCycleLabel = sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactCallCycleCode, "Contact call cycle");
SaCodeTypeDfn codeTypeContactCallCycle = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactCallCycle), contactCallCycleLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeContactCallCycle);
@@ -252,7 +252,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// C o s t E s t i m a t e s
//---------------------------------------------------------------
FlagDfn estimateDefaultFlag = new FlagDfn((Byte)Sbm.ApplCodeFlag.EstimateType_QuoteDefault, "Default to quote", "Default");
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.EstimateSalesQuotesByCosts))
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.EstimateSalesQuotesByCosts))
{
// Cost per unit.
SaCodeTypeDfn codeTypeCostPerUnit = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CostPerUnit), codeTypes.GetDescForType(Sbm.ApplCodeType.CostPerUnit), 12);
@@ -264,61 +264,61 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
codeTypeCostPerUnit.FlagDefinitions.Add(new FlagDfn(4, "Flag 4", "#4"));
#endif
codeTypeConsole.RegisterCodeType(codeTypeCostPerUnit);
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerUnit.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerUnit));
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerUnit.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerUnit));
// Cost per job.
SaCodeTypeDfn codeTypeCostPerJob = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CostPerJob), codeTypes.GetDescForType(Sbm.ApplCodeType.CostPerJob), 12);
codeTypeCostPerJob.AllowSequence = true;
codeTypeCostPerJob.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeCostPerJob);
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerJob.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerJob));
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerJob.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerJob));
}
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.EstimateLabourByMinutes))
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.EstimateLabourByMinutes))
{
// Labour cost per unit.
SaCodeTypeDfn codeTypeLabourPerUnit = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.LabourPerUnit), codeTypes.GetDescForType(Sbm.ApplCodeType.LabourPerUnit), 12);
codeTypeLabourPerUnit.AllowSequence = true;
codeTypeLabourPerUnit.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeLabourPerUnit);
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerUnit.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerUnit));
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerUnit.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerUnit));
// Labour cost per job.
SaCodeTypeDfn codeTypeLabourPerJob = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.LabourPerJob), codeTypes.GetDescForType(Sbm.ApplCodeType.LabourPerJob), 12);
codeTypeLabourPerJob.AllowSequence = true;
codeTypeLabourPerJob.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeLabourPerJob);
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerJob.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerJob));
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerJob.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerJob));
}
//---------------------------------------------------------------
// D e l i v e r y
//---------------------------------------------------------------
if (sessionConfig != null && sessionConfig.UserContext.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.SalesOrder_DispatchDetails))
if (sessionConsole != null && sessionConsole.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.SalesOrder_DispatchDetails))
{
// Delivery status.
SaCodeTypeDfn codeTypeDeliveryStatus = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryStatus), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryStatus), 3);
codeTypeDeliveryStatus.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryStatus);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryStatus.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryStatus));
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryStatus.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryStatus));
// Delivery type.
SaCodeTypeDfn codeTypeDeliveryType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryType), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryType), 12);
codeTypeDeliveryType.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryType);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryType.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryType));
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryType.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryType));
// Delivery method.
SaCodeTypeDfn codeTypeDeliveryMethod = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryMethod), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryMethod), 12);
codeTypeDeliveryMethod.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryMethod);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryMethod.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryMethod));
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryMethod.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryMethod));
// Delivery courier.
SaCodeTypeDfn codeTypeDeliveryCourier = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryCourier), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryCourier), 12);
codeTypeDeliveryCourier.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryCourier);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryCourier.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryCourier));
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryCourier.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryCourier));
// Delivery book-in.
SaCodeTypeDfn codeTypeDeliveryBookIn = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryBookIn), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryBookIn), 12);
@@ -336,13 +336,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
SaCodeTypeDfn codeTypeStockPicker = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.StockPicker), codeTypes.GetDescForType(Sbm.ApplCodeType.StockPicker), 12);
codeTypeStockPicker.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeStockPicker);
codeTypeConsole.RegisterCodesOfType(codeTypeStockPicker.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.StockPicker));
codeTypeConsole.RegisterCodesOfType(codeTypeStockPicker.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.StockPicker));
}
//---------------------------------------------------------------
// I t e m D o c u m e n t s
//---------------------------------------------------------------
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowItemDocuments))
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.ItemDocuments))
{
// PDF document types.
SaCodeTypeDfn codeTypeDocType_Pdf = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DocType_Pdf), codeTypes.GetDescForType(Sbm.ApplCodeType.DocType_Pdf), 12);
@@ -350,7 +350,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
codeTypeDocType_Pdf.AllowMixedCode = true;
codeTypeDocType_Pdf.FlagDefinitions.Add(new FlagDfn((Byte)Sbm.ApplCodeFlag.DocType_Pdf_WebPublish, "WebPublish", "Publish to Web"));
codeTypeConsole.RegisterCodeType(codeTypeDocType_Pdf);
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Pdf.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Pdf));
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Pdf.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Pdf));
// Image document types.
SaCodeTypeDfn codeTypeDocType_Image = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DocType_Image), codeTypes.GetDescForType(Sbm.ApplCodeType.DocType_Image), 12);
@@ -358,7 +358,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
codeTypeDocType_Image.AllowMixedCode = true;
codeTypeDocType_Image.FlagDefinitions.Add(new FlagDfn((Byte)Sbm.ApplCodeFlag.DocType_Image_WebPublish, "WebPublish", "Publish to Web"));
codeTypeConsole.RegisterCodeType(codeTypeDocType_Image);
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Image.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Image));
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Image.Code, sessionConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Image));
}
//---------------------------------------------------------------
File diff suppressed because it is too large Load Diff
+22 -411
View File
@@ -7,6 +7,7 @@ using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
@@ -77,423 +78,33 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// S y s t e m C o d e s
//-------------------------------------------------------------------
private static String GetOwnerOption_Caption(ISbmUserContext_Core userContext, Sbm.OrgOption_Caption orgOption_Caption, String defaultValue)
public static List<TypeCodeDesc> GetSystemCodes(Sbm.SystemCode systemCode)
{
// 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_Core userContext, Sbm.SystemCode systemCode)
{
using (SbmInternals internals = new SbmInternals(userContext))
{
SbmSessionConsole sessionConsole = internals.SessionConsole;
switch (systemCode)
{
case Sbm.SystemCode.ItemType:
return new List<TypeCodeDesc>(itemTypes);
case Sbm.SystemCode.AffiliateType:
return new List<TypeCodeDesc>(affiliateTypes);
case Sbm.SystemCode.AssociationType:
return new List<TypeCodeDesc>(associationTypes);
case Sbm.SystemCode.TransactionType:
// Transaction types.
return new List<TypeCodeDesc>()
{
new TypeCodeDesc((int) Sbm.TransactionType.Project, "PRO", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_Project, "Project")),
new TypeCodeDesc((int)Sbm.TransactionType.SalesLead, "SLD", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_SalesLead, "Sales Lead")),
new TypeCodeDesc((int)Sbm.TransactionType.SalesQuote, "SQT", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_SalesQuote, "Sales Quote")),
new TypeCodeDesc((int)Sbm.TransactionType.SalesPO, "SPO", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_SalesPO, "Sales Purchase Order")),
new TypeCodeDesc((int)Sbm.TransactionType.ProformaSalesOrder, "SAP", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_ProformaSalesOrder, "Proforma Sales Order")),
new TypeCodeDesc((int)Sbm.TransactionType.SalesOrder, "SAL", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_SalesOrder, "Sales Order")),
new TypeCodeDesc((int)Sbm.TransactionType.SalesDispatch, "SDP", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_SalesDispatch, "Sales Dispatch")),
new TypeCodeDesc((int)Sbm.TransactionType.ProformaSalesInvoice, "PSI", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_ProformaSalesInvoice, "Proforma Sales Invoice")),
new TypeCodeDesc((int)Sbm.TransactionType.SalesInvoice, "SAI", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_SalesInvoice, "Sales Invoice")),
new TypeCodeDesc((int)Sbm.TransactionType.PurchaseQuote, "PQT", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_PurchaseQuote, "Purchase Quote")),
new TypeCodeDesc((int)Sbm.TransactionType.PurchaseSO, "PSO", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_PurchaseSO, "Purchase Sales Order")),
new TypeCodeDesc((int)Sbm.TransactionType.ProformaPurchaseOrder, "PUP", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_ProformaPurchaseOrder, "Proforma Purchase Order")),
new TypeCodeDesc((int)Sbm.TransactionType.PurchaseOrder, "PUR", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_PurchaseOrder, "Purchase Order")),
new TypeCodeDesc((int)Sbm.TransactionType.PurchaseDelivery, "PDL", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_PurchaseDelivery, "Purchase Delivery")),
new TypeCodeDesc((int)Sbm.TransactionType.ProformaPurchaseInvoice, "PPI", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice, "Proforma Purchase Invoice")),
new TypeCodeDesc((int)Sbm.TransactionType.PurchaseInvoice, "PUI", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_PurchaseInvoice, "Purchase Invoice")),
};
case Sbm.SystemCode.TransactionStatusCat:
return new List<TypeCodeDesc>(transactionStatusCats);
case Sbm.SystemCode.RequirementType:
return new List<TypeCodeDesc>(requirementTypes);
case Sbm.SystemCode.TaskCodeType:
return new List<TypeCodeDesc>(taskCodeTypes);
case Sbm.SystemCode.RequirementStatusCat:
return new List<TypeCodeDesc>(requirementStatusCats);
case Sbm.SystemCode.ConstituentType:
return new List<TypeCodeDesc>(constituentTypes);
case Sbm.SystemCode.ConstituentStatusCat:
return new List<TypeCodeDesc>(constituentStatusCats);
case Sbm.SystemCode.ItemLinkData:
return new List<TypeCodeDesc>(itemLinkDatas);
case Sbm.SystemCode.PortfolioItemType:
return new List<TypeCodeDesc>(portfolioItemTypes);
case Sbm.SystemCode.LocationCategory:
return new List<TypeCodeDesc>(locationCategories);
case Sbm.SystemCode.LocationFilter:
return new List<TypeCodeDesc>(locationFilters);
case Sbm.SystemCode.ContainerCategory:
return new List<TypeCodeDesc>(containerCategories);
case Sbm.SystemCode.ContainerType:
return new List<TypeCodeDesc>(containerTypes);
case Sbm.SystemCode.CommodityType:
{
// CommodityType.
List<TypeCodeDesc> CommodityType = new List<TypeCodeDesc>();
CommodityType.Add(Sbm.CommodityType.Stock, "STK", "Stock");
CommodityType.Add(Sbm.CommodityType.NonStock, "NST", "Non-stock");
CommodityType.Add(Sbm.CommodityType.Service, "SRV", "Service");
if (assetCommodityTypeAllowed < 0)
{
// ToDo SbmSystem assetCommodityTypeAllowed
using (SbmAssetMgr assetMgr = SbmGlobals.System.CreateAssetMgr(userContext))
{
//assetCommodityTypeAllowed = assetMgr != null && assetMgr.DatabaseIsValid();
}
}
if (assetCommodityTypeAllowed > 0)
CommodityType.Add(Sbm.CommodityType.Asset, "AST", "Asset");
return CommodityType;
}
case Sbm.SystemCode.CommodityStatusCat:
return new List<TypeCodeDesc>(commodityStatusCats);
case Sbm.SystemCode.MovementType:
return new List<TypeCodeDesc>(movementTypes);
case Sbm.SystemCode.StockLevelType:
return new List<TypeCodeDesc>(stockLevelTypes);
case Sbm.SystemCode.StockLevelSource:
return new List<TypeCodeDesc>(stockLevelSources);
case Sbm.SystemCode.AddressType:
return new List<TypeCodeDesc>(addressTypes);
case Sbm.SystemCode.SysParamCategory:
return new List<TypeCodeDesc>(sysParamCategories);
case Sbm.SystemCode.ProcessCategory:
{
List<TypeCodeDesc> ProcessCategory = new List<TypeCodeDesc>();
if (sessionConsole != null)
{
if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowCommodities))
ProcessCategory.Add(Sbm.ProcessCategory.Commodity, "CMD", "Commodity");
if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowAssets))
ProcessCategory.Add(Sbm.ProcessCategory.Asset, "ASSET", "Asset");
}
return ProcessCategory;
}
case Sbm.SystemCode.ProcessType:
return new List<TypeCodeDesc>(processTypes);
case Sbm.SystemCode.PaymentType:
return new List<TypeCodeDesc>(paymentTypes);
case Sbm.SystemCode.AssetIncomeType:
return new List<TypeCodeDesc>(assetIncomeTypes);
case Sbm.SystemCode.AssetType:
return new List<TypeCodeDesc>(assetTypes);
case Sbm.SystemCode.VehicleType:
return new List<TypeCodeDesc>(vehicleTypes);
case Sbm.SystemCode.VehicleEventType:
return new List<TypeCodeDesc>(vehicleEventTypes);
case Sbm.SystemCode.VehicleFeatureSource:
return new List<TypeCodeDesc>(vVehicleFeatureSources);
case Sbm.SystemCode.VehicleFeatureType:
return new List<TypeCodeDesc>(vehicleFeatureTypes);
case Sbm.SystemCode.VehicleOptionType:
return new List<TypeCodeDesc>(vehicleOptionTypes);
case Sbm.SystemCode.VehicleTransType:
return new List<TypeCodeDesc>(vehicleTransTypes);
case Sbm.SystemCode.FuelType:
return new List<TypeCodeDesc>(fuelTypes);
case Sbm.SystemCode.OdometerUnits:
return new List<TypeCodeDesc>(odometerUnits);
case Sbm.SystemCode.DiscountType:
return new List<TypeCodeDesc>(discountTypes);
case Sbm.SystemCode.DiscountMarkup:
return new List<TypeCodeDesc>(discountMarkups);
case Sbm.SystemCode.RegionType:
return new List<TypeCodeDesc>(regionTypes);
case Sbm.SystemCode.UnitMeasureCategory:
return new List<TypeCodeDesc>(unitMeasureCategories);
case Sbm.SystemCode.UnitMeasureType:
return new List<TypeCodeDesc>(unitMeasureTypes);
case Sbm.SystemCode.FinancialType:
{
List<TypeCodeDesc> FinancialType = new List<TypeCodeDesc>();
if (sessionConsole != null)
{
if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowCommodities))
FinancialType.Add(Sbm.FinancialType.CommoditySupply, "CmdSup", "Commodity supply");
}
FinancialType.Add(Sbm.FinancialType.CommoditySales, "CmdSal", "Commodity sales");
return FinancialType;
}
case Sbm.SystemCode.PriceType:
return new List<TypeCodeDesc>(priceTypes);
case Sbm.SystemCode.PriceCalcMethod:
return new List<TypeCodeDesc>(priceCalcMethods);
case Sbm.SystemCode.PriceRounderMethod:
return new List<TypeCodeDesc>(priceRounderMethods);
case Sbm.SystemCode.PriceRounderDirection:
return new List<TypeCodeDesc>(priceRounderDirections);
case Sbm.SystemCode.SystemAccountType:
return new List<TypeCodeDesc>(systemAccountTypes);
case Sbm.SystemCode.ItemStatus:
return new List<TypeCodeDesc>(itemStatuses);
case Sbm.SystemCode.EventStatus:
return new List<TypeCodeDesc>(eventStatuses);
case Sbm.SystemCode.AssociationTab:
return new List<TypeCodeDesc>(associationTabs);
case Sbm.SystemCode.InterfaceType_Website:
{
// Interface types - Website.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_Website);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.WebStore)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.WebStore);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.JoomlaVirtueMart)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.JoomlaVirtueMart);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.MiMoWeb)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.MiMoWeb);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_Accounts:
{
// Interface Type - Accounts.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_Accounts);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_System:
{
// Interface Type - System.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_System);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.MSOutlook))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.MSOutlook);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.PostcodeAnywhere))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.PostcodeAnywhere);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Bac))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Bac);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Pvh))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Pvh);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cap))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cap);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Hpi))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Hpi);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Anchor_OrderFulfilment))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Anchor_OrderFulfilment);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Argos))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Argos);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Homebase))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Homebase);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_File:
{
// Interface Type - File.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_File);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_File.LeasewayInvoice))
codes.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_File.LeasewayInvoice);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceDataType:
return new List<TypeCodeDesc>(interfaceDataTypes);
case Sbm.SystemCode.ItemDataType:
return new List<TypeCodeDesc>(itemDataTypes);
case Sbm.SystemCode.OrgOption_Value:
return new List<TypeCodeDesc>(orgOption_Values);
case Sbm.SystemCode.OrgOption_Folder:
return new List<TypeCodeDesc>(orgOption_Folders);
case Sbm.SystemCode.OrgOption_Minutes:
return new List<TypeCodeDesc>(OrgOption_Minutes);
case Sbm.SystemCode.OrgOption_PeriodDays:
{
List<TypeCodeDesc> OrgOption_PeriodDays = new List<TypeCodeDesc>();
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.TransactionDatesInFuture, "TransDatesInFut", "Days in future that transaction dates can be set", "");
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateClosedTransaction, "UpdClosedTrans", "Grace period (days) for updating closed transactions", "Period after transaction closure during which updates are allowed (0-30 days)");
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.AllowDeliveryPlanning))
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateClosedTransaction_DispatchDetails, "UpdDisDetCloTrans", "Grace period (days) for updating dispatch details on closed order", "Period after transaction closure during which dispatch updates are allowed (0-30 days)");
if (sessionConsole != null && sessionConsole.GetStockControlConfig().AllowStockControl())
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateStockLevelsInPast, "UpdStkLvlInPast", "Update stock levels in past");
return OrgOption_PeriodDays;
}
case Sbm.SystemCode.OrgOption_PeriodWeeks:
{
List<TypeCodeDesc> OrgOption_PeriodWeeks = new List<TypeCodeDesc>();
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.TimeRecording))
{
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.Timesheets, "Timesheets", "Weeks of timesheets to list (default 8)");
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.UpdateTimeRecords_Control, "UpdTimeRecsCtrl", "Weeks in past for admin user to update time records (default 2)");
}
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.ImminentStockDue, "ImminStkDue", "Weeks of due stock to treat as imminent", "Weeks for which stock due is treated as imminent (0-12 weeks, default: 0)");
return OrgOption_PeriodWeeks;
}
case Sbm.SystemCode.OrgOption_AllowOption:
return new List<TypeCodeDesc>(orgOption_AllowOptions);
case Sbm.SystemCode.OrgOption_Caption:
{
List<TypeCodeDesc> OrgOption_Caption = new List<TypeCodeDesc>();
if (sessionConsole != null)
{
// Transaction type captions.
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.Project))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_Project, "Project", "Transaction type - Project");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesLead))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesLead, "SalLead", "Transaction type - Sales Lead");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesQuote, "SalQuote", "Transaction type - Sales quote");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesPO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesPO, "SalPO", "Transaction type - Sales PO");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesOrder, "SalPfOrder", "Transaction type - sales proforma order");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesOrder, "SalOrder", "Transaction type - sales order");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesDispatch))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesDispatch, "SalDispatch", "Transaction type - Sales dispatch");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesInvoice, "SalPfInvoice", "Transaction type - Proforma sales invoice");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesInvoice, "SalInvoice", "Transaction type - Sales invoice");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseQuote, "PurQuote", "Transaction type - Purchase quote");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseSO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseSO, "PurSO", "Transaction type - Purchase SO");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseOrder, "PurPfOrder", "Transaction type - Purchase proforma order");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseOrder, "PurOrder", "Transaction type - Purchase order");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseDelivery, "PurDelivery", "Transaction type - Purchase Delivery");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice, "PurPfInvoice", "Transaction type - Proforma Purchase invoice");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseInvoice, "PurInvoice", "Transaction type - Purchase invoice");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.Project))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_Projects, "MnuOptProject", "Caption - Projects menu option");
// Menu option captions:
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesLead))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesLeads, "MnuOptSalLead", "Caption - Sales leads menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesPO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesPOs, "MnuOptSalPO", "Caption - Sales POs menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesQuotes, "MnuOptSalQuote", "Caption - Sales quotes menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesOrders, "MnuOptSalPfOrder", "Caption - Proforma sales orders menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesOrders, "MnuOptSalOrder", "Caption - Sales orders menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesDispatch))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesDispatches, "MnuOptSalDispatch", "Caption - Sales dispatches menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesInvoices, "MnuOptSalPfInvoice", "Caption - Proforma sales invoices menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesInvoices, "MnuOptSalInvoice", "Caption - Sales invoices menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseQuotes, "MnuOptPurQuote", "Caption - Purchase quotes menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseSO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseSOs, "MnuOptPurSO", "Caption - Purchase SOs menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseOrders, "MnuOptPurPfOrder", "Caption - Proforma purchase orders menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseOrders, "MnuOptPurOrder", "Caption - Purchase orders menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseDeliveries, "MnuOptPurDelivery", "Caption - Purchase Deliveries menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseInvoices, "MnuOptPurPfInvoice", "Caption - Proforma purchase invoices menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseInvoices, "MnuOptPurInvoice", "Caption - Purchase invoices menu option");
}
return OrgOption_Caption;
}
case Sbm.SystemCode.OrgOption_ShowColumn:
{
List<TypeCodeDesc> OrgOption_ShowColumn = new List<TypeCodeDesc>();
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_AnnualSalesTarget, "Association:AnnualSalesTarget", "Association: Annual sales target");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_LastSaleRaised, "Association:Trans:LastSaleRaised", "Association: Last SO raised");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Open, "Association:Trans:SalesValue:Open", "Association: SO value: Open");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Cytd, "Association:Trans:SalesValue:Cytd", "Association: SO value: YTD");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Lcy, "Association:Trans:SalesValue:Lcy", "Association: SO value: LCY");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Group, "Association:Group", "Association: Group");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_CatalogRef, "Commodity:CatalogRef", "Commodity: Catalog reference");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_Weight, "Commodity:Weight", "Commodity: Weight");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_PackQtySale, "Commodity:PackQtySale", "Commodity: Pack qty - sale");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockAllocated, "Commodity:StockAllocated", "Commodity: Allocated stock");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockLevelSales, "Commodity:StockLevelSales", "Commodity: Stock level (Sales)");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockAvailable, "Commodity:StockAvailable", "Commodity: Available stock");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Order_AllocationInd, "Order:AllocationInd", "Order: Allocation indicator");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrder_DeliveryCourier, "SalesOrder:DeliveryCourier", "Order: Delivery courier");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrder_HasInvoice, "SalesOrder:HasInvoice", "Order: Has invoice flag");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Transaction_ContactArea, "Transaction:ContactArea", "Transaction: " + sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactAreaCode, "Contact area"));
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Accounts_InvoiceRef, "Accounts:InvoiceRef", "Accounts: Invoice reference");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_AllocationInd, "OrderItem:AllocationInd", "Order item: Allocation indicator");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_Current, "OrderItem:StockCurrent", "Order item: Stock current");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_Available, "OrderItem:StockAvailable", "Order item: Stock available");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_BySalesLocation, "OrderItem:StockBySalesLocation", "Order item: Stock by sales location");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_QtyDispatched, "SalesOrderItem:QuantityDispatched", "Sales order item: qty dispatched");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_QtyInvoiced, "SalesOrderItem:QuantityInvoiced", "Sales order item: qty invoiced");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_NextProcess, "SalesOrderItem:NextProcess", "Sales order item: Next process");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Vehicle_KeyLocation, "Vehicle:KeyLocation", "Vehicle: Key location");
return OrgOption_ShowColumn;
}
case Sbm.SystemCode.OrgOption_ShowField:
return new List<TypeCodeDesc>(orgOption_ShowFields);
case Sbm.SystemCode.OrgOption_FieldLabel:
return new List<TypeCodeDesc>(orgOption_FieldLabels);
case Sbm.SystemCode.OrgOption_TransactionCreationStatus:
return new List<TypeCodeDesc>(orgOption_TransactionCreationStatuses);
case Sbm.SystemCode.OrgOption_ContainerStatusCaption:
return new List<TypeCodeDesc>(orgOption_ContainerStatusCaptions);
case Sbm.SystemCode.OrgOption_NumericDecimals:
return new List<TypeCodeDesc>(orgOption_NumericDecimals);
case Sbm.SystemCode.OrgOption_CommodityType:
return new List<TypeCodeDesc>(orgOption_CommodityTypes);
case Sbm.SystemCode.OrgOption_StockLocation:
return new List<TypeCodeDesc>(orgOption_StockLocations);
case Sbm.SystemCode.OrgOption_TaxCodeColumn:
return new List<TypeCodeDesc>(orgOption_TaxCodeColumns);
case Sbm.SystemCode.OrgOption_SystemUserRight:
return new List<TypeCodeDesc>(orgOption_SystemUserRights);
case Sbm.SystemCode.SystemUserOption:
return new List<TypeCodeDesc>(systemUserOptions);
case Sbm.SystemCode.AssociationOption:
return new List<TypeCodeDesc>(associationOptions);
case Sbm.SystemCode.InterfaceOption:
return new List<TypeCodeDesc>(interfaceOptions);
case Sbm.SystemCode.InterfaceOption_WebFlag:
return new List<TypeCodeDesc>(interfaceOption_WebFlags);
case Sbm.SystemCode.InterfaceOption_WebUploadData:
return new List<TypeCodeDesc>(interfaceOption_WebUploadDatas);
case Sbm.SystemCode.InterfaceOption_WebUploadMethod:
return new List<TypeCodeDesc>(interfaceOption_WebUploadMethods);
case Sbm.SystemCode.InterfaceOption_WebDownloadData:
return new List<TypeCodeDesc>(interfaceOption_WebDownloadDatas);
case Sbm.SystemCode.InterfaceOption_WebDownloadMethod:
return new List<TypeCodeDesc>(interfaceOption_WebDownloadMethods);
case Sbm.SystemCode.FileInterface_RowColValue:
return new List<TypeCodeDesc>(fileInterface_RowColValues);
case Sbm.SystemCode.FileInterface_Mode:
return new List<TypeCodeDesc>(fileInterface_Modes);
}
}
return null;
List<TypeCodeDesc> codes = systemCodes.GetValueOrDefault(systemCode);
if (codes == null)
SaLogger.Warn($"{SysUtil.Fn} Unrecognised system code type: {systemCode}.");
return codes;
}
//-------------------------------------------------------------------
// D a t a M a n a g e r s
//-------------------------------------------------------------------
public abstract SbmAccountMgr CreateAccountMgr(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);
public abstract SbmAccountMgr CreateAccountMgr(SbmInternals internals);
public abstract SbmAccountMgr CreateAccountMgr(ISbmUserOrganisationContext userContext);
public abstract SbmAssetMgr CreateAssetMgr(SbmInternals internals);
public abstract SbmAssetMgr CreateAssetMgr(ISbmUserOrganisationContext userContext);
public abstract SbmCommodityMgr CreateCommodityMgr(SbmInternals internals);
public abstract SbmCommodityMgr CreateCommodityMgr(ISbmUserOrganisationContext userContext);
public abstract SbmPriceMgr CreatePriceMgr(SbmInternals internals);
public abstract SbmPriceMgr CreatePriceMgr(ISbmUserOrganisationContext userContext);
public abstract SbmDataItemMgr CreateDataItemMgr(SbmInternals internals);
public abstract SbmDataItemMgr CreateDataItemMgr(ISbmUserOrganisationContext userContext);
public abstract SbmProcessMgr CreateProcessMgr(SbmInternals internals);
public abstract SbmProcessMgr CreateProcessMgr(ISbmUserOrganisationContext userContext);
public abstract SbmStockMgr CreateStockMgr(SbmInternals internals);
public abstract SbmStockMgr CreateStockMgr(ISbmUserOrganisationContext userContext);
public abstract SbmTransactionMgr CreateTransactionMgr(SbmInternals internals);
public abstract SbmTransactionMgr CreateTransactionMgr(ISbmUserOrganisationContext userContext);
// Control.
public abstract SbmcAccountMgr CreateControlAccountMgr();
public abstract SbmcInstanceMgr CreateControlInstanceMgr();
+9 -184
View File
@@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
//=======================================================================
public class SbmUserContext : ISbmUserContext_Core
public class SbmUserContext : ISbmUserOrganisationContext
{
//-------------------------------------------------------------------
// Definitions.
@@ -69,8 +69,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public class OrganisationData
{
internal OrganisationData() { }
// Organisation options.
internal readonly SaItemOption.Cache configOptionsCache = new SaItemOption.Cache();
/// <summary>Organisation Affiliate Id.</summary>
public SysId AffiliateId { get; protected set; } = new SysId();
/// <summary>Organisation Affiliate Type.</summary>
@@ -81,8 +79,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public String InterfaceContext { get; protected set; } = "";
/// <summary>Organisation 'Internal' Association Id.</summary>
public SysId AssociationId { get; protected set; } = new SysId();
/// <summary>Organisation configuration options</summary>
public List<SaItemOption> ConfigOptions { get { return new List<SaItemOption>(configOptionsCache.ItemOptions); } }
}
private class OrganisationData_Internal : OrganisationData
{
@@ -93,7 +89,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
AffiliateType = Sbm.AffiliateType.Unknown;
DisplayName = "";
InterfaceContext = "";
configOptionsCache.Clear();
}
internal void Refresh(SbmAffiliate affiliateOrganisation, SbmAssociation associationInternal, String interfaceContext)
{
@@ -109,21 +104,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Data members.
private readonly UserData_Internal userData = new UserData_Internal();
private readonly OrganisationData_Internal organisationData;
private List<TypeCodeDesc> assocOptions;
private List<TypeCodeDesc> contextValues;
private List<TypeCodeDesc> contextFolders;
private List<TypeCodeDesc> contextAllowOptions;
private List<TypeCodeDesc> contextCaptions;
private List<TypeCodeDesc> contextShowColumns;
private List<TypeCodeDesc> contextShowFields;
private List<TypeCodeDesc> contextFieldLabels;
private List<TypeCodeDesc> contextMinutes;
private List<TypeCodeDesc> contextPeriodDays;
private List<TypeCodeDesc> contextPeriodWeeks;
private List<TypeCodeDesc> contextNumericDecimals;
private List<TypeCodeDesc> contextCommodityTypes;
private List<TypeCodeDesc> commodityTypes;
private List<TypeCodeDesc> contextSalesLocations;
//-------------------------------------------------------------------
// Construction.
@@ -170,138 +150,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
private SbmSecurityProfile securityProfile { get; set; }
public ISbmSecurityProfile_Core SecurityProfile_Core { get { return securityProfile; } }
//-------------------------------------------------------------------
// Organisation configuration.
public SaItemOption.Cache OrganisationConfigOptionsCache { get { return organisationData.configOptionsCache; } }
public String GetOrganisationOption(Sbm.OrganisationOption option, String context)
{
if (assocOptions == null) assocOptions = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.AssociationOption);
String optionName = assocOptions.GetCodeForType(option);
return GetOrganisationOption(optionName, context);
}
public String GetOrganisationOption(String optionName, String context)
{
// Retrieve the requested value from the cache.
return organisationData.configOptionsCache.ItemOptions.GetOptionValue(optionName, context);
}
public String GetOwnerOption_Value(Sbm.OrgOption_Value eCol)
{
if (contextValues == null) contextValues = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_Value);
String context = contextValues.GetCodeForType(eCol);
return GetOrganisationOption(Sbm.OrganisationOption.Value, context).Trim();
}
public String GetOwnerOption_Folder(Sbm.OrgOption_Folder eCol)
{
if (contextFolders == null) contextFolders = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_Folder);
String context = contextFolders.GetCodeForType(eCol);
return GetOrganisationOption(Sbm.OrganisationOption.Folder, context).Trim();
}
public bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption eCol)
{
if (contextAllowOptions == null) contextAllowOptions = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_AllowOption);
String context = contextAllowOptions.GetCodeForType(eCol);
String value = GetOrganisationOption(Sbm.OrganisationOption.AllowOption, context).Trim();
return StringUtil.ToBool(value);
}
public String GetOwnerOption_Caption(Sbm.OrgOption_Caption eCol, String defaultValue)
{
if (contextCaptions == null) contextCaptions = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_Caption);
String context = contextCaptions.GetCodeForType(eCol);
String value = GetOrganisationOption(Sbm.OrganisationOption.Caption, context).Trim();
return (!value.IsEmpty() ? value : defaultValue);
}
public bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx eCol)
{
if (contextShowFields == null) contextShowFields = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_ShowField);
String context = contextShowFields.GetCodeForType(eCol);
if (context.IsEmpty()) return true; // Automatically show fields that are not in the 'Show Field' list.
String value = GetOrganisationOption(Sbm.OrganisationOption.ShowField, context).Trim();
return StringUtil.ToBool(value);
}
public bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn eCol)
{
if (contextShowColumns == null) contextShowColumns = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_ShowColumn);
String context = contextShowColumns.GetCodeForType(eCol);
String value = GetOrganisationOption(Sbm.OrganisationOption.ShowColumn, context).Trim();
return StringUtil.ToBool(value);
}
public String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String defautValue)
{
if (contextFieldLabels == null) contextFieldLabels = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_FieldLabel);
String context = contextFieldLabels.GetCodeForType(eCol);
String value = GetOrganisationOption(Sbm.OrganisationOption.FieldLabel, context).Trim();
return (!value.IsEmpty() ? value : defautValue); // Return default if no label defined.
}
public int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int defautValue)
{
if (contextMinutes == null) contextMinutes = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_Minutes);
String context = contextMinutes.GetCodeForType(eLimit);
String value = GetOrganisationOption(Sbm.OrganisationOption.Minutes, context).Trim();
if (!value.IsEmpty())
{
int iUpdateLimit = value.ToShort();
if (iUpdateLimit > 0)
return iUpdateLimit;
}
return defautValue;
}
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int defautValue)
{
if (contextPeriodDays == null) contextPeriodDays = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_PeriodDays);
String context = contextPeriodDays.GetCodeForType(eLimit);
String value = GetOrganisationOption(Sbm.OrganisationOption.PeriodDays, context).Trim();
if (!value.IsEmpty())
{
int iUpdateLimit = value.ToShort();
if (iUpdateLimit > 0)
return iUpdateLimit;
}
return defautValue;
}
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int defautValue)
{
if (contextPeriodWeeks == null) contextPeriodWeeks = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_PeriodWeeks);
String context = contextPeriodWeeks.GetCodeForType(eLimit);
String value = GetOrganisationOption(Sbm.OrganisationOption.PeriodWeeks, context).Trim();
if (!value.IsEmpty())
{
int iUpdateLimit = value.ToShort();
if (iUpdateLimit > 0)
return iUpdateLimit;
}
return defautValue;
}
public int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int defautValue = 2)
{
if (contextNumericDecimals == null) contextNumericDecimals = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_NumericDecimals);
String context = contextNumericDecimals.GetCodeForType(eNumDecimals);
String value = GetOrganisationOption(Sbm.OrganisationOption.NumericDecimals, context).Trim();
int iNumDecimals = defautValue;
if (!value.IsEmpty())
iNumDecimals = value.ToShort();
iNumDecimals = Math.Min(4, Math.Max(0, iNumDecimals));
return iNumDecimals;
}
public Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityTypeContext)
{
if (contextCommodityTypes == null) contextCommodityTypes = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_CommodityType);
if (commodityTypes == null) commodityTypes = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.CommodityType);
String context = contextCommodityTypes.GetCodeForType(commodityTypeContext);
String value = GetOrganisationOption(Sbm.OrganisationOption.CommodityType, context).Trim();
Sbm.CommodityType eCmdType = (Sbm.CommodityType)commodityTypes.GetTypeForCode(value);
return eCmdType;
}
public SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation eLoc)
{
if (contextSalesLocations == null) contextSalesLocations = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_StockLocation);
String context = contextSalesLocations.GetCodeForType(eLoc);
String value = GetOrganisationOption(Sbm.OrganisationOption.SalesLocation, context).Trim();
SysId idLoc = new SysId();
if (!StringUtil.IsEmpty(value))
idLoc = new SysId(StringUtil.ToInt(value));
return idLoc;
}
//-------------------------------------------------------------------
// Modify properties - internal only.
protected void SetUserData(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
@@ -319,44 +167,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Interface context for selected organisation.
String interfaceContext = SbmAccountMgr.GetInterfaceContext(affiliateIdOrganisation);
SbmAffiliate affiliateOrganisation = null;
SbmAssociation associationInternal = null;
if (SysId.IsValid(affiliateIdOrganisation))
{
using (SbmAccountMgr accountMgr = SbmGlobals.System.CreateAccountMgr(this))
{
// Affiliate.
affiliateOrganisation = accountMgr.GetAffiliateById(affiliateIdOrganisation);
// 'Internal' association.
associationInternal = accountMgr.GetAssociationByOwnerTypeTarget(affiliateIdOrganisation, Sbm.AssociationType.Internal, affiliateIdOrganisation);
}
}
// Affiliate.
using (SbmAffiliate affiliateOrganisation = accountMgr.GetAffiliateById(affiliateIdOrganisation))
// 'Internal' association.
using (SbmAssociation associationInternal = accountMgr.GetAssociationByOwnerTypeTarget(affiliateIdOrganisation, Sbm.AssociationType.Internal, affiliateIdOrganisation))
if (affiliateOrganisation != null && associationInternal != null)
{
// Refresh the organisation properties.
organisationData.Refresh(affiliateOrganisation, associationInternal, interfaceContext);
// Refresh organisation options if required.
ItemId affiliateItemId_Owner = new ItemId((short)Sbm.ItemType.Affiliate, organisationData.AffiliateId);
ItemId associationItemId_Owner = new ItemId((short)Sbm.ItemType.Association, organisationData.AssociationId);
if (!organisationData.configOptionsCache.ItemIdRef.Id.Equals(affiliateItemId_Owner))
{
using (SaItemOptionConsole itemOptionConsole = SbmGlobals.Application.CreateItemOptionConsole(this))
if (affiliateOrganisation != null && associationInternal != null)
{
organisationData.configOptionsCache.Clear();
if (itemOptionConsole != null)
{
// Retrieve the options for this association.
organisationData.configOptionsCache.Reset(associationItemId_Owner, affiliateItemId_Owner);
organisationData.configOptionsCache.ItemOptions.AddRange(itemOptionConsole.GetItemOptionsForItem(associationItemId_Owner));
SaLogger.Debug($"{SysUtil.Fn} Populated organisation options: {organisationData.configOptionsCache.ItemOptions.Count}.");
}
// Refresh the organisation properties.
organisationData.Refresh(affiliateOrganisation, associationInternal, interfaceContext);
}
}
else ClearOrganisationData();
}
else ClearOrganisationData();
if (affiliateOrganisation != null) affiliateOrganisation.Dispose(); affiliateOrganisation = null;
if (associationInternal != null) associationInternal.Dispose(); associationInternal = null;
}
protected void ClearOrganisationData()
{