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
+119 -109
View File
@@ -112,7 +112,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Configuration console.
public enum ConfigConsole
public enum SessionConfig
{
Generic,
Sarand,
@@ -127,7 +127,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
Text,
Html
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -408,7 +408,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CommoditySuppliers,
CommodityItemDocs,
//---------------------------------------------------------------
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -469,7 +469,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
ItemOption = SaDataItemType.ItemOption,
SecurityItem = SaDataItemType.SecurityItem,
SecurityLink = SaDataItemType.SecurityLink,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -538,7 +538,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Asset,
VehicleClass,
Vehicle,
};
}
//-------------------------------------------------------------------
/// <summary>Association Tab.</summary>
@@ -553,7 +553,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Time,
Task,
Doc,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -564,7 +564,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Create,
Update,
Remove,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -580,7 +580,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
DataTaxRate,
DataUnitMeasure,
DataUomCategory, // has it own right of UOM Cat
};
}
//-------------------------------------------------------------------
/// <summary>ItemBatchType link between data items.</summary>
@@ -589,7 +589,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Any = -1,
Unknown = 0, // Do not change existing values - these are tied to the database.
SalesOrder = 10,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -614,7 +614,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
ItemCodeList_JobTrade = 101,
ItemCodeList_JobEngineer = 102,
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>
@@ -635,7 +645,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Process_LabourCost_Job = 311,
Currency = 312,
Region = 313,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -646,7 +656,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Any = 0,
Security = 1, // Security parameter.
UserParam = 2, // User configuration parameter.
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -702,7 +712,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Contact_Update,
Contact_Manage,
*/
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -714,7 +724,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Unknown = 0,
CommoditySupply = 10,
CommoditySales = 20,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -825,7 +835,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Generic file interface options.
FileInterface_RowColValue,
FileInterface_Mode,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -897,7 +907,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Item documents:
DocType_Pdf,
DocType_Image,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -908,7 +918,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
EstimateType_QuoteDefault = 1,
DocType_Pdf_WebPublish,
DocType_Image_WebPublish,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -917,7 +927,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public enum SystemUserOption
{
Right = 1000,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -929,7 +939,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
AllAccounts = 1,
Admin,
Test,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -942,7 +952,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Transactions, // Transactions
Utilities, // Utilities
Appl, // Application specific
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -962,7 +972,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Utilities_Codes,
Utilities_Security,
Appl, // Application specific
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1004,7 +1014,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Util_Security_Stats,
Util_Security_Manage,
Appl, // Application specific
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1028,7 +1038,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CommodityFilterInitialStockCat,
StatusCaption_Container,
SalesLocation,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1070,7 +1080,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
File_ColumnWidth,
File_ColumnCaption,
File_Unit,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1088,13 +1098,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
TransTimeChunk2Caption,
EmailSubject,
EmailBody,
};
}
//-------------------------------------------------------------------
public enum OrgOption_Folder
{
CommodityImage,
CommodityBarcodeImage,
};
}
//-------------------------------------------------------------------
public enum OrgOption_AllowOption
{
@@ -1125,7 +1135,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
PurchaseItem_AssociatedSalesItems,
Asset_Sale,
Asset_Rental,
};
}
//-------------------------------------------------------------------
public enum OrgOption_Caption
{
@@ -1161,7 +1171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
MenuOpt_PurchaseDeliveries,
MenuOpt_ProformaPurchaseInvoices,
MenuOpt_PurchaseInvoices,
};
}
//-------------------------------------------------------------------
public enum OrgOption_ShowColumn
{
@@ -1190,7 +1200,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
SalesOrderItem_QtyInvoiced,
SalesOrderItem_NextProcess,
Vehicle_KeyLocation,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1216,7 +1226,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
StockLevel_Bay1 = SbmDbDfn.ColumnIdx.StockLevel_Bay1,
StockLevel_Bay2 = SbmDbDfn.ColumnIdx.StockLevel_Bay2,
StockLevel_Bay3 = SbmDbDfn.ColumnIdx.StockLevel_Bay3,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1254,12 +1264,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
StockLevel_Bay1 = SbmDbDfn.ColumnIdx.StockLevel_Bay1,
StockLevel_Bay2 = SbmDbDfn.ColumnIdx.StockLevel_Bay2,
StockLevel_Bay3 = SbmDbDfn.ColumnIdx.StockLevel_Bay3,
};
}
public enum OrgOption_TransCreateStatus
{
ProformaSalesOrder,
SalesOrder,
};
}
public enum OrgOption_StatusContainer
{
Provisional,
@@ -1267,24 +1277,24 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Active,
Actioned,
Cancelled,
};
}
public enum OrgOption_PeriodDays
{
TransactionDatesInFuture,
UpdateClosedTransaction,
UpdateClosedTransaction_DispatchDetails,
UpdateStockLevelsInPast,
};
}
public enum OrgOption_Minutes
{
AutoSaveTransaction,
};
}
public enum OrgOption_PeriodWeeks
{
ImminentStockDue,
Timesheets,
UpdateTimeRecords_Control,
};
}
public enum OrgOption_NumericDecimals
{
OrderQuantity,
@@ -1292,23 +1302,23 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CommodityLength,
CommodityVolume,
CommodityDensity,
};
}
public enum OrgOption_CommodityType
{
CommodityCreationDefault,
};
}
public enum OrgOption_StockLocation
{
SalesOrderDefault,
PurchaseOrderDefault,
TransactionFilterDefault,
};
}
public enum OrgOption_CmdFilterStockCat
{
MaintView,
SalesSearch,
PurchaseSearch,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1321,26 +1331,26 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
StockLevels,
Accounts,
SalesProfile,
};
}
public enum WebUploadMethod
{
Unknown = 0,
None = 10,
Ftp,
Webstore,
};
}
public enum WebDownloadData
{
Unknown = 0,
Orders = 10,
};
}
public enum WebDownloadMethod
{
Unknown = 0,
None = 10,
Ftp,
Webstore,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1350,7 +1360,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
IncludeImminentStock,
AllowZeroOrderItemAmount,
};
}
//-------------------------------------------------------------------
/// <summary>FileInterface option.</summary>
@@ -1360,14 +1370,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Row = 10,
Col,
Value,
};
}
/// <summary>File interface mode.</summary>
public enum FileInterface_Mode
{
Unknown = 0,
Csv = 1,
MsExcel,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1377,7 +1387,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
Unknown = 0,
Customer = 10,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1392,7 +1402,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
JobBooking = 30, // Allows period across more than one day.
JobActionDue = 31,
StaffHoliday = 900,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1403,7 +1413,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Unknown = -1,
Individual = 0,
Organisation = 1,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1423,7 +1433,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
PublicSector = 5, // 'PUB'
Charity = 6, // 'CHA'
ContactGroup = 10, // 'GRP'
};
}
//---------------------------------------------------------------------------
public enum AddressType
@@ -1435,7 +1445,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Home = 3, // 'HOM'
Delivery = 4, // 'DEL'
Billing = 5, // 'BIL'
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1447,7 +1457,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
None,
Full,
Partial,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1458,7 +1468,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Any = -1,
Unknown = 0,
Stock = 10,
};
}
//-------------------------------------------------------------------
public enum LocationFilter
@@ -1468,7 +1478,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
All = -2, // All locations.
Any = -1,
Unknown = 0,
};
}
//-------------------------------------------------------------------
// Containers.
@@ -1478,7 +1488,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Unknown = 0,
// NB Do not change the positive values, as tied to the database.
Stock = 10,
};
}
public enum ContainerType
{
Any = -1,
@@ -1491,7 +1501,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Container = 200,
Wagon,
Pallet = 300,
};
}
//-------------------------------------------------------------------
/// <summary>
@@ -1502,7 +1512,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Unknown = 0,
// NB Do not change the positive values, as tied to the database.
Requirement_AssocItem_PurchaseCostProportion = 1,
};
}
//-------------------------------------------------------------------
@@ -1516,12 +1526,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Portfolio = 10,
Category = 20,
Commodity = 30,
};
}
public enum PortfolioItemStatusCat
{
Current = -2,
Any = -1,
};
}
//-------------------------------------------------------------------
// Commodity.
@@ -1535,7 +1545,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
NonStock = 2, // 'NST'
Service = 3, // 'SRV'
Asset = 4, // 'AST'
};
}
//-------------------------------------------------------------------
// Stock Movement.
@@ -1548,7 +1558,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
StockTransfer = 10,
SalesAllocation = 20,
PurchaseAllocation = 30,
};
}
public enum StockLevelType
{
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.
CurrentLevel = 10,
StockTake = 20,
};
}
public enum StockEventType
{
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.
Movement = 1,
StockLevel,
};
}
public enum StockLevelSource
{
Any = -1,
@@ -1573,7 +1583,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Manual = 10,
System = 20,
Sage = 30, // NB Needs to be corrected from '21' on Cadix db [Apr2012].
};
}
//-------------------------------------------------------------------
// Pricing.
@@ -1583,7 +1593,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Customer = 10,
Supplier = 20,
Special = 30,
};
}
public enum PriceCalcMethod
{
Unknown = 0,
@@ -1601,39 +1611,39 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
MarkupValue = 15,
/// <summary>Increase sales price by a percentage</summary>
MarkupSales = 16,
};
}
public enum PriceRounderMethod
{
Unknown = 0,
};
}
public enum PriceRounderDirection
{
Unknown = 0,
};
}
//-------------------------------------------------------------------
// Associations.
public enum AssociationType
{
Personal = -2, // Task management only.
Any = -1,
Unknown = 0,
NotInternal = -1,
Any = 0,
// NB Do not change the positive values, as tied to the database.
Internal = 1, // 'INT'
Customer = 2, // 'CUS'
Supplier = 3, // 'SUP'
Associate = 4, // 'ASS'
Member = 5, // 'MEM'
Contractor = 6, // 'CON'
Stockist = 7, // 'STK'
FinanceAgency = 8, // 'FIN'
};
Internal = 1,
Customer = 2,
Supplier = 3,
Associate = 4,
Member = 5,
Contractor = 6,
Stockist = 7,
FinanceAgency = 8,
}
public enum AssociationTypeContext
{
Any,
TimeRecording, // Association types that can have time records.
Action, // Association types that can have actions.
};
}
//-------------------------------------------------------------------
// Transaction.
@@ -1658,13 +1668,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
SalesInvoice = 51, // 'SAI'
PurchaseInvoice = 52, // 'PUV'
ProformaPurchaseInvoice = 53, // 'PPI'
};
}
public enum TransactionTypeContext
{
Any,
TimeRecording, // Transaction types that can have time records.
Action, // Transaction types that can have actions.
};
}
//-------------------------------------------------------------------
// Requirements.
@@ -1673,13 +1683,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Any = 0,
Detail = 1,
Job = 2,
};
}
public enum TaskCodeType
{
Any = 0,
Project = 1,
Job = 2,
};
}
//-------------------------------------------------------------------
// Constituents.
@@ -1695,7 +1705,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Consumable = 14,
Expense = 15,
Process = 20,
};
}
//-------------------------------------------------------------------
// 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.
Cost = 1,
Labour
};
}
//-------------------------------------------------------------------
public enum CostEstimateCategory
{
@@ -1716,14 +1726,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CostPerJob = 2,
LabourPerUnit = 3,
LabourPerJob = 4,
};
}
//-------------------------------------------------------------------
public enum DiscountMarkup
{
Discount = 10,
Markup = 20,
};
}
public enum DiscountType
{
// 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
QtyDiscountD = 5, // Discount Applied by Banding D
QtyDiscountE = 6, // Discount Applied by Banding E
};
}
//-------------------------------------------------------------------
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.
Commodity = 10,
Asset = 20,
};
}
public enum ProcessType
{
Any = -1,
@@ -1754,7 +1764,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Production = 11,
Finishing = 12,
External = 20,
};
}
//-------------------------------------------------------------------
public enum PaymentType
@@ -1767,7 +1777,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Cheque = 30,
DebitCard = 40,
CreditCard = 50,
};
}
//-------------------------------------------------------------------
// Assets.
@@ -1779,7 +1789,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Furniture = 11,
Vehicle = 50,
ComputerHardware = 60,
};
}
public enum AssetIncomeType
{
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.
Sale = 10,
Rental = 20,
};
}
//-------------------------------------------------------------------
// Vehicles.
@@ -1801,7 +1811,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Van = 12,
Truck = 13,
Coach = 14,
};
}
public enum VehicleEventType
{
Any = -1,
@@ -1812,7 +1822,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Incident = 12,
Repair = 13,
Comment = 14,
};
}
public enum VehicleFeatureSource
{
Any = -1,
@@ -1823,7 +1833,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
CAP = 12,
DVLA = 13,
SMMT = 14,
};
}
public enum VehicleFeatureType
{
Any = -1,
@@ -1847,7 +1857,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Equipment = 101, // Standard equipment.
OptionalExtra = 102, // Manufacturer option.
SelectedOption = 103,
};
}
public enum VehicleOptionType
{
Any = -1,
@@ -1858,7 +1868,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Wheels,
PaintFinish,
Packs,
};
}
public enum VehicleTransType
{
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.
Manual = 10,
Automatic = 20,
};
}
public enum VehicleFuelType
{
Any = -1,
@@ -1877,7 +1887,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Lpg = 12,
Electric = 13,
Hybrid = 20,
};
}
public enum VehicleOdometerUnits
{
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.
Mile = 10,
Kilometre = 11,
};
}
//-------------------------------------------------------------------
// Interface types.
@@ -1896,14 +1906,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
WebStore = 10,
JoomlaVirtueMart = 40,
MiMoWeb = 150, // MiMo website.
};
}
public enum InterfaceType_Accounts
{
Unknown = 0,
// NB Do not change the positive values, as tied to the database.
SageLine50 = 50,
QuickBooks = 60,
};
}
public enum InterfaceType_System
{
Unknown = 0,
@@ -1918,7 +1928,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
Anchor_OrderFulfilment = 200, // Order fulfilment for Anchor Storage.
Cadix_OrderSpreadsheet_Argos = 220,
Cadix_OrderSpreadsheet_Homebase = 221,
};
}
public enum InterfaceType_File
{
Unknown = 0,
@@ -1950,7 +1960,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
TransToWord_PurchaseDelivery = 1500 + TransactionType.PurchaseDelivery,
//TransToWord_ProformaPurchaseInvoice = 1500+ProformaPurchaseInvoice, - Use Purchase Invoice interface.
TransToWord_PurchaseInvoice = 1500 + TransactionType.PurchaseInvoice,
};
}
//-------------------------------------------------------------------
// Interface Data Types.
@@ -1998,7 +2008,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
ConstituentTime,
// Utility data:
Pricing,
};
}
//-------------------------------------------------------------------
// Action to be performed for each Stock Type on import.
@@ -2006,7 +2016,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
Import,
Ignore
};
}
//-------------------------------------------------------------------
}
@@ -8,19 +8,22 @@ using System;
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
//-------------------------------------------------------------------
// Jul-2021 ConfigConsole parameter added to avoid local creation. To be reviewed/replaced.
public static bool IsViewApplicable(ISbmUserContext_Core userContext, SbmConfigConsole configConsole, Sbm.View view)
// Jul-2021 SessionConfig parameter added to avoid local creation. To be reviewed/replaced.
public static bool IsViewApplicable(SbmSessionConsole sessionConfig, Sbm.View view)
{
//SbmConfigConsole configConsole = SbmGlobals.GetConfigConsole(userContext.SessionContext);
ISbmSecurityProfile_Core securityProfile = userContext.SecurityProfile_Core;
ISbmSecurityProfile_Core securityProfile = sessionConfig.UserContext.SecurityProfile_Core;
switch (view)
{
//-----------------------------------------------------------
@@ -29,210 +32,210 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
case Sbm.View.Main:
return true;
case Sbm.View.Console:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowConsoleView)) return false;
if (!configConsole.GetConsoleViewDfn().HasContent()) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowConsoleView)) return false;
if (!sessionConfig.GetConsoleViewDfn().HasContent()) return false;
return true;
case Sbm.View.Diary:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.DiaryView)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.DiaryView)) return false;
return true;
//-----------------------------------------------------------
// Contacts.
case Sbm.View.Contacts_Affiliates:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
return true;
case Sbm.View.Contacts_ContactGroups:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
return true;
case Sbm.View.Contacts_Associations:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AnyAssociationView)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AnyAssociationView)) return false;
return true;
case Sbm.View.Contacts_Associations_Customer:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
return true;
case Sbm.View.Contacts_Associations_Supplier:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
return true;
case Sbm.View.Contacts_Associations_Associate:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Associate)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Associate)) return false;
return true;
case Sbm.View.Contacts_Associations_Stockist:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Stockist)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Stockist)) return false;
return true;
case Sbm.View.Contacts_Associations_FinanceAgency:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.FinanceAgency)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.FinanceAgency)) return false;
return true;
case Sbm.View.Contacts_Associations_Member:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Member)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Member)) return false;
return true;
case Sbm.View.Contacts_Associations_Contractor:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowContacts)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Contractor)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Contractor)) return false;
return true;
//-----------------------------------------------------------
// Commodities.
case Sbm.View.Commodities:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true;
case Sbm.View.Commodity_Locations:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true;
case Sbm.View.Commodity_Containers:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true;
case Sbm.View.Commodity_Portfolio:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true;
case Sbm.View.Commodity_SalesBudget:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
return true;
case Sbm.View.PriceSets:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities)) return false;
//if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowPriceSets)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities)) return false;
//if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowPriceSets)) return false;
return true;
//-----------------------------------------------------------
// Assets.
case Sbm.View.AssetCategories:
case Sbm.View.Assets:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowAssets)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets)) return false;
return true;
case Sbm.View.VehicleClasses:
case Sbm.View.Vehicles:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowAssets)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowVehicles)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles)) return false;
return true;
//-----------------------------------------------------------
// Transactions.
case Sbm.View.Transactions:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AnyTransactionView)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AnyTransactionView)) return false;
return true;
case Sbm.View.Transactions_Project:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.Project)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.Project)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.Project)) return false;
return true;
case Sbm.View.Transactions_PurchaseQuote:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseQuote)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseQuote)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseQuote)) return false;
return true;
case Sbm.View.Transactions_ProformaPurchaseOrder:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaPurchaseOrder)) return false;
return true;
case Sbm.View.Transactions_PurchaseOrder:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseOrder)) return false;
return true;
case Sbm.View.Transactions_PurchaseSO:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseSO)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseSO)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseSO)) return false;
return true;
case Sbm.View.Transactions_PurchaseDelivery:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseDelivery)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseDelivery)) return false;
return true;
case Sbm.View.Transactions_ProformaPurchaseInvoice:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseInvoice)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaPurchaseInvoice)) return false;
return true;
case Sbm.View.Transactions_PurchaseInvoice:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Supplier)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseInvoice)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Supplier)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.PurchaseInvoice)) return false;
return true;
case Sbm.View.Transactions_SalesLead:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesLead)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesLead)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesLead)) return false;
return true;
case Sbm.View.Transactions_SalesQuote:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesQuote)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesQuote)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesQuote)) return false;
return true;
case Sbm.View.Transactions_ProformaSalesOrder:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesOrder)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.ProformaSalesOrder)) return false;
return true;
case Sbm.View.Transactions_SalesOrder:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesOrder)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesOrder)) return false;
return true;
case Sbm.View.Transactions_SalesPO:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesPO)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesPO)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesPO)) return false;
return true;
case Sbm.View.Transactions_SalesDispatch:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesDispatch)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesDispatch)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesDispatch)) return false;
return true;
case Sbm.View.Transactions_ProformaSalesInvoice:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesInvoice)) return false;
return true;
case Sbm.View.Transactions_SalesInvoice:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowAssociationType(userContext, Sbm.AssociationType.Customer)) return false;
if (!configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowAssociationType(Sbm.AssociationType.Customer)) return false;
if (!sessionConfig.AllowTransactionType(Sbm.TransactionType.SalesInvoice)) return false;
if (!securityProfile.UserCanAccessTransactionsOfType(Sbm.TransactionType.SalesInvoice)) return false;
return true;
//-----------------------------------------------------------
// Planning.
case Sbm.View.Transactions_PurchasingPlanning:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowPurchasingPlanning)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowPurchasingPlanning)) return false;
return true;
case Sbm.View.Transactions_ProductionControl:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowProductionControl)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowProductionControl)) return false;
return true;
case Sbm.View.Transactions_DeliveryPlanning:
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTransactions)) return false;
if (!configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowDeliveryPlanning)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions)) return false;
if (!sessionConfig.AllowOption(Sbm.ConfigOption.AllowDeliveryPlanning)) return false;
return true;
//-----------------------------------------------------------
// Other.
case Sbm.View.SystemAccounts:
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.
using (SaInterfaceConsole interfaceConsole = SbmGlobals.Application.CreateInterfaceConsole(userContext))
using (SaInterfaceConsole interfaceConsole = SbmGlobals.Application.CreateInterfaceConsole(sessionConfig.UserContext))
{
if (interfaceConsole == null || !interfaceConsole.DatabaseIsValid) return false;
// 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.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
//-------------------------------------------------------------------
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.
return false;
}
Sbm.View view = GetViewForMenuOption(userContext.SessionContext, menuOption);
Sbm.View view = GetViewForMenuOption(sessionConfig.UserContext.SessionContext, menuOption);
if (view != Sbm.View.Unknown)
// View options.
return IsViewApplicable(userContext, configConsole, GetViewForMenuOption(userContext.SessionContext, menuOption));
return IsViewApplicable(sessionConfig, GetViewForMenuOption(sessionConfig.UserContext.SessionContext, menuOption));
// Non-view options.
switch (menuOption)
@@ -293,7 +296,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-----------------------------------------------------------
// Actions.
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()}");
@@ -16,8 +16,8 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
//=======================================================================
public abstract class SbmApplication : SacsDisposable
//=======================================================================
public abstract class SbmApplication : SacsDisposable
{
//-------------------------------------------------------------------
// Data members.
@@ -58,6 +58,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
{
return GetBusMgrDatabase(sessionContext).CreateDbInfo();
}
// Instance configuration.
public abstract SbmInstanceConfig GetInstanceConfig(SbmSessionContext sessionContext);
// Database utilities.
public IDatabaseInfo CreateDbInfo(ISacsDatabase db)
{
@@ -82,7 +84,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Create consoles.
public abstract SbmConfigConsole CreateConfigConsole(SbmSessionContext sessionContext);
public abstract SbmSessionConsole CreateSessionConsole(ISbmUserContext_Core userContext);
public abstract SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext);
public abstract SaSecurityConsole CreateSecurityConsole(ISbmUserContext_Core userContext);
public abstract SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext_Core userContext);
@@ -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.Net.Standard.Base.Utils;
using System;
@@ -16,102 +17,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
/// </summary>
public abstract class SbmInstanceConfig
{
//-------------------------------------------------------------------
// Definitions.
protected const String ParamContext_Config = "Config";
protected const String ParamContext_ConfigPrefix = "Config-";
protected const String ApplicationOptionValue_Allow = "Allow";
protected const String ApplicationOptionValue_Disallow = "Disallow";
protected const String ApplicationOptionValue_Default= "Default";
//-------------------------------------------------------------------
// Owner/Instance configuration parameters.
public enum ConfigParamType
{
// Affiliate types.
AllowedAffiliateTypes,
DisallowedAffiliateTypes,
// Association types.
AllowedAssociationTypes,
DisallowedAssociationTypes,
// Transaction types.
AllowedTransactionTypes,
DisallowedTransactionTypes,
// Application options.
ApplicationOption,
}
public class ConfigParamData
{
public ConfigParamType ConfigParam { get; set; }
public String Context { get; set; }
public String Name { get; set; }
public HashSet<String> Values { get; } = new HashSet<string>();
public bool Password { get; set; }
}
public bool IsConfigParamOfType(ConfigParamType configParam, SbmcItemParam itemParam)
{
switch (configParam)
{
// Affiliate types.
case ConfigParamType.AllowedAffiliateTypes:
case ConfigParamType.DisallowedAffiliateTypes:
// Association types.
case ConfigParamType.AllowedAssociationTypes:
case ConfigParamType.DisallowedAssociationTypes:
// Transaction types.
case ConfigParamType.AllowedTransactionTypes:
case ConfigParamType.DisallowedTransactionTypes:
return itemParam.Context.EqualsCI(ParamContext_Config) && itemParam.Name.EqualsCI(configParam.ToString());
// Application options.
case ConfigParamType.ApplicationOption:
return itemParam.Context.EqualsCI($"{ParamContext_ConfigPrefix}{ConfigParamType.ApplicationOption.ToString()}");
}
return false;
}
public ConfigParamData GetConfigParamData(ConfigParamType configParam)
{
switch (configParam)
{
// Affiliate types.
case ConfigParamType.AllowedAffiliateTypes:
case ConfigParamType.DisallowedAffiliateTypes:
// Association types.
case ConfigParamType.AllowedAssociationTypes:
case ConfigParamType.DisallowedAssociationTypes:
// Transaction types.
case ConfigParamType.AllowedTransactionTypes:
case ConfigParamType.DisallowedTransactionTypes:
return new ConfigParamData() { ConfigParam = configParam, Context = ParamContext_Config, Name = configParam.ToString() };
}
return null;
}
public ConfigParamData GetAllowOptionConfigParamData(Sbm.ConfigOption option)
{
ConfigParamData configParamData = new ConfigParamData() { ConfigParam = ConfigParamType.ApplicationOption, Context = $"{ParamContext_ConfigPrefix}{ConfigParamType.ApplicationOption.ToString()}", Name = option.ToString() };
configParamData.Values.UnionWith(new List<String>() { ApplicationOptionValue_Allow, ApplicationOptionValue_Disallow, ApplicationOptionValue_Default });
return configParamData;
}
//-------------------------------------------------------------------
// Application options.
//-------------------------------------------------------------------
public abstract bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse);
//-------------------------------------------------------------------
// Allowed data component types.
//-------------------------------------------------------------------
// Supported affiliate types.
public abstract bool AllowAffiliateType(Sbm.AffiliateType type);
// Supported Association types.
public abstract bool AllowAssociationType(Sbm.AssociationType type);
// Supported Transaction types.
public abstract bool AllowTransactionType(Sbm.TransactionType type);
//-------------------------------------------------------------------
// Allow Option.
// Supported affiliate types.
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 SbmDataItemMgr dataItemMgr;
// Consoles.
private SbmConfigConsole configConsole;
private SbmSessionConsole sessionConsole;
private SaDiaryConsole diaryConsole;
private SaSecurityConsole securityConsole;
private SaCodeTypeConsole codeTypeConsole;
@@ -83,7 +83,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
if (taxCodes != null) taxCodes.ClearAndDispose();
if (unitsOfMeasure != null) unitsOfMeasure.ClearAndDispose();
// Consoles.
if (configConsole != null) configConsole.Dispose();
if (sessionConsole != null) sessionConsole.Dispose();
if (diaryConsole != null) diaryConsole.Dispose();
if (securityConsole != null) securityConsole.Dispose();
if (codeTypeConsole != null) codeTypeConsole.Dispose();
@@ -213,13 +213,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Consoles.
public SbmConfigConsole ConfigConsole
public SbmSessionConsole SessionConsole
{
get
{
if (configConsole == null)
configConsole = Application.CreateConfigConsole(SessionContext);
return configConsole;
if (sessionConsole == null)
sessionConsole = Application.CreateSessionConsole(UserContext);
return sessionConsole;
}
}
public SaDiaryConsole DiaryConsole
@@ -324,7 +324,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
get
{
if (stockControlConfig == null)
stockControlConfig = ConfigConsole.GetStockControlConfig(UserContext);
stockControlConfig = SessionConsole.GetStockControlConfig();
return stockControlConfig;
}
}
@@ -333,7 +333,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
get
{
if (requirementCostingConfig == null)
requirementCostingConfig = ConfigConsole.GetRequirementCostingConfig(UserContext);
requirementCostingConfig = SessionConsole.GetRequirementCostingConfig();
return requirementCostingConfig;
}
}
@@ -351,7 +351,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public List<SaCurrency> GetCurrencies()
{
populateCurrencies();
return currencies;
return new List<SaCurrency>(currencies);
}
public SaCurrency GetCurrencyById(SysId currencyId)
{
@@ -393,7 +393,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public List<SaTaxCode> GetTaxCodes()
{
populateTaxCodes();
return taxCodes;
return new List<SaTaxCode>(taxCodes);
}
public SaTaxCode GetTaxCodeById(SysId currencyId)
{
@@ -415,7 +415,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public List<SaUnitMeasure> GetUnitsOfMeasure()
{
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)
{
@@ -21,19 +21,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
private bool includeHostSecurityProfile = false;
private SaSecurityProfile userSecurityProfile;
private SaSecurityProfile hostSecurityProfile;
private readonly List<TypeCodeDesc> securityRights = new List<TypeCodeDesc>();
private readonly List<SaSecurityRight> securityRights = new List<SaSecurityRight>();
//-------------------------------------------------------------------
// Construction.
[JsonConstructor]
private SbmSecurityProfile() { }
public SbmSecurityProfile(ISbmUserContext_Core userContext, bool includeHostSecurityProfile)
{
this.UserContext = userContext;
this.includeHostSecurityProfile = includeHostSecurityProfile;
Admin = new AdminProfile(this);
Manage = new ManageProfile(this);
Financial = new FinancialProfile(this);
Contacts = new ContactsProfile(this);
Transaction = new TransactionsProfile(this);
Admin = new AdminProfile();
Manage = new ManageProfile();
Financial = new FinancialProfile();
Contacts = new ContactsProfile();
Transaction = new TransactionsProfile();
}
//-------------------------------------------------------------------
@@ -43,7 +45,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// 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();
@@ -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) : ""));
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.hostSecurityProfile = hostSecurityProfile;
RefreshProfileSettings(configConsole);
RefreshProfileSettings(sessionConsole);
}
private void RefreshProfileSettings(SbmConfigConsole configConsole)
private void RefreshProfileSettings(SbmSessionConsole sessionConfig)
{
RefreshAdminProfile(configConsole);
RefreshManageProfile(configConsole);
RefreshFinancialProfile(configConsole);
RefreshContactsProfile(configConsole);
RefreshTransactionProfile(configConsole);
RefreshItemTypeProfile(configConsole);
RefreshAdminProfile(sessionConfig);
RefreshManageProfile(sessionConfig);
RefreshFinancialProfile(sessionConfig);
RefreshContactsProfile(sessionConfig);
RefreshTransactionProfile(sessionConfig);
RefreshItemTypeProfile(sessionConfig);
// ToDo Commodities.
}
private void ClearProfile()
{
// Reset security profiles.
Admin = new AdminProfile(this);
Manage = new ManageProfile(this);
Financial = new FinancialProfile(this);
Contacts = new ContactsProfile(this);
Transaction = new TransactionsProfile(this);
Admin = new AdminProfile();
Manage = new ManageProfile();
Financial = new FinancialProfile();
Contacts = new ContactsProfile();
Transaction = new TransactionsProfile();
}
//-------------------------------------------------------------------
@@ -126,18 +128,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Security rights - Admin.
public class AdminProfile
{
private readonly SbmSecurityProfile securityProfile;
internal AdminProfile(SbmSecurityProfile securityProfile)
{
this.securityProfile = securityProfile;
}
internal AdminProfile() { }
public bool CanManageSecurity { get; internal set; } = false;
public bool CanManageDatabase { get; internal set; } = false;
public bool CanManageReferenceData { get; internal set; } = false;
public bool CanManageInterfaces { get; internal set; } = false;
}
public AdminProfile Admin { get; internal set; }
private void RefreshAdminProfile(SbmConfigConsole configConsole)
private void RefreshAdminProfile(SbmSessionConsole sessionConfig)
{
Admin.CanManageSecurity = UserHasSecurityRight(Sbm.SecurityRight.Security_Admin);
Admin.CanManageDatabase = UserHasSecurityRight(Sbm.SecurityRight.Database_Admin);
@@ -149,16 +147,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Security rights - Manage.
public class ManageProfile
{
private readonly SbmSecurityProfile securityProfile;
internal ManageProfile(SbmSecurityProfile securityProfile)
{
this.securityProfile = securityProfile;
}
internal ManageProfile() { }
public bool CanManageTasks { get; internal set; } = false;
public bool CanManageTimesheets { get; internal set; } = false;
}
public ManageProfile Manage { get; internal set; }
private void RefreshManageProfile(SbmConfigConsole configConsole)
private void RefreshManageProfile(SbmSessionConsole sessionConfig)
{
Manage.CanManageTasks = UserHasSecurityRight(Sbm.SecurityRight.TaskManager);
Manage.CanManageTimesheets = UserHasSecurityRight(Sbm.SecurityRight.TimesheetManager);
@@ -168,36 +162,32 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Security rights - Financials.
public class FinancialProfile
{
private readonly SbmSecurityProfile securityProfile;
internal FinancialProfile(SbmSecurityProfile securityProfile)
{
this.securityProfile = securityProfile;
}
public bool CanViewFinancials { get; internal set; }
public bool CanUpdateFinancials { get; internal set; }
public bool CanViewCommoditySupplyFinancials { 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; }
internal FinancialProfile() { }
public bool ViewFinancials { get; internal set; }
public bool UpdateFinancials { get; internal set; }
public bool ViewCommoditySupplyFinancials { get; internal set; }
public bool UpdateCommoditySupplyFinancials { get; internal set; }
public bool ViewCommoditySalesFinancials { get; internal set; }
public bool UpdateCommoditySalesFinancials { get; internal set; }
public bool FinancialsAccessControl { 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.CanUpdateFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_Update);
Financial.CanViewCommoditySupplyFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySupply);
Financial.CanUpdateCommoditySupplyFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySupply);
Financial.CanViewCommoditySalesFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySales);
Financial.CanUpdateCommoditySalesFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySales);
Financial.ViewFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_View);
Financial.UpdateFinancials = UserHasSecurityRight(Sbm.SecurityRight.Financial_Update);
Financial.ViewCommoditySupplyFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySupply);
Financial.UpdateCommoditySupplyFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySupply);
Financial.ViewCommoditySalesFinancials = UserCanAccessFinancialViewOfType(Sbm.FinancialType.CommoditySales);
Financial.UpdateCommoditySalesFinancials = UserCanAccessFinancialUpdateOfType(Sbm.FinancialType.CommoditySales);
// 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)
{
if (!Financial.ConfigOption_AllowFinancialsAccessControl) return true;
if (Financial.CanUpdateFinancials || Financial.CanViewFinancials)
if (!Financial.FinancialsAccessControl) return true;
if (Financial.UpdateFinancials || Financial.ViewFinancials)
{
// 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)))
@@ -209,8 +199,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public bool UserCanUpdateFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any)
{
if (!Financial.ConfigOption_AllowFinancialsAccessControl) return true;
if (Financial.CanUpdateFinancials)
if (!Financial.FinancialsAccessControl) return true;
if (Financial.UpdateFinancials)
{
// 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)))
@@ -242,35 +232,27 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// Security rights - Contacts.
public class ContactsProfile
{
private readonly SbmSecurityProfile securityProfile;
internal ContactsProfile(SbmSecurityProfile securityProfile)
{
this.securityProfile = securityProfile;
}
public bool CanCreate { get; internal set; } = false;
public bool CanUpdate { get; internal set; } = false;
internal ContactsProfile() { }
public bool Create { get; internal set; } = false;
public bool Update { get; internal set; } = false;
}
public ContactsProfile Contacts { get; internal set; }
public bool UserCanCreateContacts { get { return Contacts.CanCreate; } }
public bool UserCanUpdateContacts { get { return Contacts.CanUpdate; } }
private void RefreshContactsProfile(SbmConfigConsole configConsole)
public bool UserCanCreateContacts() { return Contacts.Create; }
public bool UserCanUpdateContacts() { return Contacts.Update; }
private void RefreshContactsProfile(SbmSessionConsole sessionConfig)
{
Contacts.CanUpdate = (UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Update));
Contacts.CanCreate = (Contacts.CanUpdate || UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Create));
Contacts.Update = (UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Update));
Contacts.Create = (Contacts.Update || UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Create));
}
//-------------------------------------------------------------------
// Security rights - Transactions.
public class TransactionsProfile
{
private readonly SbmSecurityProfile securityProfile;
internal TransactionsProfile(SbmSecurityProfile securityProfile)
{
this.securityProfile = securityProfile;
}
public bool CanCreate { get; internal set; } = false;
public bool CanUpdate { get; internal set; } = false;
public bool CanUpdateTransactionTypeStatusCat(Sbm.TransactionType transactionType, SbmTransaction.StatusCat transactionStatusCat)
internal TransactionsProfile() { }
public bool Create { get; internal set; } = false;
public bool Update { get; internal set; } = false;
public bool CanUpdateTransactionTypeStatusCat(SbmSecurityProfile securityProfile, Sbm.TransactionType transactionType, SbmTransaction.StatusCat transactionStatusCat)
{
SysId transactionTypeStatusCatId = SbmTransaction.GetTransactionTypeStatusId(transactionType, transactionStatusCat);
@@ -297,10 +279,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
}
}
public TransactionsProfile Transaction { get; internal set; }
private void RefreshTransactionProfile(SbmConfigConsole configConsole)
private void RefreshTransactionProfile(SbmSessionConsole sessionConfig)
{
Transaction.CanUpdate = (UserHasSecurityRight(Sbm.SecurityRight.Transaction_Update));
Transaction.CanCreate = (Transaction.CanUpdate || UserHasSecurityRight(Sbm.SecurityRight.Transaction_View));
Transaction.Update = (UserHasSecurityRight(Sbm.SecurityRight.Transaction_Update));
Transaction.Create = (Transaction.Update || UserHasSecurityRight(Sbm.SecurityRight.Transaction_View));
}
public bool UserCanAccessTransactionsOfType(Sbm.TransactionType transactionType)
@@ -317,40 +299,40 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public class ItemTypesProfile
{
internal ItemTypesProfile() { }
public bool CanCreate { get; internal set; }
public bool CanUpdate { get; internal set; }
public bool CanRemove { get; internal set; }
public bool Create { get; internal set; }
public bool Update { get; internal set; }
public bool Remove { get; internal set; }
// Config options.
public bool ConfigOption_AllowProcesses { get; internal set; }
public bool ConfigOption_AllowContacts { get; internal set; }
public bool ConfigOption_AllowCommodities { get; internal set; }
public bool ConfigOption_AllowPortfolios { get; internal set; }
public bool ConfigOption_AllowPriceSets { get; internal set; }
public bool ConfigOption_CommodityCustomers { get; internal set; }
public bool ConfigOption_CommoditySuppliers { get; internal set; }
public bool ConfigOption_AllowTransactions { get; internal set; }
public bool ConfigOption_AllowAssets { get; internal set; }
public bool ConfigOption_AllowVehicles { get; internal set; }
public bool ConfigOption_AllowStockLocations { get; internal set; }
public bool ConfigOption_AllowStockContainers { get; internal set; }
public bool ConfigOption_AllowStockControl { get; internal set; }
public bool Processes { get; internal set; }
public bool Contacts { get; internal set; }
public bool Commodities { get; internal set; }
public bool Portfolios { get; internal set; }
public bool PriceSets { get; internal set; }
public bool CommodityCustomers { get; internal set; }
public bool CommoditySuppliers { get; internal set; }
public bool Transactions { get; internal set; }
public bool Assets { get; internal set; }
public bool Vehicles { get; internal set; }
public bool StockLocations { get; internal set; }
public bool StockContainers { get; internal set; }
public bool StockControl { get; internal set; }
}
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.ConfigOption_AllowContacts = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowContacts);
ItemType.ConfigOption_AllowCommodities = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowCommodities);
ItemType.ConfigOption_AllowPortfolios = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowPortfolios);
ItemType.ConfigOption_AllowPriceSets = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowPriceSets);
ItemType.ConfigOption_CommodityCustomers = configConsole.AllowOption(UserContext, Sbm.ConfigOption.CommodityCustomers);
ItemType.ConfigOption_CommoditySuppliers = configConsole.AllowOption(UserContext, Sbm.ConfigOption.CommoditySuppliers);
ItemType.ConfigOption_AllowTransactions = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowTransactions);
ItemType.ConfigOption_AllowAssets = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowAssets);
ItemType.ConfigOption_AllowVehicles = configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowVehicles);
ItemType.ConfigOption_AllowStockLocations = configConsole.GetStockControlConfig(UserContext).AllowStockLocations();
ItemType.ConfigOption_AllowStockContainers = configConsole.GetStockControlConfig(UserContext).AllowStockContainers();
ItemType.ConfigOption_AllowStockControl = configConsole.GetStockControlConfig(UserContext).AllowStockControl();
ItemType.Processes = sessionConfig.AllowOption(Sbm.ConfigOption.AllowProcesses);
ItemType.Contacts = sessionConfig.AllowOption(Sbm.ConfigOption.AllowContacts);
ItemType.Commodities = sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities);
ItemType.Portfolios = sessionConfig.AllowOption(Sbm.ConfigOption.AllowPortfolios);
ItemType.PriceSets = sessionConfig.AllowOption(Sbm.ConfigOption.AllowPriceSets);
ItemType.CommodityCustomers = sessionConfig.AllowOption(Sbm.ConfigOption.CommodityCustomers);
ItemType.CommoditySuppliers = sessionConfig.AllowOption(Sbm.ConfigOption.CommoditySuppliers);
ItemType.Transactions = sessionConfig.AllowOption(Sbm.ConfigOption.AllowTransactions);
ItemType.Assets = sessionConfig.AllowOption(Sbm.ConfigOption.AllowAssets);
ItemType.Vehicles = sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles);
ItemType.StockLocations = sessionConfig.GetStockControlConfig().AllowStockLocations();
ItemType.StockContainers = sessionConfig.GetStockControlConfig().AllowStockContainers();
ItemType.StockControl = sessionConfig.GetStockControlConfig().AllowStockControl();
}
public bool ItemTypeIsAllowed(Sbm.ItemType itemType)
@@ -363,37 +345,37 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//case Sbm.ItemType.Language:
//case Sbm.ItemType.TaxCode:
//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.Address: return ItemType.ConfigOption_AllowContacts;
case Sbm.ItemType.Commodity: return ItemType.ConfigOption_AllowCommodities;
case Sbm.ItemType.PortfolioItem: return ItemType.ConfigOption_AllowPortfolios;
case Sbm.ItemType.Location: return ItemType.ConfigOption_AllowStockLocations;
case Sbm.ItemType.Address: return ItemType.Contacts;
case Sbm.ItemType.Commodity: return ItemType.Commodities;
case Sbm.ItemType.PortfolioItem: return ItemType.Portfolios;
case Sbm.ItemType.Location: return ItemType.StockLocations;
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.StockLevel: return ItemType.ConfigOption_AllowStockControl;
case Sbm.ItemType.StockLevel: return ItemType.StockControl;
case Sbm.ItemType.PriceSet:
case Sbm.ItemType.Price: return ItemType.ConfigOption_AllowPriceSets;
case Sbm.ItemType.CommodityCustomer: return ItemType.ConfigOption_CommodityCustomers;
case Sbm.ItemType.CommoditySupplier: return ItemType.ConfigOption_CommoditySuppliers;
case Sbm.ItemType.Price: return ItemType.PriceSets;
case Sbm.ItemType.CommodityCustomer: return ItemType.CommodityCustomers;
case Sbm.ItemType.CommoditySupplier: return ItemType.CommoditySuppliers;
//case Sbm.ItemType.Association:
case Sbm.ItemType.Transaction:
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.SystemUser:
//case Sbm.ItemType.SystemAccountUser:
case Sbm.ItemType.AssetCategory:
case Sbm.ItemType.AssetCategoryProcess:
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.Vehicle:
case Sbm.ItemType.VehicleEvent:
case Sbm.ItemType.VehicleFeature: return ItemType.ConfigOption_AllowVehicles;
case Sbm.ItemType.CommodityProcess: return ItemType.ConfigOption_AllowProcesses;
case Sbm.ItemType.RequirementProcess: return ItemType.ConfigOption_AllowProcesses;
case Sbm.ItemType.VehicleFeature: return ItemType.Vehicles;
case Sbm.ItemType.CommodityProcess: return ItemType.Processes;
case Sbm.ItemType.RequirementProcess: return ItemType.Processes;
//case Sbm.ItemType.Interface:
}
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
//-------------------------------------------------------------------
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
//---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities))
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowCommodities))
{
// Commodity category.
SaCodeTypeDfn codeTypeCommodityCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.CommodityCategory), 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityCategory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityCategory));
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityCategory));
// Commodity range.
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);
// 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;
SaCodeTypeDfn codeTypeCommodityMaterial = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityMaterial), commodityMaterialLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityMaterial);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityMaterial.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityMaterial));
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityMaterial.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityMaterial));
// 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;
SaCodeTypeDfn codeTypeCommodityFinish = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityFinish), commodityFinishLabel, 12);
codeTypeConsole.RegisterCodeType(codeTypeCommodityFinish);
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityFinish.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityFinish));
codeTypeConsole.RegisterCodesOfType(codeTypeCommodityFinish.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CommodityFinish));
// 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;
SaCodeTypeDfn codeTypeCommodityPromotion = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CommodityPromotion), commodityPromotionLabel, 12);
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
//---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowProcesses))
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowProcesses))
{
// Process type.
SaCodeTypeDfn codeTypeProcessType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ProcessType), codeTypes.GetDescForType(Sbm.ApplCodeType.ProcessType), 12);
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
//---------------------------------------------------------------
if (configConsole != null)
if (sessionConfig != null)
{
// Refer type.
SaCodeTypeDfn codeTypeReferType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.ReferType), codeTypes.GetDescForType(Sbm.ApplCodeType.ReferType), 12);
codeTypeReferType.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeReferType);
codeTypeConsole.RegisterCodesOfType(codeTypeReferType.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.ReferType));
codeTypeConsole.RegisterCodesOfType(codeTypeReferType.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.ReferType));
}
//---------------------------------------------------------------
// T a s k s
//---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowTasks))
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowTasks))
{
// Task category.
SaCodeTypeDfn codeTypeTaskCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.TaskCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.TaskCategory), 12);
codeTypeTaskCategory.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeTaskCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeTaskCategory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.TaskCategory));
codeTypeConsole.RegisterCodesOfType(codeTypeTaskCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.TaskCategory));
}
//---------------------------------------------------------------
// 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.
SaCodeTypeDfn codeTypeAssetSellCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.AssetSellCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.AssetSellCategory), 8);
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
//---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowVehicles))
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowVehicles))
{
// Vehicle category.
SaCodeTypeDfn codeTypeVehicleCategory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleCategory), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleCategory), 8);
codeTypeConsole.RegisterCodeType(codeTypeVehicleCategory);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleCategory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleCategory));
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleCategory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleCategory));
// Vehicle make.
SaCodeTypeDfn codeTypeVehicleMake = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleMake), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleMake), 8);
codeTypeConsole.RegisterCodeType(codeTypeVehicleMake);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleMake.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleMake));
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleMake.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleMake));
// Vehicle service history.
SaCodeTypeDfn codeTypeVehicleServiceHistory = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleServiceHistory), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleServiceHistory), 12);
codeTypeConsole.RegisterCodeType(codeTypeVehicleServiceHistory);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleServiceHistory.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleServiceHistory));
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleServiceHistory.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleServiceHistory));
// Vehicle insurance.
SaCodeTypeDfn codeTypeVehicleInsurance = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleInsurance), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleInsurance), 3);
codeTypeConsole.RegisterCodeType(codeTypeVehicleInsurance);
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleInsurance.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleInsurance));
codeTypeConsole.RegisterCodesOfType(codeTypeVehicleInsurance.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.VehicleInsurance));
// Vehicle tacho.
SaCodeTypeDfn codeTypeVehicleTacho = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.VehicleTacho), codeTypes.GetDescForType(Sbm.ApplCodeType.VehicleTacho), 8);
//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
//---------------------------------------------------------------
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.
SaCodeTypeDfn codeTypeHpiVehicleMake = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleMake), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleMake), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleMake);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleMake.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleMake));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleMake.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleMake));
// HPI vehicle model.
SaCodeTypeDfn codeTypeHpiVehicleModel = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleModel), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleModel), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleModel);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleModel.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleModel));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleModel.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleModel));
// HPI vehicle colour.
SaCodeTypeDfn codeTypeHpiVehicleColour = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleColour), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleColour), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleColour);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleColour.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleColour));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleColour.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleColour));
// HPI vehicle fuel.
SaCodeTypeDfn codeTypeHpiVehicleFuel = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleFuel), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleFuel), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleFuel);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleFuel.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleFuel));
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleFuel.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.HpiVehicleFuel));
// HPI vehicle transmission.
SaCodeTypeDfn codeTypeHpiVehicleTrans = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.HpiVehicleTrans), codeTypes.GetDescForType(Sbm.ApplCodeType.HpiVehicleTrans), 12);
codeTypeConsole.RegisterCodeType(codeTypeHpiVehicleTrans);
codeTypeConsole.RegisterCodesOfType(codeTypeHpiVehicleTrans.Code, 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
//---------------------------------------------------------------
if (configConsole != null)
if (sessionConfig != null)
{
// 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");
codeTypeConsole.RegisterCodeType(codeTypeAccountManager);
// 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");
codeTypeConsole.RegisterCodeType(codeTypeAccountHandler);
// 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");
codeTypeConsole.RegisterCodeType(codeTypeAccountType);
// 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);
codeTypeConsole.RegisterCodeType(codeTypeAccountRating);
// 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);
codeTypeContactTitle.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeContactTitle);
codeTypeConsole.RegisterCodesOfType(codeTypeContactTitle.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.ContactTitle));
codeTypeConsole.RegisterCodesOfType(codeTypeContactTitle.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.ContactTitle));
// 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");
codeTypeConsole.RegisterCodeType(codeTypeContactArea);
// 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);
codeTypeConsole.RegisterCodeType(codeTypeContactHandler);
// 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);
codeTypeConsole.RegisterCodeType(codeTypeContactMethod);
// 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);
codeTypeConsole.RegisterCodeType(codeTypeContactCallCycle);
@@ -252,7 +252,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// C o s t E s t i m a t e s
//---------------------------------------------------------------
FlagDfn estimateDefaultFlag = new FlagDfn((Byte)Sbm.ApplCodeFlag.EstimateType_QuoteDefault, "Default to quote", "Default");
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.EstimateSalesQuotesByCosts))
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.EstimateSalesQuotesByCosts))
{
// Cost per unit.
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"));
#endif
codeTypeConsole.RegisterCodeType(codeTypeCostPerUnit);
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerUnit.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerUnit));
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerUnit.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.CostPerUnit));
// Cost per job.
SaCodeTypeDfn codeTypeCostPerJob = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.CostPerJob), codeTypes.GetDescForType(Sbm.ApplCodeType.CostPerJob), 12);
codeTypeCostPerJob.AllowSequence = true;
codeTypeCostPerJob.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeCostPerJob);
codeTypeConsole.RegisterCodesOfType(codeTypeCostPerJob.Code, 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.
SaCodeTypeDfn codeTypeLabourPerUnit = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.LabourPerUnit), codeTypes.GetDescForType(Sbm.ApplCodeType.LabourPerUnit), 12);
codeTypeLabourPerUnit.AllowSequence = true;
codeTypeLabourPerUnit.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeLabourPerUnit);
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerUnit.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerUnit));
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerUnit.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerUnit));
// Labour cost per job.
SaCodeTypeDfn codeTypeLabourPerJob = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.LabourPerJob), codeTypes.GetDescForType(Sbm.ApplCodeType.LabourPerJob), 12);
codeTypeLabourPerJob.AllowSequence = true;
codeTypeLabourPerJob.FlagDefinitions.Add(estimateDefaultFlag);
codeTypeConsole.RegisterCodeType(codeTypeLabourPerJob);
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerJob.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerJob));
codeTypeConsole.RegisterCodesOfType(codeTypeLabourPerJob.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.LabourPerJob));
}
//---------------------------------------------------------------
// 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.
SaCodeTypeDfn codeTypeDeliveryStatus = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryStatus), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryStatus), 3);
codeTypeDeliveryStatus.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryStatus);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryStatus.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryStatus));
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryStatus.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryStatus));
// Delivery type.
SaCodeTypeDfn codeTypeDeliveryType = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryType), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryType), 12);
codeTypeDeliveryType.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryType);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryType.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryType));
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryType.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryType));
// Delivery method.
SaCodeTypeDfn codeTypeDeliveryMethod = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryMethod), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryMethod), 12);
codeTypeDeliveryMethod.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryMethod);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryMethod.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryMethod));
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryMethod.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryMethod));
// Delivery courier.
SaCodeTypeDfn codeTypeDeliveryCourier = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryCourier), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryCourier), 12);
codeTypeDeliveryCourier.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeDeliveryCourier);
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryCourier.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryCourier));
codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryCourier.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryCourier));
// Delivery book-in.
SaCodeTypeDfn codeTypeDeliveryBookIn = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DeliveryBookIn), codeTypes.GetDescForType(Sbm.ApplCodeType.DeliveryBookIn), 12);
codeTypeDeliveryBookIn.AllowSequence = true;
//codeTypeConsole.RegisterCodeType(codeTypeDeliveryBookIn);
//codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryBookIn.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryBookIn));
//codeTypeConsole.RegisterCodesOfType(codeTypeDeliveryBookIn.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DeliveryBookIn));
// Order lead time.
SaCodeTypeDfn codeTypeOrderLeadTime = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.OrderLeadTime), codeTypes.GetDescForType(Sbm.ApplCodeType.OrderLeadTime), 12);
codeTypeOrderLeadTime.AllowSequence = true;
//codeTypeConsole.RegisterCodeType(codeTypeOrderLeadTime);
//codeTypeConsole.RegisterCodesOfType(codeTypeOrderLeadTime.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.OrderLeadTime));
//codeTypeConsole.RegisterCodesOfType(codeTypeOrderLeadTime.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.OrderLeadTime));
// Delivery picker.
SaCodeTypeDfn codeTypeStockPicker = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.StockPicker), codeTypes.GetDescForType(Sbm.ApplCodeType.StockPicker), 12);
codeTypeStockPicker.AllowSequence = true;
codeTypeConsole.RegisterCodeType(codeTypeStockPicker);
codeTypeConsole.RegisterCodesOfType(codeTypeStockPicker.Code, 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
//---------------------------------------------------------------
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowItemDocuments))
if (sessionConfig != null && sessionConfig.AllowOption(Sbm.ConfigOption.AllowItemDocuments))
{
// PDF document types.
SaCodeTypeDfn codeTypeDocType_Pdf = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DocType_Pdf), codeTypes.GetDescForType(Sbm.ApplCodeType.DocType_Pdf), 12);
@@ -350,7 +350,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
codeTypeDocType_Pdf.AllowMixedCode = true;
codeTypeDocType_Pdf.FlagDefinitions.Add(new FlagDfn((Byte)Sbm.ApplCodeFlag.DocType_Pdf_WebPublish, "WebPublish", "Publish to Web"));
codeTypeConsole.RegisterCodeType(codeTypeDocType_Pdf);
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Pdf.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Pdf));
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Pdf.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Pdf));
// Image document types.
SaCodeTypeDfn codeTypeDocType_Image = new SaCodeTypeDfn(codeTypes.GetCodeForType(Sbm.ApplCodeType.DocType_Image), codeTypes.GetDescForType(Sbm.ApplCodeType.DocType_Image), 12);
@@ -358,7 +358,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
codeTypeDocType_Image.AllowMixedCode = true;
codeTypeDocType_Image.FlagDefinitions.Add(new FlagDfn((Byte)Sbm.ApplCodeFlag.DocType_Image_WebPublish, "WebPublish", "Publish to Web"));
codeTypeConsole.RegisterCodeType(codeTypeDocType_Image);
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Image.Code, configConsole.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Image));
codeTypeConsole.RegisterCodesOfType(codeTypeDocType_Image.Code, sessionConfig.GetDefaultCodesOfType(Sbm.ApplCodeType.DocType_Image));
}
//---------------------------------------------------------------
+374 -371
View File
@@ -42,17 +42,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Application definitions.
public static Sbm.ConfigConsole GetConfigConsoleType(String consoleProperty)
public static Sbm.SessionConfig GetSessionConfigType(String consoleProperty)
{
if (consoleProperty.ContainsCI("Sarand"))
return Sbm.ConfigConsole.Sarand;
return Sbm.SessionConfig.Sarand;
if (consoleProperty.ContainsCI("MPE"))
return Sbm.ConfigConsole.MPE;
return Sbm.SessionConfig.MPE;
if (consoleProperty.ContainsCI("BPE"))
return Sbm.ConfigConsole.BPE;
return Sbm.SessionConfig.BPE;
if (consoleProperty.ContainsCI("Cadix") || consoleProperty.ContainsCI("CUL"))
return Sbm.ConfigConsole.Cadix;
return Sbm.ConfigConsole.Generic;
return Sbm.SessionConfig.Cadix;
return Sbm.SessionConfig.Generic;
}
public static String GetCopyrightNotice(bool html = false)
{
@@ -86,18 +86,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
}
public static List<TypeCodeDesc> GetCodesOfType(ISbmUserContext_Core userContext, Sbm.SystemCode systemCode)
{
SbmConfigConsole configConsole = null; // SbmGlobals.GetConfigConsole(userContext.SessionContext);
switch (systemCode)
using (SbmInternals internals = new SbmInternals(userContext))
{
case Sbm.SystemCode.ItemType:
return new List<TypeCodeDesc>(itemTypes);
case Sbm.SystemCode.AffiliateType:
return new List<TypeCodeDesc>(affiliateTypes);
case Sbm.SystemCode.AssociationType:
return new List<TypeCodeDesc>(associationTypes);
case Sbm.SystemCode.TransactionType:
// Transaction types.
return new List<TypeCodeDesc>()
SbmSessionConsole sessionConsole = internals.SessionConsole;
switch (systemCode)
{
case Sbm.SystemCode.ItemType:
return new List<TypeCodeDesc>(itemTypes);
case Sbm.SystemCode.AffiliateType:
return new List<TypeCodeDesc>(affiliateTypes);
case Sbm.SystemCode.AssociationType:
return new List<TypeCodeDesc>(associationTypes);
case Sbm.SystemCode.TransactionType:
// Transaction types.
return new List<TypeCodeDesc>()
{
new TypeCodeDesc((int) Sbm.TransactionType.Project, "PRO", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_Project, "Project")),
new TypeCodeDesc((int)Sbm.TransactionType.SalesLead, "SLD", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_SalesLead, "Sales Lead")),
@@ -116,366 +118,367 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
new TypeCodeDesc((int)Sbm.TransactionType.ProformaPurchaseInvoice, "PPI", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice, "Proforma Purchase Invoice")),
new TypeCodeDesc((int)Sbm.TransactionType.PurchaseInvoice, "PUI", GetOwnerOption_Caption(userContext, Sbm.OrgOption_Caption.TransType_PurchaseInvoice, "Purchase Invoice")),
};
case Sbm.SystemCode.TransactionStatusCat:
return new List<TypeCodeDesc>(transactionStatusCats);
case Sbm.SystemCode.RequirementType:
return new List<TypeCodeDesc>(requirementTypes);
case Sbm.SystemCode.TaskCodeType:
return new List<TypeCodeDesc>(taskCodeTypes);
case Sbm.SystemCode.RequirementStatusCat:
return new List<TypeCodeDesc>(requirementStatusCats);
case Sbm.SystemCode.ConstituentType:
return new List<TypeCodeDesc>(constituentTypes);
case Sbm.SystemCode.ConstituentStatusCat:
return new List<TypeCodeDesc>(constituentStatusCats);
case Sbm.SystemCode.ItemLinkData:
return new List<TypeCodeDesc>(itemLinkDatas);
case Sbm.SystemCode.PortfolioItemType:
return new List<TypeCodeDesc>(portfolioItemTypes);
case Sbm.SystemCode.LocationCategory:
return new List<TypeCodeDesc>(locationCategories);
case Sbm.SystemCode.LocationFilter:
return new List<TypeCodeDesc>(locationFilters);
case Sbm.SystemCode.ContainerCategory:
return new List<TypeCodeDesc>(containerCategories);
case Sbm.SystemCode.ContainerType:
return new List<TypeCodeDesc>(containerTypes);
case Sbm.SystemCode.CommodityType:
{
// CommodityType.
List<TypeCodeDesc> CommodityType = new List<TypeCodeDesc>();
CommodityType.Add(Sbm.CommodityType.Stock, "STK", "Stock");
CommodityType.Add(Sbm.CommodityType.NonStock, "NST", "Non-stock");
CommodityType.Add(Sbm.CommodityType.Service, "SRV", "Service");
if (assetCommodityTypeAllowed < 0)
case Sbm.SystemCode.TransactionStatusCat:
return new List<TypeCodeDesc>(transactionStatusCats);
case Sbm.SystemCode.RequirementType:
return new List<TypeCodeDesc>(requirementTypes);
case Sbm.SystemCode.TaskCodeType:
return new List<TypeCodeDesc>(taskCodeTypes);
case Sbm.SystemCode.RequirementStatusCat:
return new List<TypeCodeDesc>(requirementStatusCats);
case Sbm.SystemCode.ConstituentType:
return new List<TypeCodeDesc>(constituentTypes);
case Sbm.SystemCode.ConstituentStatusCat:
return new List<TypeCodeDesc>(constituentStatusCats);
case Sbm.SystemCode.ItemLinkData:
return new List<TypeCodeDesc>(itemLinkDatas);
case Sbm.SystemCode.PortfolioItemType:
return new List<TypeCodeDesc>(portfolioItemTypes);
case Sbm.SystemCode.LocationCategory:
return new List<TypeCodeDesc>(locationCategories);
case Sbm.SystemCode.LocationFilter:
return new List<TypeCodeDesc>(locationFilters);
case Sbm.SystemCode.ContainerCategory:
return new List<TypeCodeDesc>(containerCategories);
case Sbm.SystemCode.ContainerType:
return new List<TypeCodeDesc>(containerTypes);
case Sbm.SystemCode.CommodityType:
{
// ToDo SbmSystem assetCommodityTypeAllowed
using (SbmAssetMgr assetMgr = SbmGlobals.System.CreateAssetMgr(userContext))
// CommodityType.
List<TypeCodeDesc> CommodityType = new List<TypeCodeDesc>();
CommodityType.Add(Sbm.CommodityType.Stock, "STK", "Stock");
CommodityType.Add(Sbm.CommodityType.NonStock, "NST", "Non-stock");
CommodityType.Add(Sbm.CommodityType.Service, "SRV", "Service");
if (assetCommodityTypeAllowed < 0)
{
//assetCommodityTypeAllowed = assetMgr != null && assetMgr.DatabaseIsValid();
}
}
if (assetCommodityTypeAllowed > 0)
CommodityType.Add(Sbm.CommodityType.Asset, "AST", "Asset");
return CommodityType;
}
case Sbm.SystemCode.CommodityStatusCat:
return new List<TypeCodeDesc>(commodityStatusCats);
case Sbm.SystemCode.MovementType:
return new List<TypeCodeDesc>(movementTypes);
case Sbm.SystemCode.StockLevelType:
return new List<TypeCodeDesc>(stockLevelTypes);
case Sbm.SystemCode.StockLevelSource:
return new List<TypeCodeDesc>(stockLevelSources);
case Sbm.SystemCode.AddressType:
return new List<TypeCodeDesc>(addressTypes);
case Sbm.SystemCode.SysParamCategory:
return new List<TypeCodeDesc>(sysParamCategories);
case Sbm.SystemCode.ProcessCategory:
{
List<TypeCodeDesc> ProcessCategory = new List<TypeCodeDesc>();
if (configConsole != null)
{
if (configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities))
ProcessCategory.Add(Sbm.ProcessCategory.Commodity, "CMD", "Commodity");
if (configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowAssets))
ProcessCategory.Add(Sbm.ProcessCategory.Asset, "ASSET", "Asset");
}
return ProcessCategory;
}
case Sbm.SystemCode.ProcessType:
return new List<TypeCodeDesc>(processTypes);
case Sbm.SystemCode.PaymentType:
return new List<TypeCodeDesc>(paymentTypes);
case Sbm.SystemCode.AssetIncomeType:
return new List<TypeCodeDesc>(assetIncomeTypes);
case Sbm.SystemCode.AssetType:
return new List<TypeCodeDesc>(assetTypes);
case Sbm.SystemCode.VehicleType:
return new List<TypeCodeDesc>(vehicleTypes);
case Sbm.SystemCode.VehicleEventType:
return new List<TypeCodeDesc>(vehicleEventTypes);
case Sbm.SystemCode.VehicleFeatureSource:
return new List<TypeCodeDesc>(vVehicleFeatureSources);
case Sbm.SystemCode.VehicleFeatureType:
return new List<TypeCodeDesc>(vehicleFeatureTypes);
case Sbm.SystemCode.VehicleOptionType:
return new List<TypeCodeDesc>(vehicleOptionTypes);
case Sbm.SystemCode.VehicleTransType:
return new List<TypeCodeDesc>(vehicleTransTypes);
case Sbm.SystemCode.FuelType:
return new List<TypeCodeDesc>(fuelTypes);
case Sbm.SystemCode.OdometerUnits:
return new List<TypeCodeDesc>(odometerUnits);
case Sbm.SystemCode.DiscountType:
return new List<TypeCodeDesc>(discountTypes);
case Sbm.SystemCode.DiscountMarkup:
return new List<TypeCodeDesc>(discountMarkups);
case Sbm.SystemCode.RegionType:
return new List<TypeCodeDesc>(regionTypes);
case Sbm.SystemCode.UnitMeasureCategory:
return new List<TypeCodeDesc>(unitMeasureCategories);
case Sbm.SystemCode.UnitMeasureType:
return new List<TypeCodeDesc>(unitMeasureTypes);
case Sbm.SystemCode.FinancialType:
{
List<TypeCodeDesc> FinancialType = new List<TypeCodeDesc>();
if (configConsole != null)
{
if (configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowCommodities))
FinancialType.Add(Sbm.FinancialType.CommoditySupply, "CmdSup", "Commodity supply");
}
FinancialType.Add(Sbm.FinancialType.CommoditySales, "CmdSal", "Commodity sales");
return FinancialType;
}
case Sbm.SystemCode.PriceType:
return new List<TypeCodeDesc>(priceTypes);
case Sbm.SystemCode.PriceCalcMethod:
return new List<TypeCodeDesc>(priceCalcMethods);
case Sbm.SystemCode.PriceRounderMethod:
return new List<TypeCodeDesc>(priceRounderMethods);
case Sbm.SystemCode.PriceRounderDirection:
return new List<TypeCodeDesc>(priceRounderDirections);
case Sbm.SystemCode.SystemAccountType:
return new List<TypeCodeDesc>(systemAccountTypes);
case Sbm.SystemCode.ItemStatus:
return new List<TypeCodeDesc>(itemStatuses);
case Sbm.SystemCode.EventStatus:
return new List<TypeCodeDesc>(eventStatuses);
case Sbm.SystemCode.AssociationTab:
return new List<TypeCodeDesc>(associationTabs);
case Sbm.SystemCode.InterfaceType_Website:
{
// Interface types - Website.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_Website);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.Website, (short)(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)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.JoomlaVirtueMart);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.MiMoWeb)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.MiMoWeb);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_Accounts:
{
// Interface Type - Accounts.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_Accounts);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_System:
{
// Interface Type - System.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_System);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)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))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.PostcodeAnywhere);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)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))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Pvh);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)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))
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))
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))
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))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Homebase);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_File:
{
// Interface Type - File.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_File);
if (configConsole == null || !configConsole.AllowInterface(userContext, SaInterfaceCategory.System, (short)Sbm.InterfaceType_File.LeasewayInvoice))
codes.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_File.LeasewayInvoice);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceDataType:
return new List<TypeCodeDesc>(interfaceDataTypes);
case Sbm.SystemCode.ItemDataType:
return new List<TypeCodeDesc>(itemDataTypes);
case Sbm.SystemCode.OrgOption_Value:
return new List<TypeCodeDesc>(orgOption_Values);
case Sbm.SystemCode.OrgOption_Folder:
return new List<TypeCodeDesc>(orgOption_Folders);
case Sbm.SystemCode.OrgOption_Minutes:
return new List<TypeCodeDesc>(OrgOption_Minutes);
case Sbm.SystemCode.OrgOption_PeriodDays:
{
List<TypeCodeDesc> OrgOption_PeriodDays = new List<TypeCodeDesc>();
// ToDo SbmSystem assetCommodityTypeAllowed
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.TransactionDatesInFuture, "TransDatesInFut", "Days in future that transaction dates can be set", "");
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateClosedTransaction, "UpdClosedTrans", "Grace period (days) for updating closed transactions", "Period after transaction closure during which updates are allowed (0-30 days)");
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.AllowDeliveryPlanning))
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateClosedTransaction_DispatchDetails, "UpdDisDetCloTrans", "Grace period (days) for updating dispatch details on closed order", "Period after transaction closure during which dispatch updates are allowed (0-30 days)");
if (configConsole != null && configConsole.GetStockControlConfig(userContext).AllowStockControl())
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateStockLevelsInPast, "UpdStkLvlInPast", "Update stock levels in past");
return OrgOption_PeriodDays;
}
case Sbm.SystemCode.OrgOption_PeriodWeeks:
{
List<TypeCodeDesc> OrgOption_PeriodWeeks = new List<TypeCodeDesc>();
if (configConsole != null && configConsole.AllowOption(userContext, Sbm.ConfigOption.TimeRecording))
{
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.Timesheets, "Timesheets", "Weeks of timesheets to list (default 8)");
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.UpdateTimeRecords_Control, "UpdTimeRecsCtrl", "Weeks in past for admin user to update time records (default 2)");
using (SbmAssetMgr assetMgr = SbmGlobals.System.CreateAssetMgr(userContext))
{
//assetCommodityTypeAllowed = assetMgr != null && assetMgr.DatabaseIsValid();
}
}
if (assetCommodityTypeAllowed > 0)
CommodityType.Add(Sbm.CommodityType.Asset, "AST", "Asset");
return CommodityType;
}
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.ImminentStockDue, "ImminStkDue", "Weeks of due stock to treat as imminent", "Weeks for which stock due is treated as imminent (0-12 weeks, default: 0)");
return OrgOption_PeriodWeeks;
}
case Sbm.SystemCode.OrgOption_AllowOption:
return new List<TypeCodeDesc>(orgOption_AllowOptions);
case Sbm.SystemCode.OrgOption_Caption:
{
List<TypeCodeDesc> OrgOption_Caption = new List<TypeCodeDesc>();
if (configConsole != null)
case Sbm.SystemCode.CommodityStatusCat:
return new List<TypeCodeDesc>(commodityStatusCats);
case Sbm.SystemCode.MovementType:
return new List<TypeCodeDesc>(movementTypes);
case Sbm.SystemCode.StockLevelType:
return new List<TypeCodeDesc>(stockLevelTypes);
case Sbm.SystemCode.StockLevelSource:
return new List<TypeCodeDesc>(stockLevelSources);
case Sbm.SystemCode.AddressType:
return new List<TypeCodeDesc>(addressTypes);
case Sbm.SystemCode.SysParamCategory:
return new List<TypeCodeDesc>(sysParamCategories);
case Sbm.SystemCode.ProcessCategory:
{
// Transaction type captions.
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.Project))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_Project, "Project", "Transaction type - Project");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesLead))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesLead, "SalLead", "Transaction type - Sales Lead");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesQuote, "SalQuote", "Transaction type - Sales quote");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesPO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesPO, "SalPO", "Transaction type - Sales PO");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesOrder, "SalPfOrder", "Transaction type - sales proforma order");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesOrder, "SalOrder", "Transaction type - sales order");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesDispatch))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesDispatch, "SalDispatch", "Transaction type - Sales dispatch");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesInvoice, "SalPfInvoice", "Transaction type - Proforma sales invoice");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesInvoice, "SalInvoice", "Transaction type - Sales invoice");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseQuote, "PurQuote", "Transaction type - Purchase quote");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseSO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseSO, "PurSO", "Transaction type - Purchase SO");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseOrder, "PurPfOrder", "Transaction type - Purchase proforma order");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseOrder, "PurOrder", "Transaction type - Purchase order");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseDelivery))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseDelivery, "PurDelivery", "Transaction type - Purchase Delivery");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice, "PurPfInvoice", "Transaction type - Proforma Purchase invoice");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseInvoice, "PurInvoice", "Transaction type - Purchase invoice");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.Project))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_Projects, "MnuOptProject", "Caption - Projects menu option");
// Menu option captions:
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesLead))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesLeads, "MnuOptSalLead", "Caption - Sales leads menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesPO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesPOs, "MnuOptSalPO", "Caption - Sales POs menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesQuotes, "MnuOptSalQuote", "Caption - Sales quotes menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesOrders, "MnuOptSalPfOrder", "Caption - Proforma sales orders menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesOrders, "MnuOptSalOrder", "Caption - Sales orders menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesDispatch))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesDispatches, "MnuOptSalDispatch", "Caption - Sales dispatches menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaSalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesInvoices, "MnuOptSalPfInvoice", "Caption - Proforma sales invoices menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.SalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesInvoices, "MnuOptSalInvoice", "Caption - Sales invoices menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseQuotes, "MnuOptPurQuote", "Caption - Purchase quotes menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseSO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseSOs, "MnuOptPurSO", "Caption - Purchase SOs menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseOrders, "MnuOptPurPfOrder", "Caption - Proforma purchase orders menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseOrders, "MnuOptPurOrder", "Caption - Purchase orders menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseDelivery))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseDeliveries, "MnuOptPurDelivery", "Caption - Purchase Deliveries menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseInvoices, "MnuOptPurPfInvoice", "Caption - Proforma purchase invoices menu option");
if (configConsole.AllowTransactionType(userContext, Sbm.TransactionType.PurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseInvoices, "MnuOptPurInvoice", "Caption - Purchase invoices menu option");
List<TypeCodeDesc> ProcessCategory = new List<TypeCodeDesc>();
if (sessionConsole != null)
{
if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowCommodities))
ProcessCategory.Add(Sbm.ProcessCategory.Commodity, "CMD", "Commodity");
if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowAssets))
ProcessCategory.Add(Sbm.ProcessCategory.Asset, "ASSET", "Asset");
}
return ProcessCategory;
}
return OrgOption_Caption;
}
case Sbm.SystemCode.OrgOption_ShowColumn:
{
List<TypeCodeDesc> OrgOption_ShowColumn = new List<TypeCodeDesc>();
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_AnnualSalesTarget, "Association:AnnualSalesTarget", "Association: Annual sales target");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_LastSaleRaised, "Association:Trans:LastSaleRaised", "Association: Last SO raised");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Open, "Association:Trans:SalesValue:Open", "Association: SO value: Open");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Cytd, "Association:Trans:SalesValue:Cytd", "Association: SO value: YTD");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Lcy, "Association:Trans:SalesValue:Lcy", "Association: SO value: LCY");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Group, "Association:Group", "Association: Group");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_CatalogRef, "Commodity:CatalogRef", "Commodity: Catalog reference");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_Weight, "Commodity:Weight", "Commodity: Weight");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_PackQtySale, "Commodity:PackQtySale", "Commodity: Pack qty - sale");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockAllocated, "Commodity:StockAllocated", "Commodity: Allocated stock");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockLevelSales, "Commodity:StockLevelSales", "Commodity: Stock level (Sales)");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockAvailable, "Commodity:StockAvailable", "Commodity: Available stock");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Order_AllocationInd, "Order:AllocationInd", "Order: Allocation indicator");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrder_DeliveryCourier, "SalesOrder:DeliveryCourier", "Order: Delivery courier");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrder_HasInvoice, "SalesOrder:HasInvoice", "Order: Has invoice flag");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Transaction_ContactArea, "Transaction:ContactArea", "Transaction: " + configConsole.GetAttributeCaption(userContext, SbmDbDfn.ColumnIdx.Association_ContactAreaCode, "Contact area"));
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Accounts_InvoiceRef, "Accounts:InvoiceRef", "Accounts: Invoice reference");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_AllocationInd, "OrderItem:AllocationInd", "Order item: Allocation indicator");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_Current, "OrderItem:StockCurrent", "Order item: Stock current");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_Available, "OrderItem:StockAvailable", "Order item: Stock available");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_BySalesLocation, "OrderItem:StockBySalesLocation", "Order item: Stock by sales location");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_QtyDispatched, "SalesOrderItem:QuantityDispatched", "Sales order item: qty dispatched");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_QtyInvoiced, "SalesOrderItem:QuantityInvoiced", "Sales order item: qty invoiced");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_NextProcess, "SalesOrderItem:NextProcess", "Sales order item: Next process");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Vehicle_KeyLocation, "Vehicle:KeyLocation", "Vehicle: Key location");
return OrgOption_ShowColumn;
}
case Sbm.SystemCode.OrgOption_ShowField:
return new List<TypeCodeDesc>(orgOption_ShowFields);
case Sbm.SystemCode.OrgOption_FieldLabel:
return new List<TypeCodeDesc>(orgOption_FieldLabels);
case Sbm.SystemCode.OrgOption_TransactionCreationStatus:
return new List<TypeCodeDesc>(orgOption_TransactionCreationStatuses);
case Sbm.SystemCode.OrgOption_ContainerStatusCaption:
return new List<TypeCodeDesc>(orgOption_ContainerStatusCaptions);
case Sbm.SystemCode.OrgOption_NumericDecimals:
return new List<TypeCodeDesc>(orgOption_NumericDecimals);
case Sbm.SystemCode.OrgOption_CommodityType:
return new List<TypeCodeDesc>(orgOption_CommodityTypes);
case Sbm.SystemCode.OrgOption_StockLocation:
return new List<TypeCodeDesc>(orgOption_StockLocations);
case Sbm.SystemCode.OrgOption_TaxCodeColumn:
return new List<TypeCodeDesc>(orgOption_TaxCodeColumns);
case Sbm.SystemCode.OrgOption_SystemUserRight:
return new List<TypeCodeDesc>(orgOption_SystemUserRights);
case Sbm.SystemCode.SystemUserOption:
return new List<TypeCodeDesc>(systemUserOptions);
case Sbm.SystemCode.AssociationOption:
return new List<TypeCodeDesc>(associationOptions);
case Sbm.SystemCode.InterfaceOption:
return new List<TypeCodeDesc>(interfaceOptions);
case Sbm.SystemCode.InterfaceOption_WebFlag:
return new List<TypeCodeDesc>(interfaceOption_WebFlags);
case Sbm.SystemCode.InterfaceOption_WebUploadData:
return new List<TypeCodeDesc>(interfaceOption_WebUploadDatas);
case Sbm.SystemCode.InterfaceOption_WebUploadMethod:
return new List<TypeCodeDesc>(interfaceOption_WebUploadMethods);
case Sbm.SystemCode.InterfaceOption_WebDownloadData:
return new List<TypeCodeDesc>(interfaceOption_WebDownloadDatas);
case Sbm.SystemCode.InterfaceOption_WebDownloadMethod:
return new List<TypeCodeDesc>(interfaceOption_WebDownloadMethods);
case Sbm.SystemCode.FileInterface_RowColValue:
return new List<TypeCodeDesc>(fileInterface_RowColValues);
case Sbm.SystemCode.FileInterface_Mode:
return new List<TypeCodeDesc>(fileInterface_Modes);
case Sbm.SystemCode.ProcessType:
return new List<TypeCodeDesc>(processTypes);
case Sbm.SystemCode.PaymentType:
return new List<TypeCodeDesc>(paymentTypes);
case Sbm.SystemCode.AssetIncomeType:
return new List<TypeCodeDesc>(assetIncomeTypes);
case Sbm.SystemCode.AssetType:
return new List<TypeCodeDesc>(assetTypes);
case Sbm.SystemCode.VehicleType:
return new List<TypeCodeDesc>(vehicleTypes);
case Sbm.SystemCode.VehicleEventType:
return new List<TypeCodeDesc>(vehicleEventTypes);
case Sbm.SystemCode.VehicleFeatureSource:
return new List<TypeCodeDesc>(vVehicleFeatureSources);
case Sbm.SystemCode.VehicleFeatureType:
return new List<TypeCodeDesc>(vehicleFeatureTypes);
case Sbm.SystemCode.VehicleOptionType:
return new List<TypeCodeDesc>(vehicleOptionTypes);
case Sbm.SystemCode.VehicleTransType:
return new List<TypeCodeDesc>(vehicleTransTypes);
case Sbm.SystemCode.FuelType:
return new List<TypeCodeDesc>(fuelTypes);
case Sbm.SystemCode.OdometerUnits:
return new List<TypeCodeDesc>(odometerUnits);
case Sbm.SystemCode.DiscountType:
return new List<TypeCodeDesc>(discountTypes);
case Sbm.SystemCode.DiscountMarkup:
return new List<TypeCodeDesc>(discountMarkups);
case Sbm.SystemCode.RegionType:
return new List<TypeCodeDesc>(regionTypes);
case Sbm.SystemCode.UnitMeasureCategory:
return new List<TypeCodeDesc>(unitMeasureCategories);
case Sbm.SystemCode.UnitMeasureType:
return new List<TypeCodeDesc>(unitMeasureTypes);
case Sbm.SystemCode.FinancialType:
{
List<TypeCodeDesc> FinancialType = new List<TypeCodeDesc>();
if (sessionConsole != null)
{
if (sessionConsole.AllowOption(Sbm.ConfigOption.AllowCommodities))
FinancialType.Add(Sbm.FinancialType.CommoditySupply, "CmdSup", "Commodity supply");
}
FinancialType.Add(Sbm.FinancialType.CommoditySales, "CmdSal", "Commodity sales");
return FinancialType;
}
case Sbm.SystemCode.PriceType:
return new List<TypeCodeDesc>(priceTypes);
case Sbm.SystemCode.PriceCalcMethod:
return new List<TypeCodeDesc>(priceCalcMethods);
case Sbm.SystemCode.PriceRounderMethod:
return new List<TypeCodeDesc>(priceRounderMethods);
case Sbm.SystemCode.PriceRounderDirection:
return new List<TypeCodeDesc>(priceRounderDirections);
case Sbm.SystemCode.SystemAccountType:
return new List<TypeCodeDesc>(systemAccountTypes);
case Sbm.SystemCode.ItemStatus:
return new List<TypeCodeDesc>(itemStatuses);
case Sbm.SystemCode.EventStatus:
return new List<TypeCodeDesc>(eventStatuses);
case Sbm.SystemCode.AssociationTab:
return new List<TypeCodeDesc>(associationTabs);
case Sbm.SystemCode.InterfaceType_Website:
{
// Interface types - Website.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_Website);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.WebStore)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.WebStore);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.JoomlaVirtueMart)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.JoomlaVirtueMart);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.Website, (short)(Sbm.InterfaceType_Website.MiMoWeb)))
interfaceTypes_Website.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_Website.MiMoWeb);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_Accounts:
{
// Interface Type - Accounts.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_Accounts);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_System:
{
// Interface Type - System.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_System);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.MSOutlook))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.MSOutlook);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.PostcodeAnywhere))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.PostcodeAnywhere);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Bac))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Bac);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Pvh))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Pvh);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cap))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cap);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Hpi))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Hpi);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Anchor_OrderFulfilment))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Anchor_OrderFulfilment);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Argos))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Argos);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Homebase))
interfaceTypes_System.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_System.Cadix_OrderSpreadsheet_Homebase);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceType_File:
{
// Interface Type - File.
// Duplicate static list and remove unsupported options.
List<TypeCodeDesc> codes = new List<TypeCodeDesc>(interfaceTypes_File);
if (sessionConsole == null || !sessionConsole.AllowInterface(SaInterfaceCategory.System, (short)Sbm.InterfaceType_File.LeasewayInvoice))
codes.RemoveAll(item => item.Type == (int)Sbm.InterfaceType_File.LeasewayInvoice);
return new List<TypeCodeDesc>(codes);
}
case Sbm.SystemCode.InterfaceDataType:
return new List<TypeCodeDesc>(interfaceDataTypes);
case Sbm.SystemCode.ItemDataType:
return new List<TypeCodeDesc>(itemDataTypes);
case Sbm.SystemCode.OrgOption_Value:
return new List<TypeCodeDesc>(orgOption_Values);
case Sbm.SystemCode.OrgOption_Folder:
return new List<TypeCodeDesc>(orgOption_Folders);
case Sbm.SystemCode.OrgOption_Minutes:
return new List<TypeCodeDesc>(OrgOption_Minutes);
case Sbm.SystemCode.OrgOption_PeriodDays:
{
List<TypeCodeDesc> OrgOption_PeriodDays = new List<TypeCodeDesc>();
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.TransactionDatesInFuture, "TransDatesInFut", "Days in future that transaction dates can be set", "");
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateClosedTransaction, "UpdClosedTrans", "Grace period (days) for updating closed transactions", "Period after transaction closure during which updates are allowed (0-30 days)");
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.AllowDeliveryPlanning))
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateClosedTransaction_DispatchDetails, "UpdDisDetCloTrans", "Grace period (days) for updating dispatch details on closed order", "Period after transaction closure during which dispatch updates are allowed (0-30 days)");
if (sessionConsole != null && sessionConsole.GetStockControlConfig().AllowStockControl())
OrgOption_PeriodDays.Add(Sbm.OrgOption_PeriodDays.UpdateStockLevelsInPast, "UpdStkLvlInPast", "Update stock levels in past");
return OrgOption_PeriodDays;
}
case Sbm.SystemCode.OrgOption_PeriodWeeks:
{
List<TypeCodeDesc> OrgOption_PeriodWeeks = new List<TypeCodeDesc>();
if (sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.TimeRecording))
{
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.Timesheets, "Timesheets", "Weeks of timesheets to list (default 8)");
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.UpdateTimeRecords_Control, "UpdTimeRecsCtrl", "Weeks in past for admin user to update time records (default 2)");
}
OrgOption_PeriodWeeks.Add(Sbm.OrgOption_PeriodWeeks.ImminentStockDue, "ImminStkDue", "Weeks of due stock to treat as imminent", "Weeks for which stock due is treated as imminent (0-12 weeks, default: 0)");
return OrgOption_PeriodWeeks;
}
case Sbm.SystemCode.OrgOption_AllowOption:
return new List<TypeCodeDesc>(orgOption_AllowOptions);
case Sbm.SystemCode.OrgOption_Caption:
{
List<TypeCodeDesc> OrgOption_Caption = new List<TypeCodeDesc>();
if (sessionConsole != null)
{
// Transaction type captions.
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.Project))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_Project, "Project", "Transaction type - Project");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesLead))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesLead, "SalLead", "Transaction type - Sales Lead");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesQuote, "SalQuote", "Transaction type - Sales quote");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesPO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesPO, "SalPO", "Transaction type - Sales PO");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesOrder, "SalPfOrder", "Transaction type - sales proforma order");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesOrder, "SalOrder", "Transaction type - sales order");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesDispatch))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesDispatch, "SalDispatch", "Transaction type - Sales dispatch");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaSalesInvoice, "SalPfInvoice", "Transaction type - Proforma sales invoice");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_SalesInvoice, "SalInvoice", "Transaction type - Sales invoice");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseQuote, "PurQuote", "Transaction type - Purchase quote");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseSO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseSO, "PurSO", "Transaction type - Purchase SO");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseOrder, "PurPfOrder", "Transaction type - Purchase proforma order");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseOrder, "PurOrder", "Transaction type - Purchase order");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseDelivery, "PurDelivery", "Transaction type - Purchase Delivery");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_ProformaPurchaseInvoice, "PurPfInvoice", "Transaction type - Proforma Purchase invoice");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.TransType_PurchaseInvoice, "PurInvoice", "Transaction type - Purchase invoice");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.Project))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_Projects, "MnuOptProject", "Caption - Projects menu option");
// Menu option captions:
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesLead))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesLeads, "MnuOptSalLead", "Caption - Sales leads menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesPO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesPOs, "MnuOptSalPO", "Caption - Sales POs menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesQuotes, "MnuOptSalQuote", "Caption - Sales quotes menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesOrders, "MnuOptSalPfOrder", "Caption - Proforma sales orders menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesOrders, "MnuOptSalOrder", "Caption - Sales orders menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesDispatch))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesDispatches, "MnuOptSalDispatch", "Caption - Sales dispatches menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaSalesInvoices, "MnuOptSalPfInvoice", "Caption - Proforma sales invoices menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.SalesInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_SalesInvoices, "MnuOptSalInvoice", "Caption - Sales invoices menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseQuote))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseQuotes, "MnuOptPurQuote", "Caption - Purchase quotes menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseSO))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseSOs, "MnuOptPurSO", "Caption - Purchase SOs menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseOrders, "MnuOptPurPfOrder", "Caption - Proforma purchase orders menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseOrder))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseOrders, "MnuOptPurOrder", "Caption - Purchase orders menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseDelivery))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseDeliveries, "MnuOptPurDelivery", "Caption - Purchase Deliveries menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.ProformaPurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_ProformaPurchaseInvoices, "MnuOptPurPfInvoice", "Caption - Proforma purchase invoices menu option");
if (sessionConsole.AllowTransactionType(Sbm.TransactionType.PurchaseInvoice))
OrgOption_Caption.Add(Sbm.OrgOption_Caption.MenuOpt_PurchaseInvoices, "MnuOptPurInvoice", "Caption - Purchase invoices menu option");
}
return OrgOption_Caption;
}
case Sbm.SystemCode.OrgOption_ShowColumn:
{
List<TypeCodeDesc> OrgOption_ShowColumn = new List<TypeCodeDesc>();
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_AnnualSalesTarget, "Association:AnnualSalesTarget", "Association: Annual sales target");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_LastSaleRaised, "Association:Trans:LastSaleRaised", "Association: Last SO raised");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Open, "Association:Trans:SalesValue:Open", "Association: SO value: Open");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Cytd, "Association:Trans:SalesValue:Cytd", "Association: SO value: YTD");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Trans_SalesValue_Lcy, "Association:Trans:SalesValue:Lcy", "Association: SO value: LCY");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Association_Group, "Association:Group", "Association: Group");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_CatalogRef, "Commodity:CatalogRef", "Commodity: Catalog reference");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_Weight, "Commodity:Weight", "Commodity: Weight");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_PackQtySale, "Commodity:PackQtySale", "Commodity: Pack qty - sale");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockAllocated, "Commodity:StockAllocated", "Commodity: Allocated stock");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockLevelSales, "Commodity:StockLevelSales", "Commodity: Stock level (Sales)");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Commodity_StockAvailable, "Commodity:StockAvailable", "Commodity: Available stock");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Order_AllocationInd, "Order:AllocationInd", "Order: Allocation indicator");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrder_DeliveryCourier, "SalesOrder:DeliveryCourier", "Order: Delivery courier");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrder_HasInvoice, "SalesOrder:HasInvoice", "Order: Has invoice flag");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Transaction_ContactArea, "Transaction:ContactArea", "Transaction: " + sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Association_ContactAreaCode, "Contact area"));
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Accounts_InvoiceRef, "Accounts:InvoiceRef", "Accounts: Invoice reference");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_AllocationInd, "OrderItem:AllocationInd", "Order item: Allocation indicator");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_Current, "OrderItem:StockCurrent", "Order item: Stock current");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_Available, "OrderItem:StockAvailable", "Order item: Stock available");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.OrderItem_Stock_BySalesLocation, "OrderItem:StockBySalesLocation", "Order item: Stock by sales location");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_QtyDispatched, "SalesOrderItem:QuantityDispatched", "Sales order item: qty dispatched");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_QtyInvoiced, "SalesOrderItem:QuantityInvoiced", "Sales order item: qty invoiced");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.SalesOrderItem_NextProcess, "SalesOrderItem:NextProcess", "Sales order item: Next process");
OrgOption_ShowColumn.Add(Sbm.OrgOption_ShowColumn.Vehicle_KeyLocation, "Vehicle:KeyLocation", "Vehicle: Key location");
return OrgOption_ShowColumn;
}
case Sbm.SystemCode.OrgOption_ShowField:
return new List<TypeCodeDesc>(orgOption_ShowFields);
case Sbm.SystemCode.OrgOption_FieldLabel:
return new List<TypeCodeDesc>(orgOption_FieldLabels);
case Sbm.SystemCode.OrgOption_TransactionCreationStatus:
return new List<TypeCodeDesc>(orgOption_TransactionCreationStatuses);
case Sbm.SystemCode.OrgOption_ContainerStatusCaption:
return new List<TypeCodeDesc>(orgOption_ContainerStatusCaptions);
case Sbm.SystemCode.OrgOption_NumericDecimals:
return new List<TypeCodeDesc>(orgOption_NumericDecimals);
case Sbm.SystemCode.OrgOption_CommodityType:
return new List<TypeCodeDesc>(orgOption_CommodityTypes);
case Sbm.SystemCode.OrgOption_StockLocation:
return new List<TypeCodeDesc>(orgOption_StockLocations);
case Sbm.SystemCode.OrgOption_TaxCodeColumn:
return new List<TypeCodeDesc>(orgOption_TaxCodeColumns);
case Sbm.SystemCode.OrgOption_SystemUserRight:
return new List<TypeCodeDesc>(orgOption_SystemUserRights);
case Sbm.SystemCode.SystemUserOption:
return new List<TypeCodeDesc>(systemUserOptions);
case Sbm.SystemCode.AssociationOption:
return new List<TypeCodeDesc>(associationOptions);
case Sbm.SystemCode.InterfaceOption:
return new List<TypeCodeDesc>(interfaceOptions);
case Sbm.SystemCode.InterfaceOption_WebFlag:
return new List<TypeCodeDesc>(interfaceOption_WebFlags);
case Sbm.SystemCode.InterfaceOption_WebUploadData:
return new List<TypeCodeDesc>(interfaceOption_WebUploadDatas);
case Sbm.SystemCode.InterfaceOption_WebUploadMethod:
return new List<TypeCodeDesc>(interfaceOption_WebUploadMethods);
case Sbm.SystemCode.InterfaceOption_WebDownloadData:
return new List<TypeCodeDesc>(interfaceOption_WebDownloadDatas);
case Sbm.SystemCode.InterfaceOption_WebDownloadMethod:
return new List<TypeCodeDesc>(interfaceOption_WebDownloadMethods);
case Sbm.SystemCode.FileInterface_RowColValue:
return new List<TypeCodeDesc>(fileInterface_RowColValues);
case Sbm.SystemCode.FileInterface_Mode:
return new List<TypeCodeDesc>(fileInterface_Modes);
}
}
return null;
}
+22 -21
View File
@@ -12,6 +12,7 @@ using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using static Sarand.Net.Standard.Base.Bus.ItemId;
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
//-------------------------------------------------------------------
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.idItem = idItem;
itemCache.itemType = (Sbm.ItemType)itemId.Type;
itemCache.idItem = itemId.Id;
itemCache.importedFromSage = false;
itemCache.importedFromQBooks = false;
itemCache.exportedFromSage = false;
@@ -222,7 +224,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
if (SysId.IsValid(sageParams.InterfaceId) && sageParams.dfnInt_Sage.Active)
{
// 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)
{
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)
{
// 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)
{
if (pIntItm.Direction == SaInterfaceProcessDirection.Inbound || pIntItm.Direction == SaInterfaceProcessDirection.Both) itemCache.importedFromQBooks = true;
@@ -244,12 +246,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
}
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);
if (itemCache.itemType == itemType && itemCache.idItem == idItem)
PopulateItemCache(itemId);
if ((short)itemCache.itemType == itemId.Type && itemCache.idItem == itemId.Id)
{
switch (accounts)
{
@@ -264,21 +266,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
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;
PopulateItemCache(itemType, idItem);
if (itemCache.itemType == itemType && itemCache.idItem == idItem)
if (!ItemId.IsValid(itemId)) return false;
PopulateItemCache(itemId);
if ((short)itemCache.itemType == itemId.Type && itemCache.idItem == itemId.Id)
{
switch (accounts)
{
@@ -342,7 +344,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public bool IsAssociationTypeManagedByAccounts(Sbm.AssociationType associationType)
{
if (associationType == Sbm.AssociationType.Unknown) return false;
// Sage Line 50:
if (IsUsingSageInterface())
{
@@ -358,7 +359,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
#if DEBUG
SaLogger.Warn("IsAssociationTypeManagedByAccounts Unsupported Sage association type: " + associationType.ToString());
#endif
break;
return false;
}
}
@@ -377,7 +378,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
#if DEBUG
SaLogger.Warn("IsAssociationTypeManagedByAccounts Unsupported QBooks association type: " + associationType.ToString());
#endif
break;
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 System;
using System.Collections.Generic;
using static Sarand.Net.Standard.Base.Core.StringPair;
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{
@@ -432,6 +433,30 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
//-------------------------------------------------------------------
// 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)
{
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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Address.
public Sbm.AddressType AddressType { 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_Country,
ProspectGroup,
// Associated data.
GroupMembers,
Association_Count,
// Common properties.
Notes,
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)
{
if (IsIndividual(AffiliateType))
@@ -388,7 +396,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{
return GetCategory(AffiliateType);
}
// Utilities - affiliate type.
// Affiliate type.
public bool TypeIsValid()
{
if (IsIndividual()) return true;
@@ -400,19 +409,23 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
if (IsContactGroup()) return true;
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()
{
return IsIndividual(AffiliateType);
}
public static bool IsOrganisation(Sbm.AffiliateType affiliateType)
{
return !IsIndividual(affiliateType) & !IsContactGroup(affiliateType);
}
public bool IsOrganisation()
{
return AffiliateType != Sbm.AffiliateType.Individual & AffiliateType != Sbm.AffiliateType.ContactGroup;
return IsOrganisation(AffiliateType);
}
// Specific affiliate types.
public bool IsCommercial()
{
return AffiliateType == Sbm.AffiliateType.Commercial;
@@ -433,11 +446,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{
return AffiliateType == Sbm.AffiliateType.Charity;
}
public static bool IsContactGroup(Sbm.AffiliateType affiliateType)
{
return affiliateType == Sbm.AffiliateType.ContactGroup;
}
public bool IsContactGroup()
{
return AffiliateType == Sbm.AffiliateType.ContactGroup;
return IsContactGroup(AffiliateType);
}
// Utilities - email validation.
// Email validation.
public static bool IsValidEmail(String email)
{
int count = 0;
@@ -748,8 +766,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Affiliate.
public Sbm.AffiliateType AffiliateType { get; set; } = Sbm.AffiliateType.Any;
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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Asset.
public SysId AssetCatId { get; set; }
public String Search { get; set; }
@@ -646,8 +646,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{
List<StringPair> value = new List<StringPair>();
if (IncludedIds.Count > 0) value.Add("Assets included", IncludedIds.ToString());
if (ExcludedIds.Count > 0) value.Add("Assets excluded", ExcludedIds.ToString());
if (IdsIncluded.Count > 0) value.Add("Assets included", IdsIncluded.ToString());
if (IdsExcluded.Count > 0) value.Add("Assets excluded", IdsExcluded.ToString());
if (SysId.IsValid(AssetCatId)) value.Add("Asset category Id", AssetCatId.ToString());
if (ItemType > 0) value.Add("Item type", ItemType.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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// AssetProcess.
public SysId AssetId { 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_AccountManagerCode,
Target_DeliveryAddress_ContactAreaCode,
// Associated members. [17-NOV-10]
// Associated members. [17-Nov-10]
Member_Type,
Member_TypeDesc,
Member_Code,
@@ -142,7 +142,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{
public SysId AffiliateIdOwner { 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 RefExt { 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()
{
if (AssociationType > 0) return true;
@@ -867,10 +873,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// 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 AffiliateIdTarget { 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> DeliveryCourierCodes { get; } = new List<String>();
public List<String> DeliveryBookInCodes { get; } = new List<String>();
/// <summary>Association must have a transaction active at some time between the specified dates (one date can be specified for open ended period).</summary>
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.NotDeleted;
// 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).
/// <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>
public DateTime TransActiveFrom { get; set; } = DateTime.MinValue;
public DateTime TransactionActiveFrom { get; set; } = DateTime.MinValue;
/// <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>
public SysId InterfaceIdExcludeSystemAccounts { get; set; }
/// <summary>Associated codes (via ItemLink) - Seasonal Category.</summary>
+16 -33
View File
@@ -1126,6 +1126,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
//-------------------------------------------------------------------
// Utilities.
public ItemId GetItemId()
{
return new ItemId((short)Sbm.ItemType.Commodity, Id);
}
//-------------------------------------------------------------------
// Properties.
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
//-------------------------------------------------------------------
public abstract bool HasProcesses();
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();
// Associated data.
public List<SbmCostEstimate> CostEstimates { get; set; }
public List<SbmItemProcess> ItemProcesses { get; set; }
//-------------------------------------------------------------------
// P a r a m s
@@ -1804,8 +1787,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// Commodity Ids.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Commodity.
public Sbm.CommodityType CommodityType { get; set; }
public bool StockItemsOnly { get; set; } = false;
@@ -1879,11 +1862,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{
SbmAccountMgr accountMgr = null;
List<StringPair> lValue = new List<StringPair>();
using (SbmConfigConsole configConsole = SbmGlobals.Application.CreateConfigConsole(userContext.SessionContext))
using (SbmSessionConsole sessionConsole = SbmGlobals.Application.CreateSessionConsole(userContext))
{
// Commodities to exclude.
if (IncludedIds.Count > 0) lValue.Add("Included commodities", IncludedIds.Count.ToString());
if (ExcludedIds.Count > 0) lValue.Add("Excluded commodities", ExcludedIds.Count.ToString());
if (IdsIncluded.Count > 0) lValue.Add("Included commodities", IdsIncluded.Count.ToString());
if (IdsExcluded.Count > 0) lValue.Add("Excluded commodities", IdsExcluded.Count.ToString());
// Commodity type.
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");
@@ -1910,9 +1893,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
if (!StringUtil.IsEmpty(SupplyMethodCode)) lValue.Add("SupplyMethod code", SupplyMethodCode);
if (!StringUtil.IsEmpty(HandlingCode)) lValue.Add("Handling code", HandlingCode);
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(FinishCode)) lValue.Add(configConsole.GetAttributeCaption(userContext, 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(MaterialCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material") + " code", MaterialCode);
if (!StringUtil.IsEmpty(FinishCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish") + " code", FinishCode);
if (!StringUtil.IsEmpty(PromotionCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion") + " code", PromotionCode);
// Price sets.
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());
@@ -230,8 +230,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// CommodityCustomer.
public SysId CommodityId { get; set; }
public SysId AssocIdCustomer { get; set; }
@@ -220,8 +220,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// CommoditySupplier.
public SysId CommodityId { get; set; }
public SysId AssocIdSupplier { get; set; }
@@ -660,8 +660,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Constituent.
public Sbm.ConstituentType ConstituentType { get; set; } = Sbm.ConstituentType.Any;
public SysId AffIdTarget { get; set; }
@@ -287,8 +287,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public Params() { }
public Params(SbmContainerItem.Params prmContainerItem)
{
IncludedIds = prmContainerItem.IncludedIds;
ExcludedIds = prmContainerItem.ExcludedIds;
IdsIncluded = prmContainerItem.IdsIncluded;
IdsExcluded = prmContainerItem.IdsExcluded;
ContainerCategory = prmContainerItem.ContainerCategory;
ContainerType = prmContainerItem.ContainerType;
Reference = prmContainerItem.ContainerReference;
@@ -302,8 +302,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
HasItems = prmContainerItem.ContainerHasItems;
}
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Container.
//public SysId AffiliateIdOwner { get; set; }
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
{
// Item Ids.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Item properties.
public SysId ContainerId { 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).
List<SbmCostEstimate> costEstimatesCommodity = commodity.GetCostEstimates();
List<SbmCostEstimate> costEstimatesCommodity = internals.CommodityMgr.GetCommodityCostEstimates(commodity);
costEstimatesCommodity.ConsolidateByQuantity(quantity);
// 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// ItemBatch.
public Sbm.ItemBatchType ItemBatchType { 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// ItemLink.
public Sbm.ItemLinkType ItemLinkType { 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// ItemProcess.
public Sbm.ItemType ItemType { 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Location.
public SysId AffiliateIdOwner { 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Movement.
public Sbm.ItemType ItemType { 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Hierarchy.
public SysId ParentItemId { 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
{
// Item Ids.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Item properties.
public Sbm.PriceType PriceType { 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Process.
public Sbm.ProcessCategory ProcessCategory { get; set; }
+32 -35
View File
@@ -1221,55 +1221,52 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
/// </summary>
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.
/* General details*/
public SysId AssociationId { get; set; }
public SysId CommodityId { get; set; }
public SysId AssetId { get; set; }
// Requirement.
public List<SysId> ReqntIncludedIds { get; } = new List<SysId>();
public List<SysId> ReqntExcludedIds { get; } = new List<SysId>();
public List<SysId> ReqntIdsSource { get; } = new List<SysId>();
public String ReqntProductCodeFull { get; set; }
public String ReqntProductCodePartial { get; set; }
public List<SysId> RequirementIdsIncluded { get; } = new List<SysId>();
public List<SysId> RequirementIdsExcluded { get; } = new List<SysId>();
public List<SysId> RequirementIdsSource { get; } = new List<SysId>();
public String RequirementProductCodeFull { get; set; }
public String RequirementProductCodePartial { get; set; }
// Stored as product code for 'Project' transactions (populating this value will force the transaction type).
public String ReqntProjectTaskCodeFull { get; set; }
public String ReqntProjectTaskCodePartial { get; set; }
public String ReqntJobNumberFull { get; set; }
public String ReqntJobNumberPartial { get; set; }
public String ReqntAssetSerialFull { get; set; }
public String ReqntAssetSerialPartial { get; set; }
public String ReqntDescBrief { get; set; }
public String ReqntPromotionCode { get; set; }
public String RequirementProjectTaskCodeFull { get; set; }
public String RequirementProjectTaskCodePartial { get; set; }
public String RequirementJobNumberFull { get; set; }
public String RequirementJobNumberPartial { get; set; }
public String RequirementAssetSerialFull { get; set; }
public String RequirementAssetSerialPartial { get; set; }
public String RequirementDescBrief { get; set; }
public String RequirementPromotionCode { get; set; }
// Transaction.
public String AliasTransaction { get; set; }
public List<SysId> TransIncludedIds { get; } = new List<SysId>();
public List<SysId> TransExcludedIds { get; } = new List<SysId>();
public SysId TransReqntSourceId { get; set; } // Identifies the transaction to which the source requirement belongs.
public List<SysId> TransactionIdsIncluded { get; } = new List<SysId>();
public List<SysId> TransactionIdsExcluded { get; } = new List<SysId>();
public SysId TransactionRequirementSourceId { get; set; } // Identifies the transaction to which the source requirement belongs.
public Sbm.TransactionType TransactionType { get; set; } = Sbm.TransactionType.Any;
public SysId TransLocationIdStock { get; set; }
public SysId TransactionLocationIdStock { get; set; }
public SbmTransaction.StatusCat TransactionStatusCat { get; set; } = SbmTransaction.StatusCat.NotDeleted;
public String TransRefPartial { get; set; }
public String TransRefExtPartial { get; set; }
public String TransDescBriefPartial { get; set; }
public String AssocPartial { get; set; }
public String TransactionRefPartial { get; set; }
public String TransactionRefExtPartial { get; set; }
public String TransactionDescBriefPartial { get; set; }
public String AssociationPartial { get; set; }
public String AccountManagerCode { get; set; }
public String AccountHandlerCode { get; set; }
public DateTime TransRaisedFrom { get; set; }
public DateTime TransRaisedTo { get; set; }
public DateTime TransRequiredFrom { get; set; }
public DateTime TransRequiredTo { get; set; }
public decimal TransAmountNetLt { get; set; } = Decimal.MinValue;
public decimal TransAmountNetGt { get; set; } = Decimal.MinValue;
public DateTime TransactionRaisedFrom { get; set; }
public DateTime TransactionRaisedTo { get; set; }
public DateTime TransactionRequiredFrom { get; set; }
public DateTime TransactionRequiredTo { get; set; }
public decimal TransactionAmountNetLt { get; set; } = Decimal.MinValue;
public decimal TransactionAmountNetGt { get; set; } = Decimal.MinValue;
// Active period.
// 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.
public DateTime TransActiveFrom { get; set; }
public DateTime TransActiveTo { get; set; }
public DateTime TransactionActiveFrom { 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]
public DateTime ActiveAnyDayDuringPeriod { get; set; }
// Commodity against associated items.
@@ -1280,8 +1277,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public SysId SalesLocationIdStock02 { get; set; }
public SysId SalesLocationIdStock03;
// Required date.
public DateTime ReqntRequiredFrom { get; set; }
public DateTime ReqntRequiredTo { get; set; }
public DateTime RequirementRequiredFrom { get; set; }
public DateTime RequirementRequiredTo { get; set; }
public String CmdMaterialCode { get; set; }
public String CmdFinishCode { get; set; }
// Common properties.
@@ -279,8 +279,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// StockLevel.
public SysId CommodityId { 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// SysParam.
public Sbm.SysParamCategory Category { get; set; } = Sbm.SysParamCategory.Any;
public String Name { get; set; }
@@ -245,8 +245,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// SystemAccount.
public Sbm.SystemAccountType Type { get; set; } = Sbm.SystemAccountType.Customer;
public SysId InterfaceId { get; set; }
@@ -173,8 +173,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// SystemAccountUser.
public SysId InterfaceId { get; set; }
public SysId AccountId { get; set; }
@@ -219,8 +219,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// User.
public SysId AffIdOwner { get; set; }
public SysId InterfaceId { get; set; }
@@ -9,8 +9,8 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{
//=======================================================================
public abstract class SbmTransaction : SbmHierarchyItem
//=======================================================================
public abstract class SbmTransaction : SbmHierarchyItem
{
//-------------------------------------------------------------------
// Columns.
@@ -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.
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;
}
}
@@ -1646,8 +1646,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; set; } = new List<SysId>();
public List<SysId> ExcludedIds { get; set; } = new List<SysId>();
public List<SysId> IdsIncluded { get; set; } = new List<SysId>();
public List<SysId> IdsExcluded { get; set; } = new List<SysId>();
// Transaction.
public SysId AssocId { 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.
// NB Elements without a test in the list below are not regarded as 'significant'.
if (ForceFullResults) return false;
if (IncludedIds.Count > 0) return false;
if (IdsIncluded.Count > 0) return false;
if (SysId.IsValid(TransIdSource)) return false;
if (StatusCat == StatusCat.Pending || StatusCat == StatusCat.Open) 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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// Vehicle.
public SysId VehicleClassId { get; set; }
public SysId AssetCatIdInclude { get; set; }
@@ -317,8 +317,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// VehicleEvent.
public SysId VehicleId { get; set; }
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
{
// List filtering.
public List<SysId> IncludedIds { get; } = new List<SysId>();
public List<SysId> ExcludedIds { get; } = new List<SysId>();
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
// VehicleFeature.
public SysId VehicleId { get; set; }
public Sbm.VehicleFeatureSource VehicleFeatureSource { get; set; } = Sbm.VehicleFeatureSource.Any;
@@ -16,7 +16,10 @@ using System.Collections.Generic;
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.
@@ -26,11 +29,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{
}
public SysId InterfaceId { get; } = new SysId();
public String Context { get; } = "";
public string Context { get; } = "";
public SaInterfaceCategory InterfaceCategory { get; } = SaInterfaceCategory.Unknown;
public short InterfaceType { get; }
public String Code { get; } = "";
public String Caption { get; } = "";
public string Code { get; } = "";
public string Caption { get; } = "";
public bool Active { get; }
}
// Sage/Quickbooks interface definition.
@@ -68,6 +71,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//-------------------------------------------------------------------
// Data members.
private List<TypeCodeDesc> transactionTypes_Full = new List<TypeCodeDesc>();
private SbmInstanceConfig instanceConfig;
private SbmAccountsDfn accountsDfn;
private AccountsInterfaceDfn dfnSageInt = new AccountsInterfaceDfn();
private AccountsInterfaceDfn dfnQBooksInt = new AccountsInterfaceDfn();
@@ -76,12 +80,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//-------------------------------------------------------------------
// Construction.
protected SbmConfigConsole(Sbm.ConfigConsole configConsole, SbmVersion consoleVersion, SbmSessionContext sessionContext)
protected SbmSessionConsole(Sbm.SessionConfig sessionConfig, SbmVersion consoleVersion, ISbmUserContext_Core userContext)
{
ConfigConsole = configConsole;
AppVersion = new SbmVersion("BusinessMgr", Sbm.Version.GetFullVersion(), SbmSystem.AssemblyBuildAt);
ConsoleVersion = consoleVersion;
SessionContext = sessionContext;
this.SessionConfig = sessionConfig;
this.AppVersion = new SbmVersion("BusinessMgr", Sbm.Version.GetFullVersion(), SacsSystem.AssemblyBuildAt);
this.ConsoleVersion = consoleVersion;
this.UserContext = userContext;
}
protected override void Dispose(bool disposing)
{
@@ -92,20 +96,22 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//-------------------------------------------------------------------
// Properties.
public Sbm.ConfigConsole ConfigConsole { get; }
public SbmSessionContext SessionContext { get; }
public Sbm.SessionConfig SessionConfig { get; }
public ISbmUserContext_Core UserContext { get; }
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
public SbmVersion AppVersion { 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
//-------------------------------------------------------------------
public static SbmConfigConsole CreateConsole(SbmSessionContext sessionContext)
public static SbmSessionConsole CreateConsole(ISbmUserContext_Core userContext)
{
SaLogger.Warn($"{SysUtil.Fn} Creating default configuration console.");
// Default console.
SbmVersion consoleVersion = new SbmVersion("Standard", Sbm.Version.GetFullVersion(), SbmSystem.AssemblyBuildAt);
return new SbmConfigConsole(Sbm.ConfigConsole.Generic, consoleVersion, sessionContext);
SbmVersion consoleVersion = new SbmVersion("Standard", Sbm.Version.GetFullVersion(), SacsSystem.AssemblyBuildAt);
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
//-------------------------------------------------------------------
// Application Customisation.
public virtual String GetApplicationCaption(Sbm.CaptionType captionType)
public virtual string GetApplicationCaption(Sbm.CaptionType captionType)
{
return "BusinessMgr";
}
@@ -127,7 +133,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
return new List<CodeDesc>();
}
public virtual bool DoAdditionalMenuOption(Sbm.MenuSection menuSection, String str)
public virtual bool DoAdditionalMenuOption(Sbm.MenuSection menuSection, string str)
{
return false;
}
@@ -145,13 +151,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//-------------------------------------------------------------------
// Application Configuration. - AllowOption.
public virtual bool AllowOption(ISbmUserContext_Core userContext, Sbm.ConfigOption option)
public virtual bool AllowOption(Sbm.ConfigOption option)
{
switch (option)
{
// Application.
case Sbm.ConfigOption.SystemMenu:
return SacsSystem.DebugMode;
return InstanceConfig.AllowApplicationOption(option, SacsSystem.DebugMode);
case Sbm.ConfigOption.AllowConsoleView:
case Sbm.ConfigOption.AllowOrganisationUpdate:
case Sbm.ConfigOption.AllowContacts:
@@ -160,26 +166,31 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.ConfigOption.AllowTransactions:
case Sbm.ConfigOption.DiaryView:
case Sbm.ConfigOption.AllowRequirementUpdateInline:
return true;
return InstanceConfig.AllowApplicationOption(option, true);
// Commodities.
case Sbm.ConfigOption.CommodityPartialCodeFilter:
//return true;
return userContext.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.Commodity_PartialCodeFilter);
if (InstanceConfig.AllowApplicationOption(option, false))
return true;
return UserContext.GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption.Commodity_PartialCodeFilter);
// Order Pricing.
case Sbm.ConfigOption.CustomerPriceSet:
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();
}
case Sbm.ConfigOption.SupplierPriceSet:
case Sbm.ConfigOption.SupplierDiscount:
{
if (InstanceConfig.AllowApplicationOption(option, false))
return true;
SbmAccountsDfn account = null;
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 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).
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.
public virtual bool AllowTransactionType(ISbmUserContext_Core userContext, Sbm.TransactionType type)
public virtual bool AllowTransactionType(Sbm.TransactionType type)
{
switch (type)
{
@@ -375,15 +386,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.SalesQuote:
case Sbm.TransactionType.SalesOrder:
//case Sbm.TransactionType.PurchaseOrder:
return true;
return InstanceConfig.AllowTransactionType(type, true);
// Proforma types are only allowed if ther counterparts cannot be created.
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:
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:
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;
}
@@ -392,27 +403,27 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// D a t a O p t i o n s
//-------------------------------------------------------------------
// 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)
{
// Fields that are tied to other columns for the purposes of controlling their display.
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:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Length);
return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Length);
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:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Density);
return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_Density);
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:
return userContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_TimeProd);
return UserContext.GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx.Commodity_TimeProd);
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:
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_SalesProjMonthlyProp:
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_SalesProjMonth11:
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)
return userContext.GetOwnerOption_ShowField(column);
return UserContext.GetOwnerOption_ShowField(column);
}
//return true;
}
//-------------------------------------------------------------------
// 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)
{
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;
}
@@ -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
//-------------------------------------------------------------------
// Job Tracking Options.
public virtual String GetDefaultQuoteDescIntro(ISbmUserContext_Core userContext)
public virtual string GetDefaultQuoteDescIntro()
{
return "";
}
@@ -471,19 +482,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//-------------------------------------------------------------------
// 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.
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.
dfnSageInt.ClearConfig();
dfnSageInt.AffiliateId_Owner = userContext.OrganisationAffiliateId;
dfnSageInt.AffiliateId_Owner = UserContext.OrganisationAffiliateId;
dfnQBooksInt.ClearConfig();
dfnQBooksInt.AffiliateId_Owner = userContext.OrganisationAffiliateId;
dfnQBooksInt.AffiliateId_Owner = UserContext.OrganisationAffiliateId;
// Identify the interfaces.
SbmAccountsDfn accountsDfn = new SbmAccountsDfn(userContext);
SbmAccountsDfn accountsDfn = new SbmAccountsDfn(UserContext);
dfnSageInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.SageLine50);
dfnQBooksInt.InterfaceId = accountsDfn.GetAccountInterfaceId(Sbm.InterfaceType_Accounts.QuickBooks);
@@ -523,12 +534,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
createTransaction_SalesQuote = true;
createTransaction_SalesOrder = true;
createTrans_SalesInvoice = true;
if (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = (!dfnSageInt.importPurchaseOrder && !dfnSageInt.exportPurchaseOrder);
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 (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = (!dfnQBooksInt.importPurchaseOrder && !dfnQBooksInt.exportPurchaseOrder);
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 (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = !dfnSageInt.importPurchaseOrder && !dfnSageInt.exportPurchaseOrder;
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 (createTransaction_PurchaseOrder) createTransaction_PurchaseOrder = !dfnQBooksInt.importPurchaseOrder && !dfnQBooksInt.exportPurchaseOrder;
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;
// Sales quotes are also imported from Sage Sales Orders.
createTransaction_SalesQuote = createTransaction_SalesOrder;
@@ -553,7 +564,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{
System, Manual, Option
}
public virtual AssignTransRefMethod TransactionAssignRefMethod(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes)
public virtual AssignTransRefMethod TransactionAssignRefMethod(Sbm.TransactionType transTypes)
{
return AssignTransRefMethod.System;
}
@@ -561,28 +572,28 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{
ByOwnerType, ByType
}
public virtual AssignTransRefSource TransactionAssignRefSource(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes)
public virtual AssignTransRefSource TransactionAssignRefSource(Sbm.TransactionType transTypes)
{
return AssignTransRefSource.ByOwnerType;
}
// By default all types of transaction have their own Id sequence.
// Override this method to allow different types of transaction to share Id sequence.
public virtual Sbm.TransactionType GetTransactionTypeForNextId(ISbmUserContext_Core userContext, Sbm.TransactionType transTypes)
public virtual Sbm.TransactionType GetTransactionTypeForNextId(Sbm.TransactionType transTypes)
{
return transTypes;
}
// 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();
Sbm.TransactionType transTypes = GetTransactionTypeForNextId(userContext, eType);
switch (TransactionAssignRefSource(userContext, eType))
Sbm.TransactionType transTypes = GetTransactionTypeForNextId(eType);
switch (TransactionAssignRefSource(eType))
{
case AssignTransRefSource.ByOwnerType:
// 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:
// Next Id only depends on the transaction type.
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.
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;
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);
}
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
// and global options that can be formatted (eg. to fixed length) by overwridden versions.
public virtual String GetTransactionCreateRef
(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
public virtual string GetTransactionCreateRef
(SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
{
String Ref = "";
string Ref = "";
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);
// Ref = FormatTransactionCreateRef(AffiliateId_Owner, idAssoc, transTypes, iRefNext);
}
return Ref;
}
public virtual String FormatTransactionCreateRef
(ISbmUserContext_Core userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt)
public virtual string FormatTransactionCreateRef
(SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt)
{
String Ref = "";
string Ref = "";
if (RefInt > 0)
{
// 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.
//Ref = String(RefInt, SeqLen);
// 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;
}
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;
}
//-------------------------------------------------------------------
/// <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 "";
}
//-------------------------------------------------------------------
// 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 (!CanCreateTransactionLocally(userContext, typeTo)) return false;
if (!AllowTransactionType(typeFrom) || !AllowTransactionType(typeTo)) return false;
if (!CanCreateTransactionLocally(typeTo)) return false;
if (typeFrom == Sbm.TransactionType.Project)
{
// Can raise another project from a project.
switch (typeTo)
{
case Sbm.TransactionType.Project:
return CanCreateTransactionLocally(userContext, typeTo);
return CanCreateTransactionLocally(typeTo);
}
}
else if (typeFrom == Sbm.TransactionType.SalesLead)
@@ -668,7 +679,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.SalesQuote:
case Sbm.TransactionType.ProformaSalesOrder:
case Sbm.TransactionType.SalesOrder:
return CanCreateTransactionLocally(userContext, typeTo);
return CanCreateTransactionLocally(typeTo);
}
}
else if (typeFrom == Sbm.TransactionType.SalesQuote)
@@ -682,7 +693,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.SalesOrder:
case Sbm.TransactionType.ProformaSalesInvoice:
case Sbm.TransactionType.SalesInvoice:
return CanCreateTransactionLocally(userContext, typeTo);
return CanCreateTransactionLocally(typeTo);
}
}
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.ProformaPurchaseOrder:
case Sbm.TransactionType.PurchaseOrder:
return CanCreateTransactionLocally(userContext, typeTo);
return CanCreateTransactionLocally(typeTo);
}
}
else if (typeFrom == Sbm.TransactionType.SalesDispatch)
@@ -711,7 +722,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
{
case Sbm.TransactionType.ProformaSalesInvoice:
case Sbm.TransactionType.SalesInvoice:
return CanCreateTransactionLocally(userContext, typeTo);
return CanCreateTransactionLocally(typeTo);
}
}
else if (typeFrom == Sbm.TransactionType.PurchaseQuote)
@@ -722,7 +733,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
case Sbm.TransactionType.PurchaseQuote:
case Sbm.TransactionType.ProformaPurchaseOrder:
case Sbm.TransactionType.PurchaseOrder:
return CanCreateTransactionLocally(userContext, typeTo);
return CanCreateTransactionLocally(typeTo);
}
}
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.ProformaPurchaseOrder:
case Sbm.TransactionType.PurchaseOrder:
return CanCreateTransactionLocally(userContext, typeTo);
return CanCreateTransactionLocally(typeTo);
}
}
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.
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)
{
//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);
}
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.
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();
foreach (TypeCodeDesc transTypeTo in transactionTypes_Full)
{
//TypeCodeDesc & typeTo = transTypes_Full.Index();
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);
}
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.
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();
//transSource; requireList; type;
@@ -785,15 +796,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//-------------------------------------------------------------------
// 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;
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.
public virtual bool UseInProgressTaxDateAsTaxPoint(ISbmUserContext_Core userContext, Sbm.TransactionType transactionType)
public virtual bool UseInProgressTaxDateAsTaxPoint(Sbm.TransactionType 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
//-------------------------------------------------------------------
// Requirement Actions.
public virtual bool SearchCommodityOnCreateRequirement(ISbmUserContext_Core userContext, Sbm.TransactionType transactionType)
public virtual bool SearchCommodityOnCreateRequirement(Sbm.TransactionType transactionType)
{
return false;
}
//-------------------------------------------------------------------
// Requirement Costing.
public virtual SbmRequirementCostingConfig GetRequirementCostingConfig(ISbmUserContext_Core userContext)
public virtual SbmRequirementCostingConfig GetRequirementCostingConfig()
{
SbmRequirementCostingConfig cfgRequirementCosting = new SbmRequirementCostingConfig();
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
//-------------------------------------------------------------------
// 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'.
return Sbm.CommodityType.Stock;
}
// Clean-up imported data (default no action).
public virtual bool CleanupImportedCommodity(ISbmUserContext_Core userContext, SbmCommodity commodity)
public virtual bool CleanupImportedCommodity(SbmCommodity commodity)
{
return true;
}
//-------------------------------------------------------------------
// Stock Control
public virtual SbmStockControlConfig GetStockControlConfig(ISbmUserContext_Core userContext)
public virtual SbmStockControlConfig GetStockControlConfig()
{
SbmStockControlConfig cfgStockControl = new SbmStockControlConfig();
return cfgStockControl;
@@ -852,11 +863,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// R e p o r t i n g
//-------------------------------------------------------------------
// 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>();
}
public virtual bool ItemHasDiaryReports(ISbmUserContext_Core userContext/*SaItemId &*/)
public virtual bool ItemHasDiaryReports(ItemId itemId)
{
return false;
}
@@ -882,7 +893,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
/// <summary>Sales Invoice report horizontal lines [Bool]</summary>
RptSalesInvoiceHorizontalLines = 111,
}
public virtual DataValue GetDefaultProcessParam(ISbmUserContext_Core userContext, ProcessParam prm)
public virtual DataValue GetDefaultProcessParam(ProcessParam prm)
{
switch (prm)
{
@@ -895,18 +906,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
//-------------------------------------------------------------------
// Automated processes.
public virtual bool PerformProcess(ISbmUserContext_Core userContext, Sbm.ProcessType type)
public virtual bool PerformProcess(Sbm.ProcessType type)
{
return false;
}
// 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>();
}
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>();
}
@@ -915,17 +926,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// Data export Enhancements. eg. for export to accounts.
public class DataExportItemDetails
{
internal DataExportItemDetails(String itemCode, String itemDesc, String itemText)
internal DataExportItemDetails(string itemCode, string itemDesc, string itemText)
{
ItemCode = itemCode;
ItemDesc = itemDesc;
ItemText = itemText;
}
public String ItemCode { get; }
public String ItemDesc { get; }
public String ItemText { get; }
public string ItemCode { get; }
public string ItemDesc { get; }
public string ItemText { get; }
};
public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(ISbmUserContext_Core userContext, SbmRequirement requirement)
public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(SbmRequirement requirement)
{
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
//-------------------------------------------------------------------
public virtual bool AllowInterfaces(ISbmUserContext_Core userContext)
public virtual bool AllowInterfaces()
{
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Website)) return true;
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Accounts)) return true;
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.System)) return true;
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.File)) return true;
if (AllowInterfaceCategory(SaInterfaceCategory.Website)) return true;
if (AllowInterfaceCategory(SaInterfaceCategory.Accounts)) return true;
if (AllowInterfaceCategory(SaInterfaceCategory.System)) return true;
if (AllowInterfaceCategory(SaInterfaceCategory.File)) return true;
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.
switch (interfaceCategory)
@@ -954,9 +965,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
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)
{
case SaInterfaceCategory.Website:
@@ -987,29 +998,29 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
// Sbm.InterfaceType_System.Hpi - Only allowed by derived console.
break;
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.TransactionExport) return true;
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesQuote) return AllowTransactionType(userContext, 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_SalesDispatch) return AllowTransactionType(userContext, 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_PurchaseOrder) return (AllowTransactionType(userContext, Sbm.TransactionType.ProformaPurchaseOrder) || AllowTransactionType(userContext, Sbm.TransactionType.PurchaseOrder));
if (interfaceType == (short)Sbm.InterfaceType_File.TransToWord_SalesQuote) return AllowTransactionType(Sbm.TransactionType.SalesQuote);
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(Sbm.TransactionType.SalesDispatch);
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(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.AffiliateExport) return true;
if (interfaceType == (short)Sbm.InterfaceType_File.AssociationImport) 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.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)
//return SbmGlobals.Application.GetPropertyValue("Interface", "LeasewayInvoice").EqualsCI("Allow");
return false;
@@ -21,8 +21,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Core
//-------------------------------------------------------------------
// Security - Contacts.
bool UserCanCreateContacts { get; }
bool UserCanUpdateContacts { get; }
bool UserCanCreateContacts();
bool UserCanUpdateContacts();
// Security - Financials.
bool UserCanViewFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
@@ -41,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Core
//-------------------------------------------------------------------
/// <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();
switch ((SbmcUserAccount.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmcUserAccount.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -209,7 +210,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -141,8 +141,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
DataValue value = new DataValue();
switch ((SbmcOwner.Column)column.Id)
{
// Notes.
case SbmcOwner.Column.Notes:
//-----------------------------------------------------------
// Notes.
case SbmcOwner.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break;
@@ -159,9 +160,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
}
break;
//-----------------------------------------------------------
}
return value;
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
//-------------------------------------------------------------------
@@ -169,8 +169,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
DataValue value = new DataValue();
switch ((SbmcRepository.Column)column.Id)
{
// Notes.
case SbmcRepository.Column.Notes:
//-----------------------------------------------------------
// Notes.
case SbmcRepository.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break;
@@ -187,9 +188,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
}
break;
//-----------------------------------------------------------
}
return value;
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
//-------------------------------------------------------------------
@@ -147,6 +147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
DataValue value = new DataValue();
switch ((SbmcItemParam.Column)column.Id)
{
//-----------------------------------------------------------
// Item Type caption.
case SbmcItemParam.Column.ItemType_Caption:
{
@@ -156,6 +157,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
}
break;
//-----------------------------------------------------------
// Item caption.
case SbmcItemParam.Column.Item_Caption:
{
@@ -169,6 +171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
}
break;
//-----------------------------------------------------------
// Value.
case SbmcItemParam.Column.Value:
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));
break;
//-----------------------------------------------------------
// Notes.
case SbmcItemParam.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -197,11 +201,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control
}
break;
//-----------------------------------------------------------
default:
value = new DataValue(column.FormatValue(values));
value = values.GetValue(column.DataName);
break;
//-----------------------------------------------------------
}
return value;
}
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(addressId)) return false;
SbmAddress.Params prmAddress = new SbmAddress.Params();
prmAddress.IncludedIds.Add(addressId);
prmAddress.IdsIncluded.Add(addressId);
prmAddress.StatusCat = SbmAddress.StatusCat.Any;
return GetAddressCount(prmAddress) == 1;
}
@@ -42,7 +42,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(addressId)) return null;
SbmAddress.Params prmAddress = new SbmAddress.Params();
prmAddress.IncludedIds.Add(addressId);
prmAddress.IdsIncluded.Add(addressId);
prmAddress.StatusCat = SbmAddress.StatusCat.Any;
return GetAddress(prmAddress);
}
@@ -348,6 +348,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmAddress.Column)column.Id)
{
//-----------------------------------------------------------
// Address type description.
case SbmAddress.Column.Type_Desc:
{
@@ -356,19 +357,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
// Address summary.
case SbmAddress.Column.Summary:
{
List<String> addresses = new List<String>();
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Line1).DataName).AsString());
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Line2).DataName).AsString());
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Line3).DataName).AsString());
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.City).DataName).AsString());
addresses.Add(values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Province).DataName).AsString());
value = new DataValue(addresses.Concat(", ", null, null, true, true).ToString() + " " + values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Postcode).DataName).AsString());
String line1 = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Line1).DataName).AsString();
String city = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.City).DataName).AsString();
String province = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Province).DataName).AsString();
String postcode = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Postcode).DataName).AsString();
String country = values.GetValue(GetAddressColumnDfn(SbmAddress.Column.Country).DataName).AsString();
value = new DataValue(SbmAddress.GetSummary(line1, city, province, postcode, country));
}
break;
//-----------------------------------------------------------
// Notes.
case SbmAddress.Column.Notes:
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));
}
break;
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -36,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(affiliateId)) return false;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(affiliateId);
prmAffiliate.IdsIncluded.Add(affiliateId);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliateCount(prmAffiliate) == 1;
}
@@ -45,7 +45,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(affiliateIdOwner)) return false;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(affiliateIdOwner);
prmAffiliate.IdsIncluded.Add(affiliateIdOwner);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliateCount(prmAffiliate) == 1;
}
@@ -55,7 +55,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
if (!StringUtil.IsEmpty(organisationName) || !SysId.IsValid(affiliateIdExclude)) return false;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.Name = organisationName;
prmAffiliate.ExcludedIds.Add(affiliateIdExclude);
prmAffiliate.IdsExcluded.Add(affiliateIdExclude);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliateCount(prmAffiliate) == 1;
}
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.Name = firstName;
prmAffiliate.Name = lastName;
prmAffiliate.ExcludedIds.Add(affiliateIdExclude);
prmAffiliate.IdsExcluded.Add(affiliateIdExclude);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliateCount(prmAffiliate) == 1;
}
@@ -80,7 +80,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(affiliateId)) return null;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(affiliateId);
prmAffiliate.IdsIncluded.Add(affiliateId);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliate(prmAffiliate);
}
@@ -126,7 +126,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(associationId)) return null;
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(associationId);
prmAffiliate.IdsIncluded.Add(associationId);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
return GetAffiliate(prmAffiliate);
}
@@ -386,6 +386,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmAffiliate.Column)column.Id)
{
//-----------------------------------------------------------
// Affiliate type description.
case SbmAffiliate.Column.Type_Code:
case SbmAffiliate.Column.Type_Desc:
@@ -397,27 +398,25 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
// Address summary.
case SbmAffiliate.Column.Address_Summary:
{
List<String> addresses = new List<String>()
{
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Line1).DataName).AsString(),
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Line2).DataName).AsString(),
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_City).DataName).AsString(),
values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Province).DataName).AsString(),
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());
String line1 = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Line1).DataName).AsString();
String city = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_City).DataName).AsString();
String province = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Province).DataName).AsString();
String postcode = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Postcode).DataName).AsString();
String country = values.GetValue(GetAffiliateColumnDfn(SbmAffiliate.Column.Address_Country).DataName).AsString();
value = new DataValue(SbmAddress.GetSummary(line1, city, province, postcode, country));
break;
}
//-----------------------------------------------------------
// Prospect Group.
case SbmAffiliate.Column.ProspectGroup:
break;
//-----------------------------------------------------------
// Notes.
case SbmAffiliate.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -436,7 +435,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -4,6 +4,7 @@ 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;
@@ -34,7 +35,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
public bool AllowColumnImport(SbmAssociation.Column 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)
{
@@ -494,7 +495,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SbmAssociation.Params prmAssociation = new SbmAssociation.Params();
prmAssociation.IncludedIds.Add(id);
prmAssociation.IdsIncluded.Add(id);
prmAssociation.StatusCat = SbmAssociation.StatusCat.Any;
return GetAssociationCount(prmAssociation) == 1;
}
@@ -533,7 +534,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(associationId)) return null;
SbmAssociation.Params prmAssociation = new SbmAssociation.Params();
prmAssociation.IncludedIds.Add(associationId);
prmAssociation.IdsIncluded.Add(associationId);
prmAssociation.AssociationType = Sbm.AssociationType.Any;
prmAssociation.StatusCat = SbmAssociation.StatusCat.Any;
return GetAssociation(prmAssociation);
}
@@ -557,7 +559,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
AssociationType = associationType,
Code = associationCode,
StatusCat = SbmAssociation.StatusCat.NotDeleted
};
};
return GetAssociation(prmAssociation);
}
@@ -784,7 +786,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
if (errField.AffiliateIdOwner != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.AffiliateIdOwner))
{
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(data.AffiliateIdOwner);
prmAffiliate.IdsIncluded.Add(data.AffiliateIdOwner);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
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))
{
SbmAffiliate.Params prmAffiliate = new SbmAffiliate.Params();
prmAffiliate.IncludedIds.Add(data.AffiliateIdTarget);
prmAffiliate.IdsIncluded.Add(data.AffiliateIdTarget);
prmAffiliate.StatusCat = SbmAffiliate.StatusCat.Any;
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))
{
/* ToDo Validate Association PriceSet
// Association PriceSet.
SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params();
prmPriceSet.IncludedIds.Add(data.PriceSetId);
prmPriceSet.IdsIncluded.Add(data.PriceSetId);
prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any;
if (GetPriceSetCount(prmPriceSet) < 1)
if (PriceMgr.GetPriceSetCount(prmPriceSet) < 1)
{
errField.PriceSetId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Price Set not found");
}
*/
}
if (errField.TaxCodeId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.TaxCodeId))
{
/* ToDo Validate Association TaxCode
errField.TaxCodeId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Tax Code's Id not found");
*/
// Association TaxCode.
using (SaTaxCode taxCode = Internals.GetTaxCodeById(data.TaxCodeId))
{
if (taxCode == null)
{
errField.TaxCodeId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Tax Code not found");
}
}
}
return true;
}
@@ -858,7 +864,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmAssociation.Column)column.Id)
{
//---------------------------------------------------------------
//-----------------------------------------------------------
// Association TypeDesc.
case SbmAssociation.Column.Type_Desc:
{
@@ -867,7 +873,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Discount TypeDesc.
case SbmAssociation.Column.DiscountType_Desc:
{
@@ -876,7 +882,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Association Coding.
case SbmAssociation.Column.AccountManagerDesc:
{
@@ -926,6 +932,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(GetCodeTypeCodeDesc(Sbm.ApplCodeType.ContactCallCycle, contactCallCycle));
break;
}
//-----------------------------------------------------------
// Association Seasonal Category.
case SbmAssociation.Column.SeasonalCategoryCode1:
case SbmAssociation.Column.SeasonalCategoryDesc1:
@@ -977,6 +985,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
}
//-----------------------------------------------------------
case SbmAssociation.Column.OrderLeadTimeDesc:
{
String orderLeadTime = values.GetValue(column.DataName).ToString();
@@ -1002,7 +1012,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// 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));
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Affiliate Type Desc.
case SbmAssociation.Column.Target_TypeDesc:
{
@@ -1050,7 +1061,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Address Type.
case SbmAssociation.Column.Target_Address_TypeDesc:
{
@@ -1061,17 +1072,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
// Address Summary.
case SbmAssociation.Column.Target_Address_Summary:
{
List<String> addresses = new List<String>()
{
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Line1).DataName).ToString(),
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Line2).DataName).ToString(),
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_City).DataName).ToString(),
values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Province).DataName).ToString(),
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());
String line1 = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Line1).DataName).ToString();
String city = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_City).DataName).ToString();
String province = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Province).DataName).ToString();
String postcode = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Postcode).DataName).ToString();
String country = values.GetValue(GetAssociationColumnDfn(SbmAssociation.Column.Target_Address_Country).DataName).ToString();
value = new DataValue(SbmAddress.GetSummary(line1, city, province, postcode, country));
break;
}
// Address Coding.
@@ -1100,7 +1106,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -9,8 +9,8 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
public partial class SbmAccountMgr
//=======================================================================
public partial class SbmAccountMgr
{
//*******************************************************************
// O r g a n i s a t i o n
@@ -178,7 +178,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
// Additonal organisation options - to support non-standard configuration options:
itemOptionDfns.AddRange(ConfigConsole.GetAdditionalOrganisationOptions());
itemOptionDfns.AddRange(SessionConsole.GetAdditionalOrganisationOptions());
return itemOptionDfns;
}
@@ -218,7 +218,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
private OrganisationOptionData InitOrganisationOptionData()
{
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))
{
// Option types.
@@ -241,8 +241,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
bool bAllowSalesDispatches = (AllowTransactionType(Sbm.TransactionType.SalesDispatch));
bool bAllowSalesInvoices = ((AllowTransactionType(Sbm.TransactionType.SalesInvoice) || AllowTransactionType(Sbm.TransactionType.ProformaSalesInvoice)));
bool bAllowPurchaseOrders = ((AllowTransactionType(Sbm.TransactionType.PurchaseOrder) || AllowTransactionType(Sbm.TransactionType.ProformaPurchaseOrder)));
bool bAllowInterfaces = (console.AllowInterfaces(UserContext));
bool bAllowInterfaces_File = (bAllowInterfaces && console.AllowInterfaceCategory(UserContext, SaInterfaceCategory.File));
bool bAllowInterfaces = (sessionConsole.AllowInterfaces());
bool bAllowInterfaces_File = (bAllowInterfaces && sessionConsole.AllowInterfaceCategory(SaInterfaceCategory.File));
// Values:
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));
if (CodeTypeHasCodes(Sbm.ApplCodeType.CommodityPromotion))
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.CommoditiesAllowedNegativePrice));
if (AllowConfigOption(Sbm.ConfigOption.TransactionSplitTimes))
@@ -28,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SbmSysParam.Params prmSysParam = new SbmSysParam.Params();
prmSysParam.IncludedIds.Add(id);
prmSysParam.IdsIncluded.Add(id);
prmSysParam.StatusCat = SbmSysParam.StatusCat.Any;
return GetSysParamCount(prmSysParam) == 1;
}
@@ -42,7 +42,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(paramId)) return null;
SbmSysParam.Params prmSysParam = new SbmSysParam.Params();
prmSysParam.IncludedIds.Add(paramId);
prmSysParam.IdsIncluded.Add(paramId);
prmSysParam.StatusCat = SbmSysParam.StatusCat.Any;
return GetSysParam(prmSysParam);
}
@@ -153,6 +153,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmSysParam.Column)column.Id)
{
//-----------------------------------------------------------
// 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));
break;
//-----------------------------------------------------------
// Status.
case SbmSysParam.Column.Status_Desc:
case SbmSysParam.Column.Status_Ind:
@@ -175,7 +175,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -30,7 +30,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(systemAccountId)) return false;
SbmSystemAccount.Params prmSystemAccount = new SbmSystemAccount.Params();
prmSystemAccount.IncludedIds.Add(systemAccountId);
prmSystemAccount.IdsIncluded.Add(systemAccountId);
prmSystemAccount.StatusCat = SbmSystemAccount.StatusCat.Any;
return GetSystemAccountCount(prmSystemAccount) == 1;
}
@@ -65,7 +65,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(systemAccountId)) return null;
SbmSystemAccount.Params prmSystemAccount = new SbmSystemAccount.Params();
prmSystemAccount.IncludedIds.Add(systemAccountId);
prmSystemAccount.IdsIncluded.Add(systemAccountId);
prmSystemAccount.StatusCat = SbmSystemAccount.StatusCat.Any;
return GetSystemAccount(prmSystemAccount);
}
@@ -183,6 +183,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmSystemAccount.Column)column.Id)
{
//-----------------------------------------------------------
// SystemAccount TypeDesc.
case SbmSystemAccount.Column.Type_Desc:
{
@@ -191,6 +192,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//-----------------------------------------------------------
// Notes.
case SbmSystemAccount.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -222,7 +224,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -124,6 +124,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmSystemAccountUser.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmSystemAccountUser.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -142,7 +143,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -30,7 +30,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(systemUserId)) return false;
SbmSystemUser.Params prmSystemUser = new SbmSystemUser.Params();
prmSystemUser.IncludedIds.Add(systemUserId);
prmSystemUser.IdsIncluded.Add(systemUserId);
prmSystemUser.StatusCat = SbmSystemUser.StatusCat.Any;
return GetSystemUserCount(prmSystemUser) == 1;
}
@@ -65,7 +65,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(systemUserId)) return null;
SbmSystemUser.Params prmSystemUser = new SbmSystemUser.Params();
prmSystemUser.IncludedIds.Add(systemUserId);
prmSystemUser.IdsIncluded.Add(systemUserId);
prmSystemUser.StatusCat = SbmSystemUser.StatusCat.Any;
return GetSystemUser(prmSystemUser);
}
@@ -174,6 +174,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmSystemUser.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmSystemUser.Column.Notes:
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));
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -27,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(assetId)) return false;
SbmAsset.Params prmAsset = new SbmAsset.Params();
prmAsset.IncludedIds.Add(assetId);
prmAsset.IdsIncluded.Add(assetId);
prmAsset.StatusCat = SbmAsset.StatusCat.Any;
return GetAssetCount(prmAsset) == 1;
}
@@ -54,7 +54,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(assetId)) return null;
SbmAsset.Params prmAsset = new SbmAsset.Params();
prmAsset.IncludedIds.Add(assetId);
prmAsset.IdsIncluded.Add(assetId);
prmAsset.StatusCat = SbmAsset.StatusCat.Any;
return GetAsset(prmAsset);
}
@@ -271,6 +271,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmAsset.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmAsset.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -289,7 +290,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -187,6 +187,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmAssetCategory.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmAssetCategory.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -205,7 +206,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -28,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(assetProcessId)) return false;
SbmAssetProcess.Params prmAssetProcess = new SbmAssetProcess.Params();
prmAssetProcess.IncludedIds.Add(assetProcessId);
prmAssetProcess.IdsIncluded.Add(assetProcessId);
prmAssetProcess.StatusCat = SbmAssetProcess.StatusCat.Any;
return GetAssetProcessCount(prmAssetProcess) == 1;
}
@@ -42,7 +42,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(assetProcessId)) return null;
SbmAssetProcess.Params prmAssetProcess = new SbmAssetProcess.Params();
prmAssetProcess.IncludedIds.Add(assetProcessId);
prmAssetProcess.IdsIncluded.Add(assetProcessId);
prmAssetProcess.StatusCat = SbmAssetProcess.StatusCat.Any;
return GetAssetProcess(prmAssetProcess);
}
@@ -147,6 +147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmAssetProcess.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmAssetProcess.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -165,7 +166,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -28,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SbmVehicle.Params prm = new SbmVehicle.Params();
prm.IncludedIds.Add(id);
prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicle.StatusCat.Any;
return GetVehicleCount(prm) == 1;
}
@@ -53,7 +53,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return null;
SbmVehicle.Params prm = new SbmVehicle.Params();
prm.IncludedIds.Add(id);
prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicle.StatusCat.Any;
return GetVehicle(prm);
}
@@ -173,6 +173,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmVehicle.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmVehicle.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -191,7 +192,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -182,6 +182,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmVehicleClass.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmVehicleClass.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -200,7 +201,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params();
prm.IncludedIds.Add(id);
prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicleEvent.StatusCat.Any;
return GetVehicleEventCount(prm) == 1;
}
@@ -39,7 +39,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(vehicleId) || (int)vehicleEventType < 1 || DateUtil.IsValid(eventOn)) return false;
SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params();
prm.IncludedIds.Add(vehicleId);
prm.IdsIncluded.Add(vehicleId);
prm.VehicleEventType = vehicleEventType;
prm.EventOn = eventOn;
prm.StatusCat = SbmVehicleEvent.StatusCat.Any;
@@ -55,7 +55,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return null;
SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params();
prm.IncludedIds.Add(id);
prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicleEvent.StatusCat.Any;
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;
SbmVehicleEvent.Params prm = new SbmVehicleEvent.Params();
prm.IncludedIds.Add(vehicleId);
prm.IdsIncluded.Add(vehicleId);
prm.VehicleEventType = vehicleEventType;
prm.EventOn = eventOn;
prm.StatusCat = SbmVehicleEvent.StatusCat.Any;
@@ -149,6 +149,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmVehicleEvent.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmVehicleEvent.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -167,7 +168,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SbmVehicleFeature.Params prm = new SbmVehicleFeature.Params();
prm.IncludedIds.Add(id);
prm.IdsIncluded.Add(id);
prm.StatusCat = SbmVehicleFeature.StatusCat.Any;
return GetVehicleFeatureCount(prm) == 1;
}
@@ -143,6 +143,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmVehicleFeature.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmVehicleFeature.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -161,7 +162,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -6,11 +6,14 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Commodity Manager.
//=======================================================================
public abstract partial class SbmCommodityMgr : SbmCoreMgr
{
//-------------------------------------------------------------------
// Data members.
// Code types.
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
{
//=======================================================================
// Commodity Manager - Commodity.
//=======================================================================
partial class SbmCommodityMgr
{
public object StringList { get; private set; }
//*******************************************************************
// C o m m o d i t i e s
//*******************************************************************
//-------------------------------------------------------------------
// Utilities.
public bool IsValidCode(String code)
{
if (StringUtil.IsEmpty(code)) return false;
if (StringUtil.IsBlank(code)) return false;
if (code != code.Trim(' ')) return false;
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.
//-------------------------------------------------------------------
@@ -309,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(commodityId)) return false;
SbmCommodity.Params prmCommodity = new SbmCommodity.Params();
prmCommodity.IncludedIds.Add(commodityId);
prmCommodity.IdsIncluded.Add(commodityId);
prmCommodity.StatusCat = SbmCommodity.StatusCat.Any;
return GetCommodityCount(prmCommodity) == 1;
}
@@ -343,7 +70,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(commodityId)) return null;
SbmCommodity.Params prmCommodity = new SbmCommodity.Params();
prmCommodity.IncludedIds.Add(commodityId);
prmCommodity.IdsIncluded.Add(commodityId);
prmCommodity.StatusCat = SbmCommodity.StatusCat.Any;
return GetCommodity(prmCommodity);
}
@@ -567,7 +294,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmCommodity.Column)column.Id)
{
//---------------------------------------------------------------
//-----------------------------------------------------------
// Commodity TypeDesc.
case SbmCommodity.Column.Type_Code:
case SbmCommodity.Column.Type_Desc:
@@ -590,7 +317,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Weight units.
case SbmCommodity.Column.Weight_Unit:
{
@@ -739,7 +466,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Commodity Codings Description.
case SbmCommodity.Column.RangeDesc:
{
@@ -796,7 +523,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Commodity Formatted Currency Values.
case SbmCommodity.Column.CostPrice_Fmt:
{
@@ -905,7 +632,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Customer Definition.
/*case SbmCommodity.Column.Cust_ProductCode:
case SbmCommodity.Column.Cust_AmountRetail:*/
@@ -942,7 +669,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
case SbmCommodity.Column.Cust_PromotionDesc:
break;*/
//---------------------------------------------------------------
//-----------------------------------------------------------
// Stock Bays.
case SbmCommodity.Column.Stock_Bays:
{
@@ -1014,7 +741,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
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.
case SbmCommodity.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -1045,14 +781,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
// Barcode Images.
case SbmCommodity.Column.BarcodeImagePath:
{
String commodityCode = values.GetValue(GetCommodityColumnDfn(SbmCommodity.Column.Code).DataName).ToString();
value = new DataValue(GetBarcodeImagePath(commodityCode));
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -11,12 +11,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Commodity Manager - Commodity Customer.
//=======================================================================
partial class SbmCommodityMgr
{
//*******************************************************************
// C o m m o d i t y C u s t o m e r s
//*******************************************************************
//-------------------------------------------------------------------
// Utilities.
public abstract bool CanManageCommodityCustomers();
@@ -30,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(commodityCustomerId)) return false;
SbmCommodityCustomer.Params prmCommodityCustomer = new SbmCommodityCustomer.Params();
prmCommodityCustomer.IncludedIds.Add(commodityCustomerId);
prmCommodityCustomer.IdsIncluded.Add(commodityCustomerId);
prmCommodityCustomer.StatusCat = SbmCommodityCustomer.StatusCat.Any;
return GetCommodityCustomerCount(prmCommodityCustomer) == 1;
}
@@ -165,7 +164,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmCommodityCustomer.Column)column.Id)
{
//---------------------------------------------------------------
//-----------------------------------------------------------
// Commodity Category.
case SbmCommodityCustomer.Column.Commodity_CategoryDesc:
{
@@ -193,7 +192,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmCommodityCustomer.GetStatusTriState(status));
}
break;
//---------------------------------------------------------------
//-----------------------------------------------------------
// CmdCustomer Formatted currency values.
case SbmCommodityCustomer.Column.AmountRetail_Fmt:
{
@@ -226,8 +226,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}*/
//---------------------------------------------------------------
//-----------------------------------------------------------
// Promotion Description.
case SbmCommodityCustomer.Column.PromotionDesc:
{
@@ -236,7 +235,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Notes.
case SbmCommodityCustomer.Column.Notes:
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));
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -9,12 +9,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Commodity Manager - Commodity Supplier.
//=======================================================================
partial class SbmCommodityMgr
{
//*******************************************************************
// C o m m o d i t y S u p p l i e r s
//*******************************************************************
//-------------------------------------------------------------------
// Utilities.
public abstract bool CanManageCommoditySuppliers();
@@ -28,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(commoditySupplierId)) return false;
SbmCommoditySupplier.Params prmCommoditySupplier = new SbmCommoditySupplier.Params();
prmCommoditySupplier.IncludedIds.Add(commoditySupplierId);
prmCommoditySupplier.IdsIncluded.Add(commoditySupplierId);
prmCommoditySupplier.StatusCat = SbmCommoditySupplier.StatusCat.Any;
return GetCommoditySupplierCount(prmCommoditySupplier) == 1;
}
@@ -42,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(commoditySupplierId)) return null;
SbmCommoditySupplier.Params prmCommoditySupplier = new SbmCommoditySupplier.Params();
prmCommoditySupplier.IncludedIds.Add(commoditySupplierId);
prmCommoditySupplier.IdsIncluded.Add(commoditySupplierId);
prmCommoditySupplier.StatusCat = SbmCommoditySupplier.StatusCat.Any;
return GetCommoditySupplier(prmCommoditySupplier);
}
@@ -142,7 +141,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmCommoditySupplier.Column)column.Id)
{
//---------------------------------------------------------------
//-----------------------------------------------------------
// Commodity Category.
case SbmCommoditySupplier.Column.Commodity_CategoryDesc:
{
@@ -170,11 +169,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmCommoditySupplier.GetStatusTriState(status));
}
break;
//---------------------------------------------------------------
//-----------------------------------------------------------
// CmdCustomer Formatted currency values.
//---------------------------------------------------------------
//-----------------------------------------------------------
// Notes.
case SbmCommoditySupplier.Column.Notes:
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));
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -10,12 +10,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Commodity Manager - Container.
//=======================================================================
partial class SbmCommodityMgr
{
//*******************************************************************
// C o n t a i n e r s
//*******************************************************************
//-------------------------------------------------------------------
// Utilities.
@@ -28,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(containerId)) return false;
SbmContainer.Params prmContainer = new SbmContainer.Params();
prmContainer.IncludedIds.Add(containerId);
prmContainer.IdsIncluded.Add(containerId);
return GetContainerCount(prmContainer) == 1;
}
@@ -53,7 +52,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(containerId)) return null;
SbmContainer.Params prmContainer = new SbmContainer.Params();
prmContainer.IncludedIds.Add(containerId);
prmContainer.IdsIncluded.Add(containerId);
return GetContainer(prmContainer);
}
@@ -196,7 +195,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Notes.
case SbmContainer.Column.Notes:
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));
break;
}
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -9,12 +9,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Commodity Manager - Container Item.
//=======================================================================
partial class SbmCommodityMgr
{
//*******************************************************************
// C o n t a i n e r s
//*******************************************************************
//-------------------------------------------------------------------
// Utilities.
public abstract String GetItemSource(Sbm.ItemType itemType, SysId itemId, bool brief = false);
@@ -29,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(containerItemId)) return false;
SbmContainerItem.Params prmContainerItem = new SbmContainerItem.Params();
prmContainerItem.IncludedIds.Add(containerItemId);
prmContainerItem.IdsIncluded.Add(containerItemId);
return GetContainerItemCount(prmContainerItem) == 1;
}
@@ -42,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(containerItemId)) return null;
SbmContainerItem.Params prmContainerItem = new SbmContainerItem.Params();
prmContainerItem.IncludedIds.Add(containerItemId);
prmContainerItem.IdsIncluded.Add(containerItemId);
return GetContainerItem(prmContainerItem);
}
@@ -163,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmContainerItem.Column)column.Id)
{
//---------------------------------------------------------------
//-----------------------------------------------------------
// Notes.
case SbmContainerItem.Column.Notes:
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));
break;
}
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -12,12 +12,12 @@ using static Sarand.Net.Standard.Base.Interfaces.SaInterfaceConsole;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Commodity Manager - Portfolio Item.
//=======================================================================
partial class SbmCommodityMgr
{
//*******************************************************************
// P o r t f o l i o I t e m
//*******************************************************************
//-------------------------------------------------------------------
// Utilities.
//-------------------------------------------------------------------
@@ -91,7 +91,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(portfolioItemId)) return false;
SbmPortfolioItem.Params prmPortfolioItem = new SbmPortfolioItem.Params();
prmPortfolioItem.IncludedIds.Add(portfolioItemId);
prmPortfolioItem.IdsIncluded.Add(portfolioItemId);
prmPortfolioItem.StatusCat = SbmPortfolioItem.StatusCat.Any;
return GetPortfolioItemCount(prmPortfolioItem) == 1;
}
@@ -116,7 +116,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(portfolioItemId)) return null;
SbmPortfolioItem.Params prmPortfolioItem = new SbmPortfolioItem.Params();
prmPortfolioItem.IncludedIds.Add(portfolioItemId);
prmPortfolioItem.IdsIncluded.Add(portfolioItemId);
prmPortfolioItem.StatusCat = SbmPortfolioItem.StatusCat.Any;
return GetPortfolioItem(prmPortfolioItem);
}
@@ -293,7 +293,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
+8 -8
View File
@@ -20,8 +20,8 @@ using System.Linq;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
public abstract class SbmCoreMgr : SbmItemMgr
//=======================================================================
public abstract class SbmCoreMgr : SbmItemMgr
{
//-------------------------------------------------------------------
// System code cache.
@@ -180,7 +180,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
// Consoles.
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } }
protected SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
@@ -243,23 +243,23 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
// Configuration console utilities.
public bool AllowConfigOption(Sbm.ConfigOption configOption)
{
return ConfigConsole.AllowOption(UserContext, configOption);
return SessionConsole.AllowOption(configOption);
}
public bool AllowAffiliateType(Sbm.AffiliateType affiliateType)
{
return ConfigConsole.AllowAffiliateType(UserContext, affiliateType);
return SessionConsole.AllowAffiliateType(affiliateType);
}
public bool AllowAssociationType(Sbm.AssociationType associationType)
{
return ConfigConsole.AllowAssociationType(UserContext, associationType);
return SessionConsole.AllowAssociationType(associationType);
}
public bool AllowTransactionType(Sbm.TransactionType transactionType)
{
return ConfigConsole.AllowTransactionType(UserContext, transactionType);
return SessionConsole.AllowTransactionType(transactionType);
}
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
{
//=======================================================================
// Data Item Manager.
//=======================================================================
public abstract partial class SbmDataItemMgr : SbmCoreMgr
{
@@ -10,12 +10,11 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
// Data Item Manager - Item Batches.
//=======================================================================
partial class SbmDataItemMgr
{
//*******************************************************************
// I t e m B a t c h e s
//*******************************************************************
//-------------------------------------------------------------------
// Utilities.
@@ -28,7 +27,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(itemBatchId)) return false;
SbmItemBatch.Params prmItemBatch = new SbmItemBatch.Params();
prmItemBatch.IncludedIds.Add(itemBatchId);
prmItemBatch.IdsIncluded.Add(itemBatchId);
prmItemBatch.StatusCat = SbmItemBatch.StatusCat.Any;
return GetItemBatchCount(prmItemBatch) == 1;
}
@@ -51,7 +50,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(itemBatchId)) return null;
SbmItemBatch.Params prmItemBatch = new SbmItemBatch.Params();
prmItemBatch.IncludedIds.Add(itemBatchId);
prmItemBatch.IdsIncluded.Add(itemBatchId);
prmItemBatch.StatusCat = SbmItemBatch.StatusCat.Any;
return GetItemBatch(prmItemBatch);
}
@@ -165,6 +164,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmItemBatch.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmItemBatch.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -183,7 +183,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
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
{
//=======================================================================
// Data Item Manager - Item Links.
//=======================================================================
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.
//-------------------------------------------------------------------
// ItemLink exists.
// Item exists.
public bool ItemLinkExistsById(SysId itemLinkId)
{
ClearErrorState();
if (!SysId.IsValid(itemLinkId)) return false;
SbmItemLink.Params prmItemLink = new SbmItemLink.Params();
prmItemLink.IncludedIds.Add(itemLinkId);
prmItemLink.IdsIncluded.Add(itemLinkId);
prmItemLink.StatusCat = SbmItemLink.StatusCat.Any;
return GetItemLinkCount(prmItemLink) == 1;
}
//-------------------------------------------------------------------
// Get itemLinks.
// Get items.
public abstract SbmItemLink GetItemLink(SbmItemLink.Params prm);
public SbmItemLink GetItemLinkById(SysId itemLinkId)
@@ -59,21 +38,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(itemLinkId)) return null;
SbmItemLink.Params prmItemLink = new SbmItemLink.Params();
prmItemLink.IncludedIds.Add(itemLinkId);
prmItemLink.IdsIncluded.Add(itemLinkId);
prmItemLink.StatusCat = SbmItemLink.StatusCat.Any;
return GetItemLink(prmItemLink);
}
//-------------------------------------------------------------------
// Create itemLinks.
// Create items.
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);
//-------------------------------------------------------------------
// Validate Item Link data.
// Validate item data.
public bool IsValidItemLink(SbmItemLink itemLink)
{
ClearErrorState();
@@ -83,7 +62,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
public virtual bool IsValidItemLinkData(SbmItemLink.Data data, SbmItemLink.ErrField errField)
{
ClearErrorState();
// ItemLink properties.
// Item properties.
if (errField.ItemLinkType != SacsHierarchyItem.ValidValue.Ignore)
{
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 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 StoreToItemLinks(Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeTo, SysId itemIdTo, 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, ItemId itemIdTo, List<SbmItemLink> itemLinks, DbUpdateInfo dbUpdateInfo);
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);
//-------------------------------------------------------------------
// ItemLink list.
// Item list.
public abstract ColumnDfn GetItemLinkColumnDfn(SbmItemLink.Column columnId, String caption = "", int width = 0);
public abstract List<String> GetItemLinkQueryFilter(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();
switch ((SbmItemLink.Column)column.Id)
{
//-----------------------------------------------------------
// Notes.
case SbmItemLink.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -209,7 +189,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -140,6 +140,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmPrice.Column)column.Id)
{
//-----------------------------------------------------------
// Price type.
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() : ""));
break;
}
//-----------------------------------------------------------
// Calculation method.
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() : ""));
break;
}
//-----------------------------------------------------------
// Rounder method.
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() : ""));
break;
}
// Rounder direction.
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() : ""));
break;
}
//-----------------------------------------------------------
// Sales dicount.
case SbmPrice.Column.SalesDiscountPercent:
{
@@ -196,12 +204,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(salesDiscountPercent);
break;
}
//-----------------------------------------------------------
// Notes.
case SbmPrice.Column.Notes:
{
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break;
}
// Status.
case SbmPrice.Column.Status_Desc:
case SbmPrice.Column.Status_Ind:
@@ -214,6 +225,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmPrice.GetStatusTriState(status));
break;
}
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -29,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(priceSetId)) return false;
SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params();
prmPriceSet.IncludedIds.Add(priceSetId);
prmPriceSet.IdsIncluded.Add(priceSetId);
prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any;
return GetPriceSetCount(prmPriceSet) == 1;
}
@@ -51,7 +51,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(priceSetId)) return null;
SbmPriceSet.Params prmPriceSet = new SbmPriceSet.Params();
prmPriceSet.IncludedIds.Add(priceSetId);
prmPriceSet.IdsIncluded.Add(priceSetId);
prmPriceSet.StatusCat = SbmPriceSet.StatusCat.Any;
return GetPriceSet(prmPriceSet);
}
@@ -152,6 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmPriceSet.Column)column.Id)
{
//-----------------------------------------------------------
// Price type.
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() : ""));
break;
}
//-----------------------------------------------------------
// Has Static Prices.
case SbmPriceSet.Column.HasStaticPrices_Tick:
case SbmPriceSet.Column.HasStaticPrices_Y:
@@ -170,12 +173,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
else value = new DataValue(hasStaticPrices);
break;
}
//-----------------------------------------------------------
// Notes.
case SbmPriceSet.Column.Notes:
{
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break;
}
// Status.
case SbmPriceSet.Column.Status_Desc:
case SbmPriceSet.Column.Status_Ind:
@@ -188,6 +194,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmPriceSet.GetStatusTriState(status));
break;
}
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
+5 -5
View File
@@ -8,8 +8,8 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
public abstract partial class SbmPriceMgr : SbmCoreMgr
//=======================================================================
public abstract partial class SbmPriceMgr : SbmCoreMgr
{
//-------------------------------------------------------------------
// Data members.
@@ -101,11 +101,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
// Price set is available but no valid 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)
bUseDiscount = configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.CustomerDiscountWhenNoPriceInSet);
bUseDiscount = sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.CustomerDiscountWhenNoPriceInSet);
else
bUseDiscount = configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.SupplierDiscountWhenNoPriceInSet);
bUseDiscount = sessionConsole != null && sessionConsole.AllowOption(Sbm.ConfigOption.SupplierDiscountWhenNoPriceInSet);
}
if (bUseDiscount)
{
@@ -31,7 +31,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(processId)) return false;
SbmProcess.Params prmProcess = new SbmProcess.Params();
prmProcess.IncludedIds.Add(processId);
prmProcess.IdsIncluded.Add(processId);
prmProcess.StatusCat = SbmProcess.StatusCat.Any;
return GetProcessCount(prmProcess) == 1;
}
@@ -45,7 +45,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(processId)) return null;
SbmProcess.Params prmProcess = new SbmProcess.Params();
prmProcess.IncludedIds.Add(processId);
prmProcess.IdsIncluded.Add(processId);
prmProcess.StatusCat = SbmProcess.StatusCat.Any;
return GetProcess(prmProcess);
}
@@ -145,7 +145,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmProcess.Column)column.Id)
{
//--------------------------------------------------------------- -
//-----------------------------------------------------------
// Process TypeDesc.
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()));
break;
}
// Process CategoryDesc.
case SbmProcess.Column.Category_Desc:
{
@@ -161,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//--------------------------------------------------------------- -
//-----------------------------------------------------------
// Notes.
case SbmProcess.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -180,7 +181,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -78,7 +78,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(locationId)) return false;
SbmLocation.Params prmLocation = new SbmLocation.Params();
prmLocation.IncludedIds.Add(locationId);
prmLocation.IdsIncluded.Add(locationId);
prmLocation.StatusCat = SbmLocation.StatusCat.Any;
return GetLocationCount(prmLocation) == 1;
}
@@ -103,7 +103,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(locationId)) return null;
SbmLocation.Params prmLocation = new SbmLocation.Params();
prmLocation.IncludedIds.Add(locationId);
prmLocation.IdsIncluded.Add(locationId);
prmLocation.StatusCat = SbmLocation.StatusCat.Any;
return GetLocation(prmLocation);
}
@@ -237,6 +237,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(SbmLocation.GetStatusTriState(status));
break;
}
//-----------------------------------------------------------
// Flags.
case SbmLocation.Column.SalesStock_Y:
case SbmLocation.Column.SalesStock_Tick:
@@ -259,7 +261,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -33,7 +33,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(movementId)) return false;
SbmMovement.Params prmMovement = new SbmMovement.Params();
prmMovement.IncludedIds.Add(movementId);
prmMovement.IdsIncluded.Add(movementId);
return GetMovementCount(prmMovement) == 1;
}
@@ -46,7 +46,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(movementId)) return null;
SbmMovement.Params prmMovement = new SbmMovement.Params();
prmMovement.IncludedIds.Add(movementId);
prmMovement.IdsIncluded.Add(movementId);
return GetMovement(prmMovement);
}
@@ -142,7 +142,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
//-----------------------------------------------------------
// Movement TypeDesc.
//---------------------------------------------------------------
//-----------------------------------------------------------
// Notes.
case SbmMovement.Column.Notes:
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));
break;
}
//-----------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -50,7 +50,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SbmConstituent.Params prmituent = new SbmConstituent.Params();
prmituent.IncludedIds.Add(id);
prmituent.IdsIncluded.Add(id);
prmituent.StatusCat = SbmConstituent.StatusCat.Any;
return GetConstituentCount(prmituent) == 1;
}
@@ -64,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return null;
SbmConstituent.Params prmituent = new SbmConstituent.Params();
prmituent.IncludedIds.Add(id);
prmituent.IdsIncluded.Add(id);
prmituent.StatusCat = SbmConstituent.StatusCat.Any;
return GetConstituent(prmituent);
}
@@ -192,7 +192,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmConstituent.Column)column.Id)
{
//-------------------------------------------------------------------
//-----------------------------------------------------------
// Constituent TypeDesc.
case SbmConstituent.Column.Type_Desc:
{
@@ -219,7 +219,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//-------------------------------------------------------------------
//-----------------------------------------------------------
// Started Date&Time.
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"));
break;
}
// Completed Date&Time.
case SbmConstituent.Column.Completed_DateFmt:
{
@@ -281,7 +282,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//-------------------------------------------------------------------
//-----------------------------------------------------------
// Due Indicator.
case SbmConstituent.Column.DueInd:
{
@@ -301,7 +302,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//-------------------------------------------------------------------
//-----------------------------------------------------------
// Notes.
case SbmConstituent.Column.Notes:
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));
break;
}
//-------------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -51,7 +51,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SbmRequirement.Params prmRequirement = new SbmRequirement.Params();
prmRequirement.ReqntIncludedIds.Add(id);
prmRequirement.RequirementIdsIncluded.Add(id);
prmRequirement.StatusCat = SbmRequirement.StatusCat.Any;
return GetRequirementCount(prmRequirement) == 1;
}
@@ -67,7 +67,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return null;
SbmRequirement.Params prmRequirement = new SbmRequirement.Params();
prmRequirement.ReqntIncludedIds.Add(id);
prmRequirement.RequirementIdsIncluded.Add(id);
prmRequirement.StatusCat = SbmRequirement.StatusCat.Any;
return GetRequirement(prmRequirement);
}
@@ -258,7 +258,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmRequirement.Column)column.Id)
{
//--------------------------------------------------------------- -(Requirement Details)
//-----------------------------------------------------------
// Requirement Promotion.
/// <summary> Precedence: & Hence:
/// <para>P1 ~ Requirement promotion - If not 'Commodity' requirement promotion requested.</para>
@@ -319,7 +319,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Association Coding.
case SbmRequirement.Column.Assoc_AccountManagerDesc:
{
@@ -334,7 +335,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction Coding.
case SbmRequirement.Column.Trans_ContactArea:
{
@@ -412,7 +413,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Reqnt-Trans Delivery TaxCode.
case SbmRequirement.Column.Trans_DeliveryTaxCode_Code:
case SbmRequirement.Column.Trans_DeliveryTaxCode_Rate:
@@ -466,7 +467,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(valAmount);
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction Cost & Margin.
case SbmRequirement.Column.Trans_CostTotal_Fmt:
case SbmRequirement.Column.Trans_AmountMargin:
@@ -521,7 +523,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction Flags (Allocation & Replacement).
case SbmRequirement.Column.Trans_AllocationInd:
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" : "");
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction Status.
case SbmRequirement.Column.Trans_StatusDesc:
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" : "");
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Required Date.
case SbmRequirement.Column.Required_Fmt:
{
@@ -606,7 +611,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(started.DayOfWeek.ToString());
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Allocation Indicators.
case SbmRequirement.Column.Allocation_Ind:
case SbmRequirement.Column.AllocationInd_YP:
@@ -630,7 +636,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Amount fields.
case SbmRequirement.Column.AmountUnitNet:
{
@@ -663,7 +670,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Display Estimated Time.
case SbmRequirement.Column.TimeEst:
case SbmRequirement.Column.TimeEstMins:
@@ -730,7 +738,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Job costing.
case SbmRequirement.Column.CostTotal_Fmt:
case SbmRequirement.Column.AmountMargin:
@@ -792,6 +800,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//-----------------------------------------------------------
// Requirement Notes.
case SbmRequirement.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -809,7 +818,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
break;
//------------------------------------------------------------------
//-----------------------------------------------------------
// Order or source order info.
case SbmRequirement.Column.OrderItem_JobNumber:
{
@@ -820,7 +829,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
// Commodity Codings.
case SbmRequirement.Column.Cmd_MaterialDesc:
{
@@ -835,7 +844,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------
//-----------------------------------------------------------
// Requirement Formatted Currency Value.
case SbmRequirement.Column.Cmd_CostPrice_Fmt:
{
@@ -929,7 +938,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
value = new DataValue(stockAvailable);
break;
}
//------------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -12,8 +12,8 @@ using System.Collections.Generic;
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
{
//=======================================================================
partial class SbmTransactionMgr
//=======================================================================
partial class SbmTransactionMgr
{
//*******************************************************************
// T r a n s a c t i o n s
@@ -46,7 +46,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SbmTransaction.Params prmTransaction = new SbmTransaction.Params();
prmTransaction.IncludedIds.Add(id);
prmTransaction.IdsIncluded.Add(id);
prmTransaction.StatusCat = SbmTransaction.StatusCat.Any;
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;
SbmTransaction.Params prmTransaction = new SbmTransaction.Params();
prmTransaction.IncludedIds.Add(affIdOwner);
prmTransaction.IdsIncluded.Add(affIdOwner);
prmTransaction.TransactionType = transactionType;
prmTransaction.TransRefFull = transactionRef;
prmTransaction.StatusCat = SbmTransaction.StatusCat.Any;
@@ -71,7 +71,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
ClearErrorState();
if (!SysId.IsValid(id)) return null;
SbmTransaction.Params prmTransaction = new SbmTransaction.Params();
prmTransaction.IncludedIds.Add(id);
prmTransaction.IdsIncluded.Add(id);
prmTransaction.StatusCat = SbmTransaction.StatusCat.Any;
return GetTransaction(prmTransaction);
}
@@ -83,7 +83,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
SbmTransaction transaction = null;
if (!SysId.IsValid(affIdOwner) || transactionType > 0 || StringUtil.IsEmpty(transRef)) return transaction;
SbmTransaction.Params prmTransaction = new SbmTransaction.Params();
prmTransaction.IncludedIds.Add(affIdOwner);
prmTransaction.IdsIncluded.Add(affIdOwner);
prmTransaction.TransactionType = Sbm.TransactionType.Any;
prmTransaction.TransRefFull = transRef;
prmTransaction.StatusCat = SbmTransaction.StatusCat.Any;
@@ -301,10 +301,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
}
// 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.
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.
SbmTransaction transRef = GetTransactionByOwnerTypeRef(data.AffiliateIdOwner, data.TransactionType, sRef);
if (transRef == null)
@@ -356,7 +356,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
DataValue value = new DataValue();
switch ((SbmTransaction.Column)column.Id)
{
//--------------------------------------------------------------------- -
//-----------------------------------------------------------
// Transaction TypeDesc.
case SbmTransaction.Column.Type_Desc:
{
@@ -374,7 +374,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//--------------------------------------------------------------------- -
//-----------------------------------------------------------
// Association Codings.
case SbmTransaction.Column.Assoc_AccountManagerDesc:
{
@@ -433,7 +433,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//--------------------------------------------------------------------- -
//-----------------------------------------------------------
// Transaction DeliveryAmount & Amount.
case SbmTransaction.Column.DeliveryAmountNet_Fmt:
case SbmTransaction.Column.DeliveryAmountTax_Fmt:
@@ -470,7 +470,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction cost and margin.
case SbmTransaction.Column.CostTotal_Fmt:
case SbmTransaction.Column.AmountMargin:
@@ -523,7 +523,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------------
//-----------------------------------------------------------
// Transaction Notes.
case SbmTransaction.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
@@ -593,7 +593,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
break;
}
//---------------------------------------------------------------------
//-----------------------------------------------------------
// Target 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());
break;
}
//---------------------------------------------------------------------
//-----------------------------------------------------------
default:
value = values.GetValue(column.DataName);
break;
}
return value;
}
@@ -19,8 +19,8 @@ using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
namespace Sarand.BusinessMgr.Net.Standard.Base.Procs
{
//=======================================================================
public abstract class SbmReport_Base : SaReport_Base
//=======================================================================
public abstract class SbmReport_Base : SaReport_Base
{
//-------------------------------------------------------------------
// Configuration.
@@ -66,7 +66,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Procs
protected SbmProcessMgr ProcessMgr { get { return Internals.ProcessMgr; } }
protected SbmDataItemMgr DataItemMgr { get { return Internals.DataItemMgr; } }
// Consoles.
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } }
protected SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
protected SaReferenceDataConsole ReferenceDataConsole { get { return Internals.ReferenceDataConsole; } }
@@ -8,8 +8,8 @@ using System;
namespace Sarand.BusinessMgr.Net.Standard.Base.UpdateLog
{
//=======================================================================
public class SbmUpdateLogItemMonitor : SaUpdateLogItemMonitor
//=======================================================================
public class SbmUpdateLogItemMonitor : SaUpdateLogItemMonitor
{
//-------------------------------------------------------------------
// Configuration.
@@ -26,7 +26,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.UpdateLog
//-------------------------------------------------------------------
// Data members.
private readonly Config config;
private SbmConfigConsole configConsole = null;
private SbmSessionConsole sessionConsole { get { return config.Internals.SessionConsole; } }
//-------------------------------------------------------------------
// Construction.
@@ -44,9 +44,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.UpdateLog
protected virtual bool IsColumnChangeLogged(SbmDbDfn.ColumnIdx columnIdx)
{
if (!config.UpdateLogConsole.CanUpdateDatabase) return false;
if (configConsole == null)
configConsole = config.Internals.ConfigConsole;
if (!configConsole.IsColumnChangeLogged(UserContext, columnIdx)) return false;
if (!sessionConsole.IsColumnChangeLogged(UserContext, columnIdx)) return false;
return true;
}
protected bool RecordAttrValue(SbmDbDfn.ColumnIdx columnIdx, String value, bool newValue)