This commit is contained in:
Andy Howard
2024-11-19 09:47:00 +00:00
parent c5ee285e27
commit 8b872cc8f3
214 changed files with 7924 additions and 5519 deletions
@@ -320,7 +320,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
public SbmCommodity.Params GetParams() public SbmCommodity.Params GetParams()
{ {
SbmCommodity.Params prmCommodity = config.CommodityParams ?? new SbmCommodity.Params(); SbmCommodity.Params prmCommodity = config.CommodityParams ?? new SbmCommodity.Params();
prmCommodity.IncludedIds.AddRange(config.ItemIds); prmCommodity.IdsIncluded.AddRange(config.ItemIds);
return prmCommodity; return prmCommodity;
} }
private DbResultSet ExecuteQuery() private DbResultSet ExecuteQuery()
@@ -715,7 +715,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
AddColumnValue(SbmCommodity.Column.Length, "Cmd_Length", "Length"); AddColumnValue(SbmCommodity.Column.Length, "Cmd_Length", "Length");
//AddColumnValue(SbmCommodity.Column.LengthUomId, "Cmd_LengthUomId", "Length","UOM Id"); //AddColumnValue(SbmCommodity.Column.LengthUomId, "Cmd_LengthUomId", "Length","UOM Id");
AddColumnValue(SbmCommodity.Column.Length_ValueUnits, "Cmd_Length_ValueUnits", "Length", "", "", "value & units"); AddColumnValue(SbmCommodity.Column.Length_ValueUnits, "Cmd_Length_ValueUnits", "Length", "", "", "value & units");
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.Commodity_Volume)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_Volume))
{ {
AddColumnValue(SbmCommodity.Column.Volume, "Cmd_Volume", "Volume"); AddColumnValue(SbmCommodity.Column.Volume, "Cmd_Volume", "Volume");
//AddColumnValue(SbmCommodity.Column.VolumeUomId, "Cmd_VolumeUomId", "Volume","UOM Id"); //AddColumnValue(SbmCommodity.Column.VolumeUomId, "Cmd_VolumeUomId", "Volume","UOM Id");
@@ -724,7 +724,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
AddColumnValue(SbmCommodity.Column.Density, "Cmd_Density", "Density"); AddColumnValue(SbmCommodity.Column.Density, "Cmd_Density", "Density");
//AddColumnValue(SbmCommodity.Column.DensityUomId, "Cmd_DensityUomId", "Density","UOM Id"); //AddColumnValue(SbmCommodity.Column.DensityUomId, "Cmd_DensityUomId", "Density","UOM Id");
AddColumnValue(SbmCommodity.Column.Density_ValueUnits, "Cmd_Density_ValueUnits", "Density", "", "", "value & units"); AddColumnValue(SbmCommodity.Column.Density_ValueUnits, "Cmd_Density_ValueUnits", "Density", "", "", "value & units");
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.Commodity_BoxQuantity)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_BoxQuantity))
{ {
AddColumnValue(SbmCommodity.Column.BoxQuantity, "Cmd_BoxQuantity", "Box qty"); AddColumnValue(SbmCommodity.Column.BoxQuantity, "Cmd_BoxQuantity", "Box qty");
//AddColumnValue(SbmCommodity.Column.BoxUomId, "Cmd_BoxUomId", "Box","UOM Id"); //AddColumnValue(SbmCommodity.Column.BoxUomId, "Cmd_BoxUomId", "Box","UOM Id");
@@ -732,7 +732,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
} }
AddColumnValue(SbmCommodity.Column.Dimensions, "Cmd_Dimensions", "Dimensions"); AddColumnValue(SbmCommodity.Column.Dimensions, "Cmd_Dimensions", "Dimensions");
AddColumnValue(SbmCommodity.Column.SpecSummary, "Cmd_SpecSummary", "Specification"); AddColumnValue(SbmCommodity.Column.SpecSummary, "Cmd_SpecSummary", "Specification");
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.Commodity_ICNTariffCode)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_ICNTariffCode))
AddColumnValue(SbmCommodity.Column.ICNTariffCode, "Cmd_ICNTariffCode", "Tariff code"); AddColumnValue(SbmCommodity.Column.ICNTariffCode, "Cmd_ICNTariffCode", "Tariff code");
// Codings: // Codings:
if (CommodityMgr.CodeTypeHasCodes(Sbm.ApplCodeType.CommodityRange)) if (CommodityMgr.CodeTypeHasCodes(Sbm.ApplCodeType.CommodityRange))
@@ -800,7 +800,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
AddColumnValue(SbmCommodity.Column.ReorderQty, "Cmd_ReorderQty", "Reorder qty"); AddColumnValue(SbmCommodity.Column.ReorderQty, "Cmd_ReorderQty", "Reorder qty");
AddColumnValue(SbmCommodity.Column.QtyOnOrder, "Cmd_QtyOnOrder", "Qty on order"); AddColumnValue(SbmCommodity.Column.QtyOnOrder, "Cmd_QtyOnOrder", "Qty on order");
// Sales: // Sales:
if (ConfigConsole.AllowOption(UserContext, Sbm.ConfigOption.CommodityExclusiveToCustomer)) if (SessionConsole.AllowOption(Sbm.ConfigOption.CommodityExclusiveToCustomer))
AddColumnValue(SbmCommodity.Column.Customer_Name, "Cmd_CustomerName", "Customer name"); AddColumnValue(SbmCommodity.Column.Customer_Name, "Cmd_CustomerName", "Customer name");
AddColumnValue(SbmCommodity.Column.SalesPrice, "Cmd_SalesPrice", "Sales price"); AddColumnValue(SbmCommodity.Column.SalesPrice, "Cmd_SalesPrice", "Sales price");
AddColumnValue(SbmCommodity.Column.SalesPrice_Fmt, "Cmd_SalesPrice_Fmt", "Sales price (fmt)"); AddColumnValue(SbmCommodity.Column.SalesPrice_Fmt, "Cmd_SalesPrice_Fmt", "Sales price (fmt)");
@@ -824,7 +824,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
AddColumnValue(SbmCommodity.Column.LastOrderDate, "Cmd_LastOrderDate", "Last order date"); AddColumnValue(SbmCommodity.Column.LastOrderDate, "Cmd_LastOrderDate", "Last order date");
AddColumnValue(SbmCommodity.Column.LastOrderQty, "Cmd_LastOrderQty", "Last order qty"); AddColumnValue(SbmCommodity.Column.LastOrderQty, "Cmd_LastOrderQty", "Last order qty");
// Customer definition: // Customer definition:
if (ConfigConsole.AllowOption(UserContext, Sbm.ConfigOption.CommodityCustomers) && CommodityMgr.TableExists(SbmDbDfn.TableIdx.CommodityCustomer)) if (SessionConsole.AllowOption(Sbm.ConfigOption.CommodityCustomers) && CommodityMgr.TableExists(SbmDbDfn.TableIdx.CommodityCustomer))
{ {
String commodityCustomerComment = "Only relevant for customer commodity exports"; String commodityCustomerComment = "Only relevant for customer commodity exports";
AddColumnValue(SbmCommodity.Column.Cust_ProductCode, "CmdCust_ProductCode", "Customer product code", "", "", commodityCustomerComment); AddColumnValue(SbmCommodity.Column.Cust_ProductCode, "CmdCust_ProductCode", "Customer product code", "", "", commodityCustomerComment);
@@ -902,13 +902,13 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
AddColumnValue(SbmCommodity.Column.Stock_AvailVsReorder, "Cmd_Stock_AvailVsReorder", "Stock - avail vs reorder"); AddColumnValue(SbmCommodity.Column.Stock_AvailVsReorder, "Cmd_Stock_AvailVsReorder", "Stock - avail vs reorder");
AddColumnValue(SbmCommodity.Column.Stock_ImminentAvailVsReorder, "Cmd_Stock_ImminentAvailVsReorder", "Stock - imminent avail vs reorder"); AddColumnValue(SbmCommodity.Column.Stock_ImminentAvailVsReorder, "Cmd_Stock_ImminentAvailVsReorder", "Stock - imminent avail vs reorder");
// Stock bays by location. // Stock bays by location.
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.StockLevel_Bay1)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.StockLevel_Bay1))
AddColumnValue(SbmCommodity.Column.Stock_Bays, "Cmd_Stock_Bays", "Stock bays"); AddColumnValue(SbmCommodity.Column.Stock_Bays, "Cmd_Stock_Bays", "Stock bays");
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.StockLevel_Bay1)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.StockLevel_Bay1))
AddColumnValue(SbmCommodity.Column.Stock_Bay1, "Cmd_Stock_Bay1", "Bay 1", "Stock - ", "", "Selected location"); AddColumnValue(SbmCommodity.Column.Stock_Bay1, "Cmd_Stock_Bay1", "Bay 1", "Stock - ", "", "Selected location");
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.StockLevel_Bay2)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.StockLevel_Bay2))
AddColumnValue(SbmCommodity.Column.Stock_Bay2, "Cmd_Stock_Bay2", "Bay 2", "Stock - ", "", "Selected location"); AddColumnValue(SbmCommodity.Column.Stock_Bay2, "Cmd_Stock_Bay2", "Bay 2", "Stock - ", "", "Selected location");
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.StockLevel_Bay3)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.StockLevel_Bay3))
AddColumnValue(SbmCommodity.Column.Stock_Bay3, "Cmd_Stock_Bay3", "Bay 3", "Stock - ", "", "Selected location"); AddColumnValue(SbmCommodity.Column.Stock_Bay3, "Cmd_Stock_Bay3", "Bay 3", "Stock - ", "", "Selected location");
// Stock due: // Stock due:
AddColumnValue(SbmCommodity.Column.Stock_NextDue_Commodity_Date, "Cmd_Stock_NextDue_Commodity_Date", "Stock - next date due commodity"); AddColumnValue(SbmCommodity.Column.Stock_NextDue_Commodity_Date, "Cmd_Stock_NextDue_Commodity_Date", "Stock - next date due commodity");
@@ -1003,7 +1003,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
AddColumnValue(SbmCommodity.Column.Stock_EndOfMonth_12, "Cmd_Stock_EndOfMonth_12", "Stock - end of month 12"); AddColumnValue(SbmCommodity.Column.Stock_EndOfMonth_12, "Cmd_Stock_EndOfMonth_12", "Stock - end of month 12");
// Requirements. // Requirements.
AddColumnValue(SbmCommodity.Column.Reqnt_AmountUnit_Earliest_ById, "Cmd_Reqnt_AmountUnit_Earliest_ById", "Earliest item price (regardless of item status)"); AddColumnValue(SbmCommodity.Column.Reqnt_AmountUnit_Earliest_ById, "Cmd_Reqnt_AmountUnit_Earliest_ById", "Earliest item price (regardless of item status)");
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.Commodity_DrawingIssue)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_DrawingIssue))
AddColumnValue(SbmCommodity.Column.Reqnt_AmountUnit_Earliest_ByCode, "Cmd_Reqnt_AmountUnit_Earliest_ByCode", "Earliest item price (regardless of issue or item status"); AddColumnValue(SbmCommodity.Column.Reqnt_AmountUnit_Earliest_ByCode, "Cmd_Reqnt_AmountUnit_Earliest_ByCode", "Earliest item price (regardless of issue or item status");
// Processes: // Processes:
if (ProcessMgr.HasProcesses(Sbm.ProcessCategory.Commodity)) if (ProcessMgr.HasProcesses(Sbm.ProcessCategory.Commodity))
@@ -1031,25 +1031,25 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
bool allowColumn = true; bool allowColumn = true;
SbmDbDfn.ColumnIdx eDbCol = (SbmDbDfn.ColumnIdx)CommodityMgr.GetCommodityColumnDfn(eCol).DbColumn; SbmDbDfn.ColumnIdx eDbCol = (SbmDbDfn.ColumnIdx)CommodityMgr.GetCommodityColumnDfn(eCol).DbColumn;
// Some columns excluded by console. // Some columns excluded by console.
if (allowColumn) allowColumn = ((int)eDbCol < 1 || ConfigConsole.DisplayAttribute(UserContext, eDbCol)); if (allowColumn) allowColumn = ((int)eDbCol < 1 || SessionConsole.DisplayAttribute(eDbCol));
if (allowColumn) if (allowColumn)
{ {
// Some tables require console permission. // Some tables require console permission.
switch (SbmDbDfn.GetTableForColumn(eDbCol)) switch (SbmDbDfn.GetTableForColumn(eDbCol))
{ {
case SbmDbDfn.TableIdx.PortfolioItem: case SbmDbDfn.TableIdx.PortfolioItem:
allowColumn = ConfigConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowPortfolios); allowColumn = SessionConsole.AllowOption(Sbm.ConfigOption.AllowPortfolios);
if (allowColumn) if (allowColumn)
allowColumn = CommodityMgr.PortfolioDatabaseIsValid; allowColumn = CommodityMgr.PortfolioDatabaseIsValid;
break; break;
case SbmDbDfn.TableIdx.StockLevel: case SbmDbDfn.TableIdx.StockLevel:
allowColumn = ConfigConsole.GetStockControlConfig(UserContext).AllowStockControl(); allowColumn = SessionConsole.GetStockControlConfig().AllowStockControl();
if (allowColumn) if (allowColumn)
allowColumn = StockMgr.DatabaseIsValid(); allowColumn = StockMgr.DatabaseIsValid();
break; break;
case SbmDbDfn.TableIdx.Transaction: case SbmDbDfn.TableIdx.Transaction:
case SbmDbDfn.TableIdx.Requirement: case SbmDbDfn.TableIdx.Requirement:
allowColumn = ConfigConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowTransactions); allowColumn = SessionConsole.AllowOption(Sbm.ConfigOption.AllowTransactions);
break; break;
} }
@@ -1058,7 +1058,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
{ {
String sDescPrefix = pcDescPrefix; String sDescPrefix = pcDescPrefix;
String sDescSuffix = pcDescSuffix; String sDescSuffix = pcDescSuffix;
optionValues_Column.Add(eCol, sCode, (sDescPrefix + " " + ConfigConsole.GetAttributeCaption(UserContext, eDbCol, sDesc) + " " + sDescSuffix).Trim(), pcComment); optionValues_Column.Add(eCol, sCode, (sDescPrefix + " " + SessionConsole.GetAttributeCaption(eDbCol, sDesc) + " " + sDescSuffix).Trim(), pcComment);
bAddValue = true; bAddValue = true;
} }
return bAddValue; return bAddValue;
@@ -126,8 +126,8 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
public static Color ExcelColumnHeadingColor { get; } = Color.LightYellow; public static Color ExcelColumnHeadingColor { get; } = Color.LightYellow;
// Security. // Security.
protected ISbmSecurityProfile_Core SecurityProfile { get { return Internals.SecurityProfile; } } protected ISbmSecurityProfile_Core SecurityProfile { get { return Internals.SecurityProfile; } }
protected bool UserCanUpdateContacts { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateContacts); } } protected bool UserCanUpdateContacts { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateContacts()); } }
protected bool UserCanCreateContacts { get { return (SecurityProfile != null && SecurityProfile.UserCanCreateContacts); } } protected bool UserCanCreateContacts { get { return (SecurityProfile != null && SecurityProfile.UserCanCreateContacts()); } }
protected bool UserCanViewFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanViewFinancials()); } } protected bool UserCanViewFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanViewFinancials()); } }
protected bool UserCanUpdateFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateFinancials()); } } protected bool UserCanUpdateFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateFinancials()); } }
protected bool UserCanManageFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateFinancials()); } } protected bool UserCanManageFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateFinancials()); } }
@@ -146,7 +146,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } } protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } } protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
// Consoles. // Consoles.
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } } protected SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } } protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } } protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } } protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
@@ -182,9 +182,9 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
// Processing options - flags. // Processing options - flags.
if (optionContexts_Flag.Count == 0) if (optionContexts_Flag.Count == 0)
{ {
optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_MaterialCost, "IncludeCol_MaterialCost", "Include column - " + ConfigConsole.GetAttributeCaption(UserContext, SbmDbDfn.ColumnIdx.Commodity_MaterialCost, "Material cost")); optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_MaterialCost, "IncludeCol_MaterialCost", "Include column - " + SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCost, "Material cost"));
optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_CostPrice, "IncludeCol_CostPrice", "Include column - " + ConfigConsole.GetAttributeCaption(UserContext, SbmDbDfn.ColumnIdx.Commodity_CostPrice, "Cost price")); optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_CostPrice, "IncludeCol_CostPrice", "Include column - " + SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CostPrice, "Cost price"));
optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_RetailPrice, "IncludeCol_RetailPrice", "Include column - " + ConfigConsole.GetAttributeCaption(UserContext, SbmDbDfn.ColumnIdx.Commodity_RetailPrice, "Retail price")); optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_RetailPrice, "IncludeCol_RetailPrice", "Include column - " + SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_RetailPrice, "Retail price"));
optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_StockCurrent, "IncludeCol_StockCurrent", "Include column - Stock: current"); optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_StockCurrent, "IncludeCol_StockCurrent", "Include column - Stock: current");
optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_StockAvailable, "IncludeCol_StockAvailable", "Include column - Stock: available"); optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_StockAvailable, "IncludeCol_StockAvailable", "Include column - Stock: available");
optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_StockDue_MonthTo03, "IncludeCol_StockDue_MonthTo03", "Include column - Stock: due to 3 months"); optionContexts_Flag.Add(ProcessOptionFlag.IncludeCol_StockDue_MonthTo03, "IncludeCol_StockDue_MonthTo03", "Include column - Stock: due to 3 months");
@@ -415,18 +415,18 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Weight_ValueUnits)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Weight_ValueUnits));
if (UserContext.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Commodity_PackQtySale)) if (UserContext.GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn.Commodity_PackQtySale))
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.PackQtySale)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.PackQtySale));
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.Commodity_Volume)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_Volume))
{ {
// Aug16 Cadix Was just SbmCommodity.Column.Volume_ValueUnits // Aug16 Cadix Was just SbmCommodity.Column.Volume_ValueUnits
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Volume)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Volume));
//displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Volume_Unit)); //displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Volume_Unit));
} }
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.Commodity_BoxQuantity)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_BoxQuantity))
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.BoxQuantity_ValueUnits)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.BoxQuantity_ValueUnits));
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Dimensions)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Dimensions));
if (CommodityMgr.CodeTypeHasCodes(Sbm.ApplCodeType.CommodityMaterial)) displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.MaterialDesc)); if (CommodityMgr.CodeTypeHasCodes(Sbm.ApplCodeType.CommodityMaterial)) displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.MaterialDesc));
if (CommodityMgr.CodeTypeHasCodes(Sbm.ApplCodeType.CommodityFinish)) displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.FinishDesc)); if (CommodityMgr.CodeTypeHasCodes(Sbm.ApplCodeType.CommodityFinish)) displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.FinishDesc));
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.Commodity_ICNTariffCode)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_ICNTariffCode))
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.ICNTariffCode)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.ICNTariffCode));
if (config.ExportType == ExportType.PurchasePlanning) if (config.ExportType == ExportType.PurchasePlanning)
@@ -533,13 +533,13 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
else else
{ {
// Standard column list. // Standard column list.
if (ConfigConsole.DisplayAttribute(UserContext, SbmDbDfn.ColumnIdx.Commodity_DrawingIssue)) if (SessionConsole.DisplayAttribute(SbmDbDfn.ColumnIdx.Commodity_DrawingIssue))
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.DrawingIssue)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.DrawingIssue));
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Status_Current_X)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Status_Current_X));
// Only show 'Type' column if type not selected: // Only show 'Type' column if type not selected:
if (config.CommodityParams.CommodityType <= 0) if (config.CommodityParams.CommodityType <= 0)
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Type_Desc)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Type_Desc));
if (ConfigConsole.AllowOption(UserContext, Sbm.ConfigOption.CommodityExclusiveToCustomer)) if (SessionConsole.AllowOption(Sbm.ConfigOption.CommodityExclusiveToCustomer))
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Customer_Name)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.Customer_Name));
displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.SalesPrice)); displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.SalesPrice));
if (CommodityMgr.CodeTypeHasCodes(Sbm.ApplCodeType.CommodityRange)) displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.RangeDesc)); if (CommodityMgr.CodeTypeHasCodes(Sbm.ApplCodeType.CommodityRange)) displayColumns.Add(CommodityMgr.GetCommodityColumnDfn(SbmCommodity.Column.RangeDesc));
@@ -16,4 +16,8 @@
<Folder Include="Procs\Utils\" /> <Folder Include="Procs\Utils\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
</ItemGroup>
</Project> </Project>
+1
View File
@@ -7,6 +7,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.31" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.31" />
<PackageReference Include="System.Data.Odbc" Version="6.0.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -98,9 +98,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Create consoles. // Create consoles.
public override SbmConfigConsole CreateConfigConsole(SbmSessionContext sessionContext) public override SbmSessionConsole CreateSessionConsole(ISbmUserContext_Core userContext)
{ {
return SbmConfigConsole.CreateConsole(sessionContext); return SbmSessionConsole.CreateConsole(userContext);
} }
public override SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext) public override SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext)
{ {
@@ -114,10 +114,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
{ {
return new SbmCodeTypeConsole_Web(userContext); return new SbmCodeTypeConsole_Web(userContext);
} }
public override SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext_Core userContext)
{
return null;
}
public override SaItemDataConsole CreateItemDataConsole(ISbmUserContext_Core userContext) public override SaItemDataConsole CreateItemDataConsole(ISbmUserContext_Core userContext)
{ {
return null; return null;
@@ -0,0 +1,74 @@
using DocumentFormat.OpenXml.Drawing.Diagrams;
using Sarand.BusinessMgr.Net.Standard.Base.App;
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Core.Web.App
{
//=======================================================================
/// <summary>
/// Facade Instance configuration for core databases without Control configuration.
/// </summary>
public class SbmInstanceConfig_Core : SbmInstanceConfig
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SbmInstanceConfig_Core(SbmSessionContext_Web sessionContext)
{
this.SessionContext = sessionContext;
}
//-------------------------------------------------------------------
// Properties.
private SbmSessionContext_Web SessionContext { get; }
//-------------------------------------------------------------------
// Allowed data component types.
//-------------------------------------------------------------------
// Supported affiliate types.
public override bool AllowAffiliateType(Sbm.AffiliateType affiliateType, bool defaultResponse)
{
return defaultResponse;
}
// Supported affiliate types.
public override bool AllowAssociationType(Sbm.AssociationType affiliateType, bool defaultResponse)
{
return defaultResponse;
}
// Supported affiliate types.
public override bool AllowTransactionType(Sbm.TransactionType affiliateType, bool defaultResponse)
{
return defaultResponse;
}
//-------------------------------------------------------------------
// Supported application options.
public override bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse)
{
return defaultResponse;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
+10 -1
View File
@@ -36,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
/// <summary>Retrieve localised text.</summary> /// <summary>Retrieve localised text.</summary>
public LocalizedString GetText(string key, bool logMissingKey = true) public LocalizedString GetText(string key, bool logMissingKey = true)
{ {
return GetText(key, new object[] { }, logMissingKey ); return GetText(key, new object[] { }, logMissingKey);
} }
public LocalizedString GetText(string key, object param) public LocalizedString GetText(string key, object param)
{ {
@@ -162,6 +162,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
return affiliateTypeCodes.GetDescForType(affiliateType, affiliateTypeCodes.GetCodeForType(affiliateType)); return affiliateTypeCodes.GetDescForType(affiliateType, affiliateTypeCodes.GetCodeForType(affiliateType));
} }
// Association Type.
public String GetAssociationTypeCaption(Sbm.AssociationType associationType)
{
if ((int)associationType < 1) return "";
// ToDo Association Type localisation.
List<TypeCodeDesc> associationTypeCodes = codes.GetCodesOfType(Sbm.SystemCode.AssociationType);
return associationTypeCodes.GetDescForType(associationType, associationTypeCodes.GetCodeForType(associationType));
}
// Asset Type. // Asset Type.
public String GetAssetTypeCaption(Sbm.AssetType assetType) public String GetAssetTypeCaption(Sbm.AssetType assetType)
{ {
@@ -64,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
// Properties. // Properties.
public SbmLocaliser Localiser { get; } public SbmLocaliser Localiser { get; }
protected SbmApplication_Web App { get { return SbmGlobals_Web.Application; } } protected SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
public SbmAppConfig AppConfig { get { return App.AppConfig; } } public App.SbmAppConfig AppConfig { get { return App.AppConfig; } }
public abstract SbmSessionContext SessionContext { get; } public abstract SbmSessionContext SessionContext { get; }
public abstract ISbmUserContext_Core UserContext_Core { get; } public abstract ISbmUserContext_Core UserContext_Core { get; }
// Business components. // Business components.
@@ -84,7 +84,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } } protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } }
protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } } protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } }
// Consoles. // Consoles.
public SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } } public SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
public SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } } public SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } } public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } } public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
@@ -12,17 +12,17 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
public static class SbmAppConfigHelper public static class SbmAppConfigHelper
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
public static Dictionary<String, SbmAppConfig> ExtractAppConfigs(IConfigurationSection appConfigsSection) public static Dictionary<String, App.SbmAppConfig> ExtractAppConfigs(IConfigurationSection appConfigsSection)
{ {
// NB The set of configurations will only allow one per context. // NB The set of configurations will only allow one per context.
// Only the last configuration found for each context will be stored (NB usually only one of each apart from 'Defaults'). // Only the last configuration found for each context will be stored (NB usually only one of each apart from 'Defaults').
Dictionary<String, SbmAppConfig> appConfigs = new Dictionary<String, SbmAppConfig>(); Dictionary<string, App.SbmAppConfig> appConfigs = new Dictionary<string, App.SbmAppConfig>();
// Start the list with a default 'Defaults' configuration - values set to application defaults (defined in Sbm). // Start the list with a default 'Defaults' configuration - values set to application defaults (defined in Sbm).
// NB This can be overridden in each level of configuration. // NB This can be overridden in each level of configuration.
// Settings from the 'Defaults' configuration provide values where they are missing from other configurations. // Settings from the 'Defaults' configuration provide values where they are missing from other configurations.
// NB Coverage may not be 100% - just where it's proven needed. // NB Coverage may not be 100% - just where it's proven needed.
SbmAppConfig defaultsAppConfig = new SbmAppConfig(Sbm.Config.Context_Defaults, null, null); App.SbmAppConfig defaultsAppConfig = new App.SbmAppConfig(Sbm.Config.Context_Defaults, null, null);
appConfigs.Add(defaultsAppConfig.Context, defaultsAppConfig); appConfigs.Add(defaultsAppConfig.Context, defaultsAppConfig);
// Load session configurations. // Load session configurations.
@@ -31,7 +31,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
if (StringUtil.IsEmpty(appConfigSection.Key)) continue; if (StringUtil.IsEmpty(appConfigSection.Key)) continue;
// Extract the configuration, supplying current 'Defaults' to supply missing values, and add to the list. // Extract the configuration, supplying current 'Defaults' to supply missing values, and add to the list.
SbmAppConfig appConfig = new SbmAppConfig(appConfigSection.Key, appConfigSection, defaultsAppConfig); App.SbmAppConfig appConfig = new App.SbmAppConfig(appConfigSection.Key, appConfigSection, defaultsAppConfig);
appConfigs.Remove(appConfigSection.Key); appConfigs.Remove(appConfigSection.Key);
appConfigs.Add(appConfigSection.Key, appConfig); appConfigs.Add(appConfigSection.Key, appConfig);
@@ -48,13 +48,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
//======================================================================= //=======================================================================
public static class AppConfigList public static class AppConfigList
{ {
public static SbmAppConfig getConfigForApplication(this List<SbmAppConfig> appConfigs) public static App.SbmAppConfig getConfigForApplication(this List<App.SbmAppConfig> appConfigs)
{ {
SbmAppConfig defaultsAppConfig = new SbmAppConfig("", null, null); App.SbmAppConfig defaultsAppConfig = new App.SbmAppConfig("", null, null);
SbmApplication app = SbmGlobals_Web.Application; SbmApplication app = SbmGlobals_Web.Application;
if (app != null) if (app != null)
{ {
foreach (SbmAppConfig appConfig in appConfigs) foreach (App.SbmAppConfig appConfig in appConfigs)
{ {
if (appConfig.Environments.ContainsCI(app.EnvironmentName)) if (appConfig.Environments.ContainsCI(app.EnvironmentName))
return appConfig; return appConfig;
@@ -75,7 +75,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
//======================================================================= //=======================================================================
public static class EmailConfigList public static class EmailConfigList
{ {
public static SbmEmailConfig getConfigForSession(this List<SbmEmailConfig> emailConfigs, SbmAppConfig appConfig) public static SbmEmailConfig getConfigForSession(this List<SbmEmailConfig> emailConfigs, App.SbmAppConfig appConfig)
{ {
if (appConfig != null && !StringUtil.IsEmpty(appConfig.Email.Context)) if (appConfig != null && !StringUtil.IsEmpty(appConfig.Email.Context))
{ {
+12 -4
View File
@@ -58,7 +58,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Application properties. // Application properties.
private SbmApplication_Web App { get { return SbmGlobals_Web.Application; } } private SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
protected SbmAppConfig AppConfig { get { return App.AppConfig; } } protected App.SbmAppConfig AppConfig { get { return App.AppConfig; } }
protected SbmSystem_Web System { get { return App.System_Web; } } protected SbmSystem_Web System { get { return App.System_Web; } }
public String SessionCookieName { get { return App.SessionCookieName; } } public String SessionCookieName { get { return App.SessionCookieName; } }
public SbmSessionData SessionData { get { return SessionData_Web; } } public SbmSessionData SessionData { get { return SessionData_Web; } }
@@ -94,7 +94,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } } protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } }
protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } } protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } }
// Consoles. // Consoles.
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } } protected SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
protected SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } } protected SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } } protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } } protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
@@ -251,7 +251,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
// NB Use methods rathe rthan accessors for properties that depend on session data // NB Use methods rathe rthan accessors for properties that depend on session data
// to avoid the model binding logic invoking a getter before it's ready for use. // to avoid the model binding logic invoking a getter before it's ready for use.
/// <summary>List of Address Types for dropdown.</summary> /// <summary>List of Code Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetCodeTypesForSelect() public IEnumerable<SelectListItem> GetCodeTypesForSelect()
{ {
List<CodeDesc> codeTypes = new List<CodeDesc>(); List<CodeDesc> codeTypes = new List<CodeDesc>();
@@ -262,6 +262,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
return new SelectList(codeTypes, "Code", "Desc"); return new SelectList(codeTypes, "Code", "Desc");
} }
/// <summary>List of Code Type Codes for dropdown.</summary>
public IEnumerable<SelectListItem> GetCodeTypeCodesForSelect(Sbm.ApplCodeType codeType, bool activeOnly = true)
{
List<CodeDesc> codes = new List<CodeDesc>();
foreach (SaCode code in CodeTypeConsole.GetCodesForCodeType(SbmSystem.GetCodeTypeCode(codeType), activeOnly))
codes.Add(code.Code, code.Description);
return new SelectList(codes, "Code", "Desc");
}
/// <summary>List of Address Types for dropdown.</summary> /// <summary>List of Address Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAddressTypeCodesForSelect() public IEnumerable<SelectListItem> GetAddressTypeCodesForSelect()
{ {
@@ -283,7 +292,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
/// <summary>List of Commodity Types for dropdown.</summary> /// <summary>List of Commodity Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetCommodityTypeCodesForSelect() public IEnumerable<SelectListItem> GetCommodityTypeCodesForSelect()
{ {
return new SelectList(GetCodesOfType(Sbm.SystemCode.CommodityType), "Code", "Desc"); return new SelectList(GetCodesOfType(Sbm.SystemCode.CommodityType), "Code", "Desc");
} }
+119 -109
View File
@@ -112,7 +112,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Configuration console. // Configuration console.
public enum ConfigConsole public enum SessionConfig
{ {
Generic, Generic,
Sarand, Sarand,
@@ -127,7 +127,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{ {
Text, Text,
Html Html
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -408,7 +408,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CommoditySuppliers, CommoditySuppliers,
CommodityItemDocs, CommodityItemDocs,
//--------------------------------------------------------------- //---------------------------------------------------------------
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -469,7 +469,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
ItemOption = SaDataItemType.ItemOption, ItemOption = SaDataItemType.ItemOption,
SecurityItem = SaDataItemType.SecurityItem, SecurityItem = SaDataItemType.SecurityItem,
SecurityLink = SaDataItemType.SecurityLink, SecurityLink = SaDataItemType.SecurityLink,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -538,7 +538,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Asset, Asset,
VehicleClass, VehicleClass,
Vehicle, Vehicle,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Association Tab.</summary> /// <summary>Association Tab.</summary>
@@ -553,7 +553,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Time, Time,
Task, Task,
Doc, Doc,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -564,7 +564,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Create, Create,
Update, Update,
Remove, Remove,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -580,7 +580,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
DataTaxRate, DataTaxRate,
DataUnitMeasure, DataUnitMeasure,
DataUomCategory, // has it own right of UOM Cat DataUomCategory, // has it own right of UOM Cat
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>ItemBatchType link between data items.</summary> /// <summary>ItemBatchType link between data items.</summary>
@@ -589,7 +589,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Any = -1, Any = -1,
Unknown = 0, // Do not change existing values - these are tied to the database. Unknown = 0, // Do not change existing values - these are tied to the database.
SalesOrder = 10, SalesOrder = 10,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -614,7 +614,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
ItemCodeList_JobTrade = 101, ItemCodeList_JobTrade = 101,
ItemCodeList_JobEngineer = 102, ItemCodeList_JobEngineer = 102,
ItemCodeList_SeasonalCategory = 103, ItemCodeList_SeasonalCategory = 103,
}; }
public enum AssociatedItemMode
{
Unknown,
Commodity_Parent, // 'From' item is fixed commodity - list associated 'To' items.
Commodity_Child, // 'To' item is fixed commodity - list associated 'From' items.
Requirement_Parent, // etc.
Requirement_Child,
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -635,7 +645,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Process_LabourCost_Job = 311, Process_LabourCost_Job = 311,
Currency = 312, Currency = 312,
Region = 313, Region = 313,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -646,7 +656,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Any = 0, Any = 0,
Security = 1, // Security parameter. Security = 1, // Security parameter.
UserParam = 2, // User configuration parameter. UserParam = 2, // User configuration parameter.
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -702,7 +712,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Contact_Update, Contact_Update,
Contact_Manage, Contact_Manage,
*/ */
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -714,7 +724,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Unknown = 0, Unknown = 0,
CommoditySupply = 10, CommoditySupply = 10,
CommoditySales = 20, CommoditySales = 20,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -825,7 +835,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Generic file interface options. // Generic file interface options.
FileInterface_RowColValue, FileInterface_RowColValue,
FileInterface_Mode, FileInterface_Mode,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -897,7 +907,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Item documents: // Item documents:
DocType_Pdf, DocType_Pdf,
DocType_Image, DocType_Image,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -908,7 +918,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
EstimateType_QuoteDefault = 1, EstimateType_QuoteDefault = 1,
DocType_Pdf_WebPublish, DocType_Pdf_WebPublish,
DocType_Image_WebPublish, DocType_Image_WebPublish,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -917,7 +927,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public enum SystemUserOption public enum SystemUserOption
{ {
Right = 1000, Right = 1000,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -929,7 +939,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
AllAccounts = 1, AllAccounts = 1,
Admin, Admin,
Test, Test,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -942,7 +952,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Transactions, // Transactions Transactions, // Transactions
Utilities, // Utilities Utilities, // Utilities
Appl, // Application specific Appl, // Application specific
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -962,7 +972,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Utilities_Codes, Utilities_Codes,
Utilities_Security, Utilities_Security,
Appl, // Application specific Appl, // Application specific
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1004,7 +1014,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Util_Security_Stats, Util_Security_Stats,
Util_Security_Manage, Util_Security_Manage,
Appl, // Application specific Appl, // Application specific
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1028,7 +1038,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CommodityFilterInitialStockCat, CommodityFilterInitialStockCat,
StatusCaption_Container, StatusCaption_Container,
SalesLocation, SalesLocation,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1070,7 +1080,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
File_ColumnWidth, File_ColumnWidth,
File_ColumnCaption, File_ColumnCaption,
File_Unit, File_Unit,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1088,13 +1098,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
TransTimeChunk2Caption, TransTimeChunk2Caption,
EmailSubject, EmailSubject,
EmailBody, EmailBody,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum OrgOption_Folder public enum OrgOption_Folder
{ {
CommodityImage, CommodityImage,
CommodityBarcodeImage, CommodityBarcodeImage,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum OrgOption_AllowOption public enum OrgOption_AllowOption
{ {
@@ -1125,7 +1135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
PurchaseItem_AssociatedSalesItems, PurchaseItem_AssociatedSalesItems,
Asset_Sale, Asset_Sale,
Asset_Rental, Asset_Rental,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum OrgOption_Caption public enum OrgOption_Caption
{ {
@@ -1161,7 +1171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
MenuOpt_PurchaseDeliveries, MenuOpt_PurchaseDeliveries,
MenuOpt_ProformaPurchaseInvoices, MenuOpt_ProformaPurchaseInvoices,
MenuOpt_PurchaseInvoices, MenuOpt_PurchaseInvoices,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum OrgOption_ShowColumn public enum OrgOption_ShowColumn
{ {
@@ -1190,7 +1200,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
SalesOrderItem_QtyInvoiced, SalesOrderItem_QtyInvoiced,
SalesOrderItem_NextProcess, SalesOrderItem_NextProcess,
Vehicle_KeyLocation, Vehicle_KeyLocation,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1216,7 +1226,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
StockLevel_Bay1 = SbmDbDfn.ColumnIdx.StockLevel_Bay1, StockLevel_Bay1 = SbmDbDfn.ColumnIdx.StockLevel_Bay1,
StockLevel_Bay2 = SbmDbDfn.ColumnIdx.StockLevel_Bay2, StockLevel_Bay2 = SbmDbDfn.ColumnIdx.StockLevel_Bay2,
StockLevel_Bay3 = SbmDbDfn.ColumnIdx.StockLevel_Bay3, StockLevel_Bay3 = SbmDbDfn.ColumnIdx.StockLevel_Bay3,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1254,12 +1264,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
StockLevel_Bay1 = SbmDbDfn.ColumnIdx.StockLevel_Bay1, StockLevel_Bay1 = SbmDbDfn.ColumnIdx.StockLevel_Bay1,
StockLevel_Bay2 = SbmDbDfn.ColumnIdx.StockLevel_Bay2, StockLevel_Bay2 = SbmDbDfn.ColumnIdx.StockLevel_Bay2,
StockLevel_Bay3 = SbmDbDfn.ColumnIdx.StockLevel_Bay3, StockLevel_Bay3 = SbmDbDfn.ColumnIdx.StockLevel_Bay3,
}; }
public enum OrgOption_TransCreateStatus public enum OrgOption_TransCreateStatus
{ {
ProformaSalesOrder, ProformaSalesOrder,
SalesOrder, SalesOrder,
}; }
public enum OrgOption_StatusContainer public enum OrgOption_StatusContainer
{ {
Provisional, Provisional,
@@ -1267,24 +1277,24 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Active, Active,
Actioned, Actioned,
Cancelled, Cancelled,
}; }
public enum OrgOption_PeriodDays public enum OrgOption_PeriodDays
{ {
TransactionDatesInFuture, TransactionDatesInFuture,
UpdateClosedTransaction, UpdateClosedTransaction,
UpdateClosedTransaction_DispatchDetails, UpdateClosedTransaction_DispatchDetails,
UpdateStockLevelsInPast, UpdateStockLevelsInPast,
}; }
public enum OrgOption_Minutes public enum OrgOption_Minutes
{ {
AutoSaveTransaction, AutoSaveTransaction,
}; }
public enum OrgOption_PeriodWeeks public enum OrgOption_PeriodWeeks
{ {
ImminentStockDue, ImminentStockDue,
Timesheets, Timesheets,
UpdateTimeRecords_Control, UpdateTimeRecords_Control,
}; }
public enum OrgOption_NumericDecimals public enum OrgOption_NumericDecimals
{ {
OrderQuantity, OrderQuantity,
@@ -1292,23 +1302,23 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CommodityLength, CommodityLength,
CommodityVolume, CommodityVolume,
CommodityDensity, CommodityDensity,
}; }
public enum OrgOption_CommodityType public enum OrgOption_CommodityType
{ {
CommodityCreationDefault, CommodityCreationDefault,
}; }
public enum OrgOption_StockLocation public enum OrgOption_StockLocation
{ {
SalesOrderDefault, SalesOrderDefault,
PurchaseOrderDefault, PurchaseOrderDefault,
TransactionFilterDefault, TransactionFilterDefault,
}; }
public enum OrgOption_CmdFilterStockCat public enum OrgOption_CmdFilterStockCat
{ {
MaintView, MaintView,
SalesSearch, SalesSearch,
PurchaseSearch, PurchaseSearch,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1321,26 +1331,26 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
StockLevels, StockLevels,
Accounts, Accounts,
SalesProfile, SalesProfile,
}; }
public enum WebUploadMethod public enum WebUploadMethod
{ {
Unknown = 0, Unknown = 0,
None = 10, None = 10,
Ftp, Ftp,
Webstore, Webstore,
}; }
public enum WebDownloadData public enum WebDownloadData
{ {
Unknown = 0, Unknown = 0,
Orders = 10, Orders = 10,
}; }
public enum WebDownloadMethod public enum WebDownloadMethod
{ {
Unknown = 0, Unknown = 0,
None = 10, None = 10,
Ftp, Ftp,
Webstore, Webstore,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1350,7 +1360,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{ {
IncludeImminentStock, IncludeImminentStock,
AllowZeroOrderItemAmount, AllowZeroOrderItemAmount,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>FileInterface option.</summary> /// <summary>FileInterface option.</summary>
@@ -1360,14 +1370,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Row = 10, Row = 10,
Col, Col,
Value, Value,
}; }
/// <summary>File interface mode.</summary> /// <summary>File interface mode.</summary>
public enum FileInterface_Mode public enum FileInterface_Mode
{ {
Unknown = 0, Unknown = 0,
Csv = 1, Csv = 1,
MsExcel, MsExcel,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1377,7 +1387,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{ {
Unknown = 0, Unknown = 0,
Customer = 10, Customer = 10,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1392,7 +1402,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
JobBooking = 30, // Allows period across more than one day. JobBooking = 30, // Allows period across more than one day.
JobActionDue = 31, JobActionDue = 31,
StaffHoliday = 900, StaffHoliday = 900,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1403,7 +1413,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Unknown = -1, Unknown = -1,
Individual = 0, Individual = 0,
Organisation = 1, Organisation = 1,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1423,7 +1433,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
PublicSector = 5, // 'PUB' PublicSector = 5, // 'PUB'
Charity = 6, // 'CHA' Charity = 6, // 'CHA'
ContactGroup = 10, // 'GRP' ContactGroup = 10, // 'GRP'
}; }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
public enum AddressType public enum AddressType
@@ -1435,7 +1445,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Home = 3, // 'HOM' Home = 3, // 'HOM'
Delivery = 4, // 'DEL' Delivery = 4, // 'DEL'
Billing = 5, // 'BIL' Billing = 5, // 'BIL'
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1447,7 +1457,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
None, None,
Full, Full,
Partial, Partial,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1458,7 +1468,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Any = -1, Any = -1,
Unknown = 0, Unknown = 0,
Stock = 10, Stock = 10,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum LocationFilter public enum LocationFilter
@@ -1468,7 +1478,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
All = -2, // All locations. All = -2, // All locations.
Any = -1, Any = -1,
Unknown = 0, Unknown = 0,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Containers. // Containers.
@@ -1478,7 +1488,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Unknown = 0, Unknown = 0,
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Stock = 10, Stock = 10,
}; }
public enum ContainerType public enum ContainerType
{ {
Any = -1, Any = -1,
@@ -1491,7 +1501,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Container = 200, Container = 200,
Wagon, Wagon,
Pallet = 300, Pallet = 300,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary> /// <summary>
@@ -1502,7 +1512,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Unknown = 0, Unknown = 0,
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Requirement_AssocItem_PurchaseCostProportion = 1, Requirement_AssocItem_PurchaseCostProportion = 1,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -1516,12 +1526,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Portfolio = 10, Portfolio = 10,
Category = 20, Category = 20,
Commodity = 30, Commodity = 30,
}; }
public enum PortfolioItemStatusCat public enum PortfolioItemStatusCat
{ {
Current = -2, Current = -2,
Any = -1, Any = -1,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Commodity. // Commodity.
@@ -1535,7 +1545,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
NonStock = 2, // 'NST' NonStock = 2, // 'NST'
Service = 3, // 'SRV' Service = 3, // 'SRV'
Asset = 4, // 'AST' Asset = 4, // 'AST'
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Stock Movement. // Stock Movement.
@@ -1548,7 +1558,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
StockTransfer = 10, StockTransfer = 10,
SalesAllocation = 20, SalesAllocation = 20,
PurchaseAllocation = 30, PurchaseAllocation = 30,
}; }
public enum StockLevelType public enum StockLevelType
{ {
Any = -1, Any = -1,
@@ -1556,7 +1566,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
CurrentLevel = 10, CurrentLevel = 10,
StockTake = 20, StockTake = 20,
}; }
public enum StockEventType public enum StockEventType
{ {
Any = -1, Any = -1,
@@ -1564,7 +1574,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Movement = 1, Movement = 1,
StockLevel, StockLevel,
}; }
public enum StockLevelSource public enum StockLevelSource
{ {
Any = -1, Any = -1,
@@ -1573,7 +1583,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Manual = 10, Manual = 10,
System = 20, System = 20,
Sage = 30, // NB Needs to be corrected from '21' on Cadix db [Apr2012]. Sage = 30, // NB Needs to be corrected from '21' on Cadix db [Apr2012].
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Pricing. // Pricing.
@@ -1583,7 +1593,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Customer = 10, Customer = 10,
Supplier = 20, Supplier = 20,
Special = 30, Special = 30,
}; }
public enum PriceCalcMethod public enum PriceCalcMethod
{ {
Unknown = 0, Unknown = 0,
@@ -1601,39 +1611,39 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
MarkupValue = 15, MarkupValue = 15,
/// <summary>Increase sales price by a percentage</summary> /// <summary>Increase sales price by a percentage</summary>
MarkupSales = 16, MarkupSales = 16,
}; }
public enum PriceRounderMethod public enum PriceRounderMethod
{ {
Unknown = 0, Unknown = 0,
}; }
public enum PriceRounderDirection public enum PriceRounderDirection
{ {
Unknown = 0, Unknown = 0,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Associations. // Associations.
public enum AssociationType public enum AssociationType
{ {
Personal = -2, // Task management only. Personal = -2, // Task management only.
Any = -1, NotInternal = -1,
Unknown = 0, Any = 0,
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Internal = 1, // 'INT' Internal = 1,
Customer = 2, // 'CUS' Customer = 2,
Supplier = 3, // 'SUP' Supplier = 3,
Associate = 4, // 'ASS' Associate = 4,
Member = 5, // 'MEM' Member = 5,
Contractor = 6, // 'CON' Contractor = 6,
Stockist = 7, // 'STK' Stockist = 7,
FinanceAgency = 8, // 'FIN' FinanceAgency = 8,
}; }
public enum AssociationTypeContext public enum AssociationTypeContext
{ {
Any, Any,
TimeRecording, // Association types that can have time records. TimeRecording, // Association types that can have time records.
Action, // Association types that can have actions. Action, // Association types that can have actions.
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Transaction. // Transaction.
@@ -1658,13 +1668,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
SalesInvoice = 51, // 'SAI' SalesInvoice = 51, // 'SAI'
PurchaseInvoice = 52, // 'PUV' PurchaseInvoice = 52, // 'PUV'
ProformaPurchaseInvoice = 53, // 'PPI' ProformaPurchaseInvoice = 53, // 'PPI'
}; }
public enum TransactionTypeContext public enum TransactionTypeContext
{ {
Any, Any,
TimeRecording, // Transaction types that can have time records. TimeRecording, // Transaction types that can have time records.
Action, // Transaction types that can have actions. Action, // Transaction types that can have actions.
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Requirements. // Requirements.
@@ -1673,13 +1683,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Any = 0, Any = 0,
Detail = 1, Detail = 1,
Job = 2, Job = 2,
}; }
public enum TaskCodeType public enum TaskCodeType
{ {
Any = 0, Any = 0,
Project = 1, Project = 1,
Job = 2, Job = 2,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Constituents. // Constituents.
@@ -1695,7 +1705,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Consumable = 14, Consumable = 14,
Expense = 15, Expense = 15,
Process = 20, Process = 20,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Cost Estimates. // Cost Estimates.
@@ -1705,7 +1715,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Cost = 1, Cost = 1,
Labour Labour
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum CostEstimateCategory public enum CostEstimateCategory
{ {
@@ -1716,14 +1726,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CostPerJob = 2, CostPerJob = 2,
LabourPerUnit = 3, LabourPerUnit = 3,
LabourPerJob = 4, LabourPerJob = 4,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum DiscountMarkup public enum DiscountMarkup
{ {
Discount = 10, Discount = 10,
Markup = 20, Markup = 20,
}; }
public enum DiscountType public enum DiscountType
{ {
// Values 0 - 6 are in line with Sage Sales Order definition. // Values 0 - 6 are in line with Sage Sales Order definition.
@@ -1734,7 +1744,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
QtyDiscountC = 4, // Discount Applied by Banding C QtyDiscountC = 4, // Discount Applied by Banding C
QtyDiscountD = 5, // Discount Applied by Banding D QtyDiscountD = 5, // Discount Applied by Banding D
QtyDiscountE = 6, // Discount Applied by Banding E QtyDiscountE = 6, // Discount Applied by Banding E
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum ProcessCategory public enum ProcessCategory
@@ -1744,7 +1754,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Commodity = 10, Commodity = 10,
Asset = 20, Asset = 20,
}; }
public enum ProcessType public enum ProcessType
{ {
Any = -1, Any = -1,
@@ -1754,7 +1764,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Production = 11, Production = 11,
Finishing = 12, Finishing = 12,
External = 20, External = 20,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public enum PaymentType public enum PaymentType
@@ -1767,7 +1777,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Cheque = 30, Cheque = 30,
DebitCard = 40, DebitCard = 40,
CreditCard = 50, CreditCard = 50,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Assets. // Assets.
@@ -1779,7 +1789,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Furniture = 11, Furniture = 11,
Vehicle = 50, Vehicle = 50,
ComputerHardware = 60, ComputerHardware = 60,
}; }
public enum AssetIncomeType public enum AssetIncomeType
{ {
Unknown = 0, Unknown = 0,
@@ -1787,7 +1797,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Sale = 10, Sale = 10,
Rental = 20, Rental = 20,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Vehicles. // Vehicles.
@@ -1801,7 +1811,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Van = 12, Van = 12,
Truck = 13, Truck = 13,
Coach = 14, Coach = 14,
}; }
public enum VehicleEventType public enum VehicleEventType
{ {
Any = -1, Any = -1,
@@ -1812,7 +1822,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Incident = 12, Incident = 12,
Repair = 13, Repair = 13,
Comment = 14, Comment = 14,
}; }
public enum VehicleFeatureSource public enum VehicleFeatureSource
{ {
Any = -1, Any = -1,
@@ -1823,7 +1833,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CAP = 12, CAP = 12,
DVLA = 13, DVLA = 13,
SMMT = 14, SMMT = 14,
}; }
public enum VehicleFeatureType public enum VehicleFeatureType
{ {
Any = -1, Any = -1,
@@ -1847,7 +1857,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Equipment = 101, // Standard equipment. Equipment = 101, // Standard equipment.
OptionalExtra = 102, // Manufacturer option. OptionalExtra = 102, // Manufacturer option.
SelectedOption = 103, SelectedOption = 103,
}; }
public enum VehicleOptionType public enum VehicleOptionType
{ {
Any = -1, Any = -1,
@@ -1858,7 +1868,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Wheels, Wheels,
PaintFinish, PaintFinish,
Packs, Packs,
}; }
public enum VehicleTransType public enum VehicleTransType
{ {
Any = -1, Any = -1,
@@ -1866,7 +1876,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Manual = 10, Manual = 10,
Automatic = 20, Automatic = 20,
}; }
public enum VehicleFuelType public enum VehicleFuelType
{ {
Any = -1, Any = -1,
@@ -1877,7 +1887,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Lpg = 12, Lpg = 12,
Electric = 13, Electric = 13,
Hybrid = 20, Hybrid = 20,
}; }
public enum VehicleOdometerUnits public enum VehicleOdometerUnits
{ {
Any = -1, Any = -1,
@@ -1885,7 +1895,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
Mile = 10, Mile = 10,
Kilometre = 11, Kilometre = 11,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Interface types. // Interface types.
@@ -1896,14 +1906,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
WebStore = 10, WebStore = 10,
JoomlaVirtueMart = 40, JoomlaVirtueMart = 40,
MiMoWeb = 150, // MiMo website. MiMoWeb = 150, // MiMo website.
}; }
public enum InterfaceType_Accounts public enum InterfaceType_Accounts
{ {
Unknown = 0, Unknown = 0,
// NB Do not change the positive values, as tied to the database. // NB Do not change the positive values, as tied to the database.
SageLine50 = 50, SageLine50 = 50,
QuickBooks = 60, QuickBooks = 60,
}; }
public enum InterfaceType_System public enum InterfaceType_System
{ {
Unknown = 0, Unknown = 0,
@@ -1918,7 +1928,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Anchor_OrderFulfilment = 200, // Order fulfilment for Anchor Storage. Anchor_OrderFulfilment = 200, // Order fulfilment for Anchor Storage.
Cadix_OrderSpreadsheet_Argos = 220, Cadix_OrderSpreadsheet_Argos = 220,
Cadix_OrderSpreadsheet_Homebase = 221, Cadix_OrderSpreadsheet_Homebase = 221,
}; }
public enum InterfaceType_File public enum InterfaceType_File
{ {
Unknown = 0, Unknown = 0,
@@ -1950,7 +1960,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
TransToWord_PurchaseDelivery = 1500 + TransactionType.PurchaseDelivery, TransToWord_PurchaseDelivery = 1500 + TransactionType.PurchaseDelivery,
//TransToWord_ProformaPurchaseInvoice = 1500+ProformaPurchaseInvoice, - Use Purchase Invoice interface. //TransToWord_ProformaPurchaseInvoice = 1500+ProformaPurchaseInvoice, - Use Purchase Invoice interface.
TransToWord_PurchaseInvoice = 1500 + TransactionType.PurchaseInvoice, TransToWord_PurchaseInvoice = 1500 + TransactionType.PurchaseInvoice,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Interface Data Types. // Interface Data Types.
@@ -1998,7 +2008,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
ConstituentTime, ConstituentTime,
// Utility data: // Utility data:
Pricing, Pricing,
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Action to be performed for each Stock Type on import. // Action to be performed for each Stock Type on import.
@@ -2006,7 +2016,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{ {
Import, Import,
Ignore Ignore
}; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -9,18 +9,21 @@ using System;
namespace Sarand.BusinessMgr.Net.Standard.Base.App namespace Sarand.BusinessMgr.Net.Standard.Base.App
{ {
//======================================================================= //=======================================================================
public static class SbmAppConsole /// <summary>
/// Application configuration:
/// <para>- Availability of UI components - menu options, views etc.</para>
/// </summary>
public static class SbmAppConfig
{ {
private static readonly String ClassName = "SbmAppConsole"; private const String ClassName = nameof(SbmAppConfig);
//------------------------------------------------------------------- //-------------------------------------------------------------------
// A p p l i c a t i o n V i e w s // A p p l i c a t i o n V i e w s
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Jul-2021 ConfigConsole parameter added to avoid local creation. To be reviewed/replaced. // Jul-2021 SessionConfig parameter added to avoid local creation. To be reviewed/replaced.
public static bool IsViewApplicable(ISbmUserContext_Core userContext, SbmConfigConsole configConsole, Sbm.View view) public static bool IsViewApplicable(SbmSessionConsole sessionConfig, Sbm.View view)
{ {
//SbmConfigConsole configConsole = SbmGlobals.GetConfigConsole(userContext.SessionContext); ISbmSecurityProfile_Core securityProfile = sessionConfig.UserContext.SecurityProfile_Core;
ISbmSecurityProfile_Core securityProfile = userContext.SecurityProfile_Core;
switch (view) switch (view)
{ {
//----------------------------------------------------------- //-----------------------------------------------------------
@@ -29,210 +32,210 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
case Sbm.View.Main: case Sbm.View.Main:
return true; return true;
case Sbm.View.Console: case Sbm.View.Console:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowConsoleView)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowConsoleView)) return false;
if (!configConsole.GetConsoleViewDfn().HasContent()) return false; if (!sessionConfig.GetConsoleViewDfn().HasContent()) return false;
return true; return true;
case Sbm.View.Diary: case Sbm.View.Diary:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.DiaryView)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.DiaryView)) return false;
return true; return true;
//----------------------------------------------------------- //-----------------------------------------------------------
// Contacts. // Contacts.
case Sbm.View.Contacts_Affiliates: case Sbm.View.Contacts_Affiliates:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
return true; return true;
case Sbm.View.Contacts_ContactGroups: case Sbm.View.Contacts_ContactGroups:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
return true; return true;
case Sbm.View.Contacts_Associations: case Sbm.View.Contacts_Associations:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AnyAssociationView)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AnyAssociationView)) return false;
return true; return true;
case Sbm.View.Contacts_Associations_Customer: case Sbm.View.Contacts_Associations_Customer:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
return true; return true;
case Sbm.View.Contacts_Associations_Supplier: case Sbm.View.Contacts_Associations_Supplier:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
return true; return true;
case Sbm.View.Contacts_Associations_Associate: case Sbm.View.Contacts_Associations_Associate:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Associate)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Associate)) return false;
return true; return true;
case Sbm.View.Contacts_Associations_Stockist: case Sbm.View.Contacts_Associations_Stockist:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Stockist)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Stockist)) return false;
return true; return true;
case Sbm.View.Contacts_Associations_FinanceAgency: case Sbm.View.Contacts_Associations_FinanceAgency:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.FinanceAgency)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.FinanceAgency)) return false;
return true; return true;
case Sbm.View.Contacts_Associations_Member: case Sbm.View.Contacts_Associations_Member:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Member)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Member)) return false;
return true; return true;
case Sbm.View.Contacts_Associations_Contractor: case Sbm.View.Contacts_Associations_Contractor:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Contractor)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Contractor)) return false;
return true; return true;
//----------------------------------------------------------- //-----------------------------------------------------------
// Commodities. // Commodities.
case Sbm.View.Commodities: case Sbm.View.Commodities:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true; return true;
case Sbm.View.Commodity_Locations: case Sbm.View.Commodity_Locations:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true; return true;
case Sbm.View.Commodity_Containers: case Sbm.View.Commodity_Containers:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true; return true;
case Sbm.View.Commodity_Portfolio: case Sbm.View.Commodity_Portfolio:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true; return true;
case Sbm.View.Commodity_SalesBudget: case Sbm.View.Commodity_SalesBudget:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true; return true;
case Sbm.View.PriceSets: case Sbm.View.PriceSets:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
//if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowPriceSets)) return false; //if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowPriceSets)) return false;
return true; return true;
//----------------------------------------------------------- //-----------------------------------------------------------
// Assets. // Assets.
case Sbm.View.AssetCategories: case Sbm.View.AssetCategories:
case Sbm.View.Assets: case Sbm.View.Assets:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowAssets)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets)) return false;
return true; return true;
case Sbm.View.VehicleClasses: case Sbm.View.VehicleClasses:
case Sbm.View.Vehicles: case Sbm.View.Vehicles:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowAssets)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowVehicles)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles)) return false;
return true; return true;
//----------------------------------------------------------- //-----------------------------------------------------------
// Transactions. // Transactions.
case Sbm.View.Transactions: case Sbm.View.Transactions:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AnyTransactionView)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AnyTransactionView)) return false;
return true; return true;
case Sbm.View.Transactions_Project: case Sbm.View.Transactions_Project:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.Project)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.Project)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.Project)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.Project)) return false;
return true; return true;
case Sbm.View.Transactions_PurchaseQuote: case Sbm.View.Transactions_PurchaseQuote:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseQuote)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseQuote)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseQuote)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseQuote)) return false;
return true; return true;
case Sbm.View.Transactions_ProformaPurchaseOrder: case Sbm.View.Transactions_ProformaPurchaseOrder:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaPurchaseOrder)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaPurchaseOrder)) return false;
return true; return true;
case Sbm.View.Transactions_PurchaseOrder: case Sbm.View.Transactions_PurchaseOrder:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseOrder)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseOrder)) return false;
return true; return true;
case Sbm.View.Transactions_PurchaseSO: case Sbm.View.Transactions_PurchaseSO:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseSO)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseSO)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseSO)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseSO)) return false;
return true; return true;
case Sbm.View.Transactions_PurchaseDelivery: case Sbm.View.Transactions_PurchaseDelivery:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseDelivery)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseDelivery)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseDelivery)) return false;
return true; return true;
case Sbm.View.Transactions_ProformaPurchaseInvoice: case Sbm.View.Transactions_ProformaPurchaseInvoice:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseInvoice)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaPurchaseInvoice)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaPurchaseInvoice)) return false;
return true; return true;
case Sbm.View.Transactions_PurchaseInvoice: case Sbm.View.Transactions_PurchaseInvoice:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseInvoice)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseInvoice)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseInvoice)) return false;
return true; return true;
case Sbm.View.Transactions_SalesLead: case Sbm.View.Transactions_SalesLead:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesLead)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesLead)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesLead)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesLead)) return false;
return true; return true;
case Sbm.View.Transactions_SalesQuote: case Sbm.View.Transactions_SalesQuote:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesQuote)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesQuote)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesQuote)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesQuote)) return false;
return true; return true;
case Sbm.View.Transactions_ProformaSalesOrder: case Sbm.View.Transactions_ProformaSalesOrder:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesOrder)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaSalesOrder)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaSalesOrder)) return false;
return true; return true;
case Sbm.View.Transactions_SalesOrder: case Sbm.View.Transactions_SalesOrder:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesOrder)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesOrder)) return false;
return true; return true;
case Sbm.View.Transactions_SalesPO: case Sbm.View.Transactions_SalesPO:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesPO)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesPO)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesPO)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesPO)) return false;
return true; return true;
case Sbm.View.Transactions_SalesDispatch: case Sbm.View.Transactions_SalesDispatch:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesDispatch)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesDispatch)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesDispatch)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesDispatch)) return false;
return true; return true;
case Sbm.View.Transactions_ProformaSalesInvoice: case Sbm.View.Transactions_ProformaSalesInvoice:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesInvoice)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesInvoice)) return false;
return true; return true;
case Sbm.View.Transactions_SalesInvoice: case Sbm.View.Transactions_SalesInvoice:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false; if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice)) return false; if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesInvoice)) return false; if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesInvoice)) return false;
return true; return true;
//----------------------------------------------------------- //-----------------------------------------------------------
// Planning. // Planning.
case Sbm.View.Transactions_PurchasingPlanning: case Sbm.View.Transactions_PurchasingPlanning:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowPurchasingPlanning)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowPurchasingPlanning)) return false;
return true; return true;
case Sbm.View.Transactions_ProductionControl: case Sbm.View.Transactions_ProductionControl:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowProductionControl)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowProductionControl)) return false;
return true; return true;
case Sbm.View.Transactions_DeliveryPlanning: case Sbm.View.Transactions_DeliveryPlanning:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowDeliveryPlanning)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowDeliveryPlanning)) return false;
return true; return true;
//----------------------------------------------------------- //-----------------------------------------------------------
// Other. // Other.
case Sbm.View.SystemAccounts: case Sbm.View.SystemAccounts:
case Sbm.View.SystemUsers: case Sbm.View.SystemUsers:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false; if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
// Interfaces must be available. // Interfaces must be available.
using (SaInterfaceConsole interfaceConsole = SbmGlobals.Application.CreateInterfaceConsole(userContext)) using (SaInterfaceConsole interfaceConsole = SbmGlobals.Application.CreateInterfaceConsole(sessionConfig.UserContext))
{ {
if (interfaceConsole == null || !interfaceConsole.DatabaseIsValid) return false; if (interfaceConsole == null || !interfaceConsole.DatabaseIsValid) return false;
// System Account & User tables must be available. // System Account & User tables must be available.
ISacsDatabase busMgrDb = SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext); ISacsDatabase busMgrDb = SbmGlobals.Application.GetBusMgrDatabase(sessionConfig.UserContext.SessionContext);
if (!SbmGlobals.Application.DbTableExists(busMgrDb, SbmDbDfn.TableIdx.SystemAccount)) return false; if (!SbmGlobals.Application.DbTableExists(busMgrDb, SbmDbDfn.TableIdx.SystemAccount)) return false;
if (!SbmGlobals.Application.DbTableExists(busMgrDb, SbmDbDfn.TableIdx.SystemUser)) return false; if (!SbmGlobals.Application.DbTableExists(busMgrDb, SbmDbDfn.TableIdx.SystemUser)) return false;
} }
@@ -265,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 // A p p l i c a t i o n M e n u
//------------------------------------------------------------------- //-------------------------------------------------------------------
public static bool IsMenuOptionApplicable(ISbmUserContext_Core userContext, SbmConfigConsole configConsole, Sbm.MenuOption menuOption) public static bool IsMenuOptionApplicable(SbmSessionConsole sessionConfig, Sbm.MenuOption menuOption)
{ {
if (!userContext.ValidUser) if (!sessionConfig.UserContext.ValidUser)
{ {
// ToDo Only Login menu option available. // ToDo Only Login menu option available.
return false; return false;
} }
Sbm.View view = GetViewForMenuOption(userContext.SessionContext, menuOption); Sbm.View view = GetViewForMenuOption(sessionConfig.UserContext.SessionContext, menuOption);
if (view != Sbm.View.Unknown) if (view != Sbm.View.Unknown)
// View options. // View options.
return IsViewApplicable(userContext, configConsole, GetViewForMenuOption(userContext.SessionContext, menuOption)); return IsViewApplicable(sessionConfig, GetViewForMenuOption(sessionConfig.UserContext.SessionContext, menuOption));
// Non-view options. // Non-view options.
switch (menuOption) switch (menuOption)
@@ -293,7 +296,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//----------------------------------------------------------- //-----------------------------------------------------------
// Actions. // Actions.
case Sbm.MenuOption.Timesheet: case Sbm.MenuOption.Timesheet:
return configConsole.AllowOption(userContext, Sbm.ConfigOption.TimeRecording); return sessionConfig.AllowOption(Sbm.ConfigOption.TimeRecording);
//----------------------------------------------------------- //-----------------------------------------------------------
} }
SaLogger.Warn($"{SysUtil.Fn} Unsupport menu option - {menuOption.ToString()}"); SaLogger.Warn($"{SysUtil.Fn} Unsupport menu option - {menuOption.ToString()}");
@@ -58,6 +58,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{ {
return GetBusMgrDatabase(sessionContext).CreateDbInfo(); return GetBusMgrDatabase(sessionContext).CreateDbInfo();
} }
// Instance configuration.
public abstract SbmInstanceConfig GetInstanceConfig(SbmSessionContext sessionContext);
// Database utilities. // Database utilities.
public IDatabaseInfo CreateDbInfo(ISacsDatabase db) public IDatabaseInfo CreateDbInfo(ISacsDatabase db)
{ {
@@ -82,7 +84,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Create consoles. // Create consoles.
public abstract SbmConfigConsole CreateConfigConsole(SbmSessionContext sessionContext); public abstract SbmSessionConsole CreateSessionConsole(ISbmUserContext_Core userContext);
public abstract SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext); public abstract SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext);
public abstract SaSecurityConsole CreateSecurityConsole(ISbmUserContext_Core userContext); public abstract SaSecurityConsole CreateSecurityConsole(ISbmUserContext_Core userContext);
public abstract SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext_Core userContext); public abstract SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext_Core userContext);
@@ -1,4 +1,5 @@
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control; using Org.BouncyCastle.Math.EC;
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
using Sarand.BusinessMgr.Net.Standard.Base.Core; using Sarand.BusinessMgr.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils; using Sarand.Net.Standard.Base.Utils;
using System; using System;
@@ -17,101 +18,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public abstract class SbmInstanceConfig public abstract class SbmInstanceConfig
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions.
protected const String ParamContext_Config = "Config";
protected const String ParamContext_ConfigPrefix = "Config-";
protected const String ApplicationOptionValue_Allow = "Allow";
protected const String ApplicationOptionValue_Disallow = "Disallow";
protected const String ApplicationOptionValue_Default= "Default";
//-------------------------------------------------------------------
// Owner/Instance configuration parameters.
public enum ConfigParamType
{
// Affiliate types.
AllowedAffiliateTypes,
DisallowedAffiliateTypes,
// Association types.
AllowedAssociationTypes,
DisallowedAssociationTypes,
// Transaction types.
AllowedTransactionTypes,
DisallowedTransactionTypes,
// Application options. // Application options.
ApplicationOption,
}
public class ConfigParamData
{
public ConfigParamType ConfigParam { get; set; }
public String Context { get; set; }
public String Name { get; set; }
public HashSet<String> Values { get; } = new HashSet<string>();
public bool Password { get; set; }
}
public bool IsConfigParamOfType(ConfigParamType configParam, SbmcItemParam itemParam)
{
switch (configParam)
{
// Affiliate types.
case ConfigParamType.AllowedAffiliateTypes:
case ConfigParamType.DisallowedAffiliateTypes:
// Association types.
case ConfigParamType.AllowedAssociationTypes:
case ConfigParamType.DisallowedAssociationTypes:
// Transaction types.
case ConfigParamType.AllowedTransactionTypes:
case ConfigParamType.DisallowedTransactionTypes:
return itemParam.Context.EqualsCI(ParamContext_Config) && itemParam.Name.EqualsCI(configParam.ToString());
// Application options.
case ConfigParamType.ApplicationOption:
return itemParam.Context.EqualsCI($"{ParamContext_ConfigPrefix}{ConfigParamType.ApplicationOption.ToString()}");
}
return false;
}
public ConfigParamData GetConfigParamData(ConfigParamType configParam)
{
switch (configParam)
{
// Affiliate types.
case ConfigParamType.AllowedAffiliateTypes:
case ConfigParamType.DisallowedAffiliateTypes:
// Association types.
case ConfigParamType.AllowedAssociationTypes:
case ConfigParamType.DisallowedAssociationTypes:
// Transaction types.
case ConfigParamType.AllowedTransactionTypes:
case ConfigParamType.DisallowedTransactionTypes:
return new ConfigParamData() { ConfigParam = configParam, Context = ParamContext_Config, Name = configParam.ToString() };
}
return null;
}
public ConfigParamData GetAllowOptionConfigParamData(Sbm.ConfigOption option)
{
ConfigParamData configParamData = new ConfigParamData() { ConfigParam = ConfigParamType.ApplicationOption, Context = $"{ParamContext_ConfigPrefix}{ConfigParamType.ApplicationOption.ToString()}", Name = option.ToString() };
configParamData.Values.UnionWith(new List<String>() { ApplicationOptionValue_Allow, ApplicationOptionValue_Disallow, ApplicationOptionValue_Default });
return configParamData;
}
//-------------------------------------------------------------------
// Application options.
//-------------------------------------------------------------------
public abstract bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse); public abstract bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse);
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Allowed data component types. // Allowed data component types.
//-------------------------------------------------------------------
// Supported affiliate types.
public abstract bool AllowAffiliateType(Sbm.AffiliateType type);
// Supported Association types.
public abstract bool AllowAssociationType(Sbm.AssociationType type);
// Supported Transaction types.
public abstract bool AllowTransactionType(Sbm.TransactionType type);
//------------------------------------------------------------------- // Supported affiliate types.
// Allow Option. public abstract bool AllowAffiliateType(Sbm.AffiliateType type, bool defaultResponse);
// Supported Association types.
public abstract bool AllowAssociationType(Sbm.AssociationType type, bool defaultResponse);
// Supported Transaction types.
public abstract bool AllowTransactionType(Sbm.TransactionType type, bool defaultResponse);
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
+18 -11
View File
@@ -40,7 +40,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
private SbmProcessMgr processMgr; private SbmProcessMgr processMgr;
private SbmDataItemMgr dataItemMgr; private SbmDataItemMgr dataItemMgr;
// Consoles. // Consoles.
private SbmConfigConsole configConsole; private SbmSessionConsole sessionConsole;
private SaDiaryConsole diaryConsole; private SaDiaryConsole diaryConsole;
private SaSecurityConsole securityConsole; private SaSecurityConsole securityConsole;
private SaCodeTypeConsole codeTypeConsole; private SaCodeTypeConsole codeTypeConsole;
@@ -83,7 +83,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
if (taxCodes != null) taxCodes.ClearAndDispose(); if (taxCodes != null) taxCodes.ClearAndDispose();
if (unitsOfMeasure != null) unitsOfMeasure.ClearAndDispose(); if (unitsOfMeasure != null) unitsOfMeasure.ClearAndDispose();
// Consoles. // Consoles.
if (configConsole != null) configConsole.Dispose(); if (sessionConsole != null) sessionConsole.Dispose();
if (diaryConsole != null) diaryConsole.Dispose(); if (diaryConsole != null) diaryConsole.Dispose();
if (securityConsole != null) securityConsole.Dispose(); if (securityConsole != null) securityConsole.Dispose();
if (codeTypeConsole != null) codeTypeConsole.Dispose(); if (codeTypeConsole != null) codeTypeConsole.Dispose();
@@ -213,13 +213,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Consoles. // Consoles.
public SbmConfigConsole ConfigConsole public SbmSessionConsole SessionConsole
{ {
get get
{ {
if (configConsole == null) if (sessionConsole == null)
configConsole = Application.CreateConfigConsole(SessionContext); sessionConsole = Application.CreateSessionConsole(UserContext);
return configConsole; return sessionConsole;
} }
} }
public SaDiaryConsole DiaryConsole public SaDiaryConsole DiaryConsole
@@ -324,7 +324,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
get get
{ {
if (stockControlConfig == null) if (stockControlConfig == null)
stockControlConfig = ConfigConsole.GetStockControlConfig(UserContext); stockControlConfig = SessionConsole.GetStockControlConfig();
return stockControlConfig; return stockControlConfig;
} }
} }
@@ -333,7 +333,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
get get
{ {
if (requirementCostingConfig == null) if (requirementCostingConfig == null)
requirementCostingConfig = ConfigConsole.GetRequirementCostingConfig(UserContext); requirementCostingConfig = SessionConsole.GetRequirementCostingConfig();
return requirementCostingConfig; return requirementCostingConfig;
} }
} }
@@ -351,7 +351,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public List<SaCurrency> GetCurrencies() public List<SaCurrency> GetCurrencies()
{ {
populateCurrencies(); populateCurrencies();
return currencies; return new List<SaCurrency>(currencies);
} }
public SaCurrency GetCurrencyById(SysId currencyId) public SaCurrency GetCurrencyById(SysId currencyId)
{ {
@@ -393,7 +393,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public List<SaTaxCode> GetTaxCodes() public List<SaTaxCode> GetTaxCodes()
{ {
populateTaxCodes(); populateTaxCodes();
return taxCodes; return new List<SaTaxCode>(taxCodes);
} }
public SaTaxCode GetTaxCodeById(SysId currencyId) public SaTaxCode GetTaxCodeById(SysId currencyId)
{ {
@@ -415,7 +415,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public List<SaUnitMeasure> GetUnitsOfMeasure() public List<SaUnitMeasure> GetUnitsOfMeasure()
{ {
populateUnitsOfMeasure(); populateUnitsOfMeasure();
return unitsOfMeasure; return new List<SaUnitMeasure>(unitsOfMeasure);
}
public String GetUnitOfMeasureCaption(SysId currencyId)
{
if (!SysId.IsValid(currencyId)) return null;
populateUnitsOfMeasure();
SaUnitMeasure uom = unitsOfMeasure.Find(item => item.Id.Equals(currencyId));
return uom?.Single ?? "";
} }
public SaUnitMeasure GetUnitOfMeasureById(SysId currencyId) public SaUnitMeasure GetUnitOfMeasureById(SysId currencyId)
{ {
@@ -21,19 +21,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
private bool includeHostSecurityProfile = false; private bool includeHostSecurityProfile = false;
private SaSecurityProfile userSecurityProfile; private SaSecurityProfile userSecurityProfile;
private SaSecurityProfile hostSecurityProfile; private SaSecurityProfile hostSecurityProfile;
private readonly List<TypeCodeDesc> securityRights = new List<TypeCodeDesc>(); private readonly List<SaSecurityRight> securityRights = new List<SaSecurityRight>();
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
[JsonConstructor]
private SbmSecurityProfile() { }
public SbmSecurityProfile(ISbmUserContext_Core userContext, bool includeHostSecurityProfile) public SbmSecurityProfile(ISbmUserContext_Core userContext, bool includeHostSecurityProfile)
{ {
this.UserContext = userContext; this.UserContext = userContext;
this.includeHostSecurityProfile = includeHostSecurityProfile; this.includeHostSecurityProfile = includeHostSecurityProfile;
Admin = new AdminProfile(this); Admin = new AdminProfile();
Manage = new ManageProfile(this); Manage = new ManageProfile();
Financial = new FinancialProfile(this); Financial = new FinancialProfile();
Contacts = new ContactsProfile(this); Contacts = new ContactsProfile();
Transaction = new TransactionsProfile(this); Transaction = new TransactionsProfile();
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -43,7 +45,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Refresh profile. // Refresh profile.
public void RefreshProfile(SbmConfigConsole configConsole, SaSecurityConsole securityConsole, SysId userId, List<TypeCodeDesc> securityRights) public void RefreshProfile(SbmSessionConsole sessionConsole, SaSecurityConsole securityConsole, SysId userId, List<SaSecurityRight> securityRights)
{ {
ClearErrorState(); ClearErrorState();
@@ -65,33 +67,33 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
} }
SaLogger.Debug($"{SysUtil.Fn} User: '{UserDisplayName}' [Id: {UserId}]" + (SysId.IsValid(previousUserId) ? ". Previous UserId: " + SysId.ToString(previousUserId) : "")); SaLogger.Debug($"{SysUtil.Fn} User: '{UserDisplayName}' [Id: {UserId}]" + (SysId.IsValid(previousUserId) ? ". Previous UserId: " + SysId.ToString(previousUserId) : ""));
RefreshProfileSettings(configConsole); RefreshProfileSettings(sessionConsole);
} }
protected void RefreshProfile(SbmConfigConsole configConsole, SaSecurityProfile userSecurityProfile, SaSecurityProfile hostSecurityProfile) protected void RefreshProfile(SbmSessionConsole sessionConsole, SaSecurityProfile userSecurityProfile, SaSecurityProfile hostSecurityProfile)
{ {
this.userSecurityProfile = userSecurityProfile; this.userSecurityProfile = userSecurityProfile;
this.hostSecurityProfile = hostSecurityProfile; this.hostSecurityProfile = hostSecurityProfile;
RefreshProfileSettings(configConsole); RefreshProfileSettings(sessionConsole);
} }
private void RefreshProfileSettings(SbmConfigConsole configConsole) private void RefreshProfileSettings(SbmSessionConsole sessionConfig)
{ {
RefreshAdminProfile(configConsole); RefreshAdminProfile(sessionConfig);
RefreshManageProfile(configConsole); RefreshManageProfile(sessionConfig);
RefreshFinancialProfile(configConsole); RefreshFinancialProfile(sessionConfig);
RefreshContactsProfile(configConsole); RefreshContactsProfile(sessionConfig);
RefreshTransactionProfile(configConsole); RefreshTransactionProfile(sessionConfig);
RefreshItemTypeProfile(configConsole); RefreshItemTypeProfile(sessionConfig);
// ToDo Commodities. // ToDo Commodities.
} }
private void ClearProfile() private void ClearProfile()
{ {
// Reset security profiles. // Reset security profiles.
Admin = new AdminProfile(this); Admin = new AdminProfile();
Manage = new ManageProfile(this); Manage = new ManageProfile();
Financial = new FinancialProfile(this); Financial = new FinancialProfile();
Contacts = new ContactsProfile(this); Contacts = new ContactsProfile();
Transaction = new TransactionsProfile(this); Transaction = new TransactionsProfile();
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -126,18 +128,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Security rights - Admin. // Security rights - Admin.
public class AdminProfile public class AdminProfile
{ {
private readonly SbmSecurityProfile securityProfile; internal AdminProfile() { }
internal AdminProfile(SbmSecurityProfile securityProfile)
{
this.securityProfile = securityProfile;
}
public bool CanManageSecurity { get; internal set; } = false; public bool CanManageSecurity { get; internal set; } = false;
public bool CanManageDatabase { get; internal set; } = false; public bool CanManageDatabase { get; internal set; } = false;
public bool CanManageReferenceData { get; internal set; } = false; public bool CanManageReferenceData { get; internal set; } = false;
public bool CanManageInterfaces { get; internal set; } = false; public bool CanManageInterfaces { get; internal set; } = false;
} }
public AdminProfile Admin { get; internal set; } public AdminProfile Admin { get; internal set; }
private void RefreshAdminProfile(SbmConfigConsole configConsole) private void RefreshAdminProfile(SbmSessionConsole sessionConfig)
{ {
Admin.CanManageSecurity = UserHasSecurityRight(Sbm.SecurityRight.Security_Admin); Admin.CanManageSecurity = UserHasSecurityRight(Sbm.SecurityRight.Security_Admin);
Admin.CanManageDatabase = UserHasSecurityRight(Sbm.SecurityRight.Database_Admin); Admin.CanManageDatabase = UserHasSecurityRight(Sbm.SecurityRight.Database_Admin);
@@ -149,16 +147,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Security rights - Manage. // Security rights - Manage.
public class ManageProfile public class ManageProfile
{ {
private readonly SbmSecurityProfile securityProfile; internal ManageProfile() { }
internal ManageProfile(SbmSecurityProfile securityProfile)
{
this.securityProfile = securityProfile;
}
public bool CanManageTasks { get; internal set; } = false; public bool CanManageTasks { get; internal set; } = false;
public bool CanManageTimesheets { get; internal set; } = false; public bool CanManageTimesheets { get; internal set; } = false;
} }
public ManageProfile Manage { get; internal set; } public ManageProfile Manage { get; internal set; }
private void RefreshManageProfile(SbmConfigConsole configConsole) private void RefreshManageProfile(SbmSessionConsole sessionConfig)
{ {
Manage.CanManageTasks = UserHasSecurityRight(Sbm.SecurityRight.TaskManager); Manage.CanManageTasks = UserHasSecurityRight(Sbm.SecurityRight.TaskManager);
Manage.CanManageTimesheets = UserHasSecurityRight(Sbm.SecurityRight.TimesheetManager); Manage.CanManageTimesheets = UserHasSecurityRight(Sbm.SecurityRight.TimesheetManager);
@@ -168,36 +162,32 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Security rights - Financials. // Security rights - Financials.
public class FinancialProfile public class FinancialProfile
{ {
private readonly SbmSecurityProfile securityProfile; internal FinancialProfile() { }
internal FinancialProfile(SbmSecurityProfile securityProfile) public bool ViewFinancials { get; internal set; }
{ public bool UpdateFinancials { get; internal set; }
this.securityProfile = securityProfile; public bool ViewCommoditySupplyFinancials { get; internal set; }
} public bool UpdateCommoditySupplyFinancials { get; internal set; }
public bool CanViewFinancials { get; internal set; } public bool ViewCommoditySalesFinancials { get; internal set; }
public bool CanUpdateFinancials { get; internal set; } public bool UpdateCommoditySalesFinancials { get; internal set; }
public bool CanViewCommoditySupplyFinancials { get; internal set; } public bool FinancialsAccessControl { get; internal set; }
public bool CanUpdateCommoditySupplyFinancials { get; internal set; }
public bool CanViewCommoditySalesFinancials { get; internal set; }
public bool CanUpdateCommoditySalesFinancials { get; internal set; }
public bool ConfigOption_AllowFinancialsAccessControl { get; internal set; }
} }
public FinancialProfile Financial { get; internal set; } public FinancialProfile Financial { get; internal set; }
private void RefreshFinancialProfile(SbmConfigConsole configConsole) private void RefreshFinancialProfile(SbmSessionConsole sessionConfig)
{ {
Financial.CanViewFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_View); Financial.ViewFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_View);
Financial.CanUpdateFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_Update); Financial.UpdateFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_Update);
Financial.CanViewCommoditySupplyFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySupply); Financial.ViewCommoditySupplyFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySupply);
Financial.CanUpdateCommoditySupplyFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySupply); Financial.UpdateCommoditySupplyFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySupply);
Financial.CanViewCommoditySalesFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySales); Financial.ViewCommoditySalesFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySales);
Financial.CanUpdateCommoditySalesFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySales); Financial.UpdateCommoditySalesFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySales);
// Config options. // Config options.
Financial.ConfigOption_AllowFinancialsAccessControl = (configConsole != null && !configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowFinancialsAccessControl)); Financial.FinancialsAccessControl = (sessionConfig != null && !sessionConfig.AllowOption(Sbm.ConfigOption.AllowFinancialsAccessControl));
} }
public bool UserCanViewFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any) public bool UserCanViewFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any)
{ {
if (!Financial.ConfigOption_AllowFinancialsAccessControl) return true; if (!Financial.FinancialsAccessControl) return true;
if (Financial.CanUpdateFinancials || Financial.CanViewFinancials) if (Financial.UpdateFinancials || Financial.ViewFinancials)
{ {
// If specific type of financial is requested, check that view is not denied. // If specific type of financial is requested, check that view is not denied.
if (financialType > 0 && IsSecurityRightDenied(Sbm.SecurityRight.Financial_ViewByType, new SysId((int)financialType))) if (financialType > 0 && IsSecurityRightDenied(Sbm.SecurityRight.Financial_ViewByType, new SysId((int)financialType)))
@@ -209,8 +199,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public bool UserCanUpdateFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any) public bool UserCanUpdateFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any)
{ {
if (!Financial.ConfigOption_AllowFinancialsAccessControl) return true; if (!Financial.FinancialsAccessControl) return true;
if (Financial.CanUpdateFinancials) if (Financial.UpdateFinancials)
{ {
// If specific type of financial is requested, check that update is not denied. // If specific type of financial is requested, check that update is not denied.
if (financialType > 0 && IsSecurityRightDenied(Sbm.SecurityRight.Financial_UpdateByType, new SysId((int)financialType))) if (financialType > 0 && IsSecurityRightDenied(Sbm.SecurityRight.Financial_UpdateByType, new SysId((int)financialType)))
@@ -242,35 +232,27 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Security rights - Contacts. // Security rights - Contacts.
public class ContactsProfile public class ContactsProfile
{ {
private readonly SbmSecurityProfile securityProfile; internal ContactsProfile() { }
internal ContactsProfile(SbmSecurityProfile securityProfile) public bool Create { get; internal set; } = false;
{ public bool Update { get; internal set; } = false;
this.securityProfile = securityProfile;
}
public bool CanCreate { get; internal set; } = false;
public bool CanUpdate { get; internal set; } = false;
} }
public ContactsProfile Contacts { get; internal set; } public ContactsProfile Contacts { get; internal set; }
public bool UserCanCreateContacts { get { return Contacts.CanCreate; } } public bool UserCanCreateContacts() { return Contacts.Create; }
public bool UserCanUpdateContacts { get { return Contacts.CanUpdate; } } public bool UserCanUpdateContacts() { return Contacts.Update; }
private void RefreshContactsProfile(SbmConfigConsole configConsole) private void RefreshContactsProfile(SbmSessionConsole sessionConfig)
{ {
Contacts.CanUpdate = (UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Update)); Contacts.Update = (UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Update));
Contacts.CanCreate = (Contacts.CanUpdate || UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Create)); Contacts.Create = (Contacts.Update || UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Create));
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Security rights - Transactions. // Security rights - Transactions.
public class TransactionsProfile public class TransactionsProfile
{ {
private readonly SbmSecurityProfile securityProfile; internal TransactionsProfile() { }
internal TransactionsProfile(SbmSecurityProfile securityProfile) public bool Create { get; internal set; } = false;
{ public bool Update { get; internal set; } = false;
this.securityProfile = securityProfile; public bool CanUpdateTransactionTypeStatusCat(SbmSecurityProfile securityProfile, Sbm.TransactionType transactionType, SbmTransaction.StatusCat transactionStatusCat)
}
public bool CanCreate { get; internal set; } = false;
public bool CanUpdate { get; internal set; } = false;
public bool CanUpdateTransactionTypeStatusCat(Sbm.TransactionType transactionType, SbmTransaction.StatusCat transactionStatusCat)
{ {
SysId transactionTypeStatusCatId = SbmTransaction.GetTransactionTypeStatusId(transactionType, transactionStatusCat); SysId transactionTypeStatusCatId = SbmTransaction.GetTransactionTypeStatusId(transactionType, transactionStatusCat);
@@ -297,10 +279,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
} }
} }
public TransactionsProfile Transaction { get; internal set; } public TransactionsProfile Transaction { get; internal set; }
private void RefreshTransactionProfile(SbmConfigConsole configConsole) private void RefreshTransactionProfile(SbmSessionConsole sessionConfig)
{ {
Transaction.CanUpdate = (UserHasSecurityRight(Sbm.SecurityRight.Transaction_Update)); Transaction.Update = (UserHasSecurityRight(Sbm.SecurityRight.Transaction_Update));
Transaction.CanCreate = (Transaction.CanUpdate || UserHasSecurityRight(Sbm.SecurityRight.Transaction_View)); Transaction.Create = (Transaction.Update || UserHasSecurityRight(Sbm.SecurityRight.Transaction_View));
} }
public bool UserCanAccessTransactionsOfType(Sbm.TransactionType transactionType) public bool UserCanAccessTransactionsOfType(Sbm.TransactionType transactionType)
@@ -317,40 +299,40 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public class ItemTypesProfile public class ItemTypesProfile
{ {
internal ItemTypesProfile() { } internal ItemTypesProfile() { }
public bool CanCreate { get; internal set; } public bool Create { get; internal set; }
public bool CanUpdate { get; internal set; } public bool Update { get; internal set; }
public bool CanRemove { get; internal set; } public bool Remove { get; internal set; }
// Config options. // Config options.
public bool ConfigOption_AllowProcesses { get; internal set; } public bool Processes { get; internal set; }
public bool ConfigOption_AllowContacts { get; internal set; } public bool Contacts { get; internal set; }
public bool ConfigOption_AllowCommodities { get; internal set; } public bool Commodities { get; internal set; }
public bool ConfigOption_AllowPortfolios { get; internal set; } public bool Portfolios { get; internal set; }
public bool ConfigOption_AllowPriceSets { get; internal set; } public bool PriceSets { get; internal set; }
public bool ConfigOption_CommodityCustomers { get; internal set; } public bool CommodityCustomers { get; internal set; }
public bool ConfigOption_CommoditySuppliers { get; internal set; } public bool CommoditySuppliers { get; internal set; }
public bool ConfigOption_AllowTransactions { get; internal set; } public bool Transactions { get; internal set; }
public bool ConfigOption_AllowAssets { get; internal set; } public bool Assets { get; internal set; }
public bool ConfigOption_AllowVehicles { get; internal set; } public bool Vehicles { get; internal set; }
public bool ConfigOption_AllowStockLocations { get; internal set; } public bool StockLocations { get; internal set; }
public bool ConfigOption_AllowStockContainers { get; internal set; } public bool StockContainers { get; internal set; }
public bool ConfigOption_AllowStockControl { get; internal set; } public bool StockControl { get; internal set; }
} }
public ItemTypesProfile ItemType { get; } = new ItemTypesProfile(); public ItemTypesProfile ItemType { get; } = new ItemTypesProfile();
private void RefreshItemTypeProfile(SbmConfigConsole configConsole) private void RefreshItemTypeProfile(SbmSessionConsole sessionConfig)
{ {
ItemType.ConfigOption_AllowProcesses = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowProcesses); ItemType.Processes = sessionConfig.AllowOption(Sbm.ConfigOption.AllowProcesses);
ItemType.ConfigOption_AllowContacts = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowContacts); ItemType.Contacts = sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts);
ItemType.ConfigOption_AllowCommodities = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowCommodities); ItemType.Commodities = sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities);
ItemType.ConfigOption_AllowPortfolios = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowPortfolios); ItemType.Portfolios = sessionConfig.AllowOption(Sbm.ConfigOption.AllowPortfolios);
ItemType.ConfigOption_AllowPriceSets = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowPriceSets); ItemType.PriceSets = sessionConfig.AllowOption(Sbm.ConfigOption.AllowPriceSets);
ItemType.ConfigOption_CommodityCustomers = configConsole.AllowOption(UserContext, Sbm.ConfigOption.CommodityCustomers); ItemType.CommodityCustomers = sessionConfig.AllowOption(Sbm.ConfigOption.CommodityCustomers);
ItemType.ConfigOption_CommoditySuppliers = configConsole.AllowOption(UserContext, Sbm.ConfigOption.CommoditySuppliers); ItemType.CommoditySuppliers = sessionConfig.AllowOption(Sbm.ConfigOption.CommoditySuppliers);
ItemType.ConfigOption_AllowTransactions = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowTransactions); ItemType.Transactions = sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions);
ItemType.ConfigOption_AllowAssets = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowAssets); ItemType.Assets = sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets);
ItemType.ConfigOption_AllowVehicles = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowVehicles); ItemType.Vehicles = sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles);
ItemType.ConfigOption_AllowStockLocations = configConsole.GetStockControlConfig(UserContext).AllowStockLocations(); ItemType.StockLocations = sessionConfig.GetStockControlConfig().AllowStockLocations();
ItemType.ConfigOption_AllowStockContainers = configConsole.GetStockControlConfig(UserContext).AllowStockContainers(); ItemType.StockContainers = sessionConfig.GetStockControlConfig().AllowStockContainers();
ItemType.ConfigOption_AllowStockControl = configConsole.GetStockControlConfig(UserContext).AllowStockControl(); ItemType.StockControl = sessionConfig.GetStockControlConfig().AllowStockControl();
} }
public bool ItemTypeIsAllowed(Sbm.ItemType itemType) public bool ItemTypeIsAllowed(Sbm.ItemType itemType)
@@ -363,37 +345,37 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//case Sbm.ItemType.Language: //case Sbm.ItemType.Language:
//case Sbm.ItemType.TaxCode: //case Sbm.ItemType.TaxCode:
//case Sbm.ItemType.UnitMeasure: //case Sbm.ItemType.UnitMeasure:
case Sbm.ItemType.Process: return ItemType.ConfigOption_AllowProcesses; case Sbm.ItemType.Process: return ItemType.Processes;
case Sbm.ItemType.Affiliate: case Sbm.ItemType.Affiliate:
case Sbm.ItemType.Address: return ItemType.ConfigOption_AllowContacts; case Sbm.ItemType.Address: return ItemType.Contacts;
case Sbm.ItemType.Commodity: return ItemType.ConfigOption_AllowCommodities; case Sbm.ItemType.Commodity: return ItemType.Commodities;
case Sbm.ItemType.PortfolioItem: return ItemType.ConfigOption_AllowPortfolios; case Sbm.ItemType.PortfolioItem: return ItemType.Portfolios;
case Sbm.ItemType.Location: return ItemType.ConfigOption_AllowStockLocations; case Sbm.ItemType.Location: return ItemType.StockLocations;
case Sbm.ItemType.Container: case Sbm.ItemType.Container:
case Sbm.ItemType.ContainerItem: return ItemType.ConfigOption_AllowStockContainers; case Sbm.ItemType.ContainerItem: return ItemType.StockContainers;
case Sbm.ItemType.Movement: case Sbm.ItemType.Movement:
case Sbm.ItemType.StockLevel: return ItemType.ConfigOption_AllowStockControl; case Sbm.ItemType.StockLevel: return ItemType.StockControl;
case Sbm.ItemType.PriceSet: case Sbm.ItemType.PriceSet:
case Sbm.ItemType.Price: return ItemType.ConfigOption_AllowPriceSets; case Sbm.ItemType.Price: return ItemType.PriceSets;
case Sbm.ItemType.CommodityCustomer: return ItemType.ConfigOption_CommodityCustomers; case Sbm.ItemType.CommodityCustomer: return ItemType.CommodityCustomers;
case Sbm.ItemType.CommoditySupplier: return ItemType.ConfigOption_CommoditySuppliers; case Sbm.ItemType.CommoditySupplier: return ItemType.CommoditySuppliers;
//case Sbm.ItemType.Association: //case Sbm.ItemType.Association:
case Sbm.ItemType.Transaction: case Sbm.ItemType.Transaction:
case Sbm.ItemType.Requirement: case Sbm.ItemType.Requirement:
case Sbm.ItemType.Constituent: return ItemType.ConfigOption_AllowTransactions; case Sbm.ItemType.Constituent: return ItemType.Transactions;
//case Sbm.ItemType.SystemAccount: //case Sbm.ItemType.SystemAccount:
//case Sbm.ItemType.SystemUser: //case Sbm.ItemType.SystemUser:
//case Sbm.ItemType.SystemAccountUser: //case Sbm.ItemType.SystemAccountUser:
case Sbm.ItemType.AssetCategory: case Sbm.ItemType.AssetCategory:
case Sbm.ItemType.AssetCategoryProcess: case Sbm.ItemType.AssetCategoryProcess:
case Sbm.ItemType.Asset: case Sbm.ItemType.Asset:
case Sbm.ItemType.AssetProcess: return ItemType.ConfigOption_AllowAssets; case Sbm.ItemType.AssetProcess: return ItemType.Assets;
case Sbm.ItemType.VehicleClass: case Sbm.ItemType.VehicleClass:
case Sbm.ItemType.Vehicle: case Sbm.ItemType.Vehicle:
case Sbm.ItemType.VehicleEvent: case Sbm.ItemType.VehicleEvent:
case Sbm.ItemType.VehicleFeature: return ItemType.ConfigOption_AllowVehicles; case Sbm.ItemType.VehicleFeature: return ItemType.Vehicles;
case Sbm.ItemType.CommodityProcess: return ItemType.ConfigOption_AllowProcesses; case Sbm.ItemType.CommodityProcess: return ItemType.Processes;
case Sbm.ItemType.RequirementProcess: return ItemType.ConfigOption_AllowProcesses; case Sbm.ItemType.RequirementProcess: return ItemType.Processes;
//case Sbm.ItemType.Interface: //case Sbm.ItemType.Interface:
} }
return true; return true;
@@ -1,172 +0,0 @@
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
using Sarand.BusinessMgr.Net.Standard.Base.Core;
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.ItemOptions;
using Sarand.Net.Standard.Base.Security;
using Sarand.Net.Standard.Base.Utils;
using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
//=======================================================================
public abstract class SbmSessionProfile
{
//-------------------------------------------------------------------
// Definitions.
internal class SbmUserContext_Internal : SbmUserContext
{
// Construction.
public SbmUserContext_Internal(SbmSessionContext sessionContext) :
base(sessionContext)
{
}
// Refresh context.
public void RefreshUser(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
{
SetUserData(securityItemUser, affiliateUser, supervisedOwners);
}
public void ClearUser()
{
ClearUserData();
}
public void RefreshSecurityProfile(SbmSecurityProfile securityProfile)
{
SetSecurityProfile(securityProfile);
}
public void RefreshOrganisation(SysId affiliateIdOrganisation)
{
SetOrganisationData(affiliateIdOrganisation);
}
public void ClearOrganisation()
{
ClearOrganisationData();
}
}
//-------------------------------------------------------------------
// Data members.
private readonly SbmUserContext_Internal userContext;
//-------------------------------------------------------------------
// Protected Construction - use derived objects.
protected SbmSessionProfile(SbmSessionContext sessionContext, SysId affiliateIdUser)
{
userContext = new SbmUserContext_Internal(sessionContext);
SysParamCache = new SbmSysParamCache(userContext, affiliateIdUser);
}
//-------------------------------------------------------------------
// Properties.
public SbmUserContext UserContext { get { return userContext; } }
public SbmSessionContext SessionContext { get { return userContext.SessionContext; } }
public ISbmSecurityProfile_Core SecurityProfile { get { return UserContext.SecurityProfile_Core; } }
protected SaItemOption.Cache OrganisationConfigOptionsCache { get { return UserContext.OrganisationConfigOptionsCache; } }
// User parameters.
protected SbmSysParamCache SysParamCache { get; }
//-------------------------------------------------------------------
// O w n e r O r g a n i s a t i o n
//-------------------------------------------------------------------
public abstract bool SetSelectedOwner(SysId affiliateId);
protected void RefreshOwnerOrganisation(SysId affiliateIdOrganisation)
{
if (SysId.IsValid(affiliateIdOrganisation))
userContext.RefreshOrganisation(affiliateIdOrganisation);
else userContext.ClearOrganisation();
}
//-------------------------------------------------------------------
// U s e r S e s s i o n
//-------------------------------------------------------------------
public bool StartUserSession(SysId userId, List<TypeCodeDesc> securityRights)
{
// Clear existing User details.
ClearUserSession();
using (SbmConfigConsole configConsole = SbmGlobals.Application.CreateConfigConsole(UserContext.SessionContext))
using (SaSecurityConsole securityConsole = SbmGlobals.Application.CreateSecurityConsole(UserContext))
using (SbmAccountMgr accountMgr = CreateAccountMgr())
{
// Security item.
SaSecurityItem securityItemUser = securityConsole.GetSecurityItemById(SaSecurity.ItemType.User, userId);
SbmAffiliate affiliateUser = accountMgr.GetAffiliateByUserId(userId);
if (affiliateUser == null)
{
SaLogger.Warn($"{SysUtil.Fn} Unable to retrieve affiliate for UserId: {SysId.ToString(userId)}");
return false;
}
List<SysIdString> userSupervisedOwners = accountMgr.GetAffiliatesSupervisedBy(affiliateUser.Id);
userContext.RefreshUser(securityItemUser, affiliateUser, userSupervisedOwners);
// Populate security rights.
SecurityProfile.RefreshProfile(configConsole, securityConsole, userId, securityRights);
// Reinstate previous owner if defined and verify that it is in the supervised list.
SysId affiliateIdOwner = UserContext.Organisation.AffiliateId;
if (!userSupervisedOwners.Exists(item => item.Id.Equals(affiliateIdOwner)))
affiliateIdOwner = new SysId();
// If not otherwise defined, select first owner in supervised list.
if (!SysId.IsValid(affiliateIdOwner) && userSupervisedOwners.Count > 0)
affiliateIdOwner = userSupervisedOwners[0].Id;
SetSelectedOwner(affiliateIdOwner);
}
// ToDo StartUserSession Reinstate previous default view.
return true;
}
public void ClearUserSession()
{
// Save user parameters.
SysParamCache.Store();
// Reset user details.
userContext.ClearUser();
SysParamCache.Clear();
}
//-------------------------------------------------------------------
// Save the user's session parameters.
public bool SaveSessionProfile()
{
bool success = false;
// Update the list of parameters that we know about to the database.
success = SysParamCache.Store();
// Clear down the list of parameters for this user.
SysParamCache.Clear();
return success;
}
//-------------------------------------------------------------------
// D a t a b a s e
//-------------------------------------------------------------------
// Database Update
public DbUpdateInfo DbUpdateInfo
{
get
{
return new DbUpdateInfo(SecurityProfile.UserId, SecurityProfile.UserDisplayName, SacsSystem.ComputerName);
}
}
public SaSecurityConsole SaSecurityConsole { get; private set; }
// Data managers.
protected SbmAccountMgr CreateAccountMgr()
{
return SbmGlobals.System.CreateAccountMgr(UserContext);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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 // R e g i s t e r C o d e T y p e s
//------------------------------------------------------------------- //-------------------------------------------------------------------
public static void RegisterCodeTypes(SbmConfigConsole configConsole, SaCodeTypeConsole codeTypeConsole, ISbmUserContext_Core userContext) public static void RegisterCodeTypes(SbmSessionConsole sessionConfig, SaCodeTypeConsole codeTypeConsole)
{ {
//--------------------------------------------------------------- //---------------------------------------------------------------
// C o m m o d i t i e s // C o m m o d i t i e s
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities))
{ {
// Commodity category. // Commodity category.
SaCodeTypeDfn codeTypeCommodityCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.CommodityCategory), 12); SaCodeTypeDfn codeTypeCommodityCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.CommodityCategory), 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityCategory); codeTypeConsole.RegisterCodeType(codeTypeCommodityCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityCategory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityCategory)); codeTypeConsole.RegisterCodesOfType(codeTypeCommodityCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityCategory));
// Commodity range. // Commodity range.
SaCodeTypeDfn codeTypeCommodityRange = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityRange), codeTypes.GetDescForType(Sbm.ApplCodeType.CommodityRange), 12); SaCodeTypeDfn codeTypeCommodityRange = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityRange), codeTypes.GetDescForType(Sbm.ApplCodeType.CommodityRange), 12);
@@ -62,184 +62,184 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//codeTypeConsole.RegisterCodeType(codeTypeCommodityDelivery); //codeTypeConsole.RegisterCodeType(codeTypeCommodityDelivery);
// Commodity material. // Commodity material.
String commodityMaterialLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material"); String commodityMaterialLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material");
if (!commodityMaterialLabel.ContainsCI("Commodity")) commodityMaterialLabel = "Commodity " + commodityMaterialLabel; if (!commodityMaterialLabel.ContainsCI("Commodity")) commodityMaterialLabel = "Commodity " + commodityMaterialLabel;
SaCodeTypeDfn codeTypeCommodityMaterial = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityMaterial), commodityMaterialLabel, 12); SaCodeTypeDfn codeTypeCommodityMaterial = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityMaterial), commodityMaterialLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityMaterial); codeTypeConsole.RegisterCodeType(codeTypeCommodityMaterial);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityMaterial.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityMaterial)); codeTypeConsole.RegisterCodesOfType(codeTypeCommodityMaterial.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityMaterial));
// Commodity finish. // Commodity finish.
String commodityFinishLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish"); String commodityFinishLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish");
if (!commodityFinishLabel.ContainsCI("Commodity")) commodityFinishLabel = "Commodity " + commodityFinishLabel; if (!commodityFinishLabel.ContainsCI("Commodity")) commodityFinishLabel = "Commodity " + commodityFinishLabel;
SaCodeTypeDfn codeTypeCommodityFinish = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityFinish), commodityFinishLabel, 12); SaCodeTypeDfn codeTypeCommodityFinish = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityFinish), commodityFinishLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityFinish); codeTypeConsole.RegisterCodeType(codeTypeCommodityFinish);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityFinish.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityFinish)); codeTypeConsole.RegisterCodesOfType(codeTypeCommodityFinish.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityFinish));
// Commodity promotion. // Commodity promotion.
String commodityPromotionLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion"); String commodityPromotionLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion");
if (!commodityPromotionLabel.ContainsCI("Commodity")) commodityPromotionLabel = "Commodity " + commodityPromotionLabel; if (!commodityPromotionLabel.ContainsCI("Commodity")) commodityPromotionLabel = "Commodity " + commodityPromotionLabel;
SaCodeTypeDfn codeTypeCommodityPromotion = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityPromotion), commodityPromotionLabel, 12); SaCodeTypeDfn codeTypeCommodityPromotion = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityPromotion), commodityPromotionLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityPromotion); codeTypeConsole.RegisterCodeType(codeTypeCommodityPromotion);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityPromotion.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityPromotion)); codeTypeConsole.RegisterCodesOfType(codeTypeCommodityPromotion.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityPromotion));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// P r o c e s s e s // P r o c e s s e s
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowProcesses)) if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowProcesses))
{ {
// Process type. // Process type.
SaCodeTypeDfn codeTypeProcessType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ProcessType), codeTypes.GetDescForType(Sbm.ApplCodeType.ProcessType), 12); SaCodeTypeDfn codeTypeProcessType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ProcessType), codeTypes.GetDescForType(Sbm.ApplCodeType.ProcessType), 12);
codeTypeConsole.RegisterCodeType(codeTypeProcessType); codeTypeConsole.RegisterCodeType(codeTypeProcessType);
codeTypeConsole.RegisterCodesOfType(codeTypeProcessType.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.ProcessType)); codeTypeConsole.RegisterCodesOfType(codeTypeProcessType.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.ProcessType));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// R e f e r r a l // R e f e r r a l
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null) if (sessionConfig != null)
{ {
// Refer type. // Refer type.
SaCodeTypeDfn codeTypeReferType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ReferType), codeTypes.GetDescForType(Sbm.ApplCodeType.ReferType), 12); SaCodeTypeDfn codeTypeReferType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ReferType), codeTypes.GetDescForType(Sbm.ApplCodeType.ReferType), 12);
codeTypeReferType.AllowSequence = true; codeTypeReferType.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeReferType); codeTypeConsole.RegisterCodeType(codeTypeReferType);
codeTypeConsole.RegisterCodesOfType(codeTypeReferType.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.ReferType)); codeTypeConsole.RegisterCodesOfType(codeTypeReferType.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.ReferType));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// T a s k s // T a s k s
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTasks)) if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowTasks))
{ {
// Task category. // Task category.
SaCodeTypeDfn codeTypeTaskCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.TaskCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.TaskCategory), 12); SaCodeTypeDfn codeTypeTaskCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.TaskCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.TaskCategory), 12);
codeTypeTaskCategory.AllowSequence = true; codeTypeTaskCategory.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeTaskCategory); codeTypeConsole.RegisterCodeType(codeTypeTaskCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeTaskCategory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.TaskCategory)); codeTypeConsole.RegisterCodesOfType(codeTypeTaskCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.TaskCategory));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// A s s e t s // A s s e t s
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowAssets)) if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets))
{ {
// Asset sell category. // Asset sell category.
SaCodeTypeDfn codeTypeAssetSellCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AssetSellCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.AssetSellCategory), 8); SaCodeTypeDfn codeTypeAssetSellCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AssetSellCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.AssetSellCategory), 8);
codeTypeConsole.RegisterCodeType(codeTypeAssetSellCategory); codeTypeConsole.RegisterCodeType(codeTypeAssetSellCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeAssetSellCategory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.AssetSellCategory)); codeTypeConsole.RegisterCodesOfType(codeTypeAssetSellCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.AssetSellCategory));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// V e h i c l e s // V e h i c l e s
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowVehicles)) if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles))
{ {
// Vehicle category. // Vehicle category.
SaCodeTypeDfn codeTypeVehicleCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleCategory), 8); SaCodeTypeDfn codeTypeVehicleCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleCategory), 8);
codeTypeConsole.RegisterCodeType(codeTypeVehicleCategory); codeTypeConsole.RegisterCodeType(codeTypeVehicleCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleCategory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleCategory)); codeTypeConsole.RegisterCodesOfType(codeTypeVehicleCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleCategory));
// Vehicle make. // Vehicle make.
SaCodeTypeDfn codeTypeVehicleMake = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleMake), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleMake), 8); SaCodeTypeDfn codeTypeVehicleMake = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleMake), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleMake), 8);
codeTypeConsole.RegisterCodeType(codeTypeVehicleMake); codeTypeConsole.RegisterCodeType(codeTypeVehicleMake);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleMake.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleMake)); codeTypeConsole.RegisterCodesOfType(codeTypeVehicleMake.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleMake));
// Vehicle service history. // Vehicle service history.
SaCodeTypeDfn codeTypeVehicleServiceHistory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleServiceHistory), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleServiceHistory), 12); SaCodeTypeDfn codeTypeVehicleServiceHistory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleServiceHistory), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleServiceHistory), 12);
codeTypeConsole.RegisterCodeType(codeTypeVehicleServiceHistory); codeTypeConsole.RegisterCodeType(codeTypeVehicleServiceHistory);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleServiceHistory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleServiceHistory)); codeTypeConsole.RegisterCodesOfType(codeTypeVehicleServiceHistory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleServiceHistory));
// Vehicle insurance. // Vehicle insurance.
SaCodeTypeDfn codeTypeVehicleInsurance = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleInsurance), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleInsurance), 3); SaCodeTypeDfn codeTypeVehicleInsurance = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleInsurance), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleInsurance), 3);
codeTypeConsole.RegisterCodeType(codeTypeVehicleInsurance); codeTypeConsole.RegisterCodeType(codeTypeVehicleInsurance);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleInsurance.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleInsurance)); codeTypeConsole.RegisterCodesOfType(codeTypeVehicleInsurance.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleInsurance));
// Vehicle tacho. // Vehicle tacho.
SaCodeTypeDfn codeTypeVehicleTacho = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleTacho), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleTacho), 8); SaCodeTypeDfn codeTypeVehicleTacho = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleTacho), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleTacho), 8);
//codeTypeConsole.RegisterCodeType(codeTypeVehicleTacho); //codeTypeConsole.RegisterCodeType(codeTypeVehicleTacho);
//codeTypeConsole.RegisterCodesOfType(codeTypeVehicleTacho.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleTacho)); //codeTypeConsole.RegisterCodesOfType(codeTypeVehicleTacho.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleTacho));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// H P I V e h i c l e s // H P I V e h i c l e s
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null && configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (int)Sbm.InterfaceType_System.Hpi)) if (sessionConfig != null && sessionConfig.AllowInterface(SaInterfaceCategory.System, (int)Sbm.InterfaceType_System.Hpi))
{ {
// HPI vehicle make. // HPI vehicle make.
SaCodeTypeDfn codeTypeHpiVehicleMake = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleMake), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleMake), 12); SaCodeTypeDfn codeTypeHpiVehicleMake = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleMake), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleMake), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleMake); codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleMake);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleMake.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleMake)); codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleMake.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleMake));
// HPI vehicle model. // HPI vehicle model.
SaCodeTypeDfn codeTypeHpiVehicleModel = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleModel), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleModel), 12); SaCodeTypeDfn codeTypeHpiVehicleModel = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleModel), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleModel), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleModel); codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleModel);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleModel.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleModel)); codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleModel.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleModel));
// HPI vehicle colour. // HPI vehicle colour.
SaCodeTypeDfn codeTypeHpiVehicleColour = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleColour), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleColour), 12); SaCodeTypeDfn codeTypeHpiVehicleColour = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleColour), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleColour), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleColour); codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleColour);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleColour.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleColour)); codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleColour.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleColour));
// HPI vehicle fuel. // HPI vehicle fuel.
SaCodeTypeDfn codeTypeHpiVehicleFuel = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleFuel), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleFuel), 12); SaCodeTypeDfn codeTypeHpiVehicleFuel = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleFuel), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleFuel), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleFuel); codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleFuel);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleFuel.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleFuel)); codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleFuel.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleFuel));
// HPI vehicle transmission. // HPI vehicle transmission.
SaCodeTypeDfn codeTypeHpiVehicleTrans = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleTrans), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleTrans), 12); SaCodeTypeDfn codeTypeHpiVehicleTrans = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleTrans), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleTrans), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleTrans); codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleTrans);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleTrans.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleTrans)); codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleTrans.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleTrans));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// C o n t a c t M a n a g e m e n t // C o n t a c t M a n a g e m e n t
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null) if (sessionConfig != null)
{ {
// Account manager. // Account manager.
String accountManagerLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_AccountManagerCode, "Account manager"); String accountManagerLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountManagerCode, "Account manager");
SaCodeTypeDfn codeTypeAccountManager = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountManager), accountManagerLabel, 12, "Account management group"); SaCodeTypeDfn codeTypeAccountManager = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountManager), accountManagerLabel, 12, "Account management group");
codeTypeConsole.RegisterCodeType(codeTypeAccountManager); codeTypeConsole.RegisterCodeType(codeTypeAccountManager);
// Account handler. // Account handler.
String accountHandlerLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_AccountHandlerCode, "Account handler"); String accountHandlerLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountHandlerCode, "Account handler");
SaCodeTypeDfn codeTypeAccountHandler = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountHandler), accountHandlerLabel, 12, "Account handling group"); SaCodeTypeDfn codeTypeAccountHandler = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountHandler), accountHandlerLabel, 12, "Account handling group");
codeTypeConsole.RegisterCodeType(codeTypeAccountHandler); codeTypeConsole.RegisterCodeType(codeTypeAccountHandler);
// Account type. // Account type.
String accountTypeLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_AccountTypeCode, "Account type"); String accountTypeLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountTypeCode, "Account type");
SaCodeTypeDfn codeTypeAccountType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountType), accountTypeLabel, 12, "Grouping by nature of business"); SaCodeTypeDfn codeTypeAccountType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountType), accountTypeLabel, 12, "Grouping by nature of business");
codeTypeConsole.RegisterCodeType(codeTypeAccountType); codeTypeConsole.RegisterCodeType(codeTypeAccountType);
// Account rating. // Account rating.
String accountRatingLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_AccountRatingCode, "Account rating"); String accountRatingLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_AccountRatingCode, "Account rating");
SaCodeTypeDfn codeTypeAccountRating = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountRating), accountRatingLabel, 12); SaCodeTypeDfn codeTypeAccountRating = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AccountRating), accountRatingLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeAccountRating); codeTypeConsole.RegisterCodeType(codeTypeAccountRating);
// Contact title. // Contact title.
String contactTitleLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Affiliate_Title, "Contact title"); String contactTitleLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Affiliate_Title, "Contact title");
SaCodeTypeDfn codeTypeContactTitle = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactTitle), contactTitleLabel, 12); SaCodeTypeDfn codeTypeContactTitle = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactTitle), contactTitleLabel, 12);
codeTypeContactTitle.AllowSequence = true; codeTypeContactTitle.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeContactTitle); codeTypeConsole.RegisterCodeType(codeTypeContactTitle);
codeTypeConsole.RegisterCodesOfType(codeTypeContactTitle.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.ContactTitle)); codeTypeConsole.RegisterCodesOfType(codeTypeContactTitle.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.ContactTitle));
// Contact area. // Contact area.
String contactAreaLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_ContactAreaCode, "Contact area"); String contactAreaLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactAreaCode, "Contact area");
SaCodeTypeDfn codeTypeContactArea = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactArea), contactAreaLabel, 12, "Geographic region"); SaCodeTypeDfn codeTypeContactArea = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactArea), contactAreaLabel, 12, "Geographic region");
codeTypeConsole.RegisterCodeType(codeTypeContactArea); codeTypeConsole.RegisterCodeType(codeTypeContactArea);
// Contact handler. // Contact handler.
String contactHandlerLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_ContactHandlerCode, "Contact handler"); String contactHandlerLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactHandlerCode, "Contact handler");
SaCodeTypeDfn codeTypeContactHandler = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactHandler), contactHandlerLabel, 12); SaCodeTypeDfn codeTypeContactHandler = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactHandler), contactHandlerLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeContactHandler); codeTypeConsole.RegisterCodeType(codeTypeContactHandler);
// Contact method. // Contact method.
String contactMethodLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_ContactMethodCode, "Contact method"); String contactMethodLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactMethodCode, "Contact method");
SaCodeTypeDfn codeTypeContactMethod = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactMethod), contactMethodLabel, 12); SaCodeTypeDfn codeTypeContactMethod = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactMethod), contactMethodLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeContactMethod); codeTypeConsole.RegisterCodeType(codeTypeContactMethod);
// Contact call cycle. // Contact call cycle.
String contactCallCycleLabel = configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_ContactCallCycleCode, "Contact call cycle"); String contactCallCycleLabel = sessionConfig.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactCallCycleCode, "Contact call cycle");
SaCodeTypeDfn codeTypeContactCallCycle = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactCallCycle), contactCallCycleLabel, 12); SaCodeTypeDfn codeTypeContactCallCycle = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ContactCallCycle), contactCallCycleLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeContactCallCycle); 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 // 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"); FlagDfn estimateDefaultFlag = new FlagDfn((Byte)Sbm.ApplCodeFlag.EstimateType_QuoteDefault, "Default to quote", "Default");
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.EstimateSalesQuotesByCosts)) if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.EstimateSalesQuotesByCosts))
{ {
// Cost per unit. // Cost per unit.
SaCodeTypeDfn codeTypeCostPerUnit = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CostPerUnit), codeTypes.GetDescForType(Sbm.ApplCodeType.CostPerUnit), 12); SaCodeTypeDfn codeTypeCostPerUnit = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CostPerUnit), codeTypes.GetDescForType(Sbm.ApplCodeType.CostPerUnit), 12);
@@ -264,85 +264,85 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
codeTypeCostPerUnit.FlagDefinitions.Add(new FlagDfn(4, "Flag 4", "#4")); codeTypeCostPerUnit.FlagDefinitions.Add(new FlagDfn(4, "Flag 4", "#4"));
#endif #endif
codeTypeConsole.RegisterCodeType(codeTypeCostPerUnit); codeTypeConsole.RegisterCodeType(codeTypeCostPerUnit);
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerUnit.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerUnit)); codeTypeConsole.RegisterCodesOfType(codeTypeCostPerUnit.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerUnit));
// Cost per job. // Cost per job.
SaCodeTypeDfn codeTypeCostPerJob = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CostPerJob), codeTypes.GetDescForType(Sbm.ApplCodeType.CostPerJob), 12); SaCodeTypeDfn codeTypeCostPerJob = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CostPerJob), codeTypes.GetDescForType(Sbm.ApplCodeType.CostPerJob), 12);
codeTypeCostPerJob.AllowSequence = true; codeTypeCostPerJob.AllowSequence = true;
codeTypeCostPerJob.FlagDefinitions.Add(estimateDefaultFlag); codeTypeCostPerJob.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeCostPerJob); codeTypeConsole.RegisterCodeType(codeTypeCostPerJob);
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerJob.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerJob)); codeTypeConsole.RegisterCodesOfType(codeTypeCostPerJob.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerJob));
} }
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.EstimateLabourByMinutes)) if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.EstimateLabourByMinutes))
{ {
// Labour cost per unit. // Labour cost per unit.
SaCodeTypeDfn codeTypeLabourPerUnit = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.LabourPerUnit), codeTypes.GetDescForType(Sbm.ApplCodeType.LabourPerUnit), 12); SaCodeTypeDfn codeTypeLabourPerUnit = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.LabourPerUnit), codeTypes.GetDescForType(Sbm.ApplCodeType.LabourPerUnit), 12);
codeTypeLabourPerUnit.AllowSequence = true; codeTypeLabourPerUnit.AllowSequence = true;
codeTypeLabourPerUnit.FlagDefinitions.Add(estimateDefaultFlag); codeTypeLabourPerUnit.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeLabourPerUnit); codeTypeConsole.RegisterCodeType(codeTypeLabourPerUnit);
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerUnit.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerUnit)); codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerUnit.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerUnit));
// Labour cost per job. // Labour cost per job.
SaCodeTypeDfn codeTypeLabourPerJob = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.LabourPerJob), codeTypes.GetDescForType(Sbm.ApplCodeType.LabourPerJob), 12); SaCodeTypeDfn codeTypeLabourPerJob = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.LabourPerJob), codeTypes.GetDescForType(Sbm.ApplCodeType.LabourPerJob), 12);
codeTypeLabourPerJob.AllowSequence = true; codeTypeLabourPerJob.AllowSequence = true;
codeTypeLabourPerJob.FlagDefinitions.Add(estimateDefaultFlag); codeTypeLabourPerJob.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeLabourPerJob); codeTypeConsole.RegisterCodeType(codeTypeLabourPerJob);
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerJob.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerJob)); codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerJob.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerJob));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// D e l i v e r y // D e l i v e r y
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null && userContext.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.SalesOrder_DispatchDetails)) if (sessionConfig != null && sessionConfig.UserContext.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.SalesOrder_DispatchDetails))
{ {
// Delivery status. // Delivery status.
SaCodeTypeDfn codeTypeDeliveryStatus = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryStatus), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryStatus), 3); SaCodeTypeDfn codeTypeDeliveryStatus = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryStatus), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryStatus), 3);
codeTypeDeliveryStatus.AllowSequence = true; codeTypeDeliveryStatus.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryStatus); codeTypeConsole.RegisterCodeType(codeTypeDeliveryStatus);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryStatus.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryStatus)); codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryStatus.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryStatus));
// Delivery type. // Delivery type.
SaCodeTypeDfn codeTypeDeliveryType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryType), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryType), 12); SaCodeTypeDfn codeTypeDeliveryType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryType), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryType), 12);
codeTypeDeliveryType.AllowSequence = true; codeTypeDeliveryType.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryType); codeTypeConsole.RegisterCodeType(codeTypeDeliveryType);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryType.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryType)); codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryType.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryType));
// Delivery method. // Delivery method.
SaCodeTypeDfn codeTypeDeliveryMethod = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryMethod), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryMethod), 12); SaCodeTypeDfn codeTypeDeliveryMethod = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryMethod), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryMethod), 12);
codeTypeDeliveryMethod.AllowSequence = true; codeTypeDeliveryMethod.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryMethod); codeTypeConsole.RegisterCodeType(codeTypeDeliveryMethod);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryMethod.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryMethod)); codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryMethod.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryMethod));
// Delivery courier. // Delivery courier.
SaCodeTypeDfn codeTypeDeliveryCourier = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryCourier), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryCourier), 12); SaCodeTypeDfn codeTypeDeliveryCourier = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryCourier), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryCourier), 12);
codeTypeDeliveryCourier.AllowSequence = true; codeTypeDeliveryCourier.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryCourier); codeTypeConsole.RegisterCodeType(codeTypeDeliveryCourier);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryCourier.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryCourier)); codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryCourier.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryCourier));
// Delivery book-in. // Delivery book-in.
SaCodeTypeDfn codeTypeDeliveryBookIn = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryBookIn), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryBookIn), 12); SaCodeTypeDfn codeTypeDeliveryBookIn = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryBookIn), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryBookIn), 12);
codeTypeDeliveryBookIn.AllowSequence = true; codeTypeDeliveryBookIn.AllowSequence = true;
//codeTypeConsole.RegisterCodeType(codeTypeDeliveryBookIn); //codeTypeConsole.RegisterCodeType(codeTypeDeliveryBookIn);
//codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryBookIn.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryBookIn)); //codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryBookIn.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryBookIn));
// Order lead time. // Order lead time.
SaCodeTypeDfn codeTypeOrderLeadTime = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.OrderLeadTime), codeTypes.GetDescForType(Sbm.ApplCodeType.OrderLeadTime), 12); SaCodeTypeDfn codeTypeOrderLeadTime = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.OrderLeadTime), codeTypes.GetDescForType(Sbm.ApplCodeType.OrderLeadTime), 12);
codeTypeOrderLeadTime.AllowSequence = true; codeTypeOrderLeadTime.AllowSequence = true;
//codeTypeConsole.RegisterCodeType(codeTypeOrderLeadTime); //codeTypeConsole.RegisterCodeType(codeTypeOrderLeadTime);
//codeTypeConsole.RegisterCodesOfType(codeTypeOrderLeadTime.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.OrderLeadTime)); //codeTypeConsole.RegisterCodesOfType(codeTypeOrderLeadTime.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.OrderLeadTime));
// Delivery picker. // Delivery picker.
SaCodeTypeDfn codeTypeStockPicker = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.StockPicker), codeTypes.GetDescForType(Sbm.ApplCodeType.StockPicker), 12); SaCodeTypeDfn codeTypeStockPicker = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.StockPicker), codeTypes.GetDescForType(Sbm.ApplCodeType.StockPicker), 12);
codeTypeStockPicker.AllowSequence = true; codeTypeStockPicker.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeStockPicker); codeTypeConsole.RegisterCodeType(codeTypeStockPicker);
codeTypeConsole.RegisterCodesOfType(codeTypeStockPicker.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.StockPicker)); codeTypeConsole.RegisterCodesOfType(codeTypeStockPicker.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.StockPicker));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
// I t e m D o c u m e n t s // I t e m D o c u m e n t s
//--------------------------------------------------------------- //---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowItemDocuments)) if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowItemDocuments))
{ {
// PDF document types. // PDF document types.
SaCodeTypeDfn codeTypeDocType_Pdf = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DocType_Pdf), codeTypes.GetDescForType(Sbm.ApplCodeType.DocType_Pdf), 12); 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.AllowMixedCode = true;
codeTypeDocType_Pdf.FlagDefinitions.Add(new FlagDfn((Byte)Sbm.ApplCodeFlag.DocType_Pdf_WebPublish, "WebPublish", "Publish to Web")); codeTypeDocType_Pdf.FlagDefinitions.Add(new FlagDfn((Byte)Sbm.ApplCodeFlag.DocType_Pdf_WebPublish, "WebPublish", "Publish to Web"));
codeTypeConsole.RegisterCodeType(codeTypeDocType_Pdf); codeTypeConsole.RegisterCodeType(codeTypeDocType_Pdf);
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Pdf.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Pdf)); codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Pdf.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Pdf));
// Image document types. // Image document types.
SaCodeTypeDfn codeTypeDocType_Image = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DocType_Image), codeTypes.GetDescForType(Sbm.ApplCodeType.DocType_Image), 12); 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.AllowMixedCode = true;
codeTypeDocType_Image.FlagDefinitions.Add(new FlagDfn((Byte)Sbm.ApplCodeFlag.DocType_Image_WebPublish, "WebPublish", "Publish to Web")); codeTypeDocType_Image.FlagDefinitions.Add(new FlagDfn((Byte)Sbm.ApplCodeFlag.DocType_Image_WebPublish, "WebPublish", "Publish to Web"));
codeTypeConsole.RegisterCodeType(codeTypeDocType_Image); codeTypeConsole.RegisterCodeType(codeTypeDocType_Image);
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Image.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Image)); codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Image.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Image));
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
+65 -62
View File
@@ -42,17 +42,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Application definitions. // Application definitions.
public static Sbm.ConfigConsole GetConfigConsoleType(String consoleProperty) public static Sbm.SessionConfig GetSessionConfigType(String consoleProperty)
{ {
if (consoleProperty.ContainsCI("Sarand")) if (consoleProperty.ContainsCI("Sarand"))
return Sbm.ConfigConsole.Sarand; return Sbm.SessionConfig.Sarand;
if (consoleProperty.ContainsCI("MPE")) if (consoleProperty.ContainsCI("MPE"))
return Sbm.ConfigConsole.MPE; return Sbm.SessionConfig.MPE;
if (consoleProperty.ContainsCI("BPE")) if (consoleProperty.ContainsCI("BPE"))
return Sbm.ConfigConsole.BPE; return Sbm.SessionConfig.BPE;
if (consoleProperty.ContainsCI("Cadix") || consoleProperty.ContainsCI("CUL")) if (consoleProperty.ContainsCI("Cadix") || consoleProperty.ContainsCI("CUL"))
return Sbm.ConfigConsole.Cadix; return Sbm.SessionConfig.Cadix;
return Sbm.ConfigConsole.Generic; return Sbm.SessionConfig.Generic;
} }
public static String GetCopyrightNotice(bool html = false) public static String GetCopyrightNotice(bool html = false)
{ {
@@ -86,7 +86,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
} }
public static List<TypeCodeDesc> GetCodesOfType(ISbmUserContext_Core userContext, Sbm.SystemCode systemCode) public static List<TypeCodeDesc> GetCodesOfType(ISbmUserContext_Core userContext, Sbm.SystemCode systemCode)
{ {
SbmConfigConsole configConsole = null; // SbmGlobals.GetConfigConsole(userContext.SessionContext); using (SbmInternals internals = new SbmInternals(userContext))
{
SbmSessionConsole sessionConsole = internals.SessionConsole;
switch (systemCode) switch (systemCode)
{ {
case Sbm.SystemCode.ItemType: case Sbm.SystemCode.ItemType:
@@ -175,11 +177,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
case Sbm.SystemCode.ProcessCategory: case Sbm.SystemCode.ProcessCategory:
{ {
List<TypeCodeDesc> ProcessCategory = new List<TypeCodeDesc>(); List<TypeCodeDesc> ProcessCategory = new List<TypeCodeDesc>();
if (configConsole != null) if (sessionConsole != null)
{ {
if (configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowCommodities))
ProcessCategory.Add(Sbm.ProcessCategory.Commodity, "CMD", "Commodity"); ProcessCategory.Add(Sbm.ProcessCategory.Commodity, "CMD", "Commodity");
if (configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowAssets)) if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowAssets))
ProcessCategory.Add(Sbm.ProcessCategory.Asset, "ASSET", "Asset"); ProcessCategory.Add(Sbm.ProcessCategory.Asset, "ASSET", "Asset");
} }
return ProcessCategory; return ProcessCategory;
@@ -221,9 +223,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
case Sbm.SystemCode.FinancialType: case Sbm.SystemCode.FinancialType:
{ {
List<TypeCodeDesc> FinancialType = new List<TypeCodeDesc>(); List<TypeCodeDesc> FinancialType = new List<TypeCodeDesc>();
if (configConsole != null) if (sessionConsole != null)
{ {
if (configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowCommodities))
FinancialType.Add(Sbm.FinancialType.CommoditySupply, "CmdSup", "Commodity supply"); FinancialType.Add(Sbm.FinancialType.CommoditySupply, "CmdSup", "Commodity supply");
} }
FinancialType.Add(Sbm.FinancialType.CommoditySales, "CmdSal", "Commodity sales"); FinancialType.Add(Sbm.FinancialType.CommoditySales, "CmdSal", "Commodity sales");
@@ -250,11 +252,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Interface types - Website. // Interface types - Website.
// Duplicate static list and remove unsupported options. // Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_Website); List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_Website);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.WebStore))) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.WebStore)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.WebStore); interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.WebStore);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.JoomlaVirtueMart))) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.JoomlaVirtueMart)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.JoomlaVirtueMart); interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.JoomlaVirtueMart);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.MiMoWeb))) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.MiMoWeb)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.MiMoWeb); interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.MiMoWeb);
return new List<TypeCodeDesc>(codes); return new List<TypeCodeDesc>(codes);
} }
@@ -270,23 +272,23 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Interface Type - System. // Interface Type - System.
// Duplicate static list and remove unsupported options. // Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_System); List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_System);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.MSOutlook)) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.MSOutlook))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.MSOutlook); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.MSOutlook);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.PostcodeAnywhere)) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.PostcodeAnywhere))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.PostcodeAnywhere); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.PostcodeAnywhere);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Bac)) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Bac))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Bac); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Bac);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Pvh)) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Pvh))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Pvh); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Pvh);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cap)) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cap))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cap); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cap);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Hpi)) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Hpi))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Hpi); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Hpi);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Anchor_OrderFulfilment)) 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); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Anchor_OrderFulfilment);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Argos)) 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); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Argos);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Homebase)) 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); interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Homebase);
return new List<TypeCodeDesc>(codes); return new List<TypeCodeDesc>(codes);
} }
@@ -295,7 +297,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Interface Type - File. // Interface Type - File.
// Duplicate static list and remove unsupported options. // Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_File); List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_File);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_File.LeasewayInvoice)) if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_File.LeasewayInvoice))
codes.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_File.LeasewayInvoice); codes.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_File.LeasewayInvoice);
return new List<TypeCodeDesc>(codes); return new List<TypeCodeDesc>(codes);
} }
@@ -315,16 +317,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.TransactionDatesInFuture, "TransDatesInFut", "Days in future that transaction dates can be set", ""); 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)"); 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 (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowDeliveryPlanning)) 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)"); 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 (configConsole != null && configConsole.GetStockControlConfig(userContext).AllowStockControl()) if (sessionConsole != null && sessionConsole.GetStockControlConfig().AllowStockControl())
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateStockLevelsInPast, "UpdStkLvlInPast", "Update stock levels in past"); OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateStockLevelsInPast, "UpdStkLvlInPast", "Update stock levels in past");
return OrgOption_PeriodDays; return OrgOption_PeriodDays;
} }
case Sbm.SystemCode.OrgOption_PeriodWeeks: case Sbm.SystemCode.OrgOption_PeriodWeeks:
{ {
List<TypeCodeDesc> OrgOption_PeriodWeeks = new List<TypeCodeDesc>(); List<TypeCodeDesc> OrgOption_PeriodWeeks = new List<TypeCodeDesc>();
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.TimeRecording)) 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.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.UpdateTimeRecords_Control, "UpdTimeRecsCtrl", "Weeks in past for admin user to update time records (default 2)");
@@ -337,73 +339,73 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
case Sbm.SystemCode.OrgOption_Caption: case Sbm.SystemCode.OrgOption_Caption:
{ {
List<TypeCodeDesc> OrgOption_Caption = new List<TypeCodeDesc>(); List<TypeCodeDesc> OrgOption_Caption = new List<TypeCodeDesc>();
if (configConsole != null) if (sessionConsole != null)
{ {
// Transaction type captions. // Transaction type captions.
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.Project)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.Project))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_Project, "Project", "Transaction type - Project"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_Project, "Project", "Transaction type - Project");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesLead)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesLead))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesLead, "SalLead", "Transaction type - Sales Lead"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesLead, "SalLead", "Transaction type - Sales Lead");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesQuote)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesQuote, "SalQuote", "Transaction type - Sales quote"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesQuote, "SalQuote", "Transaction type - Sales quote");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesPO)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesPO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesPO, "SalPO", "Transaction type - Sales PO"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesPO, "SalPO", "Transaction type - Sales PO");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesOrder)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesOrder, "SalPfOrder", "Transaction type - sales proforma order"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesOrder, "SalPfOrder", "Transaction type - sales proforma order");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesOrder, "SalOrder", "Transaction type - sales order"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesOrder, "SalOrder", "Transaction type - sales order");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesDispatch)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesDispatch))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesDispatch, "SalDispatch", "Transaction type - Sales dispatch"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesDispatch, "SalDispatch", "Transaction type - Sales dispatch");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesInvoice)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesInvoice, "SalPfInvoice", "Transaction type - Proforma sales invoice"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesInvoice, "SalPfInvoice", "Transaction type - Proforma sales invoice");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesInvoice, "SalInvoice", "Transaction type - Sales invoice"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesInvoice, "SalInvoice", "Transaction type - Sales invoice");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseQuote)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseQuote, "PurQuote", "Transaction type - Purchase quote"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseQuote, "PurQuote", "Transaction type - Purchase quote");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseSO)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseSO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseSO, "PurSO", "Transaction type - Purchase SO"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseSO, "PurSO", "Transaction type - Purchase SO");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseOrder, "PurPfOrder", "Transaction type - Purchase proforma order"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseOrder, "PurPfOrder", "Transaction type - Purchase proforma order");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseOrder, "PurOrder", "Transaction type - Purchase order"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseOrder, "PurOrder", "Transaction type - Purchase order");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseDelivery)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseDelivery, "PurDelivery", "Transaction type - Purchase Delivery"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseDelivery, "PurDelivery", "Transaction type - Purchase Delivery");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseInvoice)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice, "PurPfInvoice", "Transaction type - Proforma Purchase invoice"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice, "PurPfInvoice", "Transaction type - Proforma Purchase invoice");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseInvoice)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseInvoice, "PurInvoice", "Transaction type - Purchase invoice"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseInvoice, "PurInvoice", "Transaction type - Purchase invoice");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.Project)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.Project))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_Projects, "MnuOptProject", "Caption - Projects menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_Projects, "MnuOptProject", "Caption - Projects menu option");
// Menu option captions: // Menu option captions:
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesLead)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesLead))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesLeads, "MnuOptSalLead", "Caption - Sales leads menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesLeads, "MnuOptSalLead", "Caption - Sales leads menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesPO)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesPO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesPOs, "MnuOptSalPO", "Caption - Sales POs menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesPOs, "MnuOptSalPO", "Caption - Sales POs menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesQuote)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesQuotes, "MnuOptSalQuote", "Caption - Sales quotes menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesQuotes, "MnuOptSalQuote", "Caption - Sales quotes menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesOrder)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesOrders, "MnuOptSalPfOrder", "Caption - Proforma sales orders menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesOrders, "MnuOptSalPfOrder", "Caption - Proforma sales orders menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesOrders, "MnuOptSalOrder", "Caption - Sales orders menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesOrders, "MnuOptSalOrder", "Caption - Sales orders menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesDispatch)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesDispatch))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesDispatches, "MnuOptSalDispatch", "Caption - Sales dispatches menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesDispatches, "MnuOptSalDispatch", "Caption - Sales dispatches menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesInvoice)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesInvoices, "MnuOptSalPfInvoice", "Caption - Proforma sales invoices menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesInvoices, "MnuOptSalPfInvoice", "Caption - Proforma sales invoices menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesInvoices, "MnuOptSalInvoice", "Caption - Sales invoices menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesInvoices, "MnuOptSalInvoice", "Caption - Sales invoices menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseQuote)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseQuotes, "MnuOptPurQuote", "Caption - Purchase quotes menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseQuotes, "MnuOptPurQuote", "Caption - Purchase quotes menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseSO)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseSO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseSOs, "MnuOptPurSO", "Caption - Purchase SOs menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseSOs, "MnuOptPurSO", "Caption - Purchase SOs menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseOrders, "MnuOptPurPfOrder", "Caption - Proforma purchase orders menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseOrders, "MnuOptPurPfOrder", "Caption - Proforma purchase orders menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseOrders, "MnuOptPurOrder", "Caption - Purchase orders menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseOrders, "MnuOptPurOrder", "Caption - Purchase orders menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseDelivery)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseDeliveries, "MnuOptPurDelivery", "Caption - Purchase Deliveries menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseDeliveries, "MnuOptPurDelivery", "Caption - Purchase Deliveries menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseInvoice)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseInvoices, "MnuOptPurPfInvoice", "Caption - Proforma purchase invoices menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseInvoices, "MnuOptPurPfInvoice", "Caption - Proforma purchase invoices menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseInvoice)) if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseInvoices, "MnuOptPurInvoice", "Caption - Purchase invoices menu option"); OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseInvoices, "MnuOptPurInvoice", "Caption - Purchase invoices menu option");
} }
return OrgOption_Caption; return OrgOption_Caption;
@@ -426,7 +428,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Order_AllocationInd, "Order:AllocationInd", "Order: Allocation indicator"); 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_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.SalesOrder_HasInvoice, "SalesOrder:HasInvoice", "Order: Has invoice flag");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Transaction_ContactArea, "Transaction:ContactArea", "Transaction: " + configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_ContactAreaCode, "Contact area")); 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.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_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_Current, "OrderItem:StockCurrent", "Order item: Stock current");
@@ -477,6 +479,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
case Sbm.SystemCode.FileInterface_Mode: case Sbm.SystemCode.FileInterface_Mode:
return new List<TypeCodeDesc>(fileInterface_Modes); return new List<TypeCodeDesc>(fileInterface_Modes);
} }
}
return null; return null;
} }
+22 -21
View File
@@ -12,6 +12,7 @@ using Sarand.Net.Standard.Base.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using static Sarand.Net.Standard.Base.Bus.ItemId;
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{ {
@@ -206,12 +207,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
//------------------------------------------------------------------- //-------------------------------------------------------------------
// I t e m I m p o r t e d F r o m A c c o u n t s // I t e m I m p o r t e d F r o m A c c o u n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
public void PopulateItemCache(Sbm.ItemType itemType, SysId idItem, bool force = false) public void PopulateItemCache(ItemId itemId, bool force = false)
{ {
if (force || itemCache.itemType != itemType || itemCache.idItem != idItem) if (!ItemId.IsValid(itemId)) return;
if (force || (short)itemCache.itemType != itemId.Type || itemCache.idItem != itemId.Id)
{ {
itemCache.itemType = itemType; itemCache.itemType = (Sbm.ItemType)itemId.Type;
itemCache.idItem = idItem; itemCache.idItem = itemId.Id;
itemCache.importedFromSage = false; itemCache.importedFromSage = false;
itemCache.importedFromQBooks = false; itemCache.importedFromQBooks = false;
itemCache.exportedFromSage = false; itemCache.exportedFromSage = false;
@@ -222,7 +224,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
if (SysId.IsValid(sageParams.InterfaceId) && sageParams.dfnInt_Sage.Active) if (SysId.IsValid(sageParams.InterfaceId) && sageParams.dfnInt_Sage.Active)
{ {
// Retrieve interface data item for this item. // Retrieve interface data item for this item.
List<SaInterfaceDataItem> plIntItm = InterfaceConsole.GetInterfaceDataItemsByItem(sageParams.InterfaceId, SaInterfaceProcessDirection.Unknown, new ItemId((short)itemType, idItem)); List<SaInterfaceDataItem> plIntItm = InterfaceConsole.GetInterfaceDataItemsByItem(sageParams.InterfaceId, SaInterfaceProcessDirection.Unknown, itemId);
foreach (SaInterfaceDataItem pIntItm in plIntItm) foreach (SaInterfaceDataItem pIntItm in plIntItm)
{ {
if (pIntItm.Direction == SaInterfaceProcessDirection.Inbound || pIntItm.Direction == SaInterfaceProcessDirection.Both) itemCache.importedFromSage = true; if (pIntItm.Direction == SaInterfaceProcessDirection.Inbound || pIntItm.Direction == SaInterfaceProcessDirection.Both) itemCache.importedFromSage = true;
@@ -233,7 +235,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
if (SysId.IsValid(qbkParams.InterfaceId) && qbkParams.dfnInt_QBooks.Active) if (SysId.IsValid(qbkParams.InterfaceId) && qbkParams.dfnInt_QBooks.Active)
{ {
// Retrieve interface data item for this item. // Retrieve interface data item for this item.
List<SaInterfaceDataItem> plIntItm = InterfaceConsole.GetInterfaceDataItemsByItem(qbkParams.InterfaceId, SaInterfaceProcessDirection.Unknown, new ItemId((short)itemType, idItem)); List<SaInterfaceDataItem> plIntItm = InterfaceConsole.GetInterfaceDataItemsByItem(qbkParams.InterfaceId, SaInterfaceProcessDirection.Unknown, itemId);
foreach (SaInterfaceDataItem pIntItm in plIntItm) foreach (SaInterfaceDataItem pIntItm in plIntItm)
{ {
if (pIntItm.Direction == SaInterfaceProcessDirection.Inbound || pIntItm.Direction == SaInterfaceProcessDirection.Both) itemCache.importedFromQBooks = true; if (pIntItm.Direction == SaInterfaceProcessDirection.Inbound || pIntItm.Direction == SaInterfaceProcessDirection.Both) itemCache.importedFromQBooks = true;
@@ -244,12 +246,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
} }
return; return;
} }
public bool ItemIsImportedFromAccounts(Sbm.ItemType itemType, SysId idItem, Sbm.InterfaceType_Accounts accounts = Sbm.InterfaceType_Accounts.Unknown) public bool ItemIsImportedFromAccounts(ItemId itemId, Sbm.InterfaceType_Accounts accounts = Sbm.InterfaceType_Accounts.Unknown)
{ {
if (itemType == Sbm.ItemType.Unknown || !SysId.IsValid(idItem)) return false; if (!ItemId.IsValid(itemId)) return false;
PopulateItemCache(itemType, idItem); PopulateItemCache(itemId);
if (itemCache.itemType == itemType && itemCache.idItem == idItem) if ((short)itemCache.itemType == itemId.Type && itemCache.idItem == itemId.Id)
{ {
switch (accounts) switch (accounts)
{ {
@@ -264,21 +266,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
return false; return false;
} }
public bool ItemIsImportedFromSage(Sbm.ItemType itemType, SysId idItem) public bool ItemIsImportedFromSage(ItemId itemId)
{ {
return ItemIsImportedFromAccounts(itemType, idItem, Sbm.InterfaceType_Accounts.SageLine50); return ItemIsImportedFromAccounts(itemId, Sbm.InterfaceType_Accounts.SageLine50);
} }
public bool ItemIsImportedFromQBooks(Sbm.ItemType itemType, SysId idItem) public bool ItemIsImportedFromQBooks(ItemId itemId)
{ {
return ItemIsImportedFromAccounts(itemType, idItem, Sbm.InterfaceType_Accounts.QuickBooks); return ItemIsImportedFromAccounts(itemId, Sbm.InterfaceType_Accounts.QuickBooks);
} }
public bool IsItemExportedToAccounts(Sbm.ItemType itemType, SysId idItem, Sbm.InterfaceType_Accounts accounts = Sbm.InterfaceType_Accounts.Unknown) public bool IsItemExportedToAccounts(ItemId itemId, Sbm.InterfaceType_Accounts accounts = Sbm.InterfaceType_Accounts.Unknown)
{ {
if (itemType == Sbm.ItemType.Unknown || !SysId.IsValid(idItem)) return false; if (!ItemId.IsValid(itemId)) return false;
PopulateItemCache(itemType, idItem); PopulateItemCache(itemId);
if (itemCache.itemType == itemType && itemCache.idItem == idItem) if ((short)itemCache.itemType == itemId.Type && itemCache.idItem == itemId.Id)
{ {
switch (accounts) switch (accounts)
{ {
@@ -342,7 +344,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public bool IsAssociationTypeManagedByAccounts(Sbm.AssociationType associationType) public bool IsAssociationTypeManagedByAccounts(Sbm.AssociationType associationType)
{ {
if (associationType == Sbm.AssociationType.Unknown) return false;
// Sage Line 50: // Sage Line 50:
if (IsUsingSageInterface()) if (IsUsingSageInterface())
{ {
@@ -358,7 +359,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
#if DEBUG #if DEBUG
SaLogger.Warn("IsAssociationTypeManagedByAccounts Unsupported Sage association type: " + associationType.ToString()); SaLogger.Warn("IsAssociationTypeManagedByAccounts Unsupported Sage association type: " + associationType.ToString());
#endif #endif
break; return false;
} }
} }
@@ -377,7 +378,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
#if DEBUG #if DEBUG
SaLogger.Warn("IsAssociationTypeManagedByAccounts Unsupported QBooks association type: " + associationType.ToString()); SaLogger.Warn("IsAssociationTypeManagedByAccounts Unsupported QBooks association type: " + associationType.ToString());
#endif #endif
break; return false;
} }
} }
return false; return false;
+27 -2
View File
@@ -5,6 +5,7 @@ using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils; using Sarand.Net.Standard.Base.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using static Sarand.Net.Standard.Base.Core.StringPair;
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{ {
@@ -432,6 +433,30 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities. // Utilities.
// Address display.
public String GetDisplay()
{
return GetDisplay(Line1, Line2, Line3, City, Province, Postcode, Country);
}
public static String GetDisplay(String line1, String line2, String line3, String city, String province, String postcode, String country)
{
List<String> lines = new List<String>() { line1, line2, line3, city, province };
return StringUtil.TrimWhitespace(lines.Concat(", ", null, null, true, true).ToString() + " " + postcode + " " + country);
}
// Address summary.
public String GetSummary()
{
return GetSummary(Line1, City, Province, Postcode, Country);
}
public static String GetSummary(String line1, String city, String province, String postcode, String country)
{
List<String> lines = new List<String>() { line1, city, province };
return StringUtil.TrimWhitespace(lines.Concat(", ", null, null, true, true).ToString() + " " + postcode + " " + country);
}
// Visit on.
public bool IsVisitOn(DateTime visitDate) public bool IsVisitOn(DateTime visitDate)
{ {
if (DateUtil.IsValid(LastVisitOn) && LastVisitOn.CompareTo(visitDate) > 0) return false; if (DateUtil.IsValid(LastVisitOn) && LastVisitOn.CompareTo(visitDate) > 0) return false;
@@ -674,8 +699,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Address. // Address.
public Sbm.AddressType AddressType { get; set; } public Sbm.AddressType AddressType { get; set; }
public ItemId ItemId { get; set; } public ItemId ItemId { get; set; }
+28 -10
View File
@@ -51,7 +51,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
Address_Postcode, Address_Postcode,
Address_Country, Address_Country,
ProspectGroup, ProspectGroup,
// Associated data.
GroupMembers, GroupMembers,
Association_Count,
// Common properties. // Common properties.
Notes, Notes,
Flag, Flag,
@@ -377,7 +379,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities - affiliate category. // Utilities.
public ItemId GetItemId()
{
return new ItemId((short)Sbm.ItemType.Affiliate, Id);
}
// Affiliate category.
public static Sbm.AffiliateCategory GetCategory(Sbm.AffiliateType AffiliateType) public static Sbm.AffiliateCategory GetCategory(Sbm.AffiliateType AffiliateType)
{ {
if (IsIndividual(AffiliateType)) if (IsIndividual(AffiliateType))
@@ -388,7 +396,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{ {
return GetCategory(AffiliateType); return GetCategory(AffiliateType);
} }
// Utilities - affiliate type.
// Affiliate type.
public bool TypeIsValid() public bool TypeIsValid()
{ {
if (IsIndividual()) return true; if (IsIndividual()) return true;
@@ -400,19 +409,23 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
if (IsContactGroup()) return true; if (IsContactGroup()) return true;
return false; return false;
} }
// Utilities - affiliate types' accessor public static bool IsIndividual(Sbm.AffiliateType affiliateType)
public static bool IsIndividual(Sbm.AffiliateType AffiliateType)
{ {
return AffiliateType == Sbm.AffiliateType.Individual; return affiliateType == Sbm.AffiliateType.Individual;
} }
public bool IsIndividual() public bool IsIndividual()
{ {
return IsIndividual(AffiliateType); return IsIndividual(AffiliateType);
} }
public static bool IsOrganisation(Sbm.AffiliateType affiliateType)
{
return !IsIndividual(affiliateType) & !IsContactGroup(affiliateType);
}
public bool IsOrganisation() public bool IsOrganisation()
{ {
return AffiliateType != Sbm.AffiliateType.Individual & AffiliateType != Sbm.AffiliateType.ContactGroup; return IsOrganisation(AffiliateType);
} }
// Specific affiliate types.
public bool IsCommercial() public bool IsCommercial()
{ {
return AffiliateType == Sbm.AffiliateType.Commercial; return AffiliateType == Sbm.AffiliateType.Commercial;
@@ -433,11 +446,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{ {
return AffiliateType == Sbm.AffiliateType.Charity; return AffiliateType == Sbm.AffiliateType.Charity;
} }
public static bool IsContactGroup(Sbm.AffiliateType affiliateType)
{
return affiliateType == Sbm.AffiliateType.ContactGroup;
}
public bool IsContactGroup() public bool IsContactGroup()
{ {
return AffiliateType == Sbm.AffiliateType.ContactGroup; return IsContactGroup(AffiliateType);
} }
// Utilities - email validation.
// Email validation.
public static bool IsValidEmail(String email) public static bool IsValidEmail(String email)
{ {
int count = 0; int count = 0;
@@ -748,8 +766,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Affiliate. // Affiliate.
public Sbm.AffiliateType AffiliateType { get; set; } = Sbm.AffiliateType.Any; public Sbm.AffiliateType AffiliateType { get; set; } = Sbm.AffiliateType.Any;
public SysId AffiliateIdParent { get; set; } public SysId AffiliateIdParent { get; set; }
+4 -4
View File
@@ -626,8 +626,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Asset. // Asset.
public SysId AssetCatId { get; set; } public SysId AssetCatId { get; set; }
public String Search { get; set; } public String Search { get; set; }
@@ -646,8 +646,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{ {
List<StringPair> value = new List<StringPair>(); List<StringPair> value = new List<StringPair>();
if (IncludedIds.Count > 0) value.Add("Assets included", IncludedIds.ToString()); if (IdsIncluded.Count > 0) value.Add("Assets included", IdsIncluded.ToString());
if (ExcludedIds.Count > 0) value.Add("Assets excluded", ExcludedIds.ToString()); if (IdsExcluded.Count > 0) value.Add("Assets excluded", IdsExcluded.ToString());
if (SysId.IsValid(AssetCatId)) value.Add("Asset category Id", AssetCatId.ToString()); if (SysId.IsValid(AssetCatId)) value.Add("Asset category Id", AssetCatId.ToString());
if (ItemType > 0) value.Add("Item type", ItemType.ToString()); if (ItemType > 0) value.Add("Item type", ItemType.ToString());
if (ItemId.IsValid(ItemId)) value.Add("Item Id", ItemId.ToString()); if (ItemId.IsValid(ItemId)) value.Add("Item Id", ItemId.ToString());
@@ -225,8 +225,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// AssetProcess. // AssetProcess.
public SysId AssetId { get; set; } public SysId AssetId { get; set; }
public SysId ProcessId { get; set; } public SysId ProcessId { get; set; }
+19 -10
View File
@@ -103,7 +103,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
Target_DeliveryAddress_Postcode, Target_DeliveryAddress_Postcode,
Target_DeliveryAddress_AccountManagerCode, Target_DeliveryAddress_AccountManagerCode,
Target_DeliveryAddress_ContactAreaCode, Target_DeliveryAddress_ContactAreaCode,
// Associated members. [17-NOV-10] // Associated members. [17-Nov-10]
Member_Type, Member_Type,
Member_TypeDesc, Member_TypeDesc,
Member_Code, Member_Code,
@@ -142,7 +142,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{ {
public SysId AffiliateIdOwner { get; set; } = new SysId(); public SysId AffiliateIdOwner { get; set; } = new SysId();
public SysId AffiliateIdTarget { get; set; } = new SysId(); public SysId AffiliateIdTarget { get; set; } = new SysId();
public Sbm.AssociationType AssociationType { get; set; } = Sbm.AssociationType.Unknown; public Sbm.AssociationType AssociationType { get; set; }
public String Code { get; set; } = ""; public String Code { get; set; } = "";
public String RefExt { get; set; } = ""; public String RefExt { get; set; } = "";
public String Location { get; set; } = ""; public String Location { get; set; } = "";
@@ -543,7 +543,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities - association type. // Utilities.
public ItemId GetItemId()
{
return new ItemId((short)Sbm.ItemType.Association, Id);
}
// Association type.
public bool TypeIsValid() public bool TypeIsValid()
{ {
if (AssociationType > 0) return true; if (AssociationType > 0) return true;
@@ -867,10 +873,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Association. // Association.
public Sbm.AssociationType AssociationType { get; set; } = Sbm.AssociationType.Any; public Sbm.AssociationType AssociationType { get; set; } = Sbm.AssociationType.NotInternal;
public SysId AffiliateIdOwner { get; set; } public SysId AffiliateIdOwner { get; set; }
public SysId AffiliateIdTarget { get; set; } public SysId AffiliateIdTarget { get; set; }
public SysId AffiliateIdContactGroup { get; set; } public SysId AffiliateIdContactGroup { get; set; }
@@ -901,12 +907,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public List<String> DeliveryMethodCodes { get; } = new List<String>(); public List<String> DeliveryMethodCodes { get; } = new List<String>();
public List<String> DeliveryCourierCodes { get; } = new List<String>(); public List<String> DeliveryCourierCodes { get; } = new List<String>();
public List<String> DeliveryBookInCodes { get; } = new List<String>(); public List<String> DeliveryBookInCodes { get; } = new List<String>();
/// <summary>Association must have a transaction active at some time between the specified dates (one date can be specified for open ended period).</summary> // Association must have a transaction of the specified type (optional) active at some time between the specified dates (one date can be specified for open ended period).
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.NotDeleted; /// <summary>Transaction status - Value other than 'Any' triggers transaction filter.</summary>
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.Any;
/// <summary>Has transactions of type.</summary>
public Sbm.TransactionType TransactionType { get; set; } = Sbm.TransactionType.Unknown;
/// <summary>Has transactions active from.</summary> /// <summary>Has transactions active from.</summary>
public DateTime TransActiveFrom { get; set; } = DateTime.MinValue; public DateTime TransactionActiveFrom { get; set; } = DateTime.MinValue;
/// <summary>Has transactions active up to (inclusive).</summary> /// <summary>Has transactions active up to (inclusive).</summary>
public DateTime TransActiveTo { get; set; } = DateTime.MinValue; public DateTime TransactionActiveTo { get; set; } = DateTime.MinValue;
/// <summary>Excluded associations that are already a System Account for the specified Interface.</summary> /// <summary>Excluded associations that are already a System Account for the specified Interface.</summary>
public SysId InterfaceIdExcludeSystemAccounts { get; set; } public SysId InterfaceIdExcludeSystemAccounts { get; set; }
/// <summary>Associated codes (via ItemLink) - Seasonal Category.</summary> /// <summary>Associated codes (via ItemLink) - Seasonal Category.</summary>
+16 -33
View File
@@ -1126,6 +1126,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities. // Utilities.
public ItemId GetItemId()
{
return new ItemId((short)Sbm.ItemType.Commodity, Id);
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public Data GetData() { return data.Clone(); } public Data GetData() { return data.Clone(); }
@@ -1764,31 +1769,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// A s s o c i a t e d D a t a E l e m e n t s // Associated data.
//------------------------------------------------------------------- public List<SbmCostEstimate> CostEstimates { get; set; }
public abstract bool HasProcesses(); public List<SbmItemProcess> ItemProcesses { get; set; }
public abstract bool HasRequirements();
public abstract bool IsSalesBudgetTemplate();
public abstract bool HasComponents();
public abstract bool HasPortfolioItems();
public abstract bool HasContainers();
public abstract bool HasCustomerDetails();
public abstract bool HasSupplierDetails();
public abstract bool HasMovements();
public abstract bool HasStockLevels();
// Dependent data should only be cleared when removing a commodity.
// Data owned by this item is deleted (eg. interface data items & document references).
public abstract bool ClearDependentData();
//---------------------------------------------------------------
// Commodity cost estimates.
public abstract List<SbmCostEstimate> GetCostEstimates();
public abstract bool SetCostEstimates(List<SbmCostEstimate> costEstimatesNew);
public abstract bool CommitCostEstimates();
//---------------------------------------------------------------
// Commodity processes.
public abstract List<SbmItemProcess> GetProcesses(bool bActiveOnly = false);
public abstract bool SetProcesses(List<SbmItemProcess> itemProcessesNew);
public abstract bool CommitProcesses();
//------------------------------------------------------------------- //-------------------------------------------------------------------
// P a r a m s // P a r a m s
@@ -1804,8 +1787,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// Commodity Ids. // Commodity Ids.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Commodity. // Commodity.
public Sbm.CommodityType CommodityType { get; set; } public Sbm.CommodityType CommodityType { get; set; }
public bool StockItemsOnly { get; set; } = false; public bool StockItemsOnly { get; set; } = false;
@@ -1879,11 +1862,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{ {
SbmAccountMgr accountMgr = null; SbmAccountMgr accountMgr = null;
List<StringPair> lValue = new List<StringPair>(); List<StringPair> lValue = new List<StringPair>();
using (SbmConfigConsole configConsole = SbmGlobals.Application.CreateConfigConsole(userContext.SessionContext)) using (SbmSessionConsole sessionConsole = SbmGlobals.Application.CreateSessionConsole(userContext))
{ {
// Commodities to exclude. // Commodities to exclude.
if (IncludedIds.Count > 0) lValue.Add("Included commodities", IncludedIds.Count.ToString()); if (IdsIncluded.Count > 0) lValue.Add("Included commodities", IdsIncluded.Count.ToString());
if (ExcludedIds.Count > 0) lValue.Add("Excluded commodities", ExcludedIds.Count.ToString()); if (IdsExcluded.Count > 0) lValue.Add("Excluded commodities", IdsExcluded.Count.ToString());
// Commodity type. // Commodity type.
if (CommodityType > 0) lValue.Add("Type", SbmSystem.GetCodesOfType(userContext, Sbm.SystemCode.CommodityType).GetDescForType(CommodityType, CommodityType.ToString())); if (CommodityType > 0) lValue.Add("Type", SbmSystem.GetCodesOfType(userContext, Sbm.SystemCode.CommodityType).GetDescForType(CommodityType, CommodityType.ToString()));
else if (CommodityType == Sbm.CommodityType.AnyProduct) lValue.Add("Type", "Any product"); else if (CommodityType == Sbm.CommodityType.AnyProduct) lValue.Add("Type", "Any product");
@@ -1910,9 +1893,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
if (!StringUtil.IsEmpty(SupplyMethodCode)) lValue.Add("SupplyMethod code", SupplyMethodCode); if (!StringUtil.IsEmpty(SupplyMethodCode)) lValue.Add("SupplyMethod code", SupplyMethodCode);
if (!StringUtil.IsEmpty(HandlingCode)) lValue.Add("Handling code", HandlingCode); if (!StringUtil.IsEmpty(HandlingCode)) lValue.Add("Handling code", HandlingCode);
if (!StringUtil.IsEmpty(DeliveryCode)) lValue.Add("Delivery code", DeliveryCode); if (!StringUtil.IsEmpty(DeliveryCode)) lValue.Add("Delivery code", DeliveryCode);
if (!StringUtil.IsEmpty(MaterialCode)) lValue.Add(configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material") + " code", MaterialCode); if (!StringUtil.IsEmpty(MaterialCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material") + " code", MaterialCode);
if (!StringUtil.IsEmpty(FinishCode)) lValue.Add(configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish") + " code", FinishCode); if (!StringUtil.IsEmpty(FinishCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish") + " code", FinishCode);
if (!StringUtil.IsEmpty(PromotionCode)) lValue.Add(configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion") + " code", PromotionCode); if (!StringUtil.IsEmpty(PromotionCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion") + " code", PromotionCode);
// Price sets. // Price sets.
if (PriceSetIdsIncluded.Count > 0) lValue.Add("Included in price sets", PriceSetIdsIncluded.Count.ToString()); if (PriceSetIdsIncluded.Count > 0) lValue.Add("Included in price sets", PriceSetIdsIncluded.Count.ToString());
if (PriceSetIdsExcluded.Count > 0) lValue.Add("Excluded from price sets", PriceSetIdsExcluded.Count.ToString()); if (PriceSetIdsExcluded.Count > 0) lValue.Add("Excluded from price sets", PriceSetIdsExcluded.Count.ToString());
@@ -230,8 +230,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// CommodityCustomer. // CommodityCustomer.
public SysId CommodityId { get; set; } public SysId CommodityId { get; set; }
public SysId AssocIdCustomer { get; set; } public SysId AssocIdCustomer { get; set; }
@@ -220,8 +220,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// CommoditySupplier. // CommoditySupplier.
public SysId CommodityId { get; set; } public SysId CommodityId { get; set; }
public SysId AssocIdSupplier { get; set; } public SysId AssocIdSupplier { get; set; }
@@ -660,8 +660,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Constituent. // Constituent.
public Sbm.ConstituentType ConstituentType { get; set; } = Sbm.ConstituentType.Any; public Sbm.ConstituentType ConstituentType { get; set; } = Sbm.ConstituentType.Any;
public SysId AffIdTarget { get; set; } public SysId AffIdTarget { get; set; }
@@ -287,8 +287,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public Params() { } public Params() { }
public Params(SbmContainerItem.Params prmContainerItem) public Params(SbmContainerItem.Params prmContainerItem)
{ {
IncludedIds = prmContainerItem.IncludedIds; IdsIncluded = prmContainerItem.IdsIncluded;
ExcludedIds = prmContainerItem.ExcludedIds; IdsExcluded = prmContainerItem.IdsExcluded;
ContainerCategory = prmContainerItem.ContainerCategory; ContainerCategory = prmContainerItem.ContainerCategory;
ContainerType = prmContainerItem.ContainerType; ContainerType = prmContainerItem.ContainerType;
Reference = prmContainerItem.ContainerReference; Reference = prmContainerItem.ContainerReference;
@@ -302,8 +302,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
HasItems = prmContainerItem.ContainerHasItems; HasItems = prmContainerItem.ContainerHasItems;
} }
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Container. // Container.
//public SysId AffiliateIdOwner { get; set; } //public SysId AffiliateIdOwner { get; set; }
public Sbm.ContainerCategory ContainerCategory { get; set; } = Sbm.ContainerCategory.Any; public Sbm.ContainerCategory ContainerCategory { get; set; } = Sbm.ContainerCategory.Any;
@@ -273,8 +273,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// Item Ids. // Item Ids.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Item properties. // Item properties.
public SysId ContainerId { get; set; } public SysId ContainerId { get; set; }
public short ItemSeq { get; set; } public short ItemSeq { get; set; }
@@ -442,10 +442,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public static void SetCommodityCosts(this List<SbmCostEstimate> values, ISbmUserContext_Core userContext, SbmCommodity commodity, decimal quantity) public static void SetCommodityCosts(this List<SbmCostEstimate> values, ISbmUserContext_Core userContext, SbmInternals internals, SbmCommodity commodity, decimal quantity)
{ {
// Retrieve costs from commodity and remove unwanted costs (for other quantities). // Retrieve costs from commodity and remove unwanted costs (for other quantities).
List<SbmCostEstimate> costEstimatesCommodity = commodity.GetCostEstimates(); List<SbmCostEstimate> costEstimatesCommodity = internals.CommodityMgr.GetCommodityCostEstimates(commodity);
costEstimatesCommodity.ConsolidateByQuantity(quantity); costEstimatesCommodity.ConsolidateByQuantity(quantity);
// If there are cost estimates remaining, replace the contents of this list. // If there are cost estimates remaining, replace the contents of this list.
@@ -222,8 +222,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// ItemBatch. // ItemBatch.
public Sbm.ItemBatchType ItemBatchType { get; set; } public Sbm.ItemBatchType ItemBatchType { get; set; }
public String Ref { get; set; } public String Ref { get; set; }
+2 -2
View File
@@ -366,8 +366,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// ItemLink. // ItemLink.
public Sbm.ItemLinkType ItemLinkType { get; set; } public Sbm.ItemLinkType ItemLinkType { get; set; }
public Sbm.ItemType ItemTypeFrom { get; set; } public Sbm.ItemType ItemTypeFrom { get; set; }
@@ -349,8 +349,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// ItemProcess. // ItemProcess.
public Sbm.ItemType ItemType { get; set; } public Sbm.ItemType ItemType { get; set; }
public SysId ItemId { get; set; } public SysId ItemId { get; set; }
+2 -2
View File
@@ -221,8 +221,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Location. // Location.
public SysId AffiliateIdOwner { get; set; } public SysId AffiliateIdOwner { get; set; }
public Sbm.LocationCategory LocationCategory { get; set; } public Sbm.LocationCategory LocationCategory { get; set; }
+2 -2
View File
@@ -305,8 +305,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Movement. // Movement.
public Sbm.ItemType ItemType { get; set; } public Sbm.ItemType ItemType { get; set; }
public Sbm.ItemType ItemTypeSource { get; set; } public Sbm.ItemType ItemTypeSource { get; set; }
@@ -329,8 +329,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Hierarchy. // Hierarchy.
public SysId ParentItemId { get; set; } public SysId ParentItemId { get; set; }
public SysId AncestorItemId { get; set; } public SysId AncestorItemId { get; set; }
+2 -2
View File
@@ -231,8 +231,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// Item Ids. // Item Ids.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Item properties. // Item properties.
public Sbm.PriceType PriceType { get; set; } public Sbm.PriceType PriceType { get; set; }
public String Reference { get; set; } public String Reference { get; set; }
+2 -2
View File
@@ -284,8 +284,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Process. // Process.
public Sbm.ProcessCategory ProcessCategory { get; set; } public Sbm.ProcessCategory ProcessCategory { get; set; }
+32 -35
View File
@@ -1221,55 +1221,52 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
/// </summary> /// </summary>
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
/* List filtering. ~ due to have their own Trans&Reqnt List
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();*/
// Data members - requirements always restricted to current owner. // Data members - requirements always restricted to current owner.
/* General details*/ /* General details*/
public SysId AssociationId { get; set; } public SysId AssociationId { get; set; }
public SysId CommodityId { get; set; } public SysId CommodityId { get; set; }
public SysId AssetId { get; set; } public SysId AssetId { get; set; }
// Requirement. // Requirement.
public List<SysId> ReqntIncludedIds { get; } = new List<SysId>(); public List<SysId> RequirementIdsIncluded { get; } = new List<SysId>();
public List<SysId> ReqntExcludedIds { get; } = new List<SysId>(); public List<SysId> RequirementIdsExcluded { get; } = new List<SysId>();
public List<SysId> ReqntIdsSource { get; } = new List<SysId>(); public List<SysId> RequirementIdsSource { get; } = new List<SysId>();
public String ReqntProductCodeFull { get; set; } public String RequirementProductCodeFull { get; set; }
public String ReqntProductCodePartial { get; set; } public String RequirementProductCodePartial { get; set; }
// Stored as product code for 'Project' transactions (populating this value will force the transaction type). // Stored as product code for 'Project' transactions (populating this value will force the transaction type).
public String ReqntProjectTaskCodeFull { get; set; } public String RequirementProjectTaskCodeFull { get; set; }
public String ReqntProjectTaskCodePartial { get; set; } public String RequirementProjectTaskCodePartial { get; set; }
public String ReqntJobNumberFull { get; set; } public String RequirementJobNumberFull { get; set; }
public String ReqntJobNumberPartial { get; set; } public String RequirementJobNumberPartial { get; set; }
public String ReqntAssetSerialFull { get; set; } public String RequirementAssetSerialFull { get; set; }
public String ReqntAssetSerialPartial { get; set; } public String RequirementAssetSerialPartial { get; set; }
public String ReqntDescBrief { get; set; } public String RequirementDescBrief { get; set; }
public String ReqntPromotionCode { get; set; } public String RequirementPromotionCode { get; set; }
// Transaction. // Transaction.
public String AliasTransaction { get; set; } public String AliasTransaction { get; set; }
public List<SysId> TransIncludedIds { get; } = new List<SysId>(); public List<SysId> TransactionIdsIncluded { get; } = new List<SysId>();
public List<SysId> TransExcludedIds { get; } = new List<SysId>(); public List<SysId> TransactionIdsExcluded { get; } = new List<SysId>();
public SysId TransReqntSourceId { get; set; } // Identifies the transaction to which the source requirement belongs. public SysId TransactionRequirementSourceId { get; set; } // Identifies the transaction to which the source requirement belongs.
public Sbm.TransactionType TransactionType { get; set; } = Sbm.TransactionType.Any; public Sbm.TransactionType TransactionType { get; set; } = Sbm.TransactionType.Any;
public SysId TransLocationIdStock { get; set; } public SysId TransactionLocationIdStock { get; set; }
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.NotDeleted; public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.NotDeleted;
public String TransRefPartial { get; set; } public String TransactionRefPartial { get; set; }
public String TransRefExtPartial { get; set; } public String TransactionRefExtPartial { get; set; }
public String TransDescBriefPartial { get; set; } public String TransactionDescBriefPartial { get; set; }
public String AssocPartial { get; set; } public String AssociationPartial { get; set; }
public String AccountManagerCode { get; set; } public String AccountManagerCode { get; set; }
public String AccountHandlerCode { get; set; } public String AccountHandlerCode { get; set; }
public DateTime TransRaisedFrom { get; set; } public DateTime TransactionRaisedFrom { get; set; }
public DateTime TransRaisedTo { get; set; } public DateTime TransactionRaisedTo { get; set; }
public DateTime TransRequiredFrom { get; set; } public DateTime TransactionRequiredFrom { get; set; }
public DateTime TransRequiredTo { get; set; } public DateTime TransactionRequiredTo { get; set; }
public decimal TransAmountNetLt { get; set; } = Decimal.MinValue; public decimal TransactionAmountNetLt { get; set; } = Decimal.MinValue;
public decimal TransAmountNetGt { get; set; } = Decimal.MinValue; public decimal TransactionAmountNetGt { get; set; } = Decimal.MinValue;
// Active period. // Active period.
// Active on specific date. [Date period below ignored if this date is valid] // Active on specific date. [Date period below ignored if this date is valid]
public DateTime TransActiveOn { get; set; } public DateTime TransactionActiveOn { get; set; }
// Active during the period, or at any time from or to the specified date if only one is valid. // Active during the period, or at any time from or to the specified date if only one is valid.
public DateTime TransActiveFrom { get; set; } public DateTime TransactionActiveFrom { get; set; }
public DateTime TransActiveTo { get; set; } public DateTime TransactionActiveTo { get; set; }
// True (default) = Active at any time during period, False = Active throughout period. [Used when complete date range specified] // True (default) = Active at any time during period, False = Active throughout period. [Used when complete date range specified]
public DateTime ActiveAnyDayDuringPeriod { get; set; } public DateTime ActiveAnyDayDuringPeriod { get; set; }
// Commodity against associated items. // Commodity against associated items.
@@ -1280,8 +1277,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public SysId SalesLocationIdStock02 { get; set; } public SysId SalesLocationIdStock02 { get; set; }
public SysId SalesLocationIdStock03; public SysId SalesLocationIdStock03;
// Required date. // Required date.
public DateTime ReqntRequiredFrom { get; set; } public DateTime RequirementRequiredFrom { get; set; }
public DateTime ReqntRequiredTo { get; set; } public DateTime RequirementRequiredTo { get; set; }
public String CmdMaterialCode { get; set; } public String CmdMaterialCode { get; set; }
public String CmdFinishCode { get; set; } public String CmdFinishCode { get; set; }
// Common properties. // Common properties.
@@ -279,8 +279,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// StockLevel. // StockLevel.
public SysId CommodityId { get; set; } public SysId CommodityId { get; set; }
public SysId LocationId { get; set; } public SysId LocationId { get; set; }
+2 -2
View File
@@ -229,8 +229,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// SysParam. // SysParam.
public Sbm.SysParamCategory Category { get; set; } = Sbm.SysParamCategory.Any; public Sbm.SysParamCategory Category { get; set; } = Sbm.SysParamCategory.Any;
public String Name { get; set; } public String Name { get; set; }
@@ -245,8 +245,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// SystemAccount. // SystemAccount.
public Sbm.SystemAccountType Type { get; set; } = Sbm.SystemAccountType.Customer; public Sbm.SystemAccountType Type { get; set; } = Sbm.SystemAccountType.Customer;
public SysId InterfaceId { get; set; } public SysId InterfaceId { get; set; }
@@ -173,8 +173,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// SystemAccountUser. // SystemAccountUser.
public SysId InterfaceId { get; set; } public SysId InterfaceId { get; set; }
public SysId AccountId { get; set; } public SysId AccountId { get; set; }
@@ -219,8 +219,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// User. // User.
public SysId AffIdOwner { get; set; } public SysId AffIdOwner { get; set; }
public SysId InterfaceId { get; set; } public SysId InterfaceId { get; set; }
@@ -859,9 +859,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
// Nov-08 Current thinking is that the only differences is whether the 'In Progress' date has been specified and whether that should be used in preference to the 'Raised' date. // Nov-08 Current thinking is that the only differences is whether the 'In Progress' date has been specified and whether that should be used in preference to the 'Raised' date.
if (DateUtil.IsValid(inProgress) && (transactionStatusCat == SbmTransaction.StatusCat.Open || transactionStatusCat == SbmTransaction.StatusCat.Closed)) if (DateUtil.IsValid(inProgress) && (transactionStatusCat == SbmTransaction.StatusCat.Open || transactionStatusCat == SbmTransaction.StatusCat.Closed))
{ {
using (SbmConfigConsole configConsole = SbmGlobals.Application.CreateConfigConsole(userContext.SessionContext)) using (SbmSessionConsole sessionConsole = SbmGlobals.Application.CreateSessionConsole(userContext))
{ {
if (configConsole != null && configConsole.UseInProgressTaxDateAsTaxPoint(userContext, transactionType)) if (sessionConsole != null && sessionConsole.UseInProgressTaxDateAsTaxPoint(transactionType))
return inProgress; return inProgress;
} }
} }
@@ -1646,8 +1646,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; set; } = new List<SysId>(); public List<SysId> IdsIncluded { get; set; } = new List<SysId>();
public List<SysId> ExcludedIds { get; set; } = new List<SysId>(); public List<SysId> IdsExcluded { get; set; } = new List<SysId>();
// Transaction. // Transaction.
public SysId AssocId { get; set; } public SysId AssocId { get; set; }
public SysId TransIdSource { get; set; } public SysId TransIdSource { get; set; }
@@ -1721,7 +1721,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
// Test each 'significant' element of the filter and return 'false' if any of the values are set. // Test each 'significant' element of the filter and return 'false' if any of the values are set.
// NB Elements without a test in the list below are not regarded as 'significant'. // NB Elements without a test in the list below are not regarded as 'significant'.
if (ForceFullResults) return false; if (ForceFullResults) return false;
if (IncludedIds.Count > 0) return false; if (IdsIncluded.Count > 0) return false;
if (SysId.IsValid(TransIdSource)) return false; if (SysId.IsValid(TransIdSource)) return false;
if (StatusCat == StatusCat.Pending || StatusCat == StatusCat.Open) return false; if (StatusCat == StatusCat.Pending || StatusCat == StatusCat.Open) return false;
if (!StringUtil.IsEmpty(AssocPartial)) return false; if (!StringUtil.IsEmpty(AssocPartial)) return false;
+2 -2
View File
@@ -567,8 +567,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Vehicle. // Vehicle.
public SysId VehicleClassId { get; set; } public SysId VehicleClassId { get; set; }
public SysId AssetCatIdInclude { get; set; } public SysId AssetCatIdInclude { get; set; }
@@ -317,8 +317,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// VehicleEvent. // VehicleEvent.
public SysId VehicleId { get; set; } public SysId VehicleId { get; set; }
public Sbm.VehicleEventType VehicleEventType { get; set; } = Sbm.VehicleEventType.Any; public Sbm.VehicleEventType VehicleEventType { get; set; } = Sbm.VehicleEventType.Any;
@@ -300,8 +300,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params public new class Params : SacsHierarchyItem.Params
{ {
// List filtering. // List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>(); public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>(); public List<SysId> IdsExcluded { get; } = new List<SysId>();
// VehicleFeature. // VehicleFeature.
public SysId VehicleId { get; set; } public SysId VehicleId { get; set; }
public Sbm.VehicleFeatureSource VehicleFeatureSource { get; set; } = Sbm.VehicleFeatureSource.Any; public Sbm.VehicleFeatureSource VehicleFeatureSource { get; set; } = Sbm.VehicleFeatureSource.Any;
@@ -16,7 +16,10 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{ {
//======================================================================= //=======================================================================
public class SbmConfigConsole : SacsDisposable /// <summary>
/// Application configuration associated with a specific session.
/// </summary>
public class SbmSessionConsole : SacsDisposable
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Interface definition. // Interface definition.
@@ -26,11 +29,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{ {
} }
public SysId InterfaceId { get; } = new SysId(); public SysId InterfaceId { get; } = new SysId();
public String Context { get; } = ""; public string Context { get; } = "";
public SaInterfaceCategory InterfaceCategory { get; } = SaInterfaceCategory.Unknown; public SaInterfaceCategory InterfaceCategory { get; } = SaInterfaceCategory.Unknown;
public short InterfaceType { get; } public short InterfaceType { get; }
public String Code { get; } = ""; public string Code { get; } = "";
public String Caption { get; } = ""; public string Caption { get; } = "";
public bool Active { get; } public bool Active { get; }
} }
// Sage/Quickbooks interface definition. // Sage/Quickbooks interface definition.
@@ -68,6 +71,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private List<TypeCodeDesc> transactionTypes_Full = new List<TypeCodeDesc>(); private List<TypeCodeDesc> transactionTypes_Full = new List<TypeCodeDesc>();
private SbmInstanceConfig instanceConfig;
private SbmAccountsDfn accountsDfn; private SbmAccountsDfn accountsDfn;
private AccountsInterfaceDfn dfnSageInt = new AccountsInterfaceDfn(); private AccountsInterfaceDfn dfnSageInt = new AccountsInterfaceDfn();
private AccountsInterfaceDfn dfnQBooksInt = new AccountsInterfaceDfn(); private AccountsInterfaceDfn dfnQBooksInt = new AccountsInterfaceDfn();
@@ -76,12 +80,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
protected SbmConfigConsole(Sbm.ConfigConsole configConsole, SbmVersion consoleVersion, SbmSessionContext sessionContext) protected SbmSessionConsole(Sbm.SessionConfig sessionConfig, SbmVersion consoleVersion, ISbmUserContext_Core userContext)
{ {
ConfigConsole = configConsole; this.SessionConfig = sessionConfig;
AppVersion = new SbmVersion("BusinessMgr", Sbm.Version.GetFullVersion(), SbmSystem.AssemblyBuildAt); this.AppVersion = new SbmVersion("BusinessMgr", Sbm.Version.GetFullVersion(), SacsSystem.AssemblyBuildAt);
ConsoleVersion = consoleVersion; this.ConsoleVersion = consoleVersion;
SessionContext = sessionContext; this.UserContext = userContext;
} }
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
@@ -92,20 +96,22 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public Sbm.ConfigConsole ConfigConsole { get; } public Sbm.SessionConfig SessionConfig { get; }
public SbmSessionContext SessionContext { get; } public ISbmUserContext_Core UserContext { get; }
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
public SbmVersion AppVersion { get; } public SbmVersion AppVersion { get; }
public SbmVersion ConsoleVersion { get; } public SbmVersion ConsoleVersion { get; }
public SbmInstanceConfig InstanceConfig { get { if (instanceConfig == null) instanceConfig = SbmGlobals.Application.GetInstanceConfig(SessionContext); return instanceConfig; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C r e a t e C o n s o l e // C r e a t e C o n s o l e
//------------------------------------------------------------------- //-------------------------------------------------------------------
public static SbmConfigConsole CreateConsole(SbmSessionContext sessionContext) public static SbmSessionConsole CreateConsole(ISbmUserContext_Core userContext)
{ {
SaLogger.Warn($"{SysUtil.Fn} Creating default configuration console."); SaLogger.Warn($"{SysUtil.Fn} Creating default configuration console.");
// Default console. // Default console.
SbmVersion consoleVersion = new SbmVersion("Standard", Sbm.Version.GetFullVersion(), SbmSystem.AssemblyBuildAt); SbmVersion consoleVersion = new SbmVersion("Standard", Sbm.Version.GetFullVersion(), SacsSystem.AssemblyBuildAt);
return new SbmConfigConsole(Sbm.ConfigConsole.Generic, consoleVersion, sessionContext); return new SbmSessionConsole(Sbm.SessionConfig.Generic, consoleVersion, userContext);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -115,7 +121,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// A p p l i c a t i o n // A p p l i c a t i o n
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Application Customisation. // Application Customisation.
public virtual String GetApplicationCaption(Sbm.CaptionType captionType) public virtual string GetApplicationCaption(Sbm.CaptionType captionType)
{ {
return "BusinessMgr"; return "BusinessMgr";
} }
@@ -127,7 +133,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
return new List<CodeDesc>(); return new List<CodeDesc>();
} }
public virtual bool DoAdditionalMenuOption(Sbm.MenuSection menuSection, String str) public virtual bool DoAdditionalMenuOption(Sbm.MenuSection menuSection, string str)
{ {
return false; return false;
} }
@@ -145,13 +151,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Application Configuration. - AllowOption. // Application Configuration. - AllowOption.
public virtual bool AllowOption(ISbmUserContext_Core userContext, Sbm.ConfigOption option) public virtual bool AllowOption(Sbm.ConfigOption option)
{ {
switch (option) switch (option)
{ {
// Application. // Application.
case Sbm.ConfigOption.SystemMenu: case Sbm.ConfigOption.SystemMenu:
return SacsSystem.DebugMode; return InstanceConfig.AllowApplicationOption(option, SacsSystem.DebugMode);
case Sbm.ConfigOption.AllowConsoleView: case Sbm.ConfigOption.AllowConsoleView:
case Sbm.ConfigOption.AllowOrganisationUpdate: case Sbm.ConfigOption.AllowOrganisationUpdate:
case Sbm.ConfigOption.AllowContacts: case Sbm.ConfigOption.AllowContacts:
@@ -160,26 +166,31 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.ConfigOption.AllowTransactions: case Sbm.ConfigOption.AllowTransactions:
case Sbm.ConfigOption.DiaryView: case Sbm.ConfigOption.DiaryView:
case Sbm.ConfigOption.AllowRequirementUpdateInline: case Sbm.ConfigOption.AllowRequirementUpdateInline:
return true; return InstanceConfig.AllowApplicationOption(option, true);
// Commodities. // Commodities.
case Sbm.ConfigOption.CommodityPartialCodeFilter: case Sbm.ConfigOption.CommodityPartialCodeFilter:
//return true; if (InstanceConfig.AllowApplicationOption(option, false))
return userContext.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.Commodity_PartialCodeFilter); return true;
return UserContext.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.Commodity_PartialCodeFilter);
// Order Pricing. // Order Pricing.
case Sbm.ConfigOption.CustomerPriceSet: case Sbm.ConfigOption.CustomerPriceSet:
case Sbm.ConfigOption.CustomerDiscount: case Sbm.ConfigOption.CustomerDiscount:
{ {
if (accountsDfn == null) accountsDfn = new SbmAccountsDfn(userContext); if (InstanceConfig.AllowApplicationOption(option, false))
return true;
if (accountsDfn == null) accountsDfn = new SbmAccountsDfn(UserContext);
return accountsDfn.IsUsingSageInterface() && accountsDfn.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Customer) && !accountsDfn.UseLocalCustomerPricing(); return accountsDfn.IsUsingSageInterface() && accountsDfn.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Customer) && !accountsDfn.UseLocalCustomerPricing();
} }
case Sbm.ConfigOption.SupplierPriceSet: case Sbm.ConfigOption.SupplierPriceSet:
case Sbm.ConfigOption.SupplierDiscount: case Sbm.ConfigOption.SupplierDiscount:
{ {
if (InstanceConfig.AllowApplicationOption(option, false))
return true;
SbmAccountsDfn account = null; SbmAccountsDfn account = null;
return account.IsUsingSageInterface() && account.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Supplier) && !account.UseLocalSupplierPricing(); return account.IsUsingSageInterface() && account.IsAssociationTypeManagedByAccounts(Sbm.AssociationType.Supplier) && !account.UseLocalSupplierPricing();
} }
} }
return false; return InstanceConfig.AllowApplicationOption(option, false);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -357,17 +368,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Supported Data Item Types. // Supported Data Item Types.
// Supported affiliate types (all allowed by default). // Supported affiliate types (all allowed by default).
public virtual bool AllowAffiliateType(ISbmUserContext_Core userContext, Sbm.AffiliateType type) public virtual bool AllowAffiliateType(Sbm.AffiliateType type)
{ {
return true; return InstanceConfig.AllowAffiliateType(type, true);
} }
// Supported Association types (all allowed by default). // Supported Association types (all allowed by default).
public virtual bool AllowAssociationType(ISbmUserContext_Core userContext, Sbm.AssociationType type) public virtual bool AllowAssociationType(Sbm.AssociationType type)
{ {
return true; return InstanceConfig.AllowAssociationType(type, true);
} }
// Supported Transaction types. // Supported Transaction types.
public virtual bool AllowTransactionType(ISbmUserContext_Core userContext, Sbm.TransactionType type) public virtual bool AllowTransactionType(Sbm.TransactionType type)
{ {
switch (type) switch (type)
{ {
@@ -375,15 +386,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.SalesQuote: case Sbm.TransactionType.SalesQuote:
case Sbm.TransactionType.SalesOrder: case Sbm.TransactionType.SalesOrder:
//case Sbm.TransactionType.PurchaseOrder: //case Sbm.TransactionType.PurchaseOrder:
return true; return InstanceConfig.AllowTransactionType(type, true);
// Proforma types are only allowed if ther counterparts cannot be created. // Proforma types are only allowed if ther counterparts cannot be created.
case Sbm.TransactionType.ProformaPurchaseOrder: case Sbm.TransactionType.ProformaPurchaseOrder:
return (AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder) && !CanCreateTransactionLocally(userContext, Sbm.TransactionType.PurchaseOrder)); return InstanceConfig.AllowTransactionType(type, AllowTransactionType(Sbm.TransactionType.PurchaseOrder) && !CanCreateTransactionLocally(Sbm.TransactionType.PurchaseOrder));
case Sbm.TransactionType.ProformaSalesOrder: case Sbm.TransactionType.ProformaSalesOrder:
return (AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder) && !CanCreateTransactionLocally(userContext, Sbm.TransactionType.SalesOrder)); return InstanceConfig.AllowTransactionType(type, AllowTransactionType(Sbm.TransactionType.SalesOrder) && !CanCreateTransactionLocally(Sbm.TransactionType.SalesOrder));
case Sbm.TransactionType.ProformaSalesInvoice: case Sbm.TransactionType.ProformaSalesInvoice:
return (AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice) && !CanCreateTransactionLocally(userContext, Sbm.TransactionType.SalesInvoice)); return InstanceConfig.AllowTransactionType(type, AllowTransactionType(Sbm.TransactionType.SalesInvoice) && !CanCreateTransactionLocally(Sbm.TransactionType.SalesInvoice));
} }
return false; return false;
} }
@@ -392,27 +403,27 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// D a t a O p t i o n s // D a t a O p t i o n s
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Application Configuration. - Display and caption for data attributes. // Application Configuration. - Display and caption for data attributes.
public virtual bool DisplayAttribute(ISbmUserContext_Core userContext, SbmDbDfn.ColumnIdx column) public virtual bool DisplayAttribute(SbmDbDfn.ColumnIdx column)
{ {
switch (column) switch (column)
{ {
// Fields that are tied to other columns for the purposes of controlling their display. // Fields that are tied to other columns for the purposes of controlling their display.
case SbmDbDfn.ColumnIdx.Commodity_UomIdWeight: case SbmDbDfn.ColumnIdx.Commodity_UomIdWeight:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Weight); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Weight);
case SbmDbDfn.ColumnIdx.Commodity_UomIdLength: case SbmDbDfn.ColumnIdx.Commodity_UomIdLength:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Length); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Length);
case SbmDbDfn.ColumnIdx.Commodity_UomIdVolume: case SbmDbDfn.ColumnIdx.Commodity_UomIdVolume:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Volume); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Volume);
case SbmDbDfn.ColumnIdx.Commodity_UomIdDensity: case SbmDbDfn.ColumnIdx.Commodity_UomIdDensity:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Density); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Density);
case SbmDbDfn.ColumnIdx.Commodity_UomIdBox: case SbmDbDfn.ColumnIdx.Commodity_UomIdBox:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_BoxQuantity); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_BoxQuantity);
case SbmDbDfn.ColumnIdx.Commodity_UomIdTimeProd: case SbmDbDfn.ColumnIdx.Commodity_UomIdTimeProd:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_TimeProd); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_TimeProd);
case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdMaterial: case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdMaterial:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_MaterialCost); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_MaterialCost);
case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdExWorks: case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdExWorks:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_ExWorksCost); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_ExWorksCost);
case SbmDbDfn.ColumnIdx.Commodity_CommodityIdSalesProj: case SbmDbDfn.ColumnIdx.Commodity_CommodityIdSalesProj:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonthlyProp: case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonthlyProp:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth01: case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth01:
@@ -427,23 +438,23 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth10: case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth10:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth11: case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth11:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth12: case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth12:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_SalesProjAnnual); return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_SalesProjAnnual);
default: // Sep-08: Session profile should be able to handle all fields now (rather than just those that are controlled) default: // Sep-08: Session profile should be able to handle all fields now (rather than just those that are controlled)
return userContext.GetOwnerOption_ShowField(column); return UserContext.GetOwnerOption_ShowField(column);
} }
//return true; //return true;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Alternative data value captions. // Alternative data value captions.
public virtual String GetAttributeCaption(ISbmUserContext_Core userContext, SbmDbDfn.ColumnIdx column, string Default) public virtual string GetAttributeCaption(SbmDbDfn.ColumnIdx column, string Default)
{ {
String Caption = ""; string Caption = "";
if (column != SbmDbDfn.ColumnIdx.Unknown) if (column != SbmDbDfn.ColumnIdx.Unknown)
{ {
Caption = userContext.GetOwnerOption_FieldLabel(column, Default); Caption = UserContext.GetOwnerOption_FieldLabel(column, Default);
} }
if (StringUtil.IsEmpty(Caption)) Caption = Default; if (Caption.IsEmpty()) Caption = Default;
return Caption; return Caption;
} }
@@ -451,7 +462,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// T r a n s a c t i o n O p t i o n s // T r a n s a c t i o n O p t i o n s
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Job Tracking Options. // Job Tracking Options.
public virtual String GetDefaultQuoteDescIntro(ISbmUserContext_Core userContext) public virtual string GetDefaultQuoteDescIntro()
{ {
return ""; return "";
} }
@@ -471,19 +482,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Create Transaction. // Create Transaction.
public virtual bool CanCreateTransactionLocally(ISbmUserContext_Core userContext, Sbm.TransactionType type) public virtual bool CanCreateTransactionLocally(Sbm.TransactionType type)
{ {
if (!AllowTransactionType(userContext, type)) return false; if (!AllowTransactionType(type)) return false;
// Refresh options. // Refresh options.
if (dfnSageInt.AffiliateId_Owner != userContext.OrganisationAffiliateId || dfnQBooksInt.AffiliateId_Owner != userContext.OrganisationAffiliateId) if (dfnSageInt.AffiliateId_Owner != UserContext.OrganisationAffiliateId || dfnQBooksInt.AffiliateId_Owner != UserContext.OrganisationAffiliateId)
{ {
// Reset the accounts interface configurations. // Reset the accounts interface configurations.
dfnSageInt.ClearConfig(); dfnSageInt.ClearConfig();
dfnSageInt.AffiliateId_Owner = userContext.OrganisationAffiliateId; dfnSageInt.AffiliateId_Owner = UserContext.OrganisationAffiliateId;
dfnQBooksInt.ClearConfig(); dfnQBooksInt.ClearConfig();
dfnQBooksInt.AffiliateId_Owner = userContext.OrganisationAffiliateId; dfnQBooksInt.AffiliateId_Owner = UserContext.OrganisationAffiliateId;
// Identify the interfaces. // Identify the interfaces.
SbmAccountsDfn accountsDfn = new SbmAccountsDfn(userContext); SbmAccountsDfn accountsDfn = new SbmAccountsDfn(UserContext);
dfnSageInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.SageLine50); dfnSageInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.SageLine50);
dfnQBooksInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.QuickBooks); dfnQBooksInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.QuickBooks);
@@ -523,12 +534,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
createTransaction_SalesQuote = true; createTransaction_SalesQuote = true;
createTransaction_SalesOrder = true; createTransaction_SalesOrder = true;
createTrans_SalesInvoice = true; createTrans_SalesInvoice = true;
if (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = (!dfnSageInt.importPurchaseOrder && !dfnSageInt.exportPurchaseOrder); if (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = !dfnSageInt.importPurchaseOrder && !dfnSageInt.exportPurchaseOrder;
if (createTransaction_SalesOrder) createTransaction_SalesOrder = (!dfnSageInt.importSalesOrder && !dfnSageInt.exportSalesOrder); if (createTransaction_SalesOrder) createTransaction_SalesOrder = !dfnSageInt.importSalesOrder && !dfnSageInt.exportSalesOrder;
if (createTrans_SalesInvoice) createTrans_SalesInvoice = (!dfnSageInt.importProductInvoice && !dfnSageInt.exportProductInvoice && !dfnSageInt.importServiceInvoice && !dfnSageInt.exportServiceInvoice && !dfnSageInt.importSalesOrderInvoice && !dfnSageInt.bexport_SalesOrderInvoice); if (createTrans_SalesInvoice) createTrans_SalesInvoice = !dfnSageInt.importProductInvoice && !dfnSageInt.exportProductInvoice && !dfnSageInt.importServiceInvoice && !dfnSageInt.exportServiceInvoice && !dfnSageInt.importSalesOrderInvoice && !dfnSageInt.bexport_SalesOrderInvoice;
if (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = (!dfnQBooksInt.importPurchaseOrder && !dfnQBooksInt.exportPurchaseOrder); if (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = !dfnQBooksInt.importPurchaseOrder && !dfnQBooksInt.exportPurchaseOrder;
if (createTransaction_SalesOrder) createTransaction_SalesOrder = (!dfnQBooksInt.importSalesOrder && !dfnQBooksInt.exportSalesOrder); if (createTransaction_SalesOrder) createTransaction_SalesOrder = !dfnQBooksInt.importSalesOrder && !dfnQBooksInt.exportSalesOrder;
if (createTrans_SalesInvoice) createTrans_SalesInvoice = (!dfnQBooksInt.importProductInvoice && !dfnQBooksInt.exportProductInvoice && !dfnQBooksInt.importServiceInvoice && !dfnQBooksInt.exportServiceInvoice && !dfnQBooksInt.importSalesOrderInvoice && !dfnQBooksInt.bexport_SalesOrderInvoice); if (createTrans_SalesInvoice) createTrans_SalesInvoice = !dfnQBooksInt.importProductInvoice && !dfnQBooksInt.exportProductInvoice && !dfnQBooksInt.importServiceInvoice && !dfnQBooksInt.exportServiceInvoice && !dfnQBooksInt.importSalesOrderInvoice && !dfnQBooksInt.bexport_SalesOrderInvoice;
// Sales quotes are also imported from Sage Sales Orders. // Sales quotes are also imported from Sage Sales Orders.
createTransaction_SalesQuote = createTransaction_SalesOrder; createTransaction_SalesQuote = createTransaction_SalesOrder;
@@ -553,7 +564,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{ {
System, Manual, Option System, Manual, Option
} }
public virtual AssignTransRefMethod TransactionAssignRefMethod(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes) public virtual AssignTransRefMethod TransactionAssignRefMethod(Sbm.TransactionType transTypes)
{ {
return AssignTransRefMethod.System; return AssignTransRefMethod.System;
} }
@@ -561,28 +572,28 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{ {
ByOwnerType, ByType ByOwnerType, ByType
} }
public virtual AssignTransRefSource TransactionAssignRefSource(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes) public virtual AssignTransRefSource TransactionAssignRefSource(Sbm.TransactionType transTypes)
{ {
return AssignTransRefSource.ByOwnerType; return AssignTransRefSource.ByOwnerType;
} }
// By default all types of transaction have their own Id sequence. // By default all types of transaction have their own Id sequence.
// Override this method to allow different types of transaction to share Id sequence. // Override this method to allow different types of transaction to share Id sequence.
public virtual Sbm.TransactionType GetTransactionTypeForNextId(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes) public virtual Sbm.TransactionType GetTransactionTypeForNextId(Sbm.TransactionType transTypes)
{ {
return transTypes; return transTypes;
} }
// NextId key value. // NextId key value.
public virtual String GetTransactionNextIdKey(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType eType) public virtual string GetTransactionNextIdKey(SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType eType)
{ {
idAssoc = new SysId(); idAssoc = new SysId();
Sbm.TransactionType transTypes = GetTransactionTypeForNextId(userContext, eType); Sbm.TransactionType transTypes = GetTransactionTypeForNextId(eType);
switch (TransactionAssignRefSource(userContext, eType)) switch (TransactionAssignRefSource(eType))
{ {
case AssignTransRefSource.ByOwnerType: case AssignTransRefSource.ByOwnerType:
// Next Id depends on both the transaction type and owner. // Next Id depends on both the transaction type and owner.
return (String)"TransRef:" + transTypes.ToString() + ":" + AffiliateId_Owner.ToString(); return "TransRef:" + transTypes.ToString() + ":" + AffiliateId_Owner.ToString();
default: default:
// Next Id only depends on the transaction type. // Next Id only depends on the transaction type.
return "TransRef:" + transTypes.ToString(); return "TransRef:" + transTypes.ToString();
@@ -590,12 +601,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
} }
// Set the minimum Id for transactions of the specified type. // Set the minimum Id for transactions of the specified type.
public virtual bool SetMinTransactionId(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long iId) public virtual bool SetMinTransactionId(SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long iId)
{ {
bool set = false; bool set = false;
if (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) != null) if (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) != null)
{ {
String nextIdKey = GetTransactionNextIdKey(userContext, AffiliateId_Owner, idAssoc, transTypes); string nextIdKey = GetTransactionNextIdKey(AffiliateId_Owner, idAssoc, transTypes);
// ToDo set = SbmGlobals.Database.SetMinNextId(nextIdKey, iId, false); // ToDo set = SbmGlobals.Database.SetMinNextId(nextIdKey, iId, false);
} }
return set; return set;
@@ -603,61 +614,61 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// The implementation in this class will generate simple numeric values for the owner // The implementation in this class will generate simple numeric values for the owner
// and global options that can be formatted (eg. to fixed length) by overwridden versions. // and global options that can be formatted (eg. to fixed length) by overwridden versions.
public virtual String GetTransactionCreateRef public virtual string GetTransactionCreateRef
(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes) (SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
{ {
String Ref = ""; string Ref = "";
if (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) != null) if (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) != null)
{ {
String NextIdKey = GetTransactionNextIdKey(userContext, AffiliateId_Owner, idAssoc, transTypes); string NextIdKey = GetTransactionNextIdKey(AffiliateId_Owner, idAssoc, transTypes);
// ToDo long iRefNext = SbmGlobals.Database.GetNextId(NextIdKey, false); // ToDo long iRefNext = SbmGlobals.Database.GetNextId(NextIdKey, false);
// Ref = FormatTransactionCreateRef(AffiliateId_Owner, idAssoc, transTypes, iRefNext); // Ref = FormatTransactionCreateRef(AffiliateId_Owner, idAssoc, transTypes, iRefNext);
} }
return Ref; return Ref;
} }
public virtual String FormatTransactionCreateRef public virtual string FormatTransactionCreateRef
(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt) (SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt)
{ {
String Ref = ""; string Ref = "";
if (RefInt > 0) if (RefInt > 0)
{ {
// Retrieve and validate the sequence padding length. // Retrieve and validate the sequence padding length.
int SeqLen = Math.Max(1, Math.Min(8, GetTransactionRefSeqLength(userContext, AffiliateId_Owner, idAssoc, transTypes))); int SeqLen = Math.Max(1, Math.Min(8, GetTransactionRefSeqLength(AffiliateId_Owner, idAssoc, transTypes)));
// Pad the sequence number. // Pad the sequence number.
//Ref = String(RefInt, SeqLen); //Ref = String(RefInt, SeqLen);
// Add the reference prefix (max 5 chars) // Add the reference prefix (max 5 chars)
String prefix = GetTransactionRefPrefix(AffiliateId_Owner, idAssoc, transTypes); string prefix = GetTransactionRefPrefix(AffiliateId_Owner, idAssoc, transTypes);
Ref = prefix.Left(5) + Ref; Ref = prefix.Left(5) + Ref;
} }
return Ref; return Ref;
} }
public virtual int GetTransactionRefSeqLength(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes) public virtual int GetTransactionRefSeqLength(SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
{ {
return 5; return 5;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Transaction reference prefix by type</summary> /// <summary>Transaction reference prefix by type</summary>
public virtual String GetTransactionRefPrefix(SysId id, SysId idAssoc, Sbm.TransactionType transactionType) public virtual string GetTransactionRefPrefix(SysId id, SysId idAssoc, Sbm.TransactionType transactionType)
{ {
return ""; return "";
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Raise Transaction. // Raise Transaction.
public virtual bool CanRaiseTransaction(ISbmUserContext_Core userContext, Sbm.TransactionType typeFrom, Sbm.TransactionType typeTo) public virtual bool CanRaiseTransaction(Sbm.TransactionType typeFrom, Sbm.TransactionType typeTo)
{ {
if (!AllowTransactionType(userContext, typeFrom) || !AllowTransactionType(userContext, typeTo)) return false; if (!AllowTransactionType(typeFrom) || !AllowTransactionType(typeTo)) return false;
if (!CanCreateTransactionLocally(userContext, typeTo)) return false; if (!CanCreateTransactionLocally(typeTo)) return false;
if (typeFrom == Sbm.TransactionType.Project) if (typeFrom == Sbm.TransactionType.Project)
{ {
// Can raise another project from a project. // Can raise another project from a project.
switch (typeTo) switch (typeTo)
{ {
case Sbm.TransactionType.Project: case Sbm.TransactionType.Project:
return CanCreateTransactionLocally(userContext, typeTo); return CanCreateTransactionLocally(typeTo);
} }
} }
else if (typeFrom == Sbm.TransactionType.SalesLead) else if (typeFrom == Sbm.TransactionType.SalesLead)
@@ -668,7 +679,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.SalesQuote: case Sbm.TransactionType.SalesQuote:
case Sbm.TransactionType.ProformaSalesOrder: case Sbm.TransactionType.ProformaSalesOrder:
case Sbm.TransactionType.SalesOrder: case Sbm.TransactionType.SalesOrder:
return CanCreateTransactionLocally(userContext, typeTo); return CanCreateTransactionLocally(typeTo);
} }
} }
else if (typeFrom == Sbm.TransactionType.SalesQuote) else if (typeFrom == Sbm.TransactionType.SalesQuote)
@@ -682,7 +693,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.SalesOrder: case Sbm.TransactionType.SalesOrder:
case Sbm.TransactionType.ProformaSalesInvoice: case Sbm.TransactionType.ProformaSalesInvoice:
case Sbm.TransactionType.SalesInvoice: case Sbm.TransactionType.SalesInvoice:
return CanCreateTransactionLocally(userContext, typeTo); return CanCreateTransactionLocally(typeTo);
} }
} }
else if (typeFrom == Sbm.TransactionType.SalesOrder || typeFrom == Sbm.TransactionType.ProformaSalesOrder) else if (typeFrom == Sbm.TransactionType.SalesOrder || typeFrom == Sbm.TransactionType.ProformaSalesOrder)
@@ -701,7 +712,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.PurchaseQuote: case Sbm.TransactionType.PurchaseQuote:
case Sbm.TransactionType.ProformaPurchaseOrder: case Sbm.TransactionType.ProformaPurchaseOrder:
case Sbm.TransactionType.PurchaseOrder: case Sbm.TransactionType.PurchaseOrder:
return CanCreateTransactionLocally(userContext, typeTo); return CanCreateTransactionLocally(typeTo);
} }
} }
else if (typeFrom == Sbm.TransactionType.SalesDispatch) else if (typeFrom == Sbm.TransactionType.SalesDispatch)
@@ -711,7 +722,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{ {
case Sbm.TransactionType.ProformaSalesInvoice: case Sbm.TransactionType.ProformaSalesInvoice:
case Sbm.TransactionType.SalesInvoice: case Sbm.TransactionType.SalesInvoice:
return CanCreateTransactionLocally(userContext, typeTo); return CanCreateTransactionLocally(typeTo);
} }
} }
else if (typeFrom == Sbm.TransactionType.PurchaseQuote) else if (typeFrom == Sbm.TransactionType.PurchaseQuote)
@@ -722,7 +733,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.PurchaseQuote: case Sbm.TransactionType.PurchaseQuote:
case Sbm.TransactionType.ProformaPurchaseOrder: case Sbm.TransactionType.ProformaPurchaseOrder:
case Sbm.TransactionType.PurchaseOrder: case Sbm.TransactionType.PurchaseOrder:
return CanCreateTransactionLocally(userContext, typeTo); return CanCreateTransactionLocally(typeTo);
} }
} }
else if (typeFrom == Sbm.TransactionType.PurchaseOrder || typeFrom == Sbm.TransactionType.ProformaPurchaseOrder) else if (typeFrom == Sbm.TransactionType.PurchaseOrder || typeFrom == Sbm.TransactionType.ProformaPurchaseOrder)
@@ -736,39 +747,39 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.PurchaseQuote: case Sbm.TransactionType.PurchaseQuote:
case Sbm.TransactionType.ProformaPurchaseOrder: case Sbm.TransactionType.ProformaPurchaseOrder:
case Sbm.TransactionType.PurchaseOrder: case Sbm.TransactionType.PurchaseOrder:
return CanCreateTransactionLocally(userContext, typeTo); return CanCreateTransactionLocally(typeTo);
} }
} }
return false; return false;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseFrom(ISbmUserContext_Core userContext, Sbm.TransactionType typeFrom) public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseFrom(Sbm.TransactionType typeFrom)
{ {
// Build the list of transaction types that are allowed to be raised from the specified type. // Build the list of transaction types that are allowed to be raised from the specified type.
List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>(); List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>();
if (transactionTypes_Full.Count == 0) transactionTypes_Full = SbmSystem.GetCodesOfType(userContext, Sbm.SystemCode.TransactionType); if (transactionTypes_Full.Count == 0) transactionTypes_Full = SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.TransactionType);
foreach (TypeCodeDesc transTypeTo in transactionTypes_Full) foreach (TypeCodeDesc transTypeTo in transactionTypes_Full)
{ {
//if ((Sbm.TransactionType)typeTo.iType == typeFrom) continue; //if ((Sbm.TransactionType)typeTo.iType == typeFrom) continue;
if (CanRaiseTransaction(userContext, typeFrom, (Sbm.TransactionType)transTypeTo.Type)) if (CanRaiseTransaction(typeFrom, (Sbm.TransactionType)transTypeTo.Type))
transTypes.Add(transTypeTo); transTypes.Add(transTypeTo);
} }
return transTypes; return transTypes;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseTo(ISbmUserContext_Core userContext, Sbm.TransactionType typeTo) public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseTo(Sbm.TransactionType typeTo)
{ {
// Build the list of transaction types that are allowed to be raised to the specified type. // Build the list of transaction types that are allowed to be raised to the specified type.
List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>(); List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>();
if (transactionTypes_Full.Count == 0) transactionTypes_Full = SbmSystem.GetCodesOfType(userContext, Sbm.SystemCode.TransactionType); if (transactionTypes_Full.Count == 0) transactionTypes_Full = SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.TransactionType);
//transTypes_Full.GotoStart(); //transTypes_Full.GotoStart();
foreach (TypeCodeDesc transTypeTo in transactionTypes_Full) foreach (TypeCodeDesc transTypeTo in transactionTypes_Full)
{ {
//TypeCodeDesc & typeTo = transTypes_Full.Index(); //TypeCodeDesc & typeTo = transTypes_Full.Index();
if ((Sbm.TransactionType)transTypeTo.Type == typeTo) continue; if ((Sbm.TransactionType)transTypeTo.Type == typeTo) continue;
if (CanRaiseTransaction(userContext, (Sbm.TransactionType)transTypeTo.Type, typeTo)) if (CanRaiseTransaction((Sbm.TransactionType)transTypeTo.Type, typeTo))
transTypes.Add(transTypeTo); transTypes.Add(transTypeTo);
} }
return transTypes; return transTypes;
@@ -776,7 +787,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Prepare Requirements Transaction. - Prepare copied list of requirements, eg. when raising from another transaction. // Prepare Requirements Transaction. - Prepare copied list of requirements, eg. when raising from another transaction.
public virtual bool PrepareCopiedRequirements(ISbmUserContext_Core userContext, SbmTransaction transSource, List<SbmRequirement> requireList, Sbm.TransactionType type) public virtual bool PrepareCopiedRequirements(SbmTransaction transSource, List<SbmRequirement> requireList, Sbm.TransactionType type)
{ {
type = new Sbm.TransactionType(); type = new Sbm.TransactionType();
//transSource; requireList; type; //transSource; requireList; type;
@@ -785,15 +796,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Remove Transaction.- By default, not allowed if transaction has requirements. // Remove Transaction.- By default, not allowed if transaction has requirements.
public virtual bool CanRemoveTransactionWithRequirements(ISbmUserContext_Core userContext, SbmTransaction transaction, int requirementCount) public virtual bool CanRemoveTransactionWithRequirements(SbmTransaction transaction, int requirementCount)
{ {
if (transaction == null || !SysId.IsValid(transaction.Id)) return false; if (transaction == null || !SysId.IsValid(transaction.Id)) return false;
return (requirementCount < 1); return requirementCount < 1;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Tax Effective Date. - TransTypes that should use the 'In Progress' date as tax point as opposed to the 'Raised' date. // Tax Effective Date. - TransTypes that should use the 'In Progress' date as tax point as opposed to the 'Raised' date.
public virtual bool UseInProgressTaxDateAsTaxPoint(ISbmUserContext_Core userContext, Sbm.TransactionType transactionType) public virtual bool UseInProgressTaxDateAsTaxPoint(Sbm.TransactionType transactionType)
{ {
switch (transactionType) switch (transactionType)
{ {
@@ -811,14 +822,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// R e q u i r e m e n t O p t i o n s // R e q u i r e m e n t O p t i o n s
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Requirement Actions. // Requirement Actions.
public virtual bool SearchCommodityOnCreateRequirement(ISbmUserContext_Core userContext, Sbm.TransactionType transactionType) public virtual bool SearchCommodityOnCreateRequirement(Sbm.TransactionType transactionType)
{ {
return false; return false;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Requirement Costing. // Requirement Costing.
public virtual SbmRequirementCostingConfig GetRequirementCostingConfig(ISbmUserContext_Core userContext) public virtual SbmRequirementCostingConfig GetRequirementCostingConfig()
{ {
SbmRequirementCostingConfig cfgRequirementCosting = new SbmRequirementCostingConfig(); SbmRequirementCostingConfig cfgRequirementCosting = new SbmRequirementCostingConfig();
return cfgRequirementCosting; return cfgRequirementCosting;
@@ -828,21 +839,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// C o m m o d i t y O p t i o n s // C o m m o d i t y O p t i o n s
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Commodity Management. // Commodity Management.
public virtual Sbm.CommodityType GetCommodityTypeDefault(ISbmUserContext_Core userContext, Sbm.OrgOption_CommodityType commodityType) public virtual Sbm.CommodityType GetCommodityTypeDefault(Sbm.OrgOption_CommodityType commodityType)
{ {
// Default = 'Stock'. // Default = 'Stock'.
return Sbm.CommodityType.Stock; return Sbm.CommodityType.Stock;
} }
// Clean-up imported data (default no action). // Clean-up imported data (default no action).
public virtual bool CleanupImportedCommodity(ISbmUserContext_Core userContext, SbmCommodity commodity) public virtual bool CleanupImportedCommodity(SbmCommodity commodity)
{ {
return true; return true;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Stock Control // Stock Control
public virtual SbmStockControlConfig GetStockControlConfig(ISbmUserContext_Core userContext) public virtual SbmStockControlConfig GetStockControlConfig()
{ {
SbmStockControlConfig cfgStockControl = new SbmStockControlConfig(); SbmStockControlConfig cfgStockControl = new SbmStockControlConfig();
return cfgStockControl; return cfgStockControl;
@@ -852,11 +863,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// R e p o r t i n g // R e p o r t i n g
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Available reports (over and above standard). // Available reports (over and above standard).
public virtual List<SbmReport_Base> GetReports(ISbmUserContext_Core userContext, Sbm.View view) public virtual List<SbmReport_Base> GetReports(Sbm.View view)
{ {
return new List<SbmReport_Base>(); return new List<SbmReport_Base>();
} }
public virtual bool ItemHasDiaryReports(ISbmUserContext_Core userContext/*SaItemId &*/) public virtual bool ItemHasDiaryReports(ItemId itemId)
{ {
return false; return false;
} }
@@ -882,7 +893,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
/// <summary>Sales Invoice report horizontal lines [Bool]</summary> /// <summary>Sales Invoice report horizontal lines [Bool]</summary>
RptSalesInvoiceHorizontalLines = 111, RptSalesInvoiceHorizontalLines = 111,
} }
public virtual DataValue GetDefaultProcessParam(ISbmUserContext_Core userContext, ProcessParam prm) public virtual DataValue GetDefaultProcessParam(ProcessParam prm)
{ {
switch (prm) switch (prm)
{ {
@@ -895,18 +906,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Automated processes. // Automated processes.
public virtual bool PerformProcess(ISbmUserContext_Core userContext, Sbm.ProcessType type) public virtual bool PerformProcess(Sbm.ProcessType type)
{ {
return false; return false;
} }
// Available data import/export processes (over and above standard). // Available data import/export processes (over and above standard).
public virtual List<ISbmProcess_DataImport> GetImportProcesses(ISbmUserContext_Core userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds) public virtual List<ISbmProcess_DataImport> GetImportProcesses(Sbm.InterfaceDataType dataType, List<SysId> itemIds)
{ {
return new List<ISbmProcess_DataImport>(); return new List<ISbmProcess_DataImport>();
} }
public virtual List<ISbmProcess_DataExport> GetExportProcesses(ISbmUserContext_Core userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds) public virtual List<ISbmProcess_DataExport> GetExportProcesses(Sbm.InterfaceDataType dataType, List<SysId> itemIds)
{ {
return new List<ISbmProcess_DataExport>(); return new List<ISbmProcess_DataExport>();
} }
@@ -915,17 +926,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// Data export Enhancements. eg. for export to accounts. // Data export Enhancements. eg. for export to accounts.
public class DataExportItemDetails public class DataExportItemDetails
{ {
internal DataExportItemDetails(String itemCode, String itemDesc, String itemText) internal DataExportItemDetails(string itemCode, string itemDesc, string itemText)
{ {
ItemCode = itemCode; ItemCode = itemCode;
ItemDesc = itemDesc; ItemDesc = itemDesc;
ItemText = itemText; ItemText = itemText;
} }
public String ItemCode { get; } public string ItemCode { get; }
public String ItemDesc { get; } public string ItemDesc { get; }
public String ItemText { get; } public string ItemText { get; }
}; };
public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(ISbmUserContext_Core userContext, SbmRequirement requirement) public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(SbmRequirement requirement)
{ {
return null; return null;
} }
@@ -933,16 +944,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//------------------------------------------------------------------- //-------------------------------------------------------------------
// I n t e r f a c e O p t i o n s // I n t e r f a c e O p t i o n s
//------------------------------------------------------------------- //-------------------------------------------------------------------
public virtual bool AllowInterfaces(ISbmUserContext_Core userContext) public virtual bool AllowInterfaces()
{ {
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Website)) return true; if (AllowInterfaceCategory(SaInterfaceCategory.Website)) return true;
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Accounts)) return true; if (AllowInterfaceCategory(SaInterfaceCategory.Accounts)) return true;
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.System)) return true; if (AllowInterfaceCategory(SaInterfaceCategory.System)) return true;
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.File)) return true; if (AllowInterfaceCategory(SaInterfaceCategory.File)) return true;
return false; return false;
} }
public virtual bool AllowInterfaceCategory(ISbmUserContext_Core userContext, SaInterfaceCategory interfaceCategory) public virtual bool AllowInterfaceCategory(SaInterfaceCategory interfaceCategory)
{ {
// By default, only website and file interfaces are allowed. // By default, only website and file interfaces are allowed.
switch (interfaceCategory) switch (interfaceCategory)
@@ -954,9 +965,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
return false; return false;
} }
public virtual bool AllowInterface(ISbmUserContext_Core userContext, SaInterfaceCategory interfaceCategory, short interfaceType) public virtual bool AllowInterface(SaInterfaceCategory interfaceCategory, short interfaceType)
{ {
if (!AllowInterfaceCategory(userContext, interfaceCategory)) return false; if (!AllowInterfaceCategory(interfaceCategory)) return false;
switch (interfaceCategory) switch (interfaceCategory)
{ {
case SaInterfaceCategory.Website: case SaInterfaceCategory.Website:
@@ -987,29 +998,29 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// Sbm.InterfaceType_System.Hpi - Only allowed by derived console. // Sbm.InterfaceType_System.Hpi - Only allowed by derived console.
break; break;
case SaInterfaceCategory.File: case SaInterfaceCategory.File:
if (AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) if (AllowOption(Sbm.ConfigOption.AllowTransactions))
{ {
if (interfaceType == (short)Sbm.InterfaceType_File.TransactionImport) return true; if (interfaceType == (short)Sbm.InterfaceType_File.TransactionImport) return true;
if (interfaceType == (short)Sbm.InterfaceType_File.TransactionExport) return true; if (interfaceType == (short)Sbm.InterfaceType_File.TransactionExport) return true;
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesQuote) return AllowTransactionType(userContext, Sbm.TransactionType.SalesQuote); if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesQuote) return AllowTransactionType(Sbm.TransactionType.SalesQuote);
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesOrder) return (AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesOrder) || AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder)); if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesOrder) return AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder) || AllowTransactionType(Sbm.TransactionType.SalesOrder);
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesDispatch) return AllowTransactionType(userContext, Sbm.TransactionType.SalesDispatch); if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesDispatch) return AllowTransactionType(Sbm.TransactionType.SalesDispatch);
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesInvoice) return (AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesInvoice) || AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice)); if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesInvoice) return AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice) || AllowTransactionType(Sbm.TransactionType.SalesInvoice);
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_PurchaseOrder) return (AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder) || AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder)); if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_PurchaseOrder) return AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder) || AllowTransactionType(Sbm.TransactionType.PurchaseOrder);
} }
if (AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) if (AllowOption(Sbm.ConfigOption.AllowContacts))
{ {
if (interfaceType == (short)Sbm.InterfaceType_File.AffiliateImport) return true; if (interfaceType == (short)Sbm.InterfaceType_File.AffiliateImport) return true;
if (interfaceType == (short)Sbm.InterfaceType_File.AffiliateExport) return true; if (interfaceType == (short)Sbm.InterfaceType_File.AffiliateExport) return true;
if (interfaceType == (short)Sbm.InterfaceType_File.AssociationImport) return true; if (interfaceType == (short)Sbm.InterfaceType_File.AssociationImport) return true;
if (interfaceType == (short)Sbm.InterfaceType_File.AssociationExport) return true; if (interfaceType == (short)Sbm.InterfaceType_File.AssociationExport) return true;
} }
if (AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) if (AllowOption(Sbm.ConfigOption.AllowCommodities))
{ {
if (interfaceType == (short)Sbm.InterfaceType_File.CommodityImport) return true; if (interfaceType == (short)Sbm.InterfaceType_File.CommodityImport) return true;
if (interfaceType == (short)Sbm.InterfaceType_File.CommodityExport) return true; if (interfaceType == (short)Sbm.InterfaceType_File.CommodityExport) return true;
} }
if (interfaceType == (short)Sbm.InterfaceType_File.VehicleImport) return AllowOption(userContext, Sbm.ConfigOption.AllowVehicles); if (interfaceType == (short)Sbm.InterfaceType_File.VehicleImport) return AllowOption(Sbm.ConfigOption.AllowVehicles);
if (interfaceType == (short)Sbm.InterfaceType_File.LeasewayInvoice) if (interfaceType == (short)Sbm.InterfaceType_File.LeasewayInvoice)
//return SbmGlobals.Application.GetPropertyValue("Interface", "LeasewayInvoice").EqualsCI("Allow"); //return SbmGlobals.Application.GetPropertyValue("Interface", "LeasewayInvoice").EqualsCI("Allow");
return false; return false;
@@ -21,8 +21,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Core
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Security - Contacts. // Security - Contacts.
bool UserCanCreateContacts { get; } bool UserCanCreateContacts();
bool UserCanUpdateContacts { get; } bool UserCanUpdateContacts();
// Security - Financials. // Security - Financials.
bool UserCanViewFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any); bool UserCanViewFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
@@ -41,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Core
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Refresh profile.</summary> /// <summary>Refresh profile.</summary>
void RefreshProfile(SbmConfigConsole configConsole, SaSecurityConsole securityConsole, SysId userId, List<TypeCodeDesc> securityRights); void RefreshProfile(SbmSessionConsole sessionConsole, SaSecurityConsole securityConsole, SysId userId, List<SaSecurityRight> securityRights);
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -191,6 +191,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmcUserAccount.Column)column.Id) switch ((SbmcUserAccount.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmcUserAccount.Column.Notes: case SbmcUserAccount.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -210,6 +211,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -141,6 +141,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmcOwner.Column)column.Id) switch ((SbmcOwner.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmcOwner.Column.Notes: case SbmcOwner.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -160,6 +161,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -169,6 +169,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmcRepository.Column)column.Id) switch ((SbmcRepository.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmcRepository.Column.Notes: case SbmcRepository.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -188,6 +189,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -147,6 +147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmcItemParam.Column)column.Id) switch ((SbmcItemParam.Column)column.Id)
{ {
//-----------------------------------------------------------
// Item Type caption. // Item Type caption.
case SbmcItemParam.Column.ItemType_Caption: case SbmcItemParam.Column.ItemType_Caption:
{ {
@@ -156,6 +157,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
} }
break; break;
//-----------------------------------------------------------
// Item caption. // Item caption.
case SbmcItemParam.Column.Item_Caption: case SbmcItemParam.Column.Item_Caption:
{ {
@@ -169,6 +171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
} }
break; break;
//-----------------------------------------------------------
// Value. // Value.
case SbmcItemParam.Column.Value: case SbmcItemParam.Column.Value:
String paramContext = values.GetValue(GetItemParamColumnDfn(SbmcItemParam.Column.Context).DataName).AsString(); String paramContext = values.GetValue(GetItemParamColumnDfn(SbmcItemParam.Column.Context).DataName).AsString();
@@ -179,6 +182,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
else value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); else value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break; break;
//-----------------------------------------------------------
// Notes. // Notes.
case SbmcItemParam.Column.Notes: case SbmcItemParam.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -197,11 +201,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
} }
break; break;
//-----------------------------------------------------------
default: default:
value = new DataValue(column.FormatValue(values)); value = values.GetValue(column.DataName);
break; break;
//-----------------------------------------------------------
} }
return value; return value;
} }
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(addressId)) return false; if (!SysId.IsValid(addressId)) return false;
SbmAddress.Params prmAddress = new SbmAddress.Params(); SbmAddress.Params prmAddress = new SbmAddress.Params();
prmAddress.IncludedIds.Add(addressId); prmAddress.IdsIncluded.Add(addressId);
prmAddress.StatusCat = SbmAddress.StatusCat.Any; prmAddress.StatusCat = SbmAddress.StatusCat.Any;
return GetAddressCount(prmAddress) == 1; return GetAddressCount(prmAddress) == 1;
} }
@@ -42,7 +42,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(addressId)) return null; if (!SysId.IsValid(addressId)) return null;
SbmAddress.Params prmAddress = new SbmAddress.Params(); SbmAddress.Params prmAddress = new SbmAddress.Params();
prmAddress.IncludedIds.Add(addressId); prmAddress.IdsIncluded.Add(addressId);
prmAddress.StatusCat = SbmAddress.StatusCat.Any; prmAddress.StatusCat = SbmAddress.StatusCat.Any;
return GetAddress(prmAddress); return GetAddress(prmAddress);
} }
@@ -348,6 +348,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmAddress.Column)column.Id) switch ((SbmAddress.Column)column.Id)
{ {
//-----------------------------------------------------------
// Address type description. // Address type description.
case SbmAddress.Column.Type_Desc: case SbmAddress.Column.Type_Desc:
{ {
@@ -356,19 +357,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
//-----------------------------------------------------------
// Address summary. // Address summary.
case SbmAddress.Column.Summary: case SbmAddress.Column.Summary:
{ {
List<String> addresses = new List<String>(); String line1 = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Line1).DataName).AsString();
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Line1).DataName).AsString()); String city = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.City).DataName).AsString();
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Line2).DataName).AsString()); String province = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Province).DataName).AsString();
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Line3).DataName).AsString()); String postcode = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Postcode).DataName).AsString();
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.City).DataName).AsString()); String country = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Country).DataName).AsString();
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Province).DataName).AsString()); value = new DataValue(SbmAddress.GetSummary(line1, city, province, postcode, country));
value = new DataValue(addresses.Concat(", ", null, null, true, true).ToString() + " " + values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Postcode).DataName).AsString());
} }
break; break;
//-----------------------------------------------------------
// Notes. // Notes.
case SbmAddress.Column.Notes: case SbmAddress.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -386,6 +388,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmAddress.GetStatusTriState(status)); value = new DataValue(SbmAddress.GetStatusTriState(status));
} }
break; break;
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -36,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(affiliateId)) return false; if (!SysId.IsValid(affiliateId)) return false;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params(); SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(affiliateId); prmAffiliate.IdsIncluded.Add(affiliateId);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any; prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliateCount(prmAffiliate) == 1; return GetAffiliateCount(prmAffiliate) == 1;
} }
@@ -45,7 +45,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(affiliateIdOwner)) return false; if (!SysId.IsValid(affiliateIdOwner)) return false;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params(); SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(affiliateIdOwner); prmAffiliate.IdsIncluded.Add(affiliateIdOwner);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any; prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliateCount(prmAffiliate) == 1; return GetAffiliateCount(prmAffiliate) == 1;
} }
@@ -55,7 +55,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
if (!StringUtil.IsEmpty(organisationName) || !SysId.IsValid(affiliateIdExclude)) return false; if (!StringUtil.IsEmpty(organisationName) || !SysId.IsValid(affiliateIdExclude)) return false;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params(); SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.Name = organisationName; prmAffiliate.Name = organisationName;
prmAffiliate.ExcludedIds.Add(affiliateIdExclude); prmAffiliate.IdsExcluded.Add(affiliateIdExclude);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any; prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliateCount(prmAffiliate) == 1; return GetAffiliateCount(prmAffiliate) == 1;
} }
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params(); SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.Name = firstName; prmAffiliate.Name = firstName;
prmAffiliate.Name = lastName; prmAffiliate.Name = lastName;
prmAffiliate.ExcludedIds.Add(affiliateIdExclude); prmAffiliate.IdsExcluded.Add(affiliateIdExclude);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any; prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliateCount(prmAffiliate) == 1; return GetAffiliateCount(prmAffiliate) == 1;
} }
@@ -80,7 +80,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(affiliateId)) return null; if (!SysId.IsValid(affiliateId)) return null;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params(); SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(affiliateId); prmAffiliate.IdsIncluded.Add(affiliateId);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any; prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliate(prmAffiliate); return GetAffiliate(prmAffiliate);
} }
@@ -126,7 +126,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(associationId)) return null; if (!SysId.IsValid(associationId)) return null;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params(); SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(associationId); prmAffiliate.IdsIncluded.Add(associationId);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any; prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliate(prmAffiliate); return GetAffiliate(prmAffiliate);
} }
@@ -386,6 +386,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmAffiliate.Column)column.Id) switch ((SbmAffiliate.Column)column.Id)
{ {
//-----------------------------------------------------------
// Affiliate type description. // Affiliate type description.
case SbmAffiliate.Column.Type_Code: case SbmAffiliate.Column.Type_Code:
case SbmAffiliate.Column.Type_Desc: case SbmAffiliate.Column.Type_Desc:
@@ -397,27 +398,25 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
//-----------------------------------------------------------
// Address summary. // Address summary.
case SbmAffiliate.Column.Address_Summary: case SbmAffiliate.Column.Address_Summary:
{ {
List<String> addresses = new List<String>() String line1 = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Line1).DataName).AsString();
{ String city = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_City).DataName).AsString();
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Line1).DataName).AsString(), String province = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Province).DataName).AsString();
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Line2).DataName).AsString(), String postcode = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Postcode).DataName).AsString();
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_City).DataName).AsString(), String country = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Country).DataName).AsString();
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Province).DataName).AsString(), value = new DataValue(SbmAddress.GetSummary(line1, city, province, postcode, country));
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Postcode).DataName).AsString(),
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Country).DataName).AsString(),
};
value = new DataValue(addresses.Concat(", ", null, null, true, true).Replace(" ,", ",").Trim(',').Trim());
break; break;
} }
//-----------------------------------------------------------
// Prospect Group. // Prospect Group.
case SbmAffiliate.Column.ProspectGroup: case SbmAffiliate.Column.ProspectGroup:
break; break;
//-----------------------------------------------------------
// Notes. // Notes.
case SbmAffiliate.Column.Notes: case SbmAffiliate.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -437,6 +436,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -4,6 +4,7 @@ using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus; using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core; using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas; using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.ReferenceData;
using Sarand.Net.Standard.Base.Utils; using Sarand.Net.Standard.Base.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -34,7 +35,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
public bool AllowColumnImport(SbmAssociation.Column column) public bool AllowColumnImport(SbmAssociation.Column column)
{ {
SbmDbDfn.ColumnIdx columnDb = GetDbCol(column); SbmDbDfn.ColumnIdx columnDb = GetDbCol(column);
if (column.Equals(SbmDbDfn.ColumnIdx.Unknown) && ConfigConsole.DisplayAttribute(UserContext, columnDb)) if (column.Equals(SbmDbDfn.ColumnIdx.Unknown) && SessionConsole.DisplayAttribute(columnDb))
{ {
switch (column) switch (column)
{ {
@@ -494,7 +495,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return false; if (!SysId.IsValid(id)) return false;
SbmAssociation.Params prmAssociation = new SbmAssociation.Params(); SbmAssociation.Params prmAssociation = new SbmAssociation.Params();
prmAssociation.IncludedIds.Add(id); prmAssociation.IdsIncluded.Add(id);
prmAssociation.StatusCat = SbmAssociation.StatusCat.Any; prmAssociation.StatusCat = SbmAssociation.StatusCat.Any;
return GetAssociationCount(prmAssociation) == 1; return GetAssociationCount(prmAssociation) == 1;
} }
@@ -533,7 +534,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(associationId)) return null; if (!SysId.IsValid(associationId)) return null;
SbmAssociation.Params prmAssociation = new SbmAssociation.Params(); SbmAssociation.Params prmAssociation = new SbmAssociation.Params();
prmAssociation.IncludedIds.Add(associationId); prmAssociation.IdsIncluded.Add(associationId);
prmAssociation.AssociationType = Sbm.AssociationType.Any;
prmAssociation.StatusCat = SbmAssociation.StatusCat.Any; prmAssociation.StatusCat = SbmAssociation.StatusCat.Any;
return GetAssociation(prmAssociation); return GetAssociation(prmAssociation);
} }
@@ -784,7 +786,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
if (errField.AffiliateIdOwner != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.AffiliateIdOwner)) if (errField.AffiliateIdOwner != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.AffiliateIdOwner))
{ {
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params(); SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(data.AffiliateIdOwner); prmAffiliate.IdsIncluded.Add(data.AffiliateIdOwner);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any; prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
if (GetAffiliateCount(prmAffiliate) < 1) if (GetAffiliateCount(prmAffiliate) < 1)
{ {
@@ -795,7 +797,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
if (errField.AffiliateIdTarget != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.AffiliateIdTarget)) if (errField.AffiliateIdTarget != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.AffiliateIdTarget))
{ {
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params(); SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(data.AffiliateIdTarget); prmAffiliate.IdsIncluded.Add(data.AffiliateIdTarget);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any; prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
if (GetAffiliateCount(prmAffiliate) < 1) if (GetAffiliateCount(prmAffiliate) < 1)
{ {
@@ -805,23 +807,27 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
if (errField.PriceSetId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.PriceSetId)) if (errField.PriceSetId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.PriceSetId))
{ {
/* ToDo Validate Association PriceSet // Association PriceSet.
SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params(); SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params();
prmPriceSet.IncludedIds.Add(data.PriceSetId); prmPriceSet.IdsIncluded.Add(data.PriceSetId);
prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any; prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any;
if (GetPriceSetCount(prmPriceSet) < 1) if (PriceMgr.GetPriceSetCount(prmPriceSet) < 1)
{ {
errField.PriceSetId = SacsHierarchyItem.ValidValue.Invalid; errField.PriceSetId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Price Set not found"); return SetErrorState("Price Set not found");
} }
*/
} }
if (errField.TaxCodeId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.TaxCodeId)) if (errField.TaxCodeId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.TaxCodeId))
{ {
/* ToDo Validate Association TaxCode // Association TaxCode.
using (SaTaxCode taxCode = Internals.GetTaxCodeById(data.TaxCodeId))
{
if (taxCode == null)
{
errField.TaxCodeId = SacsHierarchyItem.ValidValue.Invalid; errField.TaxCodeId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Tax Code's Id not found"); return SetErrorState("Tax Code not found");
*/ }
}
} }
return true; return true;
} }
@@ -858,7 +864,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmAssociation.Column)column.Id) switch ((SbmAssociation.Column)column.Id)
{ {
//--------------------------------------------------------------- //-----------------------------------------------------------
// Association TypeDesc. // Association TypeDesc.
case SbmAssociation.Column.Type_Desc: case SbmAssociation.Column.Type_Desc:
{ {
@@ -867,7 +873,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Discount TypeDesc. // Discount TypeDesc.
case SbmAssociation.Column.DiscountType_Desc: case SbmAssociation.Column.DiscountType_Desc:
{ {
@@ -876,7 +882,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Association Coding. // Association Coding.
case SbmAssociation.Column.AccountManagerDesc: case SbmAssociation.Column.AccountManagerDesc:
{ {
@@ -926,6 +932,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(GetCodeTypeCodeDesc(Sbm.ApplCodeType.ContactCallCycle, contactCallCycle)); value = new DataValue(GetCodeTypeCodeDesc(Sbm.ApplCodeType.ContactCallCycle, contactCallCycle));
break; break;
} }
//-----------------------------------------------------------
// Association Seasonal Category. // Association Seasonal Category.
case SbmAssociation.Column.SeasonalCategoryCode1: case SbmAssociation.Column.SeasonalCategoryCode1:
case SbmAssociation.Column.SeasonalCategoryDesc1: case SbmAssociation.Column.SeasonalCategoryDesc1:
@@ -977,6 +985,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
} }
//-----------------------------------------------------------
case SbmAssociation.Column.OrderLeadTimeDesc: case SbmAssociation.Column.OrderLeadTimeDesc:
{ {
String orderLeadTime = values.GetValue(column.DataName).ToString(); String orderLeadTime = values.GetValue(column.DataName).ToString();
@@ -1002,7 +1012,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Notes. // Notes.
case SbmAssociation.Column.Notes: case SbmAssociation.Column.Notes:
{ {
@@ -1035,7 +1045,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SacsHierarchyItem.GetFlag(flags, SbmAssociation.Flag_Technician)); value = new DataValue(SacsHierarchyItem.GetFlag(flags, SbmAssociation.Flag_Technician));
break; break;
} }
//---------------------------------------------------------------
//-----------------------------------------------------------
// Affiliate Type Desc. // Affiliate Type Desc.
case SbmAssociation.Column.Target_TypeDesc: case SbmAssociation.Column.Target_TypeDesc:
{ {
@@ -1050,7 +1061,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Address Type. // Address Type.
case SbmAssociation.Column.Target_Address_TypeDesc: case SbmAssociation.Column.Target_Address_TypeDesc:
{ {
@@ -1061,17 +1072,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
// Address Summary. // Address Summary.
case SbmAssociation.Column.Target_Address_Summary: case SbmAssociation.Column.Target_Address_Summary:
{ {
List<String> addresses = new List<String>() String line1 = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Line1).DataName).ToString();
{ String city = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_City).DataName).ToString();
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Line1).DataName).ToString(), String province = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Province).DataName).ToString();
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Line2).DataName).ToString(), String postcode = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Postcode).DataName).ToString();
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_City).DataName).ToString(), String country = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Country).DataName).ToString();
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Province).DataName).ToString(), value = new DataValue(SbmAddress.GetSummary(line1, city, province, postcode, country));
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Postcode).DataName).ToString(),
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Country).DataName).ToString(),
};
value = new DataValue(addresses.Concat(", ", null, null, true, true).Replace(" ,", ",").Trim(',').Trim());
break; break;
} }
// Address Coding. // Address Coding.
@@ -1101,6 +1107,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -178,7 +178,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
// Additonal organisation options - to support non-standard configuration options: // Additonal organisation options - to support non-standard configuration options:
itemOptionDfns.AddRange(ConfigConsole.GetAdditionalOrganisationOptions()); itemOptionDfns.AddRange(SessionConsole.GetAdditionalOrganisationOptions());
return itemOptionDfns; return itemOptionDfns;
} }
@@ -218,7 +218,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
private OrganisationOptionData InitOrganisationOptionData() private OrganisationOptionData InitOrganisationOptionData()
{ {
OrganisationOptionData orgOptData = new OrganisationOptionData(); OrganisationOptionData orgOptData = new OrganisationOptionData();
using (SbmConfigConsole console = SbmGlobals.Application.CreateConfigConsole(UserContext.SessionContext)) using (SbmSessionConsole sessionConsole = SbmGlobals.Application.CreateSessionConsole(UserContext))
using (SbmAccountsDfn accounts = new SbmAccountsDfn(UserContext)) using (SbmAccountsDfn accounts = new SbmAccountsDfn(UserContext))
{ {
// Option types. // Option types.
@@ -241,8 +241,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
bool bAllowSalesDispatches = (AllowTransactionType(Sbm.TransactionType.SalesDispatch)); bool bAllowSalesDispatches = (AllowTransactionType(Sbm.TransactionType.SalesDispatch));
bool bAllowSalesInvoices = ((AllowTransactionType(Sbm.TransactionType.SalesInvoice) || AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice))); bool bAllowSalesInvoices = ((AllowTransactionType(Sbm.TransactionType.SalesInvoice) || AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice)));
bool bAllowPurchaseOrders = ((AllowTransactionType(Sbm.TransactionType.PurchaseOrder) || AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder))); bool bAllowPurchaseOrders = ((AllowTransactionType(Sbm.TransactionType.PurchaseOrder) || AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder)));
bool bAllowInterfaces = (console.AllowInterfaces(UserContext)); bool bAllowInterfaces = (sessionConsole.AllowInterfaces());
bool bAllowInterfaces_File = (bAllowInterfaces && console.AllowInterfaceCategory(UserContext, SaInterfaceCategory.File)); bool bAllowInterfaces_File = (bAllowInterfaces && sessionConsole.AllowInterfaceCategory(SaInterfaceCategory.File));
// Values: // Values:
List<TypeCodeDesc> orgOptionValues = SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.OrgOption_Value); List<TypeCodeDesc> orgOptionValues = SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.OrgOption_Value);
@@ -251,7 +251,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
orgOptData.Contexts_Value.Add(orgOptionValues.GetCodeDescForType(Sbm.OrgOption_Value.MaxTransactionsQueriedForEmptyFilter)); orgOptData.Contexts_Value.Add(orgOptionValues.GetCodeDescForType(Sbm.OrgOption_Value.MaxTransactionsQueriedForEmptyFilter));
if (CodeTypeHasCodes(Sbm.ApplCodeType.CommodityPromotion)) if (CodeTypeHasCodes(Sbm.ApplCodeType.CommodityPromotion))
orgOptData.Contexts_Value.Add(orgOptionValues.GetCodeDescForType(Sbm.OrgOption_Value.AlternativePromotionText)); orgOptData.Contexts_Value.Add(orgOptionValues.GetCodeDescForType(Sbm.OrgOption_Value.AlternativePromotionText));
if (console.GetRequirementCostingConfig(UserContext).AllowRequirementCosting(Sbm.TransactionType.SalesOrder)) if (sessionConsole.GetRequirementCostingConfig().AllowRequirementCosting(Sbm.TransactionType.SalesOrder))
orgOptData.Contexts_Value.Add(orgOptionValues.GetCodeDescForType(Sbm.OrgOption_Value.CostLabourRateDefault)); orgOptData.Contexts_Value.Add(orgOptionValues.GetCodeDescForType(Sbm.OrgOption_Value.CostLabourRateDefault));
orgOptData.Contexts_Value.Add(orgOptionValues.GetCodeDescForType(Sbm.OrgOption_Value.CommoditiesAllowedNegativePrice)); orgOptData.Contexts_Value.Add(orgOptionValues.GetCodeDescForType(Sbm.OrgOption_Value.CommoditiesAllowedNegativePrice));
if (AllowConfigOption(Sbm.ConfigOption.TransactionSplitTimes)) if (AllowConfigOption(Sbm.ConfigOption.TransactionSplitTimes))
@@ -28,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return false; if (!SysId.IsValid(id)) return false;
SbmSysParam.Params prmSysParam = new SbmSysParam.Params(); SbmSysParam.Params prmSysParam = new SbmSysParam.Params();
prmSysParam.IncludedIds.Add(id); prmSysParam.IdsIncluded.Add(id);
prmSysParam.StatusCat = SbmSysParam.StatusCat.Any; prmSysParam.StatusCat = SbmSysParam.StatusCat.Any;
return GetSysParamCount(prmSysParam) == 1; return GetSysParamCount(prmSysParam) == 1;
} }
@@ -42,7 +42,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(paramId)) return null; if (!SysId.IsValid(paramId)) return null;
SbmSysParam.Params prmSysParam = new SbmSysParam.Params(); SbmSysParam.Params prmSysParam = new SbmSysParam.Params();
prmSysParam.IncludedIds.Add(paramId); prmSysParam.IdsIncluded.Add(paramId);
prmSysParam.StatusCat = SbmSysParam.StatusCat.Any; prmSysParam.StatusCat = SbmSysParam.StatusCat.Any;
return GetSysParam(prmSysParam); return GetSysParam(prmSysParam);
} }
@@ -153,6 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmSysParam.Column)column.Id) switch ((SbmSysParam.Column)column.Id)
{ {
//-----------------------------------------------------------
// SysParam Cat_Desc? // SysParam Cat_Desc?
//----------------------------------------------------------- //-----------------------------------------------------------
@@ -161,7 +162,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break; break;
//-----------------------------------------------------------
// Status. // Status.
case SbmSysParam.Column.Status_Desc: case SbmSysParam.Column.Status_Desc:
case SbmSysParam.Column.Status_Ind: case SbmSysParam.Column.Status_Ind:
@@ -176,6 +176,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -30,7 +30,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(systemAccountId)) return false; if (!SysId.IsValid(systemAccountId)) return false;
SbmSystemAccount.Params prmSystemAccount = new SbmSystemAccount.Params(); SbmSystemAccount.Params prmSystemAccount = new SbmSystemAccount.Params();
prmSystemAccount.IncludedIds.Add(systemAccountId); prmSystemAccount.IdsIncluded.Add(systemAccountId);
prmSystemAccount.StatusCat = SbmSystemAccount.StatusCat.Any; prmSystemAccount.StatusCat = SbmSystemAccount.StatusCat.Any;
return GetSystemAccountCount(prmSystemAccount) == 1; return GetSystemAccountCount(prmSystemAccount) == 1;
} }
@@ -65,7 +65,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(systemAccountId)) return null; if (!SysId.IsValid(systemAccountId)) return null;
SbmSystemAccount.Params prmSystemAccount = new SbmSystemAccount.Params(); SbmSystemAccount.Params prmSystemAccount = new SbmSystemAccount.Params();
prmSystemAccount.IncludedIds.Add(systemAccountId); prmSystemAccount.IdsIncluded.Add(systemAccountId);
prmSystemAccount.StatusCat = SbmSystemAccount.StatusCat.Any; prmSystemAccount.StatusCat = SbmSystemAccount.StatusCat.Any;
return GetSystemAccount(prmSystemAccount); return GetSystemAccount(prmSystemAccount);
} }
@@ -183,6 +183,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmSystemAccount.Column)column.Id) switch ((SbmSystemAccount.Column)column.Id)
{ {
//-----------------------------------------------------------
// SystemAccount TypeDesc. // SystemAccount TypeDesc.
case SbmSystemAccount.Column.Type_Desc: case SbmSystemAccount.Column.Type_Desc:
{ {
@@ -191,6 +192,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//-----------------------------------------------------------
// Notes. // Notes.
case SbmSystemAccount.Column.Notes: case SbmSystemAccount.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -223,6 +225,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -124,6 +124,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmSystemAccountUser.Column)column.Id) switch ((SbmSystemAccountUser.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmSystemAccountUser.Column.Notes: case SbmSystemAccountUser.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -143,6 +144,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -30,7 +30,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(systemUserId)) return false; if (!SysId.IsValid(systemUserId)) return false;
SbmSystemUser.Params prmSystemUser = new SbmSystemUser.Params(); SbmSystemUser.Params prmSystemUser = new SbmSystemUser.Params();
prmSystemUser.IncludedIds.Add(systemUserId); prmSystemUser.IdsIncluded.Add(systemUserId);
prmSystemUser.StatusCat = SbmSystemUser.StatusCat.Any; prmSystemUser.StatusCat = SbmSystemUser.StatusCat.Any;
return GetSystemUserCount(prmSystemUser) == 1; return GetSystemUserCount(prmSystemUser) == 1;
} }
@@ -65,7 +65,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(systemUserId)) return null; if (!SysId.IsValid(systemUserId)) return null;
SbmSystemUser.Params prmSystemUser = new SbmSystemUser.Params(); SbmSystemUser.Params prmSystemUser = new SbmSystemUser.Params();
prmSystemUser.IncludedIds.Add(systemUserId); prmSystemUser.IdsIncluded.Add(systemUserId);
prmSystemUser.StatusCat = SbmSystemUser.StatusCat.Any; prmSystemUser.StatusCat = SbmSystemUser.StatusCat.Any;
return GetSystemUser(prmSystemUser); return GetSystemUser(prmSystemUser);
} }
@@ -174,6 +174,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmSystemUser.Column)column.Id) switch ((SbmSystemUser.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmSystemUser.Column.Notes: case SbmSystemUser.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -191,7 +192,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmSystemUser.GetStatusTriState(status)); value = new DataValue(SbmSystemUser.GetStatusTriState(status));
} }
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -27,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(assetId)) return false; if (!SysId.IsValid(assetId)) return false;
SbmAsset.Params prmAsset = new SbmAsset.Params(); SbmAsset.Params prmAsset = new SbmAsset.Params();
prmAsset.IncludedIds.Add(assetId); prmAsset.IdsIncluded.Add(assetId);
prmAsset.StatusCat = SbmAsset.StatusCat.Any; prmAsset.StatusCat = SbmAsset.StatusCat.Any;
return GetAssetCount(prmAsset) == 1; return GetAssetCount(prmAsset) == 1;
} }
@@ -54,7 +54,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(assetId)) return null; if (!SysId.IsValid(assetId)) return null;
SbmAsset.Params prmAsset = new SbmAsset.Params(); SbmAsset.Params prmAsset = new SbmAsset.Params();
prmAsset.IncludedIds.Add(assetId); prmAsset.IdsIncluded.Add(assetId);
prmAsset.StatusCat = SbmAsset.StatusCat.Any; prmAsset.StatusCat = SbmAsset.StatusCat.Any;
return GetAsset(prmAsset); return GetAsset(prmAsset);
} }
@@ -271,6 +271,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmAsset.Column)column.Id) switch ((SbmAsset.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmAsset.Column.Notes: case SbmAsset.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -290,6 +291,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -187,6 +187,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmAssetCategory.Column)column.Id) switch ((SbmAssetCategory.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmAssetCategory.Column.Notes: case SbmAssetCategory.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -206,6 +207,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -28,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(assetProcessId)) return false; if (!SysId.IsValid(assetProcessId)) return false;
SbmAssetProcess.Params prmAssetProcess = new SbmAssetProcess.Params(); SbmAssetProcess.Params prmAssetProcess = new SbmAssetProcess.Params();
prmAssetProcess.IncludedIds.Add(assetProcessId); prmAssetProcess.IdsIncluded.Add(assetProcessId);
prmAssetProcess.StatusCat = SbmAssetProcess.StatusCat.Any; prmAssetProcess.StatusCat = SbmAssetProcess.StatusCat.Any;
return GetAssetProcessCount(prmAssetProcess) == 1; return GetAssetProcessCount(prmAssetProcess) == 1;
} }
@@ -42,7 +42,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(assetProcessId)) return null; if (!SysId.IsValid(assetProcessId)) return null;
SbmAssetProcess.Params prmAssetProcess = new SbmAssetProcess.Params(); SbmAssetProcess.Params prmAssetProcess = new SbmAssetProcess.Params();
prmAssetProcess.IncludedIds.Add(assetProcessId); prmAssetProcess.IdsIncluded.Add(assetProcessId);
prmAssetProcess.StatusCat = SbmAssetProcess.StatusCat.Any; prmAssetProcess.StatusCat = SbmAssetProcess.StatusCat.Any;
return GetAssetProcess(prmAssetProcess); return GetAssetProcess(prmAssetProcess);
} }
@@ -147,6 +147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmAssetProcess.Column)column.Id) switch ((SbmAssetProcess.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmAssetProcess.Column.Notes: case SbmAssetProcess.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -166,6 +167,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -28,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return false; if (!SysId.IsValid(id)) return false;
SbmVehicle.Params prm = new SbmVehicle.Params(); SbmVehicle.Params prm = new SbmVehicle.Params();
prm.IncludedIds.Add(id); prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicle.StatusCat.Any; prm.StatusCat = SbmVehicle.StatusCat.Any;
return GetVehicleCount(prm) == 1; return GetVehicleCount(prm) == 1;
} }
@@ -53,7 +53,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return null; if (!SysId.IsValid(id)) return null;
SbmVehicle.Params prm = new SbmVehicle.Params(); SbmVehicle.Params prm = new SbmVehicle.Params();
prm.IncludedIds.Add(id); prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicle.StatusCat.Any; prm.StatusCat = SbmVehicle.StatusCat.Any;
return GetVehicle(prm); return GetVehicle(prm);
} }
@@ -173,6 +173,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmVehicle.Column)column.Id) switch ((SbmVehicle.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmVehicle.Column.Notes: case SbmVehicle.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -192,6 +193,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -182,6 +182,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmVehicleClass.Column)column.Id) switch ((SbmVehicleClass.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmVehicleClass.Column.Notes: case SbmVehicleClass.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -201,6 +202,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return false; if (!SysId.IsValid(id)) return false;
SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params(); SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params();
prm.IncludedIds.Add(id); prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicleEvent.StatusCat.Any; prm.StatusCat = SbmVehicleEvent.StatusCat.Any;
return GetVehicleEventCount(prm) == 1; return GetVehicleEventCount(prm) == 1;
} }
@@ -39,7 +39,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(vehicleId) || (int)vehicleEventType < 1 || DateUtil.IsValid(eventOn)) return false; if (!SysId.IsValid(vehicleId) || (int)vehicleEventType < 1 || DateUtil.IsValid(eventOn)) return false;
SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params(); SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params();
prm.IncludedIds.Add(vehicleId); prm.IdsIncluded.Add(vehicleId);
prm.VehicleEventType = vehicleEventType; prm.VehicleEventType = vehicleEventType;
prm.EventOn = eventOn; prm.EventOn = eventOn;
prm.StatusCat = SbmVehicleEvent.StatusCat.Any; prm.StatusCat = SbmVehicleEvent.StatusCat.Any;
@@ -55,7 +55,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return null; if (!SysId.IsValid(id)) return null;
SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params(); SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params();
prm.IncludedIds.Add(id); prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicleEvent.StatusCat.Any; prm.StatusCat = SbmVehicleEvent.StatusCat.Any;
return GetVehicleEvent(prm); return GetVehicleEvent(prm);
} }
@@ -63,7 +63,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
if (!SysId.IsValid(vehicleId) || (int)vehicleEventType < 1 || !DateUtil.IsValid(eventOn)) return null; if (!SysId.IsValid(vehicleId) || (int)vehicleEventType < 1 || !DateUtil.IsValid(eventOn)) return null;
SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params(); SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params();
prm.IncludedIds.Add(vehicleId); prm.IdsIncluded.Add(vehicleId);
prm.VehicleEventType = vehicleEventType; prm.VehicleEventType = vehicleEventType;
prm.EventOn = eventOn; prm.EventOn = eventOn;
prm.StatusCat = SbmVehicleEvent.StatusCat.Any; prm.StatusCat = SbmVehicleEvent.StatusCat.Any;
@@ -149,6 +149,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmVehicleEvent.Column)column.Id) switch ((SbmVehicleEvent.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmVehicleEvent.Column.Notes: case SbmVehicleEvent.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -168,6 +169,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return false; if (!SysId.IsValid(id)) return false;
SbmVehicleFeature.Params prm = new SbmVehicleFeature.Params(); SbmVehicleFeature.Params prm = new SbmVehicleFeature.Params();
prm.IncludedIds.Add(id); prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicleFeature.StatusCat.Any; prm.StatusCat = SbmVehicleFeature.StatusCat.Any;
return GetVehicleFeatureCount(prm) == 1; return GetVehicleFeatureCount(prm) == 1;
} }
@@ -143,6 +143,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmVehicleFeature.Column)column.Id) switch ((SbmVehicleFeature.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmVehicleFeature.Column.Notes: case SbmVehicleFeature.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -162,6 +163,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -6,11 +6,14 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Commodity Manager.
//======================================================================= //=======================================================================
public abstract partial class SbmCommodityMgr : SbmCoreMgr public abstract partial class SbmCommodityMgr : SbmCoreMgr
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
// Code types. // Code types.
private List<Sbm.ApplCodeType> supportedCodeTypes = new List<Sbm.ApplCodeType>() private List<Sbm.ApplCodeType> supportedCodeTypes = new List<Sbm.ApplCodeType>()
{ {
@@ -0,0 +1,329 @@
using Sarand.BusinessMgr.Net.Standard.Base.App;
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.ReferenceData;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Commodity Manager - Commodity - Utils.
//=======================================================================
partial class SbmCommodityMgr
{
//-------------------------------------------------------------------
// Commodity Associated data.
public abstract bool CommodityHasProcesses(SysId commodityId);
public abstract bool CommodityHasRequirements(SysId commodityId);
public abstract bool CommodityIsSalesBudgetTemplate(SysId commodityId);
public abstract bool CommodityHasComponents(SysId commodityId);
public abstract bool CommodityHasPortfolioItems(SysId commodityId);
public abstract bool CommodityHasContainers(SysId commodityId);
public abstract bool CommodityHasCustomerDetails(SysId commodityId);
public abstract bool CommodityHasSupplierDetails(SysId commodityId);
public abstract bool CommodityHasMovements(SysId commodityId);
public abstract bool CommodityHasStockLevels(SysId commodityId);
// Dependent data should only be cleared when removing a commodity.
// Data owned by this item is deleted (eg. interface data items & document references).
public abstract bool ClearCommodityDependentData(SysId commodityId);
//-------------------------------------------------------------------
// Commodity requirements.
/// <summary>
/// Update requirements for this commodity with the correct code.
/// </summary>
public abstract bool UpdateCommodityRequirements(SbmCommodity commodity);
//-------------------------------------------------------------------
// Commodity cost estimates.
public abstract List<SbmCostEstimate> GetCommodityCostEstimates(SbmCommodity commodity);
public abstract bool SetCommodityCostEstimates(SbmCommodity commodity, List<SbmCostEstimate> costEstimatesNew);
public abstract bool CommitCommodityCostEstimates(SbmCommodity commodity);
//-------------------------------------------------------------------
// Commodity processes.
public abstract List<SbmItemProcess> GetCommodityProcesses(SbmCommodity commodity, bool bActiveOnly = false);
public abstract bool SetCommodityProcesses(SbmCommodity commodity, List<SbmItemProcess> itemProcessesNew);
public abstract bool CommitCommodityProcesses(SbmCommodity commodity);
//-------------------------------------------------------------------
// Interfaces.
// Commodity interface rules.
public bool AllowColumnImport(SbmDbDfn.ColumnIdx column)
{
switch (column)
{
//case SbmDbDfn.ColumnIdx.Commodity_Id:
//case SbmDbDfn.ColumnIdx.Commodity_AffIdOwner:
//case SbmDbDfn.ColumnIdx.Commodity_Type:
case SbmDbDfn.ColumnIdx.Commodity_Code:
case SbmDbDfn.ColumnIdx.Commodity_DescBrief:
case SbmDbDfn.ColumnIdx.Commodity_DescOrder:
case SbmDbDfn.ColumnIdx.Commodity_DescDetail:
case SbmDbDfn.ColumnIdx.Commodity_DrawingNo:
case SbmDbDfn.ColumnIdx.Commodity_DrawingIssue:
case SbmDbDfn.ColumnIdx.Commodity_ImagePath:
case SbmDbDfn.ColumnIdx.Commodity_Category:
case SbmDbDfn.ColumnIdx.Commodity_Category2:
case SbmDbDfn.ColumnIdx.Commodity_Category3:
case SbmDbDfn.ColumnIdx.Commodity_Location:
case SbmDbDfn.ColumnIdx.Commodity_Department:
case SbmDbDfn.ColumnIdx.Commodity_CatalogRef:
case SbmDbDfn.ColumnIdx.Commodity_Weight:
case SbmDbDfn.ColumnIdx.Commodity_UomIdWeight:
case SbmDbDfn.ColumnIdx.Commodity_Length:
case SbmDbDfn.ColumnIdx.Commodity_UomIdLength:
case SbmDbDfn.ColumnIdx.Commodity_Volume:
case SbmDbDfn.ColumnIdx.Commodity_UomIdVolume:
case SbmDbDfn.ColumnIdx.Commodity_Density:
case SbmDbDfn.ColumnIdx.Commodity_UomIdDensity:
case SbmDbDfn.ColumnIdx.Commodity_BoxQuantity:
case SbmDbDfn.ColumnIdx.Commodity_UomIdBox:
case SbmDbDfn.ColumnIdx.Commodity_Dimensions:
case SbmDbDfn.ColumnIdx.Commodity_SpecSummary:
case SbmDbDfn.ColumnIdx.Commodity_NominalCode:
case SbmDbDfn.ColumnIdx.Commodity_NominalCodePurchase:
case SbmDbDfn.ColumnIdx.Commodity_ICNTariffCode:
//case SbmDbDfn.ColumnIdx.Commodity_TimeProd:
//case SbmDbDfn.ColumnIdx.Commodity_UomIdTimeProd:
//case SbmDbDfn.ColumnIdx.Commodity_RangeCode:
//case SbmDbDfn.ColumnIdx.Commodity_ColourCode:
//case SbmDbDfn.ColumnIdx.Commodity_SourceCode:
//case SbmDbDfn.ColumnIdx.Commodity_SupplyMethodCode:
//case SbmDbDfn.ColumnIdx.Commodity_HandlingCode:
//case SbmDbDfn.ColumnIdx.Commodity_DeliveryCode:
case SbmDbDfn.ColumnIdx.Commodity_MaterialCode:
case SbmDbDfn.ColumnIdx.Commodity_FinishCode:
case SbmDbDfn.ColumnIdx.Commodity_PromotionCode:
case SbmDbDfn.ColumnIdx.Commodity_AssIdSupplier:
case SbmDbDfn.ColumnIdx.Commodity_SupplierRef:
case SbmDbDfn.ColumnIdx.Commodity_CostPrice:
case SbmDbDfn.ColumnIdx.Commodity_PlaceOfOrigin:
case SbmDbDfn.ColumnIdx.Commodity_MaterialCost:
case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdMaterial:
case SbmDbDfn.ColumnIdx.Commodity_ExWorksCost:
case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdExWorks:
case SbmDbDfn.ColumnIdx.Commodity_ReorderLevel:
case SbmDbDfn.ColumnIdx.Commodity_ReorderQty:
//case SbmDbDfn.ColumnIdx.Commodity_QtyOnOrder:
case SbmDbDfn.ColumnIdx.Commodity_AssIdCustomer:
case SbmDbDfn.ColumnIdx.Commodity_SalesPrice:
case SbmDbDfn.ColumnIdx.Commodity_RetailPrice:
case SbmDbDfn.ColumnIdx.Commodity_RetailPricePlanned:
case SbmDbDfn.ColumnIdx.Commodity_UomIdSale:
case SbmDbDfn.ColumnIdx.Commodity_CarriageCostIndicative:
//case SbmDbDfn.ColumnIdx.Commodity_CarriageCostIndicative_Fmt:
case SbmDbDfn.ColumnIdx.Commodity_MinOrderQty:
case SbmDbDfn.ColumnIdx.Commodity_PackQty:
case SbmDbDfn.ColumnIdx.Commodity_TaxCodeId:
//case SbmDbDfn.ColumnIdx.Commodity_LastOrderDate:
//case SbmDbDfn.ColumnIdx.Commodity_LastOrderQty:
//case SbmDbDfn.ColumnIdx.Commodity_QtyInStock:
//case SbmDbDfn.ColumnIdx.Commodity_QtyAllocated:
//case SbmDbDfn.ColumnIdx.Commodity_FreeStock:
//case SbmDbDfn.ColumnIdx.Commodity_StockTakeDate:
//case SbmDbDfn.ColumnIdx.Commodity_StockTakeQty:
//case SbmDbDfn.ColumnIdx.Commodity_OrderQtyDecimals:
case SbmDbDfn.ColumnIdx.Commodity_CommodityIdSalesProj:
//case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonthlyProp:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjAnnual:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth01:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth02:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth03:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth04:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth05:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth06:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth07:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth08:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth09:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth10:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth11:
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth12:
case SbmDbDfn.ColumnIdx.Commodity_Notes:
//case SbmDbDfn.ColumnIdx.Commodity_Flags:
//case SbmDbDfn.ColumnIdx.Commodity_Status:
//case SbmDbDfn.ColumnIdx.Commodity_CreateOn:
//case SbmDbDfn.ColumnIdx.Commodity_CreateBy:
//case SbmDbDfn.ColumnIdx.Commodity_CreateHost:
//case SbmDbDfn.ColumnIdx.Commodity_UpdateOn:
//case SbmDbDfn.ColumnIdx.Commodity_UpdateBy:
//case SbmDbDfn.ColumnIdx.Commodity_UpdateHost:
return SessionConsole.DisplayAttribute(column);
}
return false;
}
public String GetColumnCaption(SbmDbDfn.ColumnIdx column)
{
switch (column)
{
case SbmDbDfn.ColumnIdx.Commodity_Type: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Type, "Type");
case SbmDbDfn.ColumnIdx.Commodity_Code: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Code, "Code");
case SbmDbDfn.ColumnIdx.Commodity_DescBrief: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DescBrief, "Brief description");
case SbmDbDfn.ColumnIdx.Commodity_DescOrder: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DescOrder, "Order description");
case SbmDbDfn.ColumnIdx.Commodity_DescDetail: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DescDetail, "Detail description");
case SbmDbDfn.ColumnIdx.Commodity_DrawingNo: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DrawingNo, "Drawing no");
case SbmDbDfn.ColumnIdx.Commodity_DrawingIssue: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DrawingIssue, "Drawing issue");
case SbmDbDfn.ColumnIdx.Commodity_ImagePath: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ImagePath, "Image path");
case SbmDbDfn.ColumnIdx.Commodity_Category: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Category, "Category");
case SbmDbDfn.ColumnIdx.Commodity_Location: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Location, "Location");
case SbmDbDfn.ColumnIdx.Commodity_Department: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Department, "Department");
case SbmDbDfn.ColumnIdx.Commodity_CatalogRef: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CatalogRef, "Catalog ref");
case SbmDbDfn.ColumnIdx.Commodity_Weight: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Weight, "Weight");
case SbmDbDfn.ColumnIdx.Commodity_UomIdWeight: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdWeight, "Weight unit");
case SbmDbDfn.ColumnIdx.Commodity_Length: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Length, "Length");
case SbmDbDfn.ColumnIdx.Commodity_UomIdLength: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdLength, "Length unit");
case SbmDbDfn.ColumnIdx.Commodity_Volume: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Volume, "Volume");
case SbmDbDfn.ColumnIdx.Commodity_UomIdVolume: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdVolume, "Volume unit");
case SbmDbDfn.ColumnIdx.Commodity_Density: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Density, "Density");
case SbmDbDfn.ColumnIdx.Commodity_UomIdDensity: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdDensity, "Density unit");
case SbmDbDfn.ColumnIdx.Commodity_BoxQuantity: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_BoxQuantity, "Box quantity");
case SbmDbDfn.ColumnIdx.Commodity_UomIdBox: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdBox, "Box unit");
case SbmDbDfn.ColumnIdx.Commodity_Dimensions: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Dimensions, "Dimensions");
case SbmDbDfn.ColumnIdx.Commodity_SpecSummary: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SpecSummary, "Specification");
case SbmDbDfn.ColumnIdx.Commodity_NominalCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_NominalCode, "Nominal code - sales");
case SbmDbDfn.ColumnIdx.Commodity_NominalCodePurchase: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_NominalCodePurchase, "Nominal code - purchase");
case SbmDbDfn.ColumnIdx.Commodity_ICNTariffCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ICNTariffCode, "ICN Tariff code");
case SbmDbDfn.ColumnIdx.Commodity_MaterialCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material");
case SbmDbDfn.ColumnIdx.Commodity_FinishCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish");
case SbmDbDfn.ColumnIdx.Commodity_PromotionCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion");
case SbmDbDfn.ColumnIdx.Commodity_AssIdSupplier: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_AssIdSupplier, "Supplier");
case SbmDbDfn.ColumnIdx.Commodity_SupplierRef: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SupplierRef, "Supplier ref");
case SbmDbDfn.ColumnIdx.Commodity_CostPrice: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CostPrice, "Cost price");
case SbmDbDfn.ColumnIdx.Commodity_PlaceOfOrigin: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PlaceOfOrigin, "Place of origin");
case SbmDbDfn.ColumnIdx.Commodity_MaterialCost: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCost, "Material cost");
case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdMaterial: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CurrencyIdMaterial, "Material currency");
case SbmDbDfn.ColumnIdx.Commodity_ExWorksCost: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ExWorksCost, "Ex-works cost");
case SbmDbDfn.ColumnIdx.Commodity_CurrencyIdExWorks: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CurrencyIdExWorks, "Ex-works currency");
case SbmDbDfn.ColumnIdx.Commodity_ReorderLevel: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ReorderLevel, "Reorder level");
case SbmDbDfn.ColumnIdx.Commodity_ReorderQty: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ReorderQty, "Reorder qty");
case SbmDbDfn.ColumnIdx.Commodity_AssIdCustomer: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_AssIdCustomer, "Customer");
case SbmDbDfn.ColumnIdx.Commodity_SalesPrice: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesPrice, "Sales price");
case SbmDbDfn.ColumnIdx.Commodity_RetailPrice: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_RetailPrice, "Retail price");
case SbmDbDfn.ColumnIdx.Commodity_RetailPricePlanned: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_RetailPricePlanned, "Retail price planned");
case SbmDbDfn.ColumnIdx.Commodity_UomIdSale: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdSale, "Sale unit");
case SbmDbDfn.ColumnIdx.Commodity_PackQty: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PackQty, "Pack qty - sale");
case SbmDbDfn.ColumnIdx.Commodity_TaxCodeId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_TaxCodeId, "Tax code");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjAnnual: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjAnnual, "Projected annual sales");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth01: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth01, "Projected sales - Jan");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth02: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth02, "Projected sales - Feb");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth03: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth03, "Projected sales - Mar");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth04: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth04, "Projected sales - Apr");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth05: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth05, "Projected sales - May");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth06: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth06, "Projected sales - Jun");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth07: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth07, "Projected sales - Jul");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth08: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth08, "Projected sales - Aug");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth09: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth09, "Projected sales - Sep");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth10: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth10, "Projected sales - Oct");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth11: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth11, "Projected sales - Nov");
case SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth12: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth12, "Projected sales - Dec");
}
return "";
}
//-------------------------------------------------------------------
// Image Paths.
public String GetImagePathPrefix()
{
String prefix = "";
if (AccountsDfn.IsItemTypeManagedByAccounts(Sbm.ItemType.Commodity))
{
if (AccountsDfn.IsUsingSageInterface())
prefix = "%SAGE%\\";
}
return prefix;
}
public String GetActualImagePath(String imagePath)
{
//SATRACE("SapCommodityMgr::GetActualImagePath '"+imagePath+"'\n");
if (StringUtil.IsEmpty(imagePath)) return imagePath;
String imagePathPrefix = GetImagePathPrefix();
String cmdImagePath = imagePath;
if (cmdImagePath.Left(imagePathPrefix.Length) == imagePathPrefix)
{
String imageFolder = "";
if (AccountsDfn.IsItemTypeManagedByAccounts(Sbm.ItemType.Commodity))
{
if (AccountsDfn.IsUsingSageInterface())
imageFolder = AccountsDfn.GetImageFolder(Sbm.InterfaceType_Accounts.SageLine50);
}
//ToDo SaSystem::GETPATHDELIM in SbmCmdMgr need to be created inorder to work
cmdImagePath = imageFolder + /*SaSystem::GetPathDelim(imageFolder) +*/ cmdImagePath.Right(cmdImagePath.Length - imagePathPrefix.Length);
}
#if _DEBUG_XXX
if (!sCmdImagePath.IsEmpty())
{
SATRACE("GetActualImagePath Path = '" + cmdImagePath + "'\n");
}
#endif
return cmdImagePath;
}
public String GetStandardImagePath(String commodityCode)
{
// Using organisation configuration image folder.
if (StringUtil.IsEmpty(commodityCode)) return commodityCode;
String path = "";
if (!StringUtil.IsEmpty(commodityCode))
{
String folder = UserContext.GetOwnerOption_Folder(Sbm.OrgOption_Folder.CommodityImage);
path = GetImagePath(folder, commodityCode);
}
return path;
}
public String GetBarcodeImagePath(String commodityCode)
{
// Using organisation configuration barcode image folder.
if (StringUtil.IsEmpty(commodityCode)) return commodityCode;
String path = "";
if (!StringUtil.IsEmpty(commodityCode))
{
String folder = UserContext.GetOwnerOption_Folder(Sbm.OrgOption_Folder.CommodityBarcodeImage);
path = GetImagePath(folder, commodityCode);
}
return path;
}
public String GetImagePath(String folder, String filenamePrefix)
{
String path = "";
//SATRACE("SapCommodityMgr::GetImagePath Locating image file '"+sFilenamePrefix+"' in folder '"+sFolder+"'\n");
if (!folder.IsEmpty() && Directory.Exists(folder) && !filenamePrefix.IsEmpty())
{
List<String> imageExtensions = StringListUtil.Split("jpg,jpeg,gif,png,tif,eps", ",");
foreach (String imageExtension in imageExtensions)
{
//ToDo SaSystem::GETPATHDELIM in SbmCmdMgr need to be created inorder to work
path = folder + /*SaSystem::GetPathDelim(folder) +*/ filenamePrefix + "." + imageExtension;
#if _DEBUG
if (Sys_Fn::FileExists(path))
{
SATRACE("GetImagePath Found image file: " + path + "\n");
}
#endif
if (!Directory.Exists(path)) path.IsEmpty();
}
}
return path;
}
//-------------------------------------------------------------------
public abstract List<Sbm.CommodityType> GetCommodityTypesInUse();
public abstract Sbm.CommodityType GetTypeForCommodityId(SysId commodityId);
public abstract double GetCostPriceForCommodityId(SysId commodityId);
public abstract List<SysIdString> GetSalesTemplateCommmodities();
public abstract bool UpdateReferencesToSalesTemplate(SbmCommodity commodity);
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -13,293 +13,20 @@ using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Commodity Manager - Commodity.
//======================================================================= //=======================================================================
partial class SbmCommodityMgr partial class SbmCommodityMgr
{ {
public object StringList { get; private set; } //-------------------------------------------------------------------
//*******************************************************************
// C o m m o d i t i e s
//*******************************************************************
// Utilities. // Utilities.
public bool IsValidCode(String code) public bool IsValidCode(String code)
{ {
if (StringUtil.IsEmpty(code)) return false; if (StringUtil.IsBlank(code)) return false;
if (code != code.Trim(' ')) return false; if (code != code.Trim(' ')) return false;
return true; return true;
} }
// Commodity interface rules.
public bool AllowColumnImport(SbmCommodity.Column column)
{
switch (column)
{
//case SbmCommodity.Column.Id:
//case SbmCommodity.Column.AffIdOwner:
//case SbmCommodity.Column.Type:
case SbmCommodity.Column.Code:
case SbmCommodity.Column.DescBrief:
case SbmCommodity.Column.DescOrder:
case SbmCommodity.Column.DescDetail:
case SbmCommodity.Column.DrawingNo:
case SbmCommodity.Column.DrawingIssue:
case SbmCommodity.Column.ImagePath:
case SbmCommodity.Column.Category1Code:
case SbmCommodity.Column.Category2Code:
case SbmCommodity.Column.Category3Code:
case SbmCommodity.Column.Location:
case SbmCommodity.Column.Department:
case SbmCommodity.Column.CatalogRef:
case SbmCommodity.Column.Weight:
case SbmCommodity.Column.Weight_UomId:
case SbmCommodity.Column.Length:
case SbmCommodity.Column.Length_UomId:
case SbmCommodity.Column.Volume:
case SbmCommodity.Column.Volume_UomId:
case SbmCommodity.Column.Density:
case SbmCommodity.Column.Density_UomId:
case SbmCommodity.Column.BoxQuantity:
case SbmCommodity.Column.BoxQuantity_UomId:
case SbmCommodity.Column.Dimensions:
case SbmCommodity.Column.SpecSummary:
case SbmCommodity.Column.NominalCode:
case SbmCommodity.Column.NominalCodePurchase:
case SbmCommodity.Column.ICNTariffCode:
//case SbmCommodity.Column.TimeProd:
//case SbmCommodity.Column.UomIdTimeProd:
//case SbmCommodity.Column.RangeCode:
//case SbmCommodity.Column.ColourCode:
//case SbmCommodity.Column.SourceCode:
//case SbmCommodity.Column.SupplyMethodCode:
//case SbmCommodity.Column.HandlingCode:
//case SbmCommodity.Column.DeliveryCode:
case SbmCommodity.Column.MaterialCode:
case SbmCommodity.Column.FinishCode:
case SbmCommodity.Column.PromotionCode:
case SbmCommodity.Column.AssociationIdSupplier:
case SbmCommodity.Column.Supplier_Ref:
case SbmCommodity.Column.CostPrice:
case SbmCommodity.Column.PlaceOfOrigin:
case SbmCommodity.Column.MaterialCost:
case SbmCommodity.Column.MaterialCurrencyId:
case SbmCommodity.Column.ExWorksCost:
case SbmCommodity.Column.ExWorksCurrencyId:
case SbmCommodity.Column.ReorderLevel:
case SbmCommodity.Column.ReorderQty:
//case SbmCommodity.Column.QtyOnOrder:
case SbmCommodity.Column.AssociationIdCustomer:
case SbmCommodity.Column.SalesPrice:
case SbmCommodity.Column.RetailPrice:
case SbmCommodity.Column.RetailPricePlanned:
case SbmCommodity.Column.UomIdSale:
case SbmCommodity.Column.CarriageCostIndicative:
//case SbmCommodity.Column.CarriageCostIndicative_Fmt:
case SbmCommodity.Column.MinOrderQty:
case SbmCommodity.Column.PackQty:
case SbmCommodity.Column.TaxCodeId:
//case SbmCommodity.Column.LastOrderDate:
//case SbmCommodity.Column.LastOrderQty:
//case SbmCommodity.Column.QtyInStock:
//case SbmCommodity.Column.QtyAllocated:
//case SbmCommodity.Column.FreeStock:
//case SbmCommodity.Column.StockTakeDate:
//case SbmCommodity.Column.StockTakeQty:
//case SbmCommodity.Column.OrderQtyDecimals:
case SbmCommodity.Column.CommodityIdSalesProj:
//case SbmCommodity.Column.SalesProjMonthlyProp:
case SbmCommodity.Column.SalesProj_Annual:
case SbmCommodity.Column.SalesProjMonth01:
case SbmCommodity.Column.SalesProjMonth02:
case SbmCommodity.Column.SalesProjMonth03:
case SbmCommodity.Column.SalesProjMonth04:
case SbmCommodity.Column.SalesProjMonth05:
case SbmCommodity.Column.SalesProjMonth06:
case SbmCommodity.Column.SalesProjMonth07:
case SbmCommodity.Column.SalesProjMonth08:
case SbmCommodity.Column.SalesProjMonth09:
case SbmCommodity.Column.SalesProjMonth10:
case SbmCommodity.Column.SalesProjMonth11:
case SbmCommodity.Column.SalesProjMonth12:
case SbmCommodity.Column.Notes:
//case SbmCommodity.Column.Flags:
//case SbmCommodity.Column.Status:
//case SbmCommodity.Column.CreateOn:
//case SbmCommodity.Column.CreateBy:
//case SbmCommodity.Column.CreateHost:
//case SbmCommodity.Column.UpdateOn:
//case SbmCommodity.Column.UpdateBy:
//case SbmCommodity.Column.UpdateHost:
return true;//return ConfigConsole.DisplayAttribute(column);
}
return false;
}
public String GetColumnCode(SbmCommodity.Column column)
{
switch (column)
{
case SbmCommodity.Column.Type:
case SbmCommodity.Column.Type_Code:
case SbmCommodity.Column.Type_Desc:
return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Type, "Type");
case SbmCommodity.Column.Code: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Code, "Code");
case SbmCommodity.Column.DescBrief: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DescBrief, "Brief description");
case SbmCommodity.Column.DescOrder: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DescOrder, "Order description");
case SbmCommodity.Column.DescDetail: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DescDetail, "Detail description");
case SbmCommodity.Column.DrawingNo: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DrawingNo, "Drawing no");
case SbmCommodity.Column.DrawingIssue: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_DrawingIssue, "Drawing issue");
case SbmCommodity.Column.ImagePath: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ImagePath, "Image path");
case SbmCommodity.Column.Category1Code: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Category, "Category");
case SbmCommodity.Column.Location: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Location, "Location");
case SbmCommodity.Column.Department: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Department, "Department");
case SbmCommodity.Column.CatalogRef: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CatalogRef, "Catalog ref");
case SbmCommodity.Column.Weight: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Weight, "Weight");
case SbmCommodity.Column.Weight_UomId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdWeight, "Weight unit");
case SbmCommodity.Column.Length: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Length, "Length");
case SbmCommodity.Column.Length_UomId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdLength, "Length unit");
case SbmCommodity.Column.Volume: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Volume, "Volume");
case SbmCommodity.Column.Volume_UomId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdVolume, "Volume unit");
case SbmCommodity.Column.Density: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Density, "Density");
case SbmCommodity.Column.Density_UomId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdDensity, "Density unit");
case SbmCommodity.Column.BoxQuantity: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_BoxQuantity, "Box quantity");
case SbmCommodity.Column.BoxQuantity_UomId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdBox, "Box unit");
case SbmCommodity.Column.Dimensions: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Dimensions, "Dimensions");
case SbmCommodity.Column.SpecSummary: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SpecSummary, "Specification");
case SbmCommodity.Column.NominalCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_NominalCode, "Nominal code - sales");
case SbmCommodity.Column.NominalCodePurchase: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_NominalCodePurchase, "Nominal code - purchase");
case SbmCommodity.Column.ICNTariffCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ICNTariffCode, "ICN Tariff code");
case SbmCommodity.Column.MaterialCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material");
case SbmCommodity.Column.FinishCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish");
case SbmCommodity.Column.PromotionCode: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion");
case SbmCommodity.Column.AssociationIdSupplier: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_AssIdSupplier, "Supplier");
case SbmCommodity.Column.Supplier_Ref: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SupplierRef, "Supplier ref");
case SbmCommodity.Column.CostPrice: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CostPrice, "Cost price");
case SbmCommodity.Column.PlaceOfOrigin: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PlaceOfOrigin, "Place of origin");
case SbmCommodity.Column.MaterialCost: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCost, "Material cost");
case SbmCommodity.Column.MaterialCurrencyId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CurrencyIdMaterial, "Material currency");
case SbmCommodity.Column.ExWorksCost: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ExWorksCost, "Ex-works cost");
case SbmCommodity.Column.ExWorksCurrencyId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CurrencyIdExWorks, "Ex-works currency");
case SbmCommodity.Column.ReorderLevel: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ReorderLevel, "Reorder level");
case SbmCommodity.Column.ReorderQty: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_ReorderQty, "Reorder qty");
case SbmCommodity.Column.AssociationIdCustomer: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_AssIdCustomer, "Customer");
case SbmCommodity.Column.SalesPrice: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesPrice, "Sales price");
case SbmCommodity.Column.RetailPrice: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_RetailPrice, "Retail price");
case SbmCommodity.Column.RetailPricePlanned: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_RetailPricePlanned, "Retail price planned");
case SbmCommodity.Column.UomIdSale: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_UomIdSale, "Sale unit");
case SbmCommodity.Column.PackQty: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PackQty, "Pack qty - sale");
case SbmCommodity.Column.TaxCodeId: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_TaxCodeId, "Tax code");
case SbmCommodity.Column.SalesProj_Annual: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjAnnual, "Projected annual sales");
case SbmCommodity.Column.SalesProjMonth01: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth01, "Projected sales - Jan");
case SbmCommodity.Column.SalesProjMonth02: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth02, "Projected sales - Feb");
case SbmCommodity.Column.SalesProjMonth03: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth03, "Projected sales - Mar");
case SbmCommodity.Column.SalesProjMonth04: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth04, "Projected sales - Apr");
case SbmCommodity.Column.SalesProjMonth05: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth05, "Projected sales - May");
case SbmCommodity.Column.SalesProjMonth06: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth06, "Projected sales - Jun");
case SbmCommodity.Column.SalesProjMonth07: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth07, "Projected sales - Jul");
case SbmCommodity.Column.SalesProjMonth08: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth08, "Projected sales - Aug");
case SbmCommodity.Column.SalesProjMonth09: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth09, "Projected sales - Sep");
case SbmCommodity.Column.SalesProjMonth10: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth10, "Projected sales - Oct");
case SbmCommodity.Column.SalesProjMonth11: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth11, "Projected sales - Nov");
case SbmCommodity.Column.SalesProjMonth12: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_SalesProjMonth12, "Projected sales - Dec");
}
return "";
}
// Image Paths.
public String GetImagePathPrefix()
{
String prefix = "";
if (AccountsDfn.IsItemTypeManagedByAccounts(Sbm.ItemType.Commodity))
{
if (AccountsDfn.IsUsingSageInterface())
prefix = "%SAGE%\\";
}
return prefix;
}
public String GetActualImagePath(String imagePath)
{
//SATRACE("SapCommodityMgr::GetActualImagePath '"+imagePath+"'\n");
if (StringUtil.IsEmpty(imagePath)) return imagePath;
String imagePathPrefix = GetImagePathPrefix();
String cmdImagePath = imagePath;
if (cmdImagePath.Left(imagePathPrefix.Length) == imagePathPrefix)
{
String imageFolder = "";
if (AccountsDfn.IsItemTypeManagedByAccounts(Sbm.ItemType.Commodity))
{
if (AccountsDfn.IsUsingSageInterface())
imageFolder = AccountsDfn.GetImageFolder(Sbm.InterfaceType_Accounts.SageLine50);
}
//ToDo SaSystem::GETPATHDELIM in SbmCmdMgr need to be created inorder to work
cmdImagePath = imageFolder + /*SaSystem::GetPathDelim(imageFolder) +*/ cmdImagePath.Right(cmdImagePath.Length - imagePathPrefix.Length);
}
#if _DEBUG_XXX
if (!sCmdImagePath.IsEmpty())
{
SATRACE("GetActualImagePath Path = '" + cmdImagePath + "'\n");
}
#endif
return cmdImagePath;
}
public String GetStandardImagePath(String commodityCode)
{
// Using organisation configuration image folder.
if (StringUtil.IsEmpty(commodityCode)) return commodityCode;
String path = "";
if (!StringUtil.IsEmpty(commodityCode))
{
String folder = UserContext.GetOwnerOption_Folder(Sbm.OrgOption_Folder.CommodityImage);
path = GetImagePath(folder, commodityCode);
}
return path;
}
public String GetBarcodeImagePath(String commodityCode)
{
// Using organisation configuration barcode image folder.
if (StringUtil.IsEmpty(commodityCode)) return commodityCode;
String path = "";
if (!StringUtil.IsEmpty(commodityCode))
{
String folder = UserContext.GetOwnerOption_Folder(Sbm.OrgOption_Folder.CommodityBarcodeImage);
path = GetImagePath(folder, commodityCode);
}
return path;
}
public String GetImagePath(String folder, String filenamePrefix)
{
String path = "";
//SATRACE("SapCommodityMgr::GetImagePath Locating image file '"+sFilenamePrefix+"' in folder '"+sFolder+"'\n");
if (!folder.IsEmpty() && Directory.Exists(folder) && !filenamePrefix.IsEmpty())
{
List<String> imageExtensions = StringListUtil.Split("jpg,jpeg,gif,png,tif,eps", ",");
foreach (String imageExtension in imageExtensions)
{
//ToDo SaSystem::GETPATHDELIM in SbmCmdMgr need to be created inorder to work
path = folder + /*SaSystem::GetPathDelim(folder) +*/ filenamePrefix + "." + imageExtension;
#if _DEBUG
if (Sys_Fn::FileExists(path))
{
SATRACE("GetImagePath Found image file: " + path + "\n");
}
#endif
if (!Directory.Exists(path)) path.IsEmpty();
}
}
return path;
}
public abstract List<Sbm.CommodityType> GetCommodityTypesInUse();
public abstract Sbm.CommodityType GetTypeForCommodityId(SysId commodityId);
public abstract double GetCostPriceForCommodityId(SysId commodityId);
public abstract List<SysIdString> GetSalesTemplateCommmodities();
public abstract bool UpdateReferencesToSalesTemplate(SbmCommodity commodity);
public abstract String BuildSalesQuantityQuery(DateTime earliest, DateTime latest, bool completeOrders, String tableAliasCommodity);// Sales Quantity Query.
public abstract String BuildAllocatedStockQuery(List<SysId> locIds);// Allocated Stock Query.
public abstract String BuildCurrentStockQuery(List<SysId> locIds);// Currency Stock Query.
public abstract String BuildPlannedStockMovementsQuery(DateTime earliest, DateTime latest, SbmCommodity.Params prmCmd, bool intoStock, bool provisional, String tableAliasCommodity);// Stock Movements Query.
public abstract void PopulateLocationIdLists();// Populate LocationId Lists.
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Retrieve individual commodities. // Retrieve individual commodities.
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -309,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(commodityId)) return false; if (!SysId.IsValid(commodityId)) return false;
SbmCommodity.Params prmCommodity = new SbmCommodity.Params(); SbmCommodity.Params prmCommodity = new SbmCommodity.Params();
prmCommodity.IncludedIds.Add(commodityId); prmCommodity.IdsIncluded.Add(commodityId);
prmCommodity.StatusCat = SbmCommodity.StatusCat.Any; prmCommodity.StatusCat = SbmCommodity.StatusCat.Any;
return GetCommodityCount(prmCommodity) == 1; return GetCommodityCount(prmCommodity) == 1;
} }
@@ -343,7 +70,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(commodityId)) return null; if (!SysId.IsValid(commodityId)) return null;
SbmCommodity.Params prmCommodity = new SbmCommodity.Params(); SbmCommodity.Params prmCommodity = new SbmCommodity.Params();
prmCommodity.IncludedIds.Add(commodityId); prmCommodity.IdsIncluded.Add(commodityId);
prmCommodity.StatusCat = SbmCommodity.StatusCat.Any; prmCommodity.StatusCat = SbmCommodity.StatusCat.Any;
return GetCommodity(prmCommodity); return GetCommodity(prmCommodity);
} }
@@ -567,7 +294,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmCommodity.Column)column.Id) switch ((SbmCommodity.Column)column.Id)
{ {
//--------------------------------------------------------------- //-----------------------------------------------------------
// Commodity TypeDesc. // Commodity TypeDesc.
case SbmCommodity.Column.Type_Code: case SbmCommodity.Column.Type_Code:
case SbmCommodity.Column.Type_Desc: case SbmCommodity.Column.Type_Desc:
@@ -590,7 +317,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Weight units. // Weight units.
case SbmCommodity.Column.Weight_Unit: case SbmCommodity.Column.Weight_Unit:
{ {
@@ -739,7 +466,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Commodity Codings Description. // Commodity Codings Description.
case SbmCommodity.Column.RangeDesc: case SbmCommodity.Column.RangeDesc:
{ {
@@ -796,7 +523,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Commodity Formatted Currency Values. // Commodity Formatted Currency Values.
case SbmCommodity.Column.CostPrice_Fmt: case SbmCommodity.Column.CostPrice_Fmt:
{ {
@@ -905,7 +632,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Customer Definition. // Customer Definition.
/*case SbmCommodity.Column.Cust_ProductCode: /*case SbmCommodity.Column.Cust_ProductCode:
case SbmCommodity.Column.Cust_AmountRetail:*/ case SbmCommodity.Column.Cust_AmountRetail:*/
@@ -942,7 +669,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
case SbmCommodity.Column.Cust_PromotionDesc: case SbmCommodity.Column.Cust_PromotionDesc:
break;*/ break;*/
//--------------------------------------------------------------- //-----------------------------------------------------------
// Stock Bays. // Stock Bays.
case SbmCommodity.Column.Stock_Bays: case SbmCommodity.Column.Stock_Bays:
{ {
@@ -1014,7 +741,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Barcode Images.
case SbmCommodity.Column.BarcodeImagePath:
{
String commodityCode = values.GetValue(GetCommodityColumnDfn(SbmCommodity.Column.Code).DataName).ToString();
value = new DataValue(GetBarcodeImagePath(commodityCode));
break;
}
//-----------------------------------------------------------
// Commodity Notes. // Commodity Notes.
case SbmCommodity.Column.Notes: case SbmCommodity.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -1045,14 +781,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
// Barcode Images. //-----------------------------------------------------------
case SbmCommodity.Column.BarcodeImagePath: default:
{ value = values.GetValue(column.DataName);
String commodityCode = values.GetValue(GetCommodityColumnDfn(SbmCommodity.Column.Code).DataName).ToString();
value = new DataValue(GetBarcodeImagePath(commodityCode));
break; break;
}
//---------------------------------------------------------------
} }
return value; return value;
} }
@@ -11,12 +11,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Commodity Manager - Commodity Customer.
//======================================================================= //=======================================================================
partial class SbmCommodityMgr partial class SbmCommodityMgr
{ {
//*******************************************************************
// C o m m o d i t y C u s t o m e r s
//*******************************************************************
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities. // Utilities.
public abstract bool CanManageCommodityCustomers(); public abstract bool CanManageCommodityCustomers();
@@ -30,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(commodityCustomerId)) return false; if (!SysId.IsValid(commodityCustomerId)) return false;
SbmCommodityCustomer.Params prmCommodityCustomer = new SbmCommodityCustomer.Params(); SbmCommodityCustomer.Params prmCommodityCustomer = new SbmCommodityCustomer.Params();
prmCommodityCustomer.IncludedIds.Add(commodityCustomerId); prmCommodityCustomer.IdsIncluded.Add(commodityCustomerId);
prmCommodityCustomer.StatusCat = SbmCommodityCustomer.StatusCat.Any; prmCommodityCustomer.StatusCat = SbmCommodityCustomer.StatusCat.Any;
return GetCommodityCustomerCount(prmCommodityCustomer) == 1; return GetCommodityCustomerCount(prmCommodityCustomer) == 1;
} }
@@ -165,7 +164,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmCommodityCustomer.Column)column.Id) switch ((SbmCommodityCustomer.Column)column.Id)
{ {
//--------------------------------------------------------------- //-----------------------------------------------------------
// Commodity Category. // Commodity Category.
case SbmCommodityCustomer.Column.Commodity_CategoryDesc: case SbmCommodityCustomer.Column.Commodity_CategoryDesc:
{ {
@@ -193,7 +192,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmCommodityCustomer.GetStatusTriState(status)); value = new DataValue(SbmCommodityCustomer.GetStatusTriState(status));
} }
break; break;
//---------------------------------------------------------------
//-----------------------------------------------------------
// CmdCustomer Formatted currency values. // CmdCustomer Formatted currency values.
case SbmCommodityCustomer.Column.AmountRetail_Fmt: case SbmCommodityCustomer.Column.AmountRetail_Fmt:
{ {
@@ -226,8 +226,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
}*/ }*/
//-----------------------------------------------------------
//---------------------------------------------------------------
// Promotion Description. // Promotion Description.
case SbmCommodityCustomer.Column.PromotionDesc: case SbmCommodityCustomer.Column.PromotionDesc:
{ {
@@ -236,7 +235,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Notes. // Notes.
case SbmCommodityCustomer.Column.Notes: case SbmCommodityCustomer.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -254,7 +253,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmCommodityCustomer.GetStatusTriState(status)); value = new DataValue(SbmCommodityCustomer.GetStatusTriState(status));
break; break;
} }
//---------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -9,12 +9,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Commodity Manager - Commodity Supplier.
//======================================================================= //=======================================================================
partial class SbmCommodityMgr partial class SbmCommodityMgr
{ {
//*******************************************************************
// C o m m o d i t y S u p p l i e r s
//*******************************************************************
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities. // Utilities.
public abstract bool CanManageCommoditySuppliers(); public abstract bool CanManageCommoditySuppliers();
@@ -28,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(commoditySupplierId)) return false; if (!SysId.IsValid(commoditySupplierId)) return false;
SbmCommoditySupplier.Params prmCommoditySupplier = new SbmCommoditySupplier.Params(); SbmCommoditySupplier.Params prmCommoditySupplier = new SbmCommoditySupplier.Params();
prmCommoditySupplier.IncludedIds.Add(commoditySupplierId); prmCommoditySupplier.IdsIncluded.Add(commoditySupplierId);
prmCommoditySupplier.StatusCat = SbmCommoditySupplier.StatusCat.Any; prmCommoditySupplier.StatusCat = SbmCommoditySupplier.StatusCat.Any;
return GetCommoditySupplierCount(prmCommoditySupplier) == 1; return GetCommoditySupplierCount(prmCommoditySupplier) == 1;
} }
@@ -42,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(commoditySupplierId)) return null; if (!SysId.IsValid(commoditySupplierId)) return null;
SbmCommoditySupplier.Params prmCommoditySupplier = new SbmCommoditySupplier.Params(); SbmCommoditySupplier.Params prmCommoditySupplier = new SbmCommoditySupplier.Params();
prmCommoditySupplier.IncludedIds.Add(commoditySupplierId); prmCommoditySupplier.IdsIncluded.Add(commoditySupplierId);
prmCommoditySupplier.StatusCat = SbmCommoditySupplier.StatusCat.Any; prmCommoditySupplier.StatusCat = SbmCommoditySupplier.StatusCat.Any;
return GetCommoditySupplier(prmCommoditySupplier); return GetCommoditySupplier(prmCommoditySupplier);
} }
@@ -142,7 +141,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmCommoditySupplier.Column)column.Id) switch ((SbmCommoditySupplier.Column)column.Id)
{ {
//--------------------------------------------------------------- //-----------------------------------------------------------
// Commodity Category. // Commodity Category.
case SbmCommoditySupplier.Column.Commodity_CategoryDesc: case SbmCommoditySupplier.Column.Commodity_CategoryDesc:
{ {
@@ -170,11 +169,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmCommoditySupplier.GetStatusTriState(status)); value = new DataValue(SbmCommoditySupplier.GetStatusTriState(status));
} }
break; break;
//---------------------------------------------------------------
//-----------------------------------------------------------
// CmdCustomer Formatted currency values. // CmdCustomer Formatted currency values.
//-----------------------------------------------------------
//---------------------------------------------------------------
// Notes. // Notes.
case SbmCommoditySupplier.Column.Notes: case SbmCommoditySupplier.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -192,7 +191,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmCommoditySupplier.GetStatusTriState(status)); value = new DataValue(SbmCommoditySupplier.GetStatusTriState(status));
break; break;
} }
//---------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -10,12 +10,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Commodity Manager - Container.
//======================================================================= //=======================================================================
partial class SbmCommodityMgr partial class SbmCommodityMgr
{ {
//*******************************************************************
// C o n t a i n e r s
//*******************************************************************
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities. // Utilities.
@@ -28,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(containerId)) return false; if (!SysId.IsValid(containerId)) return false;
SbmContainer.Params prmContainer = new SbmContainer.Params(); SbmContainer.Params prmContainer = new SbmContainer.Params();
prmContainer.IncludedIds.Add(containerId); prmContainer.IdsIncluded.Add(containerId);
return GetContainerCount(prmContainer) == 1; return GetContainerCount(prmContainer) == 1;
} }
@@ -53,7 +52,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(containerId)) return null; if (!SysId.IsValid(containerId)) return null;
SbmContainer.Params prmContainer = new SbmContainer.Params(); SbmContainer.Params prmContainer = new SbmContainer.Params();
prmContainer.IncludedIds.Add(containerId); prmContainer.IdsIncluded.Add(containerId);
return GetContainer(prmContainer); return GetContainer(prmContainer);
} }
@@ -196,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Notes. // Notes.
case SbmContainer.Column.Notes: case SbmContainer.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -214,7 +213,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmContainer.GetStatusTriState(status)); value = new DataValue(SbmContainer.GetStatusTriState(status));
break; break;
} }
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -9,12 +9,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Commodity Manager - Container Item.
//======================================================================= //=======================================================================
partial class SbmCommodityMgr partial class SbmCommodityMgr
{ {
//*******************************************************************
// C o n t a i n e r s
//*******************************************************************
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities. // Utilities.
public abstract String GetItemSource(Sbm.ItemType itemType, SysId itemId, bool brief = false); public abstract String GetItemSource(Sbm.ItemType itemType, SysId itemId, bool brief = false);
@@ -29,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(containerItemId)) return false; if (!SysId.IsValid(containerItemId)) return false;
SbmContainerItem.Params prmContainerItem = new SbmContainerItem.Params(); SbmContainerItem.Params prmContainerItem = new SbmContainerItem.Params();
prmContainerItem.IncludedIds.Add(containerItemId); prmContainerItem.IdsIncluded.Add(containerItemId);
return GetContainerItemCount(prmContainerItem) == 1; return GetContainerItemCount(prmContainerItem) == 1;
} }
@@ -42,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(containerItemId)) return null; if (!SysId.IsValid(containerItemId)) return null;
SbmContainerItem.Params prmContainerItem = new SbmContainerItem.Params(); SbmContainerItem.Params prmContainerItem = new SbmContainerItem.Params();
prmContainerItem.IncludedIds.Add(containerItemId); prmContainerItem.IdsIncluded.Add(containerItemId);
return GetContainerItem(prmContainerItem); return GetContainerItem(prmContainerItem);
} }
@@ -163,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmContainerItem.Column)column.Id) switch ((SbmContainerItem.Column)column.Id)
{ {
//--------------------------------------------------------------- //-----------------------------------------------------------
// Notes. // Notes.
case SbmContainerItem.Column.Notes: case SbmContainerItem.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -181,7 +180,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmContainerItem.GetStatusTriState(status)); value = new DataValue(SbmContainerItem.GetStatusTriState(status));
break; break;
} }
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -12,12 +12,12 @@ using static Sarand.Net.Standard.Base.Interfaces.SaInterfaceConsole;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Commodity Manager - Portfolio Item.
//======================================================================= //=======================================================================
partial class SbmCommodityMgr partial class SbmCommodityMgr
{ {
//******************************************************************* //-------------------------------------------------------------------
// P o r t f o l i o I t e m
//*******************************************************************
// Utilities. // Utilities.
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -91,7 +91,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(portfolioItemId)) return false; if (!SysId.IsValid(portfolioItemId)) return false;
SbmPortfolioItem.Params prmPortfolioItem = new SbmPortfolioItem.Params(); SbmPortfolioItem.Params prmPortfolioItem = new SbmPortfolioItem.Params();
prmPortfolioItem.IncludedIds.Add(portfolioItemId); prmPortfolioItem.IdsIncluded.Add(portfolioItemId);
prmPortfolioItem.StatusCat = SbmPortfolioItem.StatusCat.Any; prmPortfolioItem.StatusCat = SbmPortfolioItem.StatusCat.Any;
return GetPortfolioItemCount(prmPortfolioItem) == 1; return GetPortfolioItemCount(prmPortfolioItem) == 1;
} }
@@ -116,7 +116,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(portfolioItemId)) return null; if (!SysId.IsValid(portfolioItemId)) return null;
SbmPortfolioItem.Params prmPortfolioItem = new SbmPortfolioItem.Params(); SbmPortfolioItem.Params prmPortfolioItem = new SbmPortfolioItem.Params();
prmPortfolioItem.IncludedIds.Add(portfolioItemId); prmPortfolioItem.IdsIncluded.Add(portfolioItemId);
prmPortfolioItem.StatusCat = SbmPortfolioItem.StatusCat.Any; prmPortfolioItem.StatusCat = SbmPortfolioItem.StatusCat.Any;
return GetPortfolioItem(prmPortfolioItem); return GetPortfolioItem(prmPortfolioItem);
} }
@@ -294,6 +294,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
+6 -6
View File
@@ -180,7 +180,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } } protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } } protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
// Consoles. // Consoles.
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } } protected SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } } protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } } protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } } protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
@@ -243,23 +243,23 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
// Configuration console utilities. // Configuration console utilities.
public bool AllowConfigOption(Sbm.ConfigOption configOption) public bool AllowConfigOption(Sbm.ConfigOption configOption)
{ {
return ConfigConsole.AllowOption(UserContext, configOption); return SessionConsole.AllowOption(configOption);
} }
public bool AllowAffiliateType(Sbm.AffiliateType affiliateType) public bool AllowAffiliateType(Sbm.AffiliateType affiliateType)
{ {
return ConfigConsole.AllowAffiliateType(UserContext, affiliateType); return SessionConsole.AllowAffiliateType(affiliateType);
} }
public bool AllowAssociationType(Sbm.AssociationType associationType) public bool AllowAssociationType(Sbm.AssociationType associationType)
{ {
return ConfigConsole.AllowAssociationType(UserContext, associationType); return SessionConsole.AllowAssociationType(associationType);
} }
public bool AllowTransactionType(Sbm.TransactionType transactionType) public bool AllowTransactionType(Sbm.TransactionType transactionType)
{ {
return ConfigConsole.AllowTransactionType(UserContext, transactionType); return SessionConsole.AllowTransactionType(transactionType);
} }
public String GetAttributeCaption(SbmDbDfn.ColumnIdx columnIdx, String defaultValue) public String GetAttributeCaption(SbmDbDfn.ColumnIdx columnIdx, String defaultValue)
{ {
return ConfigConsole.GetAttributeCaption(UserContext, columnIdx, defaultValue); return SessionConsole.GetAttributeCaption(columnIdx, defaultValue);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -3,6 +3,8 @@ using Sarand.BusinessMgr.Net.Standard.Base.Core;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Data Item Manager.
//======================================================================= //=======================================================================
public abstract partial class SbmDataItemMgr : SbmCoreMgr public abstract partial class SbmDataItemMgr : SbmCoreMgr
{ {
@@ -10,12 +10,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Data Item Manager - Item Batches.
//======================================================================= //=======================================================================
partial class SbmDataItemMgr partial class SbmDataItemMgr
{ {
//*******************************************************************
// I t e m B a t c h e s
//*******************************************************************
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Utilities. // Utilities.
@@ -28,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(itemBatchId)) return false; if (!SysId.IsValid(itemBatchId)) return false;
SbmItemBatch.Params prmItemBatch = new SbmItemBatch.Params(); SbmItemBatch.Params prmItemBatch = new SbmItemBatch.Params();
prmItemBatch.IncludedIds.Add(itemBatchId); prmItemBatch.IdsIncluded.Add(itemBatchId);
prmItemBatch.StatusCat = SbmItemBatch.StatusCat.Any; prmItemBatch.StatusCat = SbmItemBatch.StatusCat.Any;
return GetItemBatchCount(prmItemBatch) == 1; return GetItemBatchCount(prmItemBatch) == 1;
} }
@@ -51,7 +50,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(itemBatchId)) return null; if (!SysId.IsValid(itemBatchId)) return null;
SbmItemBatch.Params prmItemBatch = new SbmItemBatch.Params(); SbmItemBatch.Params prmItemBatch = new SbmItemBatch.Params();
prmItemBatch.IncludedIds.Add(itemBatchId); prmItemBatch.IdsIncluded.Add(itemBatchId);
prmItemBatch.StatusCat = SbmItemBatch.StatusCat.Any; prmItemBatch.StatusCat = SbmItemBatch.StatusCat.Any;
return GetItemBatch(prmItemBatch); return GetItemBatch(prmItemBatch);
} }
@@ -165,6 +164,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmItemBatch.Column)column.Id) switch ((SbmItemBatch.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmItemBatch.Column.Notes: case SbmItemBatch.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -184,6 +184,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -0,0 +1,79 @@
using Sarand.BusinessMgr.Net.Standard.Base.App;
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Data Item Manager - Item Links - Utils.
//=======================================================================
partial class SbmDataItemMgr
{
//-------------------------------------------------------------------
// Utilities.
public static Sbm.ItemLinkType GetLinkType(Sbm.ApplCodeType applCodeType)
{
switch (applCodeType)
{
case Sbm.ApplCodeType.SeasonalCategory: return Sbm.ItemLinkType.ItemCodeList_SeasonalCategory;
case Sbm.ApplCodeType.PostcodeArea: return Sbm.ItemLinkType.ItemCodeList_PostcodeArea;
case Sbm.ApplCodeType.JobTrade: return Sbm.ItemLinkType.ItemCodeList_JobTrade;
case Sbm.ApplCodeType.JobEngineer: return Sbm.ItemLinkType.ItemCodeList_JobEngineer;
}
return Sbm.ItemLinkType.Unknown;
}
//-------------------------------------------------------------------
// Clean up data issues/inconsistencies.
public abstract bool DoDbCleanup();
// Clear all associated data for item - attributes and links.
public abstract bool ClearDataItem(Sbm.ItemType itemType, SysId itemId);
//-------------------------------------------------------------------
// Linked Items.
public static bool ItemLinkParentIsFixed(Sbm.AssociatedItemMode itemMode)
{
switch (itemMode)
{
case Sbm.AssociatedItemMode.Commodity_Parent:
case Sbm.AssociatedItemMode.Requirement_Parent:
return true;
}
return false;
}
public static bool ItemLinkChildIsFixed(Sbm.AssociatedItemMode itemMode)
{
switch (itemMode)
{
case Sbm.AssociatedItemMode.Commodity_Child:
case Sbm.AssociatedItemMode.Requirement_Child:
return true;
}
return false;
}
public static bool ItemLinkConfigIsValid(Sbm.AssociatedItemMode itemMode, Sbm.ItemLinkType itemLinkType)
{
switch (itemMode)
{
case Sbm.AssociatedItemMode.Commodity_Child:
case Sbm.AssociatedItemMode.Requirement_Child:
return true;
}
return false;
}
public abstract bool UpdateLinkedItems(Sbm.AssociatedItemMode itemMode, Sbm.ItemLinkType itemLinkType, ref ItemId itemIdParent, ref ItemId itemIdChild, ItemId itemId, List<SbmItemLink> itemLinks);
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -10,48 +10,27 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
//=======================================================================
// Data Item Manager - Item Links.
//======================================================================= //=======================================================================
partial class SbmDataItemMgr partial class SbmDataItemMgr
{ {
//*******************************************************************
// I t e m L i n k s
//*******************************************************************
//-------------------------------------------------------------------
// Utilities.
public static Sbm.ItemLinkType GetLinkType(Sbm.ApplCodeType applCodeType)
{
switch (applCodeType)
{
case Sbm.ApplCodeType.SeasonalCategory: return Sbm.ItemLinkType.ItemCodeList_SeasonalCategory;
case Sbm.ApplCodeType.PostcodeArea: return Sbm.ItemLinkType.ItemCodeList_PostcodeArea;
case Sbm.ApplCodeType.JobTrade: return Sbm.ItemLinkType.ItemCodeList_JobTrade;
case Sbm.ApplCodeType.JobEngineer: return Sbm.ItemLinkType.ItemCodeList_JobEngineer;
}
return Sbm.ItemLinkType.Unknown;
}
// Clean up data issues/inconsistencies.
public abstract bool DoDbCleanup();
// Clear all associated data for item - attributes and links.
public abstract bool ClearDataItem(Sbm.ItemType itemType, SysId itemId);
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Retrieve individual itemLinks. // Retrieve individual itemLinks.
//------------------------------------------------------------------- //-------------------------------------------------------------------
// ItemLink exists. // Item exists.
public bool ItemLinkExistsById(SysId itemLinkId) public bool ItemLinkExistsById(SysId itemLinkId)
{ {
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(itemLinkId)) return false; if (!SysId.IsValid(itemLinkId)) return false;
SbmItemLink.Params prmItemLink = new SbmItemLink.Params(); SbmItemLink.Params prmItemLink = new SbmItemLink.Params();
prmItemLink.IncludedIds.Add(itemLinkId); prmItemLink.IdsIncluded.Add(itemLinkId);
prmItemLink.StatusCat = SbmItemLink.StatusCat.Any; prmItemLink.StatusCat = SbmItemLink.StatusCat.Any;
return GetItemLinkCount(prmItemLink) == 1; return GetItemLinkCount(prmItemLink) == 1;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Get itemLinks. // Get items.
public abstract SbmItemLink GetItemLink(SbmItemLink.Params prm); public abstract SbmItemLink GetItemLink(SbmItemLink.Params prm);
public SbmItemLink GetItemLinkById(SysId itemLinkId) public SbmItemLink GetItemLinkById(SysId itemLinkId)
@@ -59,21 +38,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(itemLinkId)) return null; if (!SysId.IsValid(itemLinkId)) return null;
SbmItemLink.Params prmItemLink = new SbmItemLink.Params(); SbmItemLink.Params prmItemLink = new SbmItemLink.Params();
prmItemLink.IncludedIds.Add(itemLinkId); prmItemLink.IdsIncluded.Add(itemLinkId);
prmItemLink.StatusCat = SbmItemLink.StatusCat.Any; prmItemLink.StatusCat = SbmItemLink.StatusCat.Any;
return GetItemLink(prmItemLink); return GetItemLink(prmItemLink);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Create itemLinks. // Create items.
public abstract SbmItemLink CreateItemLink(Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeFrom, SysId itemIdFrom, Sbm.ItemType itemTypeTo, SysId itemIdTo); public abstract SbmItemLink CreateItemLink(Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeFrom, SysId itemIdFrom, Sbm.ItemType itemTypeTo, SysId itemIdTo);
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Has itemLinks. // Has items.
public abstract bool HasItemLinks(Sbm.ItemType itemType, SysId itemId); public abstract bool HasItemLinks(Sbm.ItemType itemType, SysId itemId);
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Validate Item Link data. // Validate item data.
public bool IsValidItemLink(SbmItemLink itemLink) public bool IsValidItemLink(SbmItemLink itemLink)
{ {
ClearErrorState(); ClearErrorState();
@@ -83,7 +62,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
public virtual bool IsValidItemLinkData(SbmItemLink.Data data, SbmItemLink.ErrField errField) public virtual bool IsValidItemLinkData(SbmItemLink.Data data, SbmItemLink.ErrField errField)
{ {
ClearErrorState(); ClearErrorState();
// ItemLink properties. // Item properties.
if (errField.ItemLinkType != SacsHierarchyItem.ValidValue.Ignore) if (errField.ItemLinkType != SacsHierarchyItem.ValidValue.Ignore)
{ {
if ((int)data.ItemLinkType < 1) if ((int)data.ItemLinkType < 1)
@@ -157,11 +136,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// ItemLink database interface. // Item database interface.
public abstract bool InsertItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo); public abstract bool InsertItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo);
public abstract bool UpdateItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo); public abstract bool UpdateItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo);
public abstract bool StoreFromItemLinks(Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeFrom, SysId itemIdFrom, List<SbmItemLink> itemLinks, DbUpdateInfo dbUpdateInfo); public abstract bool StoreFromItemLinks(Sbm.ItemLinkType itemLinkType, ItemId itemIdFrom, List<SbmItemLink> itemLinks, DbUpdateInfo dbUpdateInfo);
public abstract bool StoreToItemLinks(Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeTo, SysId itemIdTo, List<SbmItemLink> itemLinks, DbUpdateInfo dbUpdateInfo); public abstract bool StoreToItemLinks(Sbm.ItemLinkType itemLinkType, ItemId itemIdTo, List<SbmItemLink> itemLinks, DbUpdateInfo dbUpdateInfo);
public virtual bool ItemLinkCanBeDeleted(SbmItemLink itemLink) public virtual bool ItemLinkCanBeDeleted(SbmItemLink itemLink)
{ {
@@ -172,7 +151,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
public abstract bool DeleteItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo); public abstract bool DeleteItemLink(SbmItemLink itemLink, DbUpdateInfo dbUpdateInfo);
//------------------------------------------------------------------- //-------------------------------------------------------------------
// ItemLink list. // Item list.
public abstract ColumnDfn GetItemLinkColumnDfn(SbmItemLink.Column columnId, String caption = "", int width = 0); public abstract ColumnDfn GetItemLinkColumnDfn(SbmItemLink.Column columnId, String caption = "", int width = 0);
public abstract List<String> GetItemLinkQueryFilter(SbmItemLink.Params prm); public abstract List<String> GetItemLinkQueryFilter(SbmItemLink.Params prm);
public abstract long GetItemLinkCount(SbmItemLink.Params prm); public abstract long GetItemLinkCount(SbmItemLink.Params prm);
@@ -191,6 +170,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmItemLink.Column)column.Id) switch ((SbmItemLink.Column)column.Id)
{ {
//-----------------------------------------------------------
// Notes. // Notes.
case SbmItemLink.Column.Notes: case SbmItemLink.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -210,6 +190,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -140,6 +140,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmPrice.Column)column.Id) switch ((SbmPrice.Column)column.Id)
{ {
//-----------------------------------------------------------
// Price type. // Price type.
case SbmPrice.Column.PriceType_Desc: case SbmPrice.Column.PriceType_Desc:
{ {
@@ -147,6 +148,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(PriceTypes.GetDescForType(priceType, priceType > 0 ? priceType.ToString() : "")); value = new DataValue(PriceTypes.GetDescForType(priceType, priceType > 0 ? priceType.ToString() : ""));
break; break;
} }
//-----------------------------------------------------------
// Calculation method. // Calculation method.
case SbmPrice.Column.CalculationMethod_Desc: case SbmPrice.Column.CalculationMethod_Desc:
{ {
@@ -154,6 +157,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(PriceCalculationMethods.GetDescForType(calculationMethod, calculationMethod > 0 ? calculationMethod.ToString() : "")); value = new DataValue(PriceCalculationMethods.GetDescForType(calculationMethod, calculationMethod > 0 ? calculationMethod.ToString() : ""));
break; break;
} }
//-----------------------------------------------------------
// Rounder method. // Rounder method.
case SbmPrice.Column.RounderMethod_Desc: case SbmPrice.Column.RounderMethod_Desc:
{ {
@@ -161,6 +166,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(PriceRounderMethods.GetDescForType(rounderMethod, rounderMethod > 0 ? rounderMethod.ToString() : "")); value = new DataValue(PriceRounderMethods.GetDescForType(rounderMethod, rounderMethod > 0 ? rounderMethod.ToString() : ""));
break; break;
} }
// Rounder direction. // Rounder direction.
case SbmPrice.Column.RounderDirection_Desc: case SbmPrice.Column.RounderDirection_Desc:
{ {
@@ -168,6 +174,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(PriceRounderDirections.GetDescForType(rounderDirection, rounderDirection > 0 ? rounderDirection.ToString() : "")); value = new DataValue(PriceRounderDirections.GetDescForType(rounderDirection, rounderDirection > 0 ? rounderDirection.ToString() : ""));
break; break;
} }
//-----------------------------------------------------------
// Sales dicount. // Sales dicount.
case SbmPrice.Column.SalesDiscountPercent: case SbmPrice.Column.SalesDiscountPercent:
{ {
@@ -196,12 +204,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(salesDiscountPercent); value = new DataValue(salesDiscountPercent);
break; break;
} }
//-----------------------------------------------------------
// Notes. // Notes.
case SbmPrice.Column.Notes: case SbmPrice.Column.Notes:
{ {
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break; break;
} }
// Status. // Status.
case SbmPrice.Column.Status_Desc: case SbmPrice.Column.Status_Desc:
case SbmPrice.Column.Status_Ind: case SbmPrice.Column.Status_Ind:
@@ -214,6 +225,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmPrice.GetStatusTriState(status)); value = new DataValue(SbmPrice.GetStatusTriState(status));
break; break;
} }
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(priceSetId)) return false; if (!SysId.IsValid(priceSetId)) return false;
SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params(); SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params();
prmPriceSet.IncludedIds.Add(priceSetId); prmPriceSet.IdsIncluded.Add(priceSetId);
prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any; prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any;
return GetPriceSetCount(prmPriceSet) == 1; return GetPriceSetCount(prmPriceSet) == 1;
} }
@@ -51,7 +51,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(priceSetId)) return null; if (!SysId.IsValid(priceSetId)) return null;
SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params(); SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params();
prmPriceSet.IncludedIds.Add(priceSetId); prmPriceSet.IdsIncluded.Add(priceSetId);
prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any; prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any;
return GetPriceSet(prmPriceSet); return GetPriceSet(prmPriceSet);
} }
@@ -152,6 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmPriceSet.Column)column.Id) switch ((SbmPriceSet.Column)column.Id)
{ {
//-----------------------------------------------------------
// Price type. // Price type.
case SbmPriceSet.Column.PriceType_Desc: case SbmPriceSet.Column.PriceType_Desc:
{ {
@@ -159,6 +160,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(PriceTypes.GetDescForType(priceType, priceType > 0 ? priceType.ToString() : "")); value = new DataValue(PriceTypes.GetDescForType(priceType, priceType > 0 ? priceType.ToString() : ""));
break; break;
} }
//-----------------------------------------------------------
// Has Static Prices. // Has Static Prices.
case SbmPriceSet.Column.HasStaticPrices_Tick: case SbmPriceSet.Column.HasStaticPrices_Tick:
case SbmPriceSet.Column.HasStaticPrices_Y: case SbmPriceSet.Column.HasStaticPrices_Y:
@@ -170,12 +173,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
else value = new DataValue(hasStaticPrices); else value = new DataValue(hasStaticPrices);
break; break;
} }
//-----------------------------------------------------------
// Notes. // Notes.
case SbmPriceSet.Column.Notes: case SbmPriceSet.Column.Notes:
{ {
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break; break;
} }
// Status. // Status.
case SbmPriceSet.Column.Status_Desc: case SbmPriceSet.Column.Status_Desc:
case SbmPriceSet.Column.Status_Ind: case SbmPriceSet.Column.Status_Ind:
@@ -188,6 +194,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmPriceSet.GetStatusTriState(status)); value = new DataValue(SbmPriceSet.GetStatusTriState(status));
break; break;
} }
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
+3 -3
View File
@@ -101,11 +101,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
// Price set is available but no valid price found. // Price set is available but no valid price found.
// Discount can be used if allowed in conjunction with no price set price found. // Discount can be used if allowed in conjunction with no price set price found.
SbmConfigConsole configConsole = ConfigConsole; SbmSessionConsole sessionConsole = SessionConsole;
if (prmCalc.IsSales) if (prmCalc.IsSales)
bUseDiscount = configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.CustomerDiscountWhenNoPriceInSet); bUseDiscount = sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.CustomerDiscountWhenNoPriceInSet);
else else
bUseDiscount = configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.SupplierDiscountWhenNoPriceInSet); bUseDiscount = sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.SupplierDiscountWhenNoPriceInSet);
} }
if (bUseDiscount) if (bUseDiscount)
{ {
@@ -31,7 +31,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(processId)) return false; if (!SysId.IsValid(processId)) return false;
SbmProcess.Params prmProcess = new SbmProcess.Params(); SbmProcess.Params prmProcess = new SbmProcess.Params();
prmProcess.IncludedIds.Add(processId); prmProcess.IdsIncluded.Add(processId);
prmProcess.StatusCat = SbmProcess.StatusCat.Any; prmProcess.StatusCat = SbmProcess.StatusCat.Any;
return GetProcessCount(prmProcess) == 1; return GetProcessCount(prmProcess) == 1;
} }
@@ -45,7 +45,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(processId)) return null; if (!SysId.IsValid(processId)) return null;
SbmProcess.Params prmProcess = new SbmProcess.Params(); SbmProcess.Params prmProcess = new SbmProcess.Params();
prmProcess.IncludedIds.Add(processId); prmProcess.IdsIncluded.Add(processId);
prmProcess.StatusCat = SbmProcess.StatusCat.Any; prmProcess.StatusCat = SbmProcess.StatusCat.Any;
return GetProcess(prmProcess); return GetProcess(prmProcess);
} }
@@ -145,7 +145,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmProcess.Column)column.Id) switch ((SbmProcess.Column)column.Id)
{ {
//--------------------------------------------------------------- - //-----------------------------------------------------------
// Process TypeDesc. // Process TypeDesc.
case SbmProcess.Column.Type_Desc: case SbmProcess.Column.Type_Desc:
{ {
@@ -153,6 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(ProcessTypes.GetDescForType(processType, ((int)processType).ToString())); value = new DataValue(ProcessTypes.GetDescForType(processType, ((int)processType).ToString()));
break; break;
} }
// Process CategoryDesc. // Process CategoryDesc.
case SbmProcess.Column.Category_Desc: case SbmProcess.Column.Category_Desc:
{ {
@@ -161,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- - //-----------------------------------------------------------
// Notes. // Notes.
case SbmProcess.Column.Notes: case SbmProcess.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -181,6 +182,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -78,7 +78,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(locationId)) return false; if (!SysId.IsValid(locationId)) return false;
SbmLocation.Params prmLocation = new SbmLocation.Params(); SbmLocation.Params prmLocation = new SbmLocation.Params();
prmLocation.IncludedIds.Add(locationId); prmLocation.IdsIncluded.Add(locationId);
prmLocation.StatusCat = SbmLocation.StatusCat.Any; prmLocation.StatusCat = SbmLocation.StatusCat.Any;
return GetLocationCount(prmLocation) == 1; return GetLocationCount(prmLocation) == 1;
} }
@@ -103,7 +103,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(locationId)) return null; if (!SysId.IsValid(locationId)) return null;
SbmLocation.Params prmLocation = new SbmLocation.Params(); SbmLocation.Params prmLocation = new SbmLocation.Params();
prmLocation.IncludedIds.Add(locationId); prmLocation.IdsIncluded.Add(locationId);
prmLocation.StatusCat = SbmLocation.StatusCat.Any; prmLocation.StatusCat = SbmLocation.StatusCat.Any;
return GetLocation(prmLocation); return GetLocation(prmLocation);
} }
@@ -237,6 +237,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmLocation.GetStatusTriState(status)); value = new DataValue(SbmLocation.GetStatusTriState(status));
break; break;
} }
//-----------------------------------------------------------
// Flags. // Flags.
case SbmLocation.Column.SalesStock_Y: case SbmLocation.Column.SalesStock_Y:
case SbmLocation.Column.SalesStock_Tick: case SbmLocation.Column.SalesStock_Tick:
@@ -260,6 +262,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -33,7 +33,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(movementId)) return false; if (!SysId.IsValid(movementId)) return false;
SbmMovement.Params prmMovement = new SbmMovement.Params(); SbmMovement.Params prmMovement = new SbmMovement.Params();
prmMovement.IncludedIds.Add(movementId); prmMovement.IdsIncluded.Add(movementId);
return GetMovementCount(prmMovement) == 1; return GetMovementCount(prmMovement) == 1;
} }
@@ -46,7 +46,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(movementId)) return null; if (!SysId.IsValid(movementId)) return null;
SbmMovement.Params prmMovement = new SbmMovement.Params(); SbmMovement.Params prmMovement = new SbmMovement.Params();
prmMovement.IncludedIds.Add(movementId); prmMovement.IdsIncluded.Add(movementId);
return GetMovement(prmMovement); return GetMovement(prmMovement);
} }
@@ -142,7 +142,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
//----------------------------------------------------------- //-----------------------------------------------------------
// Movement TypeDesc. // Movement TypeDesc.
//--------------------------------------------------------------- //-----------------------------------------------------------
// Notes. // Notes.
case SbmMovement.Column.Notes: case SbmMovement.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -160,7 +160,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmMovement.GetStatusTriState(status)); value = new DataValue(SbmMovement.GetStatusTriState(status));
break; break;
} }
//----------------------------------------------------------- //-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -50,7 +50,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return false; if (!SysId.IsValid(id)) return false;
SbmConstituent.Params prmituent = new SbmConstituent.Params(); SbmConstituent.Params prmituent = new SbmConstituent.Params();
prmituent.IncludedIds.Add(id); prmituent.IdsIncluded.Add(id);
prmituent.StatusCat = SbmConstituent.StatusCat.Any; prmituent.StatusCat = SbmConstituent.StatusCat.Any;
return GetConstituentCount(prmituent) == 1; return GetConstituentCount(prmituent) == 1;
} }
@@ -64,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return null; if (!SysId.IsValid(id)) return null;
SbmConstituent.Params prmituent = new SbmConstituent.Params(); SbmConstituent.Params prmituent = new SbmConstituent.Params();
prmituent.IncludedIds.Add(id); prmituent.IdsIncluded.Add(id);
prmituent.StatusCat = SbmConstituent.StatusCat.Any; prmituent.StatusCat = SbmConstituent.StatusCat.Any;
return GetConstituent(prmituent); return GetConstituent(prmituent);
} }
@@ -192,7 +192,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmConstituent.Column)column.Id) switch ((SbmConstituent.Column)column.Id)
{ {
//------------------------------------------------------------------- //-----------------------------------------------------------
// Constituent TypeDesc. // Constituent TypeDesc.
case SbmConstituent.Column.Type_Desc: case SbmConstituent.Column.Type_Desc:
{ {
@@ -219,7 +219,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//------------------------------------------------------------------- //-----------------------------------------------------------
// Started Date&Time. // Started Date&Time.
case SbmConstituent.Column.Started_DateFmt: case SbmConstituent.Column.Started_DateFmt:
{ {
@@ -273,6 +273,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
else value = new DataValue(DateUtil.Format(required, "d-MMM-yyyy")); else value = new DataValue(DateUtil.Format(required, "d-MMM-yyyy"));
break; break;
} }
// Completed Date&Time. // Completed Date&Time.
case SbmConstituent.Column.Completed_DateFmt: case SbmConstituent.Column.Completed_DateFmt:
{ {
@@ -281,7 +282,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//------------------------------------------------------------------- //-----------------------------------------------------------
// Due Indicator. // Due Indicator.
case SbmConstituent.Column.DueInd: case SbmConstituent.Column.DueInd:
{ {
@@ -301,7 +302,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//------------------------------------------------------------------- //-----------------------------------------------------------
// Notes. // Notes.
case SbmConstituent.Column.Notes: case SbmConstituent.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -318,7 +319,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmConstituent.GetStatusTriState(status)); value = new DataValue(SbmConstituent.GetStatusTriState(status));
break; break;
} }
//-------------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -51,7 +51,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return false; if (!SysId.IsValid(id)) return false;
SbmRequirement.Params prmRequirement = new SbmRequirement.Params(); SbmRequirement.Params prmRequirement = new SbmRequirement.Params();
prmRequirement.ReqntIncludedIds.Add(id); prmRequirement.RequirementIdsIncluded.Add(id);
prmRequirement.StatusCat = SbmRequirement.StatusCat.Any; prmRequirement.StatusCat = SbmRequirement.StatusCat.Any;
return GetRequirementCount(prmRequirement) == 1; return GetRequirementCount(prmRequirement) == 1;
} }
@@ -67,7 +67,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return null; if (!SysId.IsValid(id)) return null;
SbmRequirement.Params prmRequirement = new SbmRequirement.Params(); SbmRequirement.Params prmRequirement = new SbmRequirement.Params();
prmRequirement.ReqntIncludedIds.Add(id); prmRequirement.RequirementIdsIncluded.Add(id);
prmRequirement.StatusCat = SbmRequirement.StatusCat.Any; prmRequirement.StatusCat = SbmRequirement.StatusCat.Any;
return GetRequirement(prmRequirement); return GetRequirement(prmRequirement);
} }
@@ -258,7 +258,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmRequirement.Column)column.Id) switch ((SbmRequirement.Column)column.Id)
{ {
//--------------------------------------------------------------- -(Requirement Details) //-----------------------------------------------------------
// Requirement Promotion. // Requirement Promotion.
/// <summary> Precedence: & Hence: /// <summary> Precedence: & Hence:
/// <para>P1 ~ Requirement promotion - If not 'Commodity' requirement promotion requested.</para> /// <para>P1 ~ Requirement promotion - If not 'Commodity' requirement promotion requested.</para>
@@ -319,7 +319,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
// Association Coding. // Association Coding.
case SbmRequirement.Column.Assoc_AccountManagerDesc: case SbmRequirement.Column.Assoc_AccountManagerDesc:
{ {
@@ -334,7 +335,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//------------------------------------------------------------------ //-----------------------------------------------------------
// Transaction Coding. // Transaction Coding.
case SbmRequirement.Column.Trans_ContactArea: case SbmRequirement.Column.Trans_ContactArea:
{ {
@@ -412,7 +413,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//------------------------------------------------------------------ //-----------------------------------------------------------
// Reqnt-Trans Delivery TaxCode. // Reqnt-Trans Delivery TaxCode.
case SbmRequirement.Column.Trans_DeliveryTaxCode_Code: case SbmRequirement.Column.Trans_DeliveryTaxCode_Code:
case SbmRequirement.Column.Trans_DeliveryTaxCode_Rate: case SbmRequirement.Column.Trans_DeliveryTaxCode_Rate:
@@ -466,7 +467,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(valAmount); value = new DataValue(valAmount);
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction Cost & Margin. // Transaction Cost & Margin.
case SbmRequirement.Column.Trans_CostTotal_Fmt: case SbmRequirement.Column.Trans_CostTotal_Fmt:
case SbmRequirement.Column.Trans_AmountMargin: case SbmRequirement.Column.Trans_AmountMargin:
@@ -521,7 +523,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction Flags (Allocation & Replacement). // Transaction Flags (Allocation & Replacement).
case SbmRequirement.Column.Trans_AllocationInd: case SbmRequirement.Column.Trans_AllocationInd:
case SbmRequirement.Column.Trans_AllocationInd_YP: case SbmRequirement.Column.Trans_AllocationInd_YP:
@@ -560,7 +563,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
else if (column.Id == (int)SbmRequirement.Column.Trans_ReplacementOrder_Y) value = new DataValue(replacementOrder ? "Y" : ""); else if (column.Id == (int)SbmRequirement.Column.Trans_ReplacementOrder_Y) value = new DataValue(replacementOrder ? "Y" : "");
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction Status. // Transaction Status.
case SbmRequirement.Column.Trans_StatusDesc: case SbmRequirement.Column.Trans_StatusDesc:
case SbmRequirement.Column.Trans_StatusInd: case SbmRequirement.Column.Trans_StatusInd:
@@ -583,7 +587,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
else if (column.Id == (int)SbmRequirement.Column.Trans_Status_OnHold_Y) value = new DataValue(onHold ? "Y" : ""); else if (column.Id == (int)SbmRequirement.Column.Trans_Status_OnHold_Y) value = new DataValue(onHold ? "Y" : "");
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
// Required Date. // Required Date.
case SbmRequirement.Column.Required_Fmt: case SbmRequirement.Column.Required_Fmt:
{ {
@@ -606,7 +611,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(started.DayOfWeek.ToString()); value = new DataValue(started.DayOfWeek.ToString());
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
// Allocation Indicators. // Allocation Indicators.
case SbmRequirement.Column.Allocation_Ind: case SbmRequirement.Column.Allocation_Ind:
case SbmRequirement.Column.AllocationInd_YP: case SbmRequirement.Column.AllocationInd_YP:
@@ -630,7 +636,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
// Amount fields. // Amount fields.
case SbmRequirement.Column.AmountUnitNet: case SbmRequirement.Column.AmountUnitNet:
{ {
@@ -663,7 +670,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
// Display Estimated Time. // Display Estimated Time.
case SbmRequirement.Column.TimeEst: case SbmRequirement.Column.TimeEst:
case SbmRequirement.Column.TimeEstMins: case SbmRequirement.Column.TimeEstMins:
@@ -730,7 +738,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//------------------------------------------------------------------ //-----------------------------------------------------------
// Job costing. // Job costing.
case SbmRequirement.Column.CostTotal_Fmt: case SbmRequirement.Column.CostTotal_Fmt:
case SbmRequirement.Column.AmountMargin: case SbmRequirement.Column.AmountMargin:
@@ -792,6 +800,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//-----------------------------------------------------------
// Requirement Notes. // Requirement Notes.
case SbmRequirement.Column.Notes: case SbmRequirement.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -809,7 +818,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
break; break;
//------------------------------------------------------------------ //-----------------------------------------------------------
// Order or source order info. // Order or source order info.
case SbmRequirement.Column.OrderItem_JobNumber: case SbmRequirement.Column.OrderItem_JobNumber:
{ {
@@ -820,7 +829,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//------------------------------------------------------------------ //-----------------------------------------------------------
// Commodity Codings. // Commodity Codings.
case SbmRequirement.Column.Cmd_MaterialDesc: case SbmRequirement.Column.Cmd_MaterialDesc:
{ {
@@ -835,7 +844,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------- //-----------------------------------------------------------
// Requirement Formatted Currency Value. // Requirement Formatted Currency Value.
case SbmRequirement.Column.Cmd_CostPrice_Fmt: case SbmRequirement.Column.Cmd_CostPrice_Fmt:
{ {
@@ -929,7 +938,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(stockAvailable); value = new DataValue(stockAvailable);
break; break;
} }
//------------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -46,7 +46,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return false; if (!SysId.IsValid(id)) return false;
SbmTransaction.Params prmTransaction = new SbmTransaction.Params(); SbmTransaction.Params prmTransaction = new SbmTransaction.Params();
prmTransaction.IncludedIds.Add(id); prmTransaction.IdsIncluded.Add(id);
prmTransaction.StatusCat = SbmTransaction.StatusCat.Any; prmTransaction.StatusCat = SbmTransaction.StatusCat.Any;
return GetTransactionCount(prmTransaction) == 1; return GetTransactionCount(prmTransaction) == 1;
} }
@@ -55,7 +55,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{ {
if (!SysId.IsValid(affIdOwner) || (int)transactionType < 1 || StringUtil.IsEmpty(transactionRef)) return false; if (!SysId.IsValid(affIdOwner) || (int)transactionType < 1 || StringUtil.IsEmpty(transactionRef)) return false;
SbmTransaction.Params prmTransaction = new SbmTransaction.Params(); SbmTransaction.Params prmTransaction = new SbmTransaction.Params();
prmTransaction.IncludedIds.Add(affIdOwner); prmTransaction.IdsIncluded.Add(affIdOwner);
prmTransaction.TransactionType = transactionType; prmTransaction.TransactionType = transactionType;
prmTransaction.TransRefFull = transactionRef; prmTransaction.TransRefFull = transactionRef;
prmTransaction.StatusCat = SbmTransaction.StatusCat.Any; prmTransaction.StatusCat = SbmTransaction.StatusCat.Any;
@@ -71,7 +71,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState(); ClearErrorState();
if (!SysId.IsValid(id)) return null; if (!SysId.IsValid(id)) return null;
SbmTransaction.Params prmTransaction = new SbmTransaction.Params(); SbmTransaction.Params prmTransaction = new SbmTransaction.Params();
prmTransaction.IncludedIds.Add(id); prmTransaction.IdsIncluded.Add(id);
prmTransaction.StatusCat = SbmTransaction.StatusCat.Any; prmTransaction.StatusCat = SbmTransaction.StatusCat.Any;
return GetTransaction(prmTransaction); return GetTransaction(prmTransaction);
} }
@@ -83,7 +83,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
SbmTransaction transaction = null; SbmTransaction transaction = null;
if (!SysId.IsValid(affIdOwner) || transactionType > 0 || StringUtil.IsEmpty(transRef)) return transaction; if (!SysId.IsValid(affIdOwner) || transactionType > 0 || StringUtil.IsEmpty(transRef)) return transaction;
SbmTransaction.Params prmTransaction = new SbmTransaction.Params(); SbmTransaction.Params prmTransaction = new SbmTransaction.Params();
prmTransaction.IncludedIds.Add(affIdOwner); prmTransaction.IdsIncluded.Add(affIdOwner);
prmTransaction.TransactionType = Sbm.TransactionType.Any; prmTransaction.TransactionType = Sbm.TransactionType.Any;
prmTransaction.TransRefFull = transRef; prmTransaction.TransRefFull = transRef;
prmTransaction.StatusCat = SbmTransaction.StatusCat.Any; prmTransaction.StatusCat = SbmTransaction.StatusCat.Any;
@@ -301,10 +301,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
} }
// Populate reference if not already done. // Populate reference if not already done.
if (StringUtil.IsEmpty(data.Ref) && ConfigConsole.TransactionAssignRefMethod(UserContext, data.TransactionType) != SbmConfigConsole.AssignTransRefMethod.Manual) if (StringUtil.IsEmpty(data.Ref) && SessionConsole.TransactionAssignRefMethod(data.TransactionType) != SbmSessionConsole.AssignTransRefMethod.Manual)
{ {
// Retrieve the next available transaction reference. // Retrieve the next available transaction reference.
String sRef = ConfigConsole.GetTransactionCreateRef(UserContext, data.AffiliateIdOwner, data.AssociationId, data.TransactionType); ; ; String sRef = SessionConsole.GetTransactionCreateRef(data.AffiliateIdOwner, data.AssociationId, data.TransactionType);
// Check that another transaction doesn't already exist with this reference. // Check that another transaction doesn't already exist with this reference.
SbmTransaction transRef = GetTransactionByOwnerTypeRef(data.AffiliateIdOwner, data.TransactionType, sRef); SbmTransaction transRef = GetTransactionByOwnerTypeRef(data.AffiliateIdOwner, data.TransactionType, sRef);
if (transRef == null) if (transRef == null)
@@ -356,7 +356,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue(); DataValue value = new DataValue();
switch ((SbmTransaction.Column)column.Id) switch ((SbmTransaction.Column)column.Id)
{ {
//--------------------------------------------------------------------- - //-----------------------------------------------------------
// Transaction TypeDesc. // Transaction TypeDesc.
case SbmTransaction.Column.Type_Desc: case SbmTransaction.Column.Type_Desc:
{ {
@@ -374,7 +374,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------------- - //-----------------------------------------------------------
// Association Codings. // Association Codings.
case SbmTransaction.Column.Assoc_AccountManagerDesc: case SbmTransaction.Column.Assoc_AccountManagerDesc:
{ {
@@ -433,7 +433,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------------- - //-----------------------------------------------------------
// Transaction DeliveryAmount & Amount. // Transaction DeliveryAmount & Amount.
case SbmTransaction.Column.DeliveryAmountNet_Fmt: case SbmTransaction.Column.DeliveryAmountNet_Fmt:
case SbmTransaction.Column.DeliveryAmountTax_Fmt: case SbmTransaction.Column.DeliveryAmountTax_Fmt:
@@ -470,7 +470,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------------- //-----------------------------------------------------------
// Transaction cost and margin. // Transaction cost and margin.
case SbmTransaction.Column.CostTotal_Fmt: case SbmTransaction.Column.CostTotal_Fmt:
case SbmTransaction.Column.AmountMargin: case SbmTransaction.Column.AmountMargin:
@@ -523,7 +523,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------------- //-----------------------------------------------------------
// Transaction Notes. // Transaction Notes.
case SbmTransaction.Column.Notes: case SbmTransaction.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200)); value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -593,7 +593,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break; break;
} }
//--------------------------------------------------------------------- //-----------------------------------------------------------
// Target Address. // Target Address.
case SbmTransaction.Column.AssocTarget_Address: case SbmTransaction.Column.AssocTarget_Address:
{ {
@@ -627,7 +627,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(addresses.Concat(", ", null, null, true, true).Replace(" ,", ",").Trim(',').Trim()); value = new DataValue(addresses.Concat(", ", null, null, true, true).Replace(" ,", ",").Trim(',').Trim());
break; break;
} }
//---------------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
} }
return value; return value;
} }
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Procs
protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } } protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } } protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
// Consoles. // Consoles.
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } } protected SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } } protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } } protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } } protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
@@ -26,7 +26,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.UpdateLog
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private readonly Config config; private readonly Config config;
private SbmConfigConsole configConsole = null; private SbmSessionConsole sessionConsole { get { return config.Internals.SessionConsole; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
@@ -44,9 +44,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.UpdateLog
protected virtual bool IsColumnChangeLogged(SbmDbDfn.ColumnIdx columnIdx) protected virtual bool IsColumnChangeLogged(SbmDbDfn.ColumnIdx columnIdx)
{ {
if (!config.UpdateLogConsole.CanUpdateDatabase) return false; if (!config.UpdateLogConsole.CanUpdateDatabase) return false;
if (configConsole == null) if (!sessionConsole.IsColumnChangeLogged(UserContext, columnIdx)) return false;
configConsole = config.Internals.ConfigConsole;
if (!configConsole.IsColumnChangeLogged(UserContext, columnIdx)) return false;
return true; return true;
} }
protected bool RecordAttrValue(SbmDbDfn.ColumnIdx columnIdx, String value, bool newValue) protected bool RecordAttrValue(SbmDbDfn.ColumnIdx columnIdx, String value, bool newValue)
@@ -60,7 +60,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Bus
if (interfaceConsole != null) if (interfaceConsole != null)
{ {
if (!interfaceConsole.ClearInterfaceDataItems(new ItemId((short)Sbm.ItemType.Association, Id), internals.DbUpdateInfo)) if (!interfaceConsole.ClearInterfaceDataItems(new ItemId((short)Sbm.ItemType.Association, Id), internals.DbUpdateInfo))
SetErrorState("Failed to clear interface data items - " + interfaceConsole.ErrorState); SetErrorState("Failed to clear interface data items - " + interfaceConsole.ErrorStateMessage);
} }
else SetErrorState("failed to initialise interface console"); else SetErrorState("failed to initialise interface console");
interfaceConsole = null; // Do not delete this global object. interfaceConsole = null; // Do not delete this global object.
@@ -72,7 +72,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Bus
if (dataItemMgr != null) if (dataItemMgr != null)
{ {
if (!dataItemMgr.ClearDataItem(Sbm.ItemType.Address, Id)) if (!dataItemMgr.ClearDataItem(Sbm.ItemType.Address, Id))
SetErrorState(dataItemMgr.ErrorState.ToString()); SetErrorState(dataItemMgr.ErrorStateMessage);
} }
else SetErrorState("Data item manager is not available"); else SetErrorState("Data item manager is not available");
} }
@@ -111,7 +111,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Bus
if (interfaceConsole != null) if (interfaceConsole != null)
{ {
if (!interfaceConsole.ClearInterfaceDataItems(new ItemId((short)Sbm.ItemType.Association, Id), internals.DbUpdateInfo)) if (!interfaceConsole.ClearInterfaceDataItems(new ItemId((short)Sbm.ItemType.Association, Id), internals.DbUpdateInfo))
SetErrorState("Failed to clear interface data items - " + interfaceConsole.ErrorState); SetErrorState("Failed to clear interface data items - " + interfaceConsole.ErrorStateMessage);
} }
else SetErrorState("failed to initialise interface console"); else SetErrorState("failed to initialise interface console");
interfaceConsole = null; // Do not delete this global object. interfaceConsole = null; // Do not delete this global object.
@@ -123,7 +123,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Bus
if (dataItemMgr != null) if (dataItemMgr != null)
{ {
if (!dataItemMgr.ClearDataItem(Sbm.ItemType.Affiliate, Id)) if (!dataItemMgr.ClearDataItem(Sbm.ItemType.Affiliate, Id))
SetErrorState(dataItemMgr.ErrorState.ToString()); SetErrorState(dataItemMgr.ErrorStateMessage);
} }
else SetErrorState("Data item manager is not available"); else SetErrorState("Data item manager is not available");
} }
@@ -104,7 +104,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Bus
if (interfaceConsole != null) if (interfaceConsole != null)
{ {
if (!interfaceConsole.ClearInterfaceDataItems(new ItemId((short)Sbm.ItemType.AssetCategory, Id), internals.DbUpdateInfo)) if (!interfaceConsole.ClearInterfaceDataItems(new ItemId((short)Sbm.ItemType.AssetCategory, Id), internals.DbUpdateInfo))
SetErrorState(interfaceConsole.ErrorState.ToString()); SetErrorState(interfaceConsole.ErrorStateMessage);
} }
else SetErrorState("Failed to retrieve interface console"); else SetErrorState("Failed to retrieve interface console");
interfaceConsole = null; // Do not delete this global object. interfaceConsole = null; // Do not delete this global object.
@@ -149,7 +149,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Bus
{ {
ClearErrorState(); ClearErrorState();
/*if (!processMgr.UpdateProcessesForItem(Sbm.ItemType.AssetCategory, Id, itemProcesses)) /*if (!processMgr.UpdateProcessesForItem(Sbm.ItemType.AssetCategory, Id, itemProcesses))
SetErrorState(processMgr.ErrorState.ToString());*/ SetErrorState(processMgr.ErrorStateMessage.ToString());*/
return !HasErrorState(); return !HasErrorState();
} }
} }

Some files were not shown because too many files have changed in this diff Show More