Consolidate User Context
This commit is contained in:
@@ -30,6 +30,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaBusinessMgrCoreWebControl
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaBusinessMgrCoreWebPortal", "SaBusinessMgrCoreWebPortal\SaBusinessMgrCoreWebPortal.csproj", "{C7BA3DCA-5A4E-4541-899C-BF8208E276D5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaBusMgrTest_Portal", "SaBusMgrTest_Portal\SaBusMgrTest_Portal.csproj", "{3C833156-A879-420A-BA5B-CB828C209A5A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -80,6 +82,10 @@ Global
|
||||
{C7BA3DCA-5A4E-4541-899C-BF8208E276D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C7BA3DCA-5A4E-4541-899C-BF8208E276D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C7BA3DCA-5A4E-4541-899C-BF8208E276D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3C833156-A879-420A-BA5B-CB828C209A5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3C833156-A879-420A-BA5B-CB828C209A5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3C833156-A879-420A-BA5B-CB828C209A5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3C833156-A879-420A-BA5B-CB828C209A5A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// I n t e r f a c e O p t i o n D e f i n i t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
public static List<SaItemOptionDfn> GetInterfaceItemOptionDfns(SbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
public static List<SaItemOptionDfn> GetInterfaceItemOptionDfns(ISbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
{
|
||||
switch (interfaceCategory)
|
||||
{
|
||||
@@ -58,7 +59,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s i n g O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
public static List<SaProcess_Base.GroupData> GetProcessingOptions(SbmUserContext userContext, SaInterface interfaceObj)
|
||||
public static List<SaProcess_Base.GroupData> GetProcessingOptions(ISbmUserContext userContext, SaInterface interfaceObj)
|
||||
{
|
||||
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return new List<SaProcess_Base.GroupData>();
|
||||
List<SaProcess_Base.GroupData> optionGroups = null;
|
||||
@@ -89,7 +90,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// C o n f i g u r e P r o c e s s
|
||||
//-------------------------------------------------------------------
|
||||
public static SbmInterfaceProcess ConfigureProcess(SbmUserContext userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
||||
public static SbmInterfaceProcess ConfigureProcess(ISbmUserContext userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
||||
{
|
||||
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return null;
|
||||
switch (interfaceObj.Category)
|
||||
@@ -119,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s I n t e r f a c e
|
||||
//-------------------------------------------------------------------
|
||||
public static bool ProcessInterface(SbmUserContext userContext, SaInterface interfaceObj)
|
||||
public static bool ProcessInterface(ISbmUserContext userContext, SaInterface interfaceObj)
|
||||
{
|
||||
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return false;
|
||||
switch (interfaceObj.Category)
|
||||
@@ -148,7 +149,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
// I n v o k e P r o c e s s D e f i n i t i o n
|
||||
//-------------------------------------------------------------------
|
||||
// Invoke process based on definition from command line argument.
|
||||
public static bool InvokeProcessDefinition(SbmUserContext userContext, SacsProcessDefinition processDfn)
|
||||
public static bool InvokeProcessDefinition(ISbmUserContext userContext, SacsProcessDefinition processDfn)
|
||||
{
|
||||
//----------------------------------------------------------------
|
||||
// Log process definition.
|
||||
@@ -187,11 +188,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve interface.
|
||||
private static SaInterface GetSystemInterfaceByType(SbmUserContext userContext, short interfaceType, String caption)
|
||||
private static SaInterface GetSystemInterfaceByType(ISbmUserContext userContext, short interfaceType, String caption)
|
||||
{
|
||||
return GetInterfaceByCategoryType(userContext, SaInterfaceCategory.System, interfaceType, caption);
|
||||
}
|
||||
private static SaInterface GetInterfaceByCategoryType(SbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType, String caption)
|
||||
private static SaInterface GetInterfaceByCategoryType(ISbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType, String caption)
|
||||
{
|
||||
SaInterface saInterface = null;
|
||||
SaInterface.Params prmInterface = new SaInterface.Params();
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Net;
|
||||
using System.Text;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System.IO;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
{
|
||||
@@ -29,7 +30,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
}
|
||||
public new class Config : SbmProcess_Base.Config
|
||||
{
|
||||
protected Config (SbmUserContext userContext) : base(userContext)
|
||||
protected Config(ISbmUserContext userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
public SysId InterfaceId { get; set; }
|
||||
@@ -63,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Static initialisation.
|
||||
static SbmInterfaceProcess ()
|
||||
static SbmInterfaceProcess()
|
||||
{
|
||||
// Interface process groups.
|
||||
interfaceProcessGroups = new List<TypeCodeDesc>();
|
||||
@@ -73,12 +74,12 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmInterfaceProcess (Config config) : base(config)
|
||||
protected SbmInterfaceProcess(Config config) : base(config)
|
||||
{
|
||||
this.config = config;
|
||||
interfaceObj = InterfaceConsole.GetInterfaceById(config.InterfaceId);
|
||||
}
|
||||
protected override void Dispose (bool disposing)
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
@@ -96,7 +97,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate configuration.
|
||||
protected virtual bool ValidateConfig ()
|
||||
protected virtual bool ValidateConfig()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
@@ -104,7 +105,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s i n g
|
||||
//-------------------------------------------------------------------
|
||||
protected override void ResetProcess ()
|
||||
protected override void ResetProcess()
|
||||
{
|
||||
base.ResetProcess();
|
||||
}
|
||||
@@ -112,7 +113,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
//-------------------------------------------------------------------
|
||||
// I t e m O p t i o n D e f i n i t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
protected static SaItemOptionDfn InitItemOptionDfn (String itemOptionName, String itemOptionCaption, List<TypeCodeDesc> optionContexts = null)
|
||||
protected static SaItemOptionDfn InitItemOptionDfn(String itemOptionName, String itemOptionCaption, List<TypeCodeDesc> optionContexts = null)
|
||||
{
|
||||
SaItemOptionDfn itemOptionDfn = new SaItemOptionDfn();
|
||||
itemOptionDfn.Name = itemOptionName;
|
||||
@@ -131,13 +132,13 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s i n g E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
protected override void OnProcessStarting ()
|
||||
protected override void OnProcessStarting()
|
||||
{
|
||||
base.OnProcessStarting();
|
||||
if (config.InterfaceProcessCreation == InterfaceProcessCreation.OnStartProcessing)
|
||||
OpenInterfaceProcess();
|
||||
}
|
||||
protected override void OnProcessEnding ()
|
||||
protected override void OnProcessEnding()
|
||||
{
|
||||
CloseInterfaceProcess();
|
||||
base.OnProcessEnding();
|
||||
@@ -146,7 +147,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
//-------------------------------------------------------------------
|
||||
// I n t e r f a c e P r o c e s s
|
||||
//-------------------------------------------------------------------
|
||||
private bool OpenInterfaceProcess ()
|
||||
private bool OpenInterfaceProcess()
|
||||
{
|
||||
if (!SysId.IsValid(config.InterfaceId)) return false;
|
||||
|
||||
@@ -161,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
|
||||
return (interfaceProcess != null && interfaceProcess.InterfaceId.Equals(config.InterfaceId));
|
||||
}
|
||||
private bool CloseInterfaceProcess ()
|
||||
private bool CloseInterfaceProcess()
|
||||
{
|
||||
if (interfaceProcess == null) return false;
|
||||
|
||||
@@ -191,7 +192,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected bool LogInterfaceProcessMessage (String message, SaMessageLevel messageLevel = SaMessageLevel.Info)
|
||||
protected bool LogInterfaceProcessMessage(String message, SaMessageLevel messageLevel = SaMessageLevel.Info)
|
||||
{
|
||||
if (!OpenInterfaceProcess()) return false;
|
||||
|
||||
@@ -205,7 +206,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
//-------------------------------------------------------------------
|
||||
// I n t e r f a c e D a t a I t e m s
|
||||
//-------------------------------------------------------------------
|
||||
protected bool StoreInterfaceDataItem (SaInterfaceDataItem interfaceDataItem, SaStatus processStatus, SaStatus itemStatus, String itemCaption)
|
||||
protected bool StoreInterfaceDataItem(SaInterfaceDataItem interfaceDataItem, SaStatus processStatus, SaStatus itemStatus, String itemCaption)
|
||||
{
|
||||
if (!OK) return false;
|
||||
DateTime now = DateTime.Now;
|
||||
@@ -236,7 +237,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
//-------------------------------------------------------------------
|
||||
// A r c h i v e F i l e
|
||||
//-------------------------------------------------------------------
|
||||
protected bool SaveFileDataToArchive (String archiveRootFolder, String fileName, String fileExtension, String fileData, String fn)
|
||||
protected bool SaveFileDataToArchive(String archiveRootFolder, String fileName, String fileExtension, String fileData, String fn)
|
||||
{
|
||||
if (!OK) return false;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Net.Standard.Proc.Excel;
|
||||
using Sarand.Net.Standard.Base.Data;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
{
|
||||
@@ -28,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
// Configuration.
|
||||
public new class Config : SbmInterfaceProcess.Config
|
||||
{
|
||||
public Config (SbmUserContext userContext) : base(userContext)
|
||||
public Config (ISbmUserContext userContext) : base(userContext)
|
||||
{
|
||||
ItemType = Sbm.ItemType.Commodity;
|
||||
ProcessType = ProcessType.ExportData;
|
||||
@@ -1072,7 +1073,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
Export_Commodities,
|
||||
}
|
||||
/// <summary>Configure processing options.</summary>
|
||||
public static List<SaProcess_Base.GroupData> GetProcessingOptions (SbmUserContext userContext, SaInterface interfaceObj)
|
||||
public static List<SaProcess_Base.GroupData> GetProcessingOptions (ISbmUserContext userContext, SaInterface interfaceObj)
|
||||
{
|
||||
List<SaProcess_Base.GroupData> optionGroups = new List<SaProcess_Base.GroupData>();
|
||||
|
||||
@@ -1087,7 +1088,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Interfaces
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Process interface using selected options.</summary>
|
||||
public static SbmInterfaceProcess ConfigureProcess (SbmUserContext userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
||||
public static SbmInterfaceProcess ConfigureProcess (ISbmUserContext userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
||||
{
|
||||
if (processGroup.OptionGroup.Type == (int)InterfaceProcessGroup.Export)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.ItemOptions;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Proc.Procs;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
{
|
||||
@@ -37,11 +38,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
public new class Config : SaProcess.Config
|
||||
{
|
||||
protected Config (SbmUserContext userContext) : base()
|
||||
protected Config(ISbmUserContext userContext) : base()
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
/// <summary>Specific type of data item being handled.</summary>
|
||||
public Sbm.ItemType ItemType { get; set; } = Sbm.ItemType.Unknown;
|
||||
/// <summary>Format to import/export data.</summary>
|
||||
@@ -67,12 +68,12 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmProcess_Base (Config config) : base(config)
|
||||
protected SbmProcess_Base(Config config) : base(config)
|
||||
{
|
||||
this.config = config;
|
||||
if (!EnhancedLogging) EnhancedLogging = config.EnhancedLogging;
|
||||
}
|
||||
protected override void Dispose (bool disposing)
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
@@ -103,7 +104,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
}
|
||||
// Context.
|
||||
public SbmUserContext UserContext { get { return config.UserContext; } }
|
||||
public ISbmUserContext UserContext { get { return config.UserContext; } }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
protected SbmInternals Internals
|
||||
{
|
||||
@@ -122,12 +123,12 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
// Excel export.
|
||||
public static Color ExcelColumnHeadingColor { get; } = Color.LightYellow;
|
||||
// Security.
|
||||
protected SbmSecurityProfile SecurityProfile { get { return Internals.SecurityProfile; } }
|
||||
protected bool UserCanUpdateContacts { get { return (SecurityProfile != null && SecurityProfile.Contacts.CanUpdate); } }
|
||||
protected bool UserCanCreateContacts { get { return (SecurityProfile != null && SecurityProfile.Contacts.CanCreate); } }
|
||||
protected bool UserCanViewFinancials { get { return (SecurityProfile != null && SecurityProfile.Financial.CanViewFinancials); } }
|
||||
protected bool UserCanUpdateFinancials { get { return (SecurityProfile != null && SecurityProfile.Financial.CanUpdateFinancials); } }
|
||||
protected bool UserCanManageFinancials { get { return (SecurityProfile != null && SecurityProfile.Financial.CanViewFinancials); } }
|
||||
protected ISbmSecurityProfile SecurityProfile { get { return Internals.SecurityProfile; } }
|
||||
protected bool UserCanUpdateContacts { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateContacts); } }
|
||||
protected bool UserCanCreateContacts { get { return (SecurityProfile != null && SecurityProfile.UserCanCreateContacts); } }
|
||||
protected bool UserCanViewFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanViewFinancials()); } }
|
||||
protected bool UserCanUpdateFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateFinancials()); } }
|
||||
protected bool UserCanManageFinancials { get { return (SecurityProfile != null && SecurityProfile.UserCanUpdateFinancials()); } }
|
||||
// ToDo SbmForm SecurityProfile Assets.
|
||||
/*
|
||||
protected bool UserCanManageAssets { get { return (SecurityProfile != null && SecurityProfile.Assets.CanManage); } }
|
||||
@@ -155,21 +156,21 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
protected SbmStockControlConfig StockControlConfig { get { return Internals.StockControlConfig; } }
|
||||
protected SbmRequirementCostingConfig RequirementCostingConfig { get { return Internals.RequirementCostingConfig; } }
|
||||
// Currencies.
|
||||
protected List<SaCurrency> GetCurrencies ()
|
||||
protected List<SaCurrency> GetCurrencies()
|
||||
{
|
||||
return Internals.GetCurrencies();
|
||||
}
|
||||
|
||||
protected SaCurrency GetCurrencyById (SysId currencyId)
|
||||
protected SaCurrency GetCurrencyById(SysId currencyId)
|
||||
{
|
||||
return Internals.GetCurrencyById(currencyId);
|
||||
}
|
||||
protected SaCurrency GetCurrencyByCode (String currencyCode)
|
||||
protected SaCurrency GetCurrencyByCode(String currencyCode)
|
||||
{
|
||||
return Internals.GetCurrencyByCode(currencyCode);
|
||||
}
|
||||
protected static byte CurrencyDecimalsDefault { get { return SbmInternals.CurrencyDecimalsDefault; } }
|
||||
protected byte GetCurrencyDecimalsForCurrencyById (SysId currencyId)
|
||||
protected byte GetCurrencyDecimalsForCurrencyById(SysId currencyId)
|
||||
{
|
||||
return Internals.GetCurrencyDecimalsForCurrencyById(currencyId);
|
||||
}
|
||||
@@ -177,7 +178,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s i n g
|
||||
//-------------------------------------------------------------------
|
||||
protected virtual void ResetProcess ()
|
||||
protected virtual void ResetProcess()
|
||||
{
|
||||
ClearStatistics();
|
||||
}
|
||||
@@ -186,26 +187,26 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
// P r o c e s s i n g O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Are options supported - False by default.</summary>
|
||||
public virtual bool HasProcessingOptions ()
|
||||
public virtual bool HasProcessingOptions()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/// <summary>Are required options populated - True by default.</summary>
|
||||
public virtual bool AreProcessingOptionsComplete ()
|
||||
public virtual bool AreProcessingOptionsComplete()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/// <summary>Processing option definitions.</summary>
|
||||
public virtual List<SaItemOptionDfn> GetProcessingOptionDfns ()
|
||||
public virtual List<SaItemOptionDfn> GetProcessingOptionDfns()
|
||||
{
|
||||
return new List<SaItemOptionDfn>();
|
||||
}
|
||||
/// <summary>Processing options.</summary>
|
||||
public virtual List<SaItemOption> GetProcessingOptions ()
|
||||
public virtual List<SaItemOption> GetProcessingOptions()
|
||||
{
|
||||
return new List<SaItemOption>(processingOptions ?? new List<SaItemOption>());
|
||||
}
|
||||
public String GetProcessingOptionValue (String name, String context, String defaultValue = "")
|
||||
public String GetProcessingOptionValue(String name, String context, String defaultValue = "")
|
||||
{
|
||||
if (processingOptions == null)
|
||||
SetProcessingOptions(GetProcessingOptions());
|
||||
@@ -213,18 +214,18 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
return itemOption?.Value ?? defaultValue;
|
||||
}
|
||||
/// <summary>Store processing options.</summary>
|
||||
public virtual bool SetProcessingOptions (List<SaItemOption> processingOptions)
|
||||
public virtual bool SetProcessingOptions(List<SaItemOption> processingOptions)
|
||||
{
|
||||
this.processingOptions = new List<SaItemOption>(processingOptions);
|
||||
return true;
|
||||
}
|
||||
/// <summary>Allow process to update its own options.</summary>
|
||||
public virtual bool UpdateProcessingOptions ()
|
||||
public virtual bool UpdateProcessingOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/// <summary>Allow process to update its own options.</summary>
|
||||
public virtual bool UpdateOptions ()
|
||||
public virtual bool UpdateOptions()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -236,7 +237,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
{
|
||||
public class Stat
|
||||
{
|
||||
public Stat (int statType, int initialValue = 0)
|
||||
public Stat(int statType, int initialValue = 0)
|
||||
{
|
||||
StatType = statType;
|
||||
InitialValue = initialValue;
|
||||
@@ -244,52 +245,52 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
public int StatType { get; }
|
||||
public int InitialValue { get; }
|
||||
}
|
||||
public void Clear () { }
|
||||
public void Clear() { }
|
||||
public Dictionary<int, int> Statistics { get; } = new Dictionary<int, int>();
|
||||
}
|
||||
private readonly StatisticsData stats = new StatisticsData();
|
||||
protected int GetStatistic (int statisticType)
|
||||
protected int GetStatistic(int statisticType)
|
||||
{
|
||||
return stats.Statistics.GetValue(statisticType, 0);
|
||||
}
|
||||
protected int GetStatistic<T> (T statisticType) where T : struct, IConvertible
|
||||
protected int GetStatistic<T>(T statisticType) where T : struct, IConvertible
|
||||
{
|
||||
if (!(statisticType is Enum))
|
||||
throw new ArgumentException(this.GetFn("GetStatistic") + " parameter must be an enumerated type. Type supplied: " + typeof(T).Name);
|
||||
return GetStatistic((int)(statisticType as IConvertible));
|
||||
}
|
||||
protected int SetStatistic (int statisticType, int value)
|
||||
protected int SetStatistic(int statisticType, int value)
|
||||
{
|
||||
return stats.Statistics[statisticType] = value;
|
||||
}
|
||||
protected int SetStatistic<T> (T statisticType, int value) where T : struct, IConvertible
|
||||
protected int SetStatistic<T>(T statisticType, int value) where T : struct, IConvertible
|
||||
{
|
||||
if (!(statisticType is Enum))
|
||||
throw new ArgumentException(this.GetFn("SetStatistic") + " parameter must be an enumerated type. Type supplied: " + typeof(T).Name);
|
||||
return SetStatistic((int)(statisticType as IConvertible), value);
|
||||
}
|
||||
protected int IncrementStatistic (int statisticType, int increment = 1)
|
||||
protected int IncrementStatistic(int statisticType, int increment = 1)
|
||||
{
|
||||
return stats.Statistics[statisticType] = GetStatistic(statisticType) + increment;
|
||||
}
|
||||
protected int IncrementStatistic<T> (T statisticType, int increment = 1) where T : struct, IConvertible
|
||||
protected int IncrementStatistic<T>(T statisticType, int increment = 1) where T : struct, IConvertible
|
||||
{
|
||||
if (!(statisticType is Enum))
|
||||
throw new ArgumentException(this.GetFn("IncrementStatistic") + " parameter must be an enumerated type. Type supplied: " + typeof(T).Name);
|
||||
return IncrementStatistic((int)(statisticType as IConvertible), increment);
|
||||
}
|
||||
protected void ClearStatistic (int statisticType)
|
||||
protected void ClearStatistic(int statisticType)
|
||||
{
|
||||
if (stats.Statistics.ContainsKey(statisticType))
|
||||
stats.Statistics.Remove(statisticType);
|
||||
}
|
||||
protected void ClearStatistic<T> (T statisticType) where T : struct, IConvertible
|
||||
protected void ClearStatistic<T>(T statisticType) where T : struct, IConvertible
|
||||
{
|
||||
if (!(statisticType is Enum))
|
||||
throw new ArgumentException(this.GetFn("ClearStatistic") + " parameter must be an enumerated type. Type supplied: " + typeof(T).Name);
|
||||
ClearStatistic((int)(statisticType as IConvertible));
|
||||
}
|
||||
private void ClearStatistics ()
|
||||
private void ClearStatistics()
|
||||
{
|
||||
stats.Statistics.Clear();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -23,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
// Configuration.
|
||||
public new class Config : SbmProcess_Base.Config
|
||||
{
|
||||
public Config (SbmUserContext userContext) : base(userContext)
|
||||
public Config(ISbmUserContext userContext) : base(userContext)
|
||||
{
|
||||
ItemType = Sbm.ItemType.Commodity;
|
||||
DataFormat = DataFormatType.Excel;
|
||||
@@ -93,12 +94,12 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmProcess_Commodity_Export (Config config) : base(config)
|
||||
public SbmProcess_Commodity_Export(Config config) : base(config)
|
||||
{
|
||||
this.config = config;
|
||||
Params.CommodityProcessesExist = ProcessMgr.HasProcesses(Sbm.ProcessCategory.Commodity);
|
||||
}
|
||||
protected override void Dispose (bool disposing)
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
@@ -159,7 +160,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
private void CalculateItemCount ()
|
||||
private void CalculateItemCount()
|
||||
{
|
||||
if (Params.CommodityCountTotal >= 0 || !OK) return;
|
||||
Params.CommodityCountTotal = CommodityMgr.GetCommodityCount(config.CommodityParams);
|
||||
@@ -168,12 +169,12 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s i n g O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
public override bool HasProcessingOptions ()
|
||||
public override bool HasProcessingOptions()
|
||||
{
|
||||
PopulateProcessingOptionDfns();
|
||||
return true;
|
||||
}
|
||||
private void PopulateProcessingOptionDfns ()
|
||||
private void PopulateProcessingOptionDfns()
|
||||
{
|
||||
if (processingOptionDfns.Count > 0) return;
|
||||
if (config.ExportType == ExportType.ActualSales || config.ExportType == ExportType.ProjectedSales)
|
||||
@@ -211,7 +212,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
//-------------------------------------------------------------------
|
||||
// P r o c e s s i n g
|
||||
//-------------------------------------------------------------------
|
||||
protected override bool Run ()
|
||||
protected override bool Run()
|
||||
{
|
||||
SetProgressInfo("Preparing to export data to Excel.");
|
||||
ResetProcess();
|
||||
@@ -232,7 +233,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected override void ResetProcess ()
|
||||
protected override void ResetProcess()
|
||||
{
|
||||
base.ResetProcess();
|
||||
|
||||
@@ -242,7 +243,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private bool ValidateConfig ()
|
||||
private bool ValidateConfig()
|
||||
{
|
||||
if (!OK) return false;
|
||||
|
||||
@@ -268,7 +269,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
//-------------------------------------------------------------------
|
||||
// E x p o r t D a t a
|
||||
//-------------------------------------------------------------------
|
||||
private bool ExportData ()
|
||||
private bool ExportData()
|
||||
{
|
||||
if (!OK) return false;
|
||||
String fn = this.GetFn("ExportData");
|
||||
@@ -321,7 +322,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private void PrepareColumns ()
|
||||
private void PrepareColumns()
|
||||
{
|
||||
displayColumns.Clear();
|
||||
additionalQueryColumns.Clear();
|
||||
@@ -566,7 +567,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
//-------------------------------------------------------------------
|
||||
private class ProjectedSalesData
|
||||
{
|
||||
public void Clear ()
|
||||
public void Clear()
|
||||
{
|
||||
SalesBudget = 0.0m;
|
||||
Allocated = 0.0m;
|
||||
@@ -583,7 +584,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
//-------------------------------------------------------------------
|
||||
// E x p o r t C o m m o d i t i e s T o E x c e l
|
||||
//-------------------------------------------------------------------
|
||||
private bool ExportCommoditiesToExcel (SaMsSpreadsheet spreadsheet)
|
||||
private bool ExportCommoditiesToExcel(SaMsSpreadsheet spreadsheet)
|
||||
{
|
||||
if (!OK) return false;
|
||||
String fn = this.GetFn("ExportCommoditiesToExcel");
|
||||
@@ -591,13 +592,13 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
SetProgressInfo(progressPrefix + " - Preparing data");
|
||||
|
||||
// Projected sales.
|
||||
ProjectedSalesData[] projectedSales = new ProjectedSalesData [12];
|
||||
ProjectedSalesData[] projectedSales = new ProjectedSalesData[12];
|
||||
for (int projectedSaleIdx = 0; projectedSaleIdx < projectedSales.Length; projectedSaleIdx++)
|
||||
projectedSales[projectedSaleIdx] = new ProjectedSalesData();
|
||||
decimal[]projectedSalesBudget = new decimal[12];
|
||||
decimal[] projectedSalesBudget = new decimal[12];
|
||||
|
||||
// Columns to query.
|
||||
List<ColumnDfn> queryColumns = new List<ColumnDfn> (displayColumns);
|
||||
List<ColumnDfn> queryColumns = new List<ColumnDfn>(displayColumns);
|
||||
foreach (ColumnDfn column in additionalQueryColumns)
|
||||
{
|
||||
if (!queryColumns.HasId(column.Id))
|
||||
@@ -620,7 +621,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
// Progress is refreshed every few rows.
|
||||
long commodityCount = 0;
|
||||
Params.CommodityCountTotal = CommodityMgr.GetCommodityCount(config.CommodityParams);
|
||||
int progressRefreshRows = (int)Math.Max(5,Params.CommodityCountTotal/(Params.CommodityCountTotal>1000?1000:100));
|
||||
int progressRefreshRows = (int)Math.Max(5, Params.CommodityCountTotal / (Params.CommodityCountTotal > 1000 ? 1000 : 100));
|
||||
|
||||
using (DbResultSet resultSet = CommodityMgr.ExecuteCommodityQuery(queryColumns, config.CommodityParams))
|
||||
{
|
||||
@@ -641,7 +642,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
for (int monthIdx = 0; monthIdx < 12; monthIdx++)
|
||||
{
|
||||
DateTime monthDate = DateTime.Today.StartOfMonth().IncrementMonth(monthIdx);
|
||||
ProjectedSalesData projSales = projectedSales[monthIdx];
|
||||
ProjectedSalesData projSales = projectedSales[monthIdx];
|
||||
projSales.Clear();
|
||||
projSales.SalesBudget = values.GetDecimal(CommodityMgr.GetCommodityColumnDfn((SbmCommodity.Column)(SbmCommodity.Column.SalesProj_Jan + monthDate.Month - 1)).DataName);
|
||||
projSales.Allocated = values.GetDecimal(CommodityMgr.GetCommodityColumnDfn((SbmCommodity.Column)(SbmCommodity.Column.Stock_Allocated_MonthCurrent + monthIdx)).DataName);
|
||||
@@ -657,12 +658,12 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
|
||||
// Common values used in calculations.
|
||||
// Currently in stock.
|
||||
decimal currentStock = !col_CurrentLevel.IsEmpty() ? values.GetDecimal(col_CurrentLevel) : 0.0m;
|
||||
decimal currentStock = !col_CurrentLevel.IsEmpty() ? values.GetDecimal(col_CurrentLevel) : 0.0m;
|
||||
// Stock due imminently.
|
||||
decimal imminentStock = Math.Max(0.0m, !col_DueImminently.IsEmpty() ? values.GetDecimal(col_DueImminently) : 0.0m);
|
||||
decimal reorderLevel = !col_ReorderLevel.IsEmpty() ? values.GetDecimal(col_ReorderLevel) : 0.0m;
|
||||
decimal allocatedStock = !col_TotalAllocated.IsEmpty() ? values.GetDecimal(col_TotalAllocated) : 0.0m;
|
||||
decimal availableStock = currentStock - allocatedStock;
|
||||
decimal imminentStock = Math.Max(0.0m, !col_DueImminently.IsEmpty() ? values.GetDecimal(col_DueImminently) : 0.0m);
|
||||
decimal reorderLevel = !col_ReorderLevel.IsEmpty() ? values.GetDecimal(col_ReorderLevel) : 0.0m;
|
||||
decimal allocatedStock = !col_TotalAllocated.IsEmpty() ? values.GetDecimal(col_TotalAllocated) : 0.0m;
|
||||
decimal availableStock = currentStock - allocatedStock;
|
||||
|
||||
// Output the value for each column in turn.
|
||||
List<DataValue> cellValues = new List<DataValue>();
|
||||
@@ -716,7 +717,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
}
|
||||
else if (column.Id == (int)SbmCommodity.Column.Stock_AvailVsReorder)
|
||||
{
|
||||
decimal availPropReorder = (reorderLevel > 0.0m ? Math.Max(0,availableStock) * 100.0m / reorderLevel : 0.0m);
|
||||
decimal availPropReorder = (reorderLevel > 0.0m ? Math.Max(0, availableStock) * 100.0m / reorderLevel : 0.0m);
|
||||
value = new DataValue(availPropReorder);
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
@@ -759,7 +760,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
if (DateUtil.IsValid(config.CommodityParams.ProjectedSalesTo)) dTo = config.CommodityParams.ProjectedSalesTo;
|
||||
for (DateTime d = config.CommodityParams.ProjectedSalesFrom; DateUtil.IsValid(d) && d <= dTo; d.IncrementDate(1))
|
||||
{
|
||||
decimal salesProjMonth = projectedSalesBudget[d.Month-1];
|
||||
decimal salesProjMonth = projectedSalesBudget[d.Month - 1];
|
||||
salesProjPeriod += salesProjMonth / d.EndOfMonth().Day;
|
||||
}
|
||||
if (column.Id == (int)SbmCommodity.Column.SalesProj_Period)
|
||||
@@ -767,7 +768,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Procs
|
||||
else if (column.Id == (int)SbmCommodity.Column.StockSold_Period)
|
||||
{
|
||||
decimal stockSoldPeriod = values.GetDecimal(column.DataName);
|
||||
decimal percSoldVsBudget = salesProjPeriod > 0.0m ? stockSoldPeriod / salesProjPeriod * 100.0m : 0.0m;
|
||||
decimal percSoldVsBudget = salesProjPeriod > 0.0m ? stockSoldPeriod / salesProjPeriod * 100.0m : 0.0m;
|
||||
value = new DataValue(stockSoldPeriod);
|
||||
if (percSoldVsBudget < BudgetPercRed)
|
||||
attrCell.InteriorColourIndex = SaXlColourIndex.Rose;
|
||||
|
||||
@@ -16,6 +16,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
{
|
||||
@@ -31,7 +32,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
}
|
||||
protected class PrintPageConfig
|
||||
{
|
||||
public PrintPageConfig (Graphics graphics, PageSettings pageSettings, Rectangle pageBounds, Rectangle marginBounds, int pageNumber, int pageCount)
|
||||
public PrintPageConfig(Graphics graphics, PageSettings pageSettings, Rectangle pageBounds, Rectangle marginBounds, int pageNumber, int pageCount)
|
||||
{
|
||||
// Graphics for printing to physical device (printer or print preview control).
|
||||
Graphics = graphics;
|
||||
@@ -80,7 +81,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
// Configuration.
|
||||
public new class Config : SbmReport_Base.Config
|
||||
{
|
||||
protected Config (SbmUserContext userContext) :
|
||||
protected Config(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
@@ -101,11 +102,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmReport (Config config) : base(config)
|
||||
protected SbmReport(Config config) : base(config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
protected override void Dispose (bool disposing)
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
@@ -138,7 +139,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Text utilities.
|
||||
protected SizeF DrawString (Graphics graphics, String text, Font font, Brush brush, PointF position, StringFormat format)
|
||||
protected SizeF DrawString(Graphics graphics, String text, Font font, Brush brush, PointF position, StringFormat format)
|
||||
{
|
||||
if (!VirtualPrint)
|
||||
graphics.DrawString(text, font, brush, position, format);
|
||||
@@ -146,7 +147,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
SizeF sizeText = graphics.MeasureString(text, font);
|
||||
return sizeText;
|
||||
}
|
||||
protected SizeF DrawString (Graphics graphics, String text, Font font, Brush brush, RectangleF position, StringFormat format)
|
||||
protected SizeF DrawString(Graphics graphics, String text, Font font, Brush brush, RectangleF position, StringFormat format)
|
||||
{
|
||||
if (!VirtualPrint)
|
||||
graphics.DrawString(text, font, brush, position, format);
|
||||
@@ -162,10 +163,10 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Printer configuration.
|
||||
public abstract void ConfigurePrinter (PageSettings pageSettings);
|
||||
public abstract void ConfigurePrintPreview (PageSettings pageSettings);
|
||||
public abstract void ConfigurePageMargins (PageSettings pageSettings);
|
||||
protected abstract void InitDrawingTools (Graphics graphics, Rectangle bounds);
|
||||
public abstract void ConfigurePrinter(PageSettings pageSettings);
|
||||
public abstract void ConfigurePrintPreview(PageSettings pageSettings);
|
||||
public abstract void ConfigurePageMargins(PageSettings pageSettings);
|
||||
protected abstract void InitDrawingTools(Graphics graphics, Rectangle bounds);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P r i n t P a g e S e c t i o n
|
||||
@@ -179,10 +180,10 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
/// <para>eg. A single row in a printed table with optional headings.</para>
|
||||
/// <para>Method can be anonymous to allow other parameters to be passed in the context of the report's page printing, rathe rthan just relying on the Page Config.</para>
|
||||
/// </summary>
|
||||
protected delegate void PrintPageSectionFn ();
|
||||
protected delegate void PrintPageSectionFn();
|
||||
/// <summary> Print mode is either physical - printing to printer or preview control - or virtual - to test whether section fits on page. </summary>
|
||||
protected bool VirtualPrint { get { return printMode == PrintMode.Virtual; } }
|
||||
private void SwitchPrintMode (PrintMode mode, PrintPageConfig cfg)
|
||||
private void SwitchPrintMode(PrintMode mode, PrintPageConfig cfg)
|
||||
{
|
||||
printMode = mode;
|
||||
}
|
||||
@@ -190,7 +191,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
/// Test print the page section to verify that it fits on the page, before printing to the physical device.
|
||||
/// <para>Returns false if section doesn't fit on the page.</para>
|
||||
/// </summary>
|
||||
protected bool PrintPageSectionIfSpace (PrintPageConfig cfg, PrintPageSectionFn printPageSectionFn)
|
||||
protected bool PrintPageSectionIfSpace(PrintPageConfig cfg, PrintPageSectionFn printPageSectionFn)
|
||||
{
|
||||
// Make a note of the current print position and test print the section to the virtual page.
|
||||
int posYInitial = cfg.PosY;
|
||||
@@ -230,7 +231,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
//-------------------------------------------------------------------
|
||||
// P r i n t i n g
|
||||
//-------------------------------------------------------------------
|
||||
public virtual void BeginPrint (PrintAction printAction, int pageNumberFrom = 0, int pageNumberTo = 0)
|
||||
public virtual void BeginPrint(PrintAction printAction, int pageNumberFrom = 0, int pageNumberTo = 0)
|
||||
{
|
||||
String fn = GetType().Name + ".BeginPrint";
|
||||
if (DebugMode) SaLogger.Debug(fn + " PrintAction: " + printAction + ". Page range: " + pageNumberFrom + "-" + pageNumberTo + ". Page count: " + PageCount);
|
||||
@@ -242,8 +243,8 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
PreviewPrinting = printAction == PrintAction.PrintToPreview;
|
||||
FilePrinting = printAction == PrintAction.PrintToFile;
|
||||
}
|
||||
public virtual void QueryPageSettings (PageSettings pageSettings, PrintAction printAction) { }
|
||||
public PrintPageResult PrintPage (Graphics graphics, PageSettings pageSettings, Rectangle pageBounds, Rectangle marginBounds)
|
||||
public virtual void QueryPageSettings(PageSettings pageSettings, PrintAction printAction) { }
|
||||
public PrintPageResult PrintPage(Graphics graphics, PageSettings pageSettings, Rectangle pageBounds, Rectangle marginBounds)
|
||||
{
|
||||
String fn = GetType().Name + ".PrintPage";
|
||||
PageNumber++;
|
||||
@@ -288,11 +289,11 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
if (PageNumberTo > 0 && PageNumber + 1 > PageNumberTo) return PrintPageResult.NoMorePages;
|
||||
return printPageResult;
|
||||
}
|
||||
protected abstract PrintPageResult PrintPage (PrintPageConfig cfg);
|
||||
public virtual void EndPrint (PrintAction printAction) { }
|
||||
protected abstract PrintPageResult PrintPage(PrintPageConfig cfg);
|
||||
public virtual void EndPrint(PrintAction printAction) { }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected void LogPageSettings (Graphics graphics, PageSettings pageSettings, Rectangle pageBounds, Rectangle marginBounds)
|
||||
protected void LogPageSettings(Graphics graphics, PageSettings pageSettings, Rectangle pageBounds, Rectangle marginBounds)
|
||||
{
|
||||
// Log print configuration.
|
||||
List<StringPair> info = new List<StringPair>();
|
||||
@@ -311,13 +312,13 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Reports
|
||||
//-------------------------------------------------------------------
|
||||
// H e a d e r a n d F o o t e r
|
||||
//-------------------------------------------------------------------
|
||||
protected virtual void PrintHeader (PrintPageConfig cfg)
|
||||
protected virtual void PrintHeader(PrintPageConfig cfg)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Printing - Footer.
|
||||
protected virtual void PrintFooter (PrintPageConfig cfg)
|
||||
protected virtual void PrintFooter(PrintPageConfig cfg)
|
||||
{
|
||||
// Print footer - Format.
|
||||
SbmPrinter_Footer.Config footerConfig = new SbmPrinter_Footer.Config();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Core.Web.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -97,45 +98,45 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
// Create consoles.
|
||||
public override SbmConfigConsole CreateConfigConsole(SbmSessionContext sessionContext)
|
||||
{
|
||||
return null;
|
||||
return SbmConfigConsole.CreateConsole(sessionContext);
|
||||
}
|
||||
public override SaDiaryConsole CreateDiaryConsole(SbmUserContext userContext)
|
||||
public override SaDiaryConsole CreateDiaryConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaSecurityConsole CreateSecurityConsole(SbmUserContext userContext)
|
||||
public override SaSecurityConsole CreateSecurityConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmSecurityConsole_Web(userContext, GetBusMgrDatabase(userContext.SessionContext));
|
||||
return new SbmSecurityConsole_Web(userContext);
|
||||
}
|
||||
public override SaCodeTypeConsole CreateCodeTypeConsole(SbmUserContext userContext)
|
||||
public override SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaReferenceDataConsole CreateReferenceDataConsole(SbmUserContext userContext)
|
||||
public override SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaItemDataConsole CreateItemDataConsole(SbmUserContext userContext)
|
||||
public override SaItemDataConsole CreateItemDataConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaItemDocConsole CreateItemDocConsole(SbmUserContext userContext)
|
||||
public override SaItemDocConsole CreateItemDocConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaItemOptionConsole CreateItemOptionConsole(SbmUserContext userContext)
|
||||
public override SaItemOptionConsole CreateItemOptionConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaInterfaceConsole CreateInterfaceConsole(SbmUserContext userContext)
|
||||
public override SaInterfaceConsole CreateInterfaceConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public override SaUpdateLogConsole CreateUpdateLogConsole(SbmUserContext userContext)
|
||||
public override SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmUpdateLogConsole_Web(userContext, GetBusMgrDatabase(userContext.SessionContext));
|
||||
return new SbmUpdateLogConsole_Web(userContext);
|
||||
}
|
||||
public override SbmEmailConsole CreateEmailConsole(SbmUserContext userContext)
|
||||
public override SbmEmailConsole CreateEmailConsole(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmEmailConsole_Web(EmailConfig);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -8,18 +10,20 @@ using System.Text;
|
||||
namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmSessionData_Web : SbmSessionData
|
||||
public abstract class SbmSessionData_Web : SbmSessionData, ISbmUserContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Private construction - for JSON deserialisation.
|
||||
// Protected construction - for JSON deserialisation.
|
||||
protected SbmSessionData_Web(long sessionIdx, int itemIdx, SbmSessionContext sessionContext) :
|
||||
base(sessionIdx, itemIdx, sessionContext)
|
||||
{
|
||||
securityProfile = new SbmSecurityProfile(this, false);
|
||||
}
|
||||
// Protected construction.
|
||||
protected SbmSessionData_Web(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser) :
|
||||
base(sessionContext, securityItemUser, affiliateUser)
|
||||
protected SbmSessionData_Web(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations, SbmAssociation associationOrganisation, SbmAffiliate affiliateOrganisation) :
|
||||
base(sessionContext, securityItemUser, affiliateUser, supervisedOrganisations, associationOrganisation, affiliateOrganisation)
|
||||
{
|
||||
securityProfile = new SbmSecurityProfile(this, false);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -33,6 +37,30 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security Profile.
|
||||
private readonly SbmSecurityProfile securityProfile;
|
||||
public ISbmSecurityProfile SecurityProfile { get { return securityProfile; } }
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// ToDo: Organisation configuration.
|
||||
public String GetOrganisationOption(Sbm.OrganisationOption option, String context) { return null; }
|
||||
public String GetOrganisationOption(String optionName, String context) { return null; }
|
||||
public String GetOwnerOption_Value(Sbm.OrgOption_Value eCol) { return null; }
|
||||
public String GetOwnerOption_Folder(Sbm.OrgOption_Folder eCol) { return null; }
|
||||
public bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption eCol) { return false; }
|
||||
public String GetOwnerOption_Caption(Sbm.OrgOption_Caption eCol, String defautValue) { return defautValue; }
|
||||
public bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx eCol) { return false; }
|
||||
public bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn eCol) { return false; }
|
||||
public String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String defautValue) { return defautValue; }
|
||||
public int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int defautValue) { return defautValue; }
|
||||
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int defautValue) { return defautValue; }
|
||||
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int defautValue) { return defautValue; }
|
||||
public int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int defautValue = 2) { return defautValue; }
|
||||
public Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityTypeContext) { return Sbm.CommodityType.Unknown; }
|
||||
public SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation eLoc) { return null; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Contacts.
|
||||
public class ContactsData
|
||||
@@ -46,6 +74,19 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
}
|
||||
public ContactsData Contacts { get; } = new ContactsData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Commodities.
|
||||
public class CommoditiesData
|
||||
{
|
||||
public class FilterData
|
||||
{
|
||||
public uint PageNo { get; set; } = 1;
|
||||
public ushort PageLength { get; set; } = 16;
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
}
|
||||
public CommoditiesData Commodities { get; } = new CommoditiesData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -16,7 +17,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSecurityConsole_Web(SbmUserContext userContext, ISacsDatabase database) : base(userContext, database)
|
||||
public SbmSecurityConsole_Web(ISbmUserContext userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Consoles;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using System;
|
||||
@@ -15,7 +16,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmUpdateLogConsole_Web(SbmUserContext userContext, ISacsDatabase database) : base(userContext, database)
|
||||
public SbmUpdateLogConsole_Web(ISbmUserContext userContext) : base(userContext)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
};
|
||||
}
|
||||
private readonly SessionStorage sessionStorage = new SessionStorage();
|
||||
protected JsonSerializerSettings SbmSessionDataJsonSerializerSettings { get { return SessionStorage.JsonDeserialisationSettings; } }
|
||||
public static JsonSerializerSettings SbmSessionDataJsonSerializerSettings { get { return SessionStorage.JsonDeserialisationSettings; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public SbmSessionData_Web SessionData
|
||||
@@ -441,6 +441,10 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
|
||||
public Boolean Awaiting { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Awaiting)); } }
|
||||
public Boolean Active { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Active)); } }
|
||||
public Boolean Deleted { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Deleted)); } }
|
||||
public String CreatedOn { get; set; }
|
||||
public String CreatedOnFmt { get; set; }
|
||||
public String UpdatedOn { get; set; }
|
||||
public String UpdatedOnFmt { get; set; }
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
|
||||
// Security.
|
||||
public bool ValidUserSession { get { return SessionData?.ValidUserSession ?? false; } }
|
||||
public bool AwaitingLogin { get { return !ValidUserSession; } }
|
||||
public bool KeepLoggedIn { get { return !AwaitingLogin && SessionData.User.KeepLoggedIn; } }
|
||||
public bool KeepLoggedIn { get { return !AwaitingLogin && SessionData.KeepLoggedIn; } }
|
||||
/// <summary>Maximum length allowed for password entry: sign-up, change password etc.</summary>
|
||||
public int PasswordMaxLength { get; } = 32;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using System;
|
||||
@@ -14,10 +15,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// A p p l i c a t i o n V i e w s
|
||||
//-------------------------------------------------------------------
|
||||
// Jul-2021 ConfigConsole parameter added to avoid local creation. To be reviewed/replaced.
|
||||
public static bool IsViewApplicable(SbmUserContext userContext, SbmConfigConsole configConsole, Sbm.View view)
|
||||
public static bool IsViewApplicable(ISbmUserContext userContext, SbmConfigConsole configConsole, Sbm.View view)
|
||||
{
|
||||
//SbmConfigConsole configConsole = SbmGlobals.GetConfigConsole(userContext.SessionContext);
|
||||
SbmSecurityProfile securityProfile = userContext.SecurityProfile;
|
||||
ISbmSecurityProfile securityProfile = userContext.SecurityProfile;
|
||||
switch (view)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
@@ -262,7 +263,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// A p p l i c a t i o n M e n u
|
||||
//-------------------------------------------------------------------
|
||||
public static bool IsMenuOptionApplicable(SbmUserContext userContext, SbmConfigConsole configConsole, Sbm.MenuOption menuOption)
|
||||
public static bool IsMenuOptionApplicable(ISbmUserContext userContext, SbmConfigConsole configConsole, Sbm.MenuOption menuOption)
|
||||
{
|
||||
String fn = ClassName + ".IsMenuOptionApplicable";
|
||||
if (!userContext.ValidUser)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Consoles;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -83,16 +84,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Create consoles.
|
||||
public abstract SbmConfigConsole CreateConfigConsole(SbmSessionContext sessionContext);
|
||||
public abstract SaDiaryConsole CreateDiaryConsole(SbmUserContext userContext);
|
||||
public abstract SaSecurityConsole CreateSecurityConsole(SbmUserContext userContext);
|
||||
public abstract SaCodeTypeConsole CreateCodeTypeConsole(SbmUserContext userContext);
|
||||
public abstract SaReferenceDataConsole CreateReferenceDataConsole(SbmUserContext userContext);
|
||||
public abstract SaItemDataConsole CreateItemDataConsole(SbmUserContext userContext);
|
||||
public abstract SaItemDocConsole CreateItemDocConsole(SbmUserContext userContext);
|
||||
public abstract SaItemOptionConsole CreateItemOptionConsole(SbmUserContext userContext);
|
||||
public abstract SaInterfaceConsole CreateInterfaceConsole(SbmUserContext userContext);
|
||||
public abstract SaUpdateLogConsole CreateUpdateLogConsole(SbmUserContext userContext);
|
||||
public abstract SbmEmailConsole CreateEmailConsole(SbmUserContext userContext);
|
||||
public abstract SaDiaryConsole CreateDiaryConsole(ISbmUserContext userContext);
|
||||
public abstract SaSecurityConsole CreateSecurityConsole(ISbmUserContext userContext);
|
||||
public abstract SaCodeTypeConsole CreateCodeTypeConsole(ISbmUserContext userContext);
|
||||
public abstract SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext userContext);
|
||||
public abstract SaItemDataConsole CreateItemDataConsole(ISbmUserContext userContext);
|
||||
public abstract SaItemDocConsole CreateItemDocConsole(ISbmUserContext userContext);
|
||||
public abstract SaItemOptionConsole CreateItemOptionConsole(ISbmUserContext userContext);
|
||||
public abstract SaInterfaceConsole CreateInterfaceConsole(ISbmUserContext userContext);
|
||||
public abstract SaUpdateLogConsole CreateUpdateLogConsole(ISbmUserContext userContext);
|
||||
public abstract SbmEmailConsole CreateEmailConsole(ISbmUserContext userContext);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Procs;
|
||||
using Sarand.Net.Standard.Accounts.QuickBooks.App;
|
||||
using Sarand.Net.Standard.Accounts.Sage.App;
|
||||
@@ -144,7 +145,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application Configuration. - AllowOption.
|
||||
public virtual bool AllowOption(SbmUserContext userContext, Sbm.ConfigOption option)
|
||||
public virtual bool AllowOption(ISbmUserContext userContext, Sbm.ConfigOption option)
|
||||
{
|
||||
switch (option)
|
||||
{
|
||||
@@ -323,24 +324,24 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// I t e m s
|
||||
//-------------------------------------------------------------------
|
||||
// Item Data Interface.
|
||||
public virtual bool CanUpdateItemData(SbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
public virtual bool CanUpdateItemData(ISbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool DoUpdateItemData(SbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
public virtual bool DoUpdateItemData(ISbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool CanRemoveItemData(SbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
public virtual bool CanRemoveItemData(ISbmUserContext userContext, Sbm.ItemDataType itemDataType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update Log.
|
||||
public virtual bool IsColumnChangeLogged(SbmUserContext userContext, SbmDbDfn.ColumnIdx column)
|
||||
public virtual bool IsColumnChangeLogged(ISbmUserContext userContext, SbmDbDfn.ColumnIdx column)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -357,17 +358,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Supported Data Item Types.
|
||||
// Supported affiliate types (all allowed by default).
|
||||
public virtual bool AllowAffiliateType(SbmUserContext userContext, Sbm.AffiliateType type)
|
||||
public virtual bool AllowAffiliateType(ISbmUserContext userContext, Sbm.AffiliateType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Supported Association types (all allowed by default).
|
||||
public virtual bool AllowAssociationType(SbmUserContext userContext, Sbm.AssociationType type)
|
||||
public virtual bool AllowAssociationType(ISbmUserContext userContext, Sbm.AssociationType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Supported Transaction types.
|
||||
public virtual bool AllowTransactionType(SbmUserContext userContext, Sbm.TransactionType type)
|
||||
public virtual bool AllowTransactionType(ISbmUserContext userContext, Sbm.TransactionType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -392,7 +393,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// D a t a O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
// Application Configuration. - Display and caption for data attributes.
|
||||
public virtual bool DisplayAttribute(SbmUserContext userContext, SbmDbDfn.ColumnIdx column)
|
||||
public virtual bool DisplayAttribute(ISbmUserContext userContext, SbmDbDfn.ColumnIdx column)
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
@@ -436,7 +437,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Alternative data value captions.
|
||||
public virtual String GetAttributeCaption(SbmUserContext userContext, SbmDbDfn.ColumnIdx column, string Default)
|
||||
public virtual String GetAttributeCaption(ISbmUserContext userContext, SbmDbDfn.ColumnIdx column, string Default)
|
||||
{
|
||||
String Caption = "";
|
||||
if (column != SbmDbDfn.ColumnIdx.Unknown)
|
||||
@@ -451,7 +452,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// T r a n s a c t i o n O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
// Job Tracking Options.
|
||||
public virtual String GetDefaultQuoteDescIntro(SbmUserContext userContext)
|
||||
public virtual String GetDefaultQuoteDescIntro(ISbmUserContext userContext)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@@ -459,11 +460,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Transaction Maintenance Dialogs.
|
||||
/*
|
||||
public SapDlgUpdateTransaction GetCreateTransactionDlg (SbmUserContext userContext, SysId id, Sbm.TransactionType type)
|
||||
public SapDlgUpdateTransaction GetCreateTransactionDlg (ISbmUserContext userContext, SysId id, Sbm.TransactionType type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public SapDlgUpdateTransaction GetUpdateTransactionDlg (SbmUserContext userContext, Sbm.TransactionType type, bool readOnly)
|
||||
public SapDlgUpdateTransaction GetUpdateTransactionDlg (ISbmUserContext userContext, Sbm.TransactionType type, bool readOnly)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -471,7 +472,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Transaction.
|
||||
public virtual bool CanCreateTransactionLocally(SbmUserContext userContext, Sbm.TransactionType type)
|
||||
public virtual bool CanCreateTransactionLocally(ISbmUserContext userContext, Sbm.TransactionType type)
|
||||
{
|
||||
if (!AllowTransactionType(userContext, type)) return false;
|
||||
// Refresh options.
|
||||
@@ -553,7 +554,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
System, Manual, Option
|
||||
}
|
||||
public virtual AssignTransRefMethod TransactionAssignRefMethod(SbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
public virtual AssignTransRefMethod TransactionAssignRefMethod(ISbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
{
|
||||
return AssignTransRefMethod.System;
|
||||
}
|
||||
@@ -561,20 +562,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
ByOwnerType, ByType
|
||||
}
|
||||
public virtual AssignTransRefSource TransactionAssignRefSource(SbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
public virtual AssignTransRefSource TransactionAssignRefSource(ISbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
{
|
||||
return AssignTransRefSource.ByOwnerType;
|
||||
}
|
||||
|
||||
// By default all types of transaction have their own Id sequence.
|
||||
// Override this method to allow different types of transaction to share Id sequence.
|
||||
public virtual Sbm.TransactionType GetTransactionTypeForNextId(SbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
public virtual Sbm.TransactionType GetTransactionTypeForNextId(ISbmUserContext userContext, Sbm.TransactionType transTypes)
|
||||
{
|
||||
return transTypes;
|
||||
}
|
||||
|
||||
// NextId key value.
|
||||
public virtual String GetTransactionNextIdKey(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType eType)
|
||||
public virtual String GetTransactionNextIdKey(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType eType)
|
||||
{
|
||||
idAssoc = new SysId();
|
||||
Sbm.TransactionType transTypes = GetTransactionTypeForNextId(userContext, eType);
|
||||
@@ -590,7 +591,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
// Set the minimum Id for transactions of the specified type.
|
||||
public virtual bool SetMinTransactionId(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long iId)
|
||||
public virtual bool SetMinTransactionId(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long iId)
|
||||
{
|
||||
bool set = false;
|
||||
if (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) != null)
|
||||
@@ -604,7 +605,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// The implementation in this class will generate simple numeric values for the owner
|
||||
// and global options that can be formatted (eg. to fixed length) by overwridden versions.
|
||||
public virtual String GetTransactionCreateRef
|
||||
(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
||||
(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
||||
{
|
||||
String Ref = "";
|
||||
if (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) != null)
|
||||
@@ -617,7 +618,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
public virtual String FormatTransactionCreateRef
|
||||
(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt)
|
||||
(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes, long RefInt)
|
||||
{
|
||||
String Ref = "";
|
||||
if (RefInt > 0)
|
||||
@@ -633,7 +634,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return Ref;
|
||||
}
|
||||
|
||||
public virtual int GetTransactionRefSeqLength(SbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
||||
public virtual int GetTransactionRefSeqLength(ISbmUserContext userContext, SysId AffiliateId_Owner, SysId idAssoc, Sbm.TransactionType transTypes)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
@@ -647,7 +648,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Raise Transaction.
|
||||
public virtual bool CanRaiseTransaction(SbmUserContext userContext, Sbm.TransactionType typeFrom, Sbm.TransactionType typeTo)
|
||||
public virtual bool CanRaiseTransaction(ISbmUserContext userContext, Sbm.TransactionType typeFrom, Sbm.TransactionType typeTo)
|
||||
{
|
||||
if (!AllowTransactionType(userContext, typeFrom) || !AllowTransactionType(userContext, typeTo)) return false;
|
||||
if (!CanCreateTransactionLocally(userContext, typeTo)) return false;
|
||||
@@ -743,7 +744,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseFrom(SbmUserContext userContext, Sbm.TransactionType typeFrom)
|
||||
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseFrom(ISbmUserContext userContext, Sbm.TransactionType typeFrom)
|
||||
{
|
||||
// Build the list of transaction types that are allowed to be raised from the specified type.
|
||||
List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>();
|
||||
@@ -758,7 +759,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseTo(SbmUserContext userContext, Sbm.TransactionType typeTo)
|
||||
public virtual List<TypeCodeDesc> GetTransactionTypesForRaiseTo(ISbmUserContext userContext, Sbm.TransactionType typeTo)
|
||||
{
|
||||
// Build the list of transaction types that are allowed to be raised to the specified type.
|
||||
List<TypeCodeDesc> transTypes = new List<TypeCodeDesc>();
|
||||
@@ -776,7 +777,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Prepare Requirements Transaction. - Prepare copied list of requirements, eg. when raising from another transaction.
|
||||
public virtual bool PrepareCopiedRequirements(SbmUserContext userContext, SbmTransaction transSource, List<SbmRequirement> requireList, Sbm.TransactionType type)
|
||||
public virtual bool PrepareCopiedRequirements(ISbmUserContext userContext, SbmTransaction transSource, List<SbmRequirement> requireList, Sbm.TransactionType type)
|
||||
{
|
||||
type = new Sbm.TransactionType();
|
||||
//transSource; requireList; type;
|
||||
@@ -785,7 +786,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Remove Transaction.- By default, not allowed if transaction has requirements.
|
||||
public virtual bool CanRemoveTransactionWithRequirements(SbmUserContext userContext, SbmTransaction transaction, int requirementCount)
|
||||
public virtual bool CanRemoveTransactionWithRequirements(ISbmUserContext userContext, SbmTransaction transaction, int requirementCount)
|
||||
{
|
||||
if (transaction == null || !SysId.IsValid(transaction.Id)) return false;
|
||||
return (requirementCount < 1);
|
||||
@@ -793,7 +794,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Tax Effective Date. - TransTypes that should use the 'In Progress' date as tax point as opposed to the 'Raised' date.
|
||||
public virtual bool UseInProgressTaxDateAsTaxPoint(SbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
public virtual bool UseInProgressTaxDateAsTaxPoint(ISbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
{
|
||||
switch (transactionType)
|
||||
{
|
||||
@@ -811,14 +812,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// R e q u i r e m e n t O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
// Requirement Actions.
|
||||
public virtual bool SearchCommodityOnCreateRequirement(SbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
public virtual bool SearchCommodityOnCreateRequirement(ISbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Requirement Costing.
|
||||
public virtual SbmRequirementCostingConfig GetRequirementCostingConfig(SbmUserContext userContext)
|
||||
public virtual SbmRequirementCostingConfig GetRequirementCostingConfig(ISbmUserContext userContext)
|
||||
{
|
||||
SbmRequirementCostingConfig cfgRequirementCosting = new SbmRequirementCostingConfig();
|
||||
return cfgRequirementCosting;
|
||||
@@ -828,21 +829,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// C o m m o d i t y O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
// Commodity Management.
|
||||
public virtual Sbm.CommodityType GetCommodityTypeDefault(SbmUserContext userContext, Sbm.OrgOption_CommodityType commodityType)
|
||||
public virtual Sbm.CommodityType GetCommodityTypeDefault(ISbmUserContext userContext, Sbm.OrgOption_CommodityType commodityType)
|
||||
{
|
||||
// Default = 'Stock'.
|
||||
return Sbm.CommodityType.Stock;
|
||||
}
|
||||
|
||||
// Clean-up imported data (default no action).
|
||||
public virtual bool CleanupImportedCommodity(SbmUserContext userContext, SbmCommodity commodity)
|
||||
public virtual bool CleanupImportedCommodity(ISbmUserContext userContext, SbmCommodity commodity)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Stock Control
|
||||
public virtual SbmStockControlConfig GetStockControlConfig(SbmUserContext userContext)
|
||||
public virtual SbmStockControlConfig GetStockControlConfig(ISbmUserContext userContext)
|
||||
{
|
||||
SbmStockControlConfig cfgStockControl = new SbmStockControlConfig();
|
||||
return cfgStockControl;
|
||||
@@ -852,20 +853,20 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// R e p o r t i n g
|
||||
//-------------------------------------------------------------------
|
||||
// Available reports (over and above standard).
|
||||
public virtual List<SbmReport_Base> GetReports(SbmUserContext userContext, Sbm.View view)
|
||||
public virtual List<SbmReport_Base> GetReports(ISbmUserContext userContext, Sbm.View view)
|
||||
{
|
||||
return new List<SbmReport_Base>();
|
||||
}
|
||||
public virtual bool ItemHasDiaryReports(SbmUserContext userContext/*SaItemId &*/)
|
||||
public virtual bool ItemHasDiaryReports(ISbmUserContext userContext/*SaItemId &*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
public virtual List<SbmReport_Base> GetDiaryReports(SbmUserContext userContext, SaDiaryReport_Params &)
|
||||
public virtual List<SbmReport_Base> GetDiaryReports(ISbmUserContext userContext, SaDiaryReport_Params &)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual List<SbmReport_Base> GetDiaryReportsForItem(SbmUserContext userContext, ItemId itemId)
|
||||
public virtual List<SbmReport_Base> GetDiaryReportsForItem(ISbmUserContext userContext, ItemId itemId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -882,7 +883,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
/// <summary>Sales Invoice report horizontal lines [Bool]</summary>
|
||||
RptSalesInvoiceHorizontalLines = 111,
|
||||
}
|
||||
public virtual DataValue GetDefaultProcessParam(SbmUserContext userContext, ProcessParam prm)
|
||||
public virtual DataValue GetDefaultProcessParam(ISbmUserContext userContext, ProcessParam prm)
|
||||
{
|
||||
switch (prm)
|
||||
{
|
||||
@@ -895,18 +896,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Automated processes.
|
||||
public virtual bool PerformProcess(SbmUserContext userContext, Sbm.ProcessType type)
|
||||
public virtual bool PerformProcess(ISbmUserContext userContext, Sbm.ProcessType type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Available data import/export processes (over and above standard).
|
||||
public virtual List<ISbmProcess_DataImport> GetImportProcesses(SbmUserContext userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
||||
public virtual List<ISbmProcess_DataImport> GetImportProcesses(ISbmUserContext userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
||||
{
|
||||
return new List<ISbmProcess_DataImport>();
|
||||
}
|
||||
|
||||
public virtual List<ISbmProcess_DataExport> GetExportProcesses(SbmUserContext userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
||||
public virtual List<ISbmProcess_DataExport> GetExportProcesses(ISbmUserContext userContext, Sbm.InterfaceDataType dataType, List<SysId> itemIds)
|
||||
{
|
||||
return new List<ISbmProcess_DataExport>();
|
||||
}
|
||||
@@ -925,7 +926,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public String ItemDesc { get; }
|
||||
public String ItemText { get; }
|
||||
};
|
||||
public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(SbmUserContext userContext, SbmRequirement requirement)
|
||||
public virtual DataExportItemDetails GetDataExportInvoiceItemDetails(ISbmUserContext userContext, SbmRequirement requirement)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -933,7 +934,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// I n t e r f a c e O p t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
public virtual bool AllowInterfaces(SbmUserContext userContext)
|
||||
public virtual bool AllowInterfaces(ISbmUserContext userContext)
|
||||
{
|
||||
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Website)) return true;
|
||||
if (AllowInterfaceCategory(userContext, SaInterfaceCategory.Accounts)) return true;
|
||||
@@ -942,7 +943,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool AllowInterfaceCategory(SbmUserContext userContext, SaInterfaceCategory interfaceCategory)
|
||||
public virtual bool AllowInterfaceCategory(ISbmUserContext userContext, SaInterfaceCategory interfaceCategory)
|
||||
{
|
||||
// By default, only website and file interfaces are allowed.
|
||||
switch (interfaceCategory)
|
||||
@@ -954,7 +955,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool AllowInterface(SbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
public virtual bool AllowInterface(ISbmUserContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
{
|
||||
if (!AllowInterfaceCategory(userContext, interfaceCategory)) return false;
|
||||
switch (interfaceCategory)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
@@ -100,7 +101,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public virtual String LinkSuffix { get { return ""; } }
|
||||
//---------------------------------------------------------------
|
||||
// Utilities.
|
||||
public virtual bool Refresh(SbmUserContext userContext)
|
||||
public virtual bool Refresh(ISbmUserContext userContext)
|
||||
{
|
||||
ItemCount = 0;
|
||||
switch (LinkType)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
@@ -58,7 +59,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmInternals(SbmUserContext userContext)
|
||||
public SbmInternals(ISbmUserContext userContext)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
@@ -96,9 +97,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Session properties.
|
||||
public SbmApplication Application { get { return SbmGlobals.Application; } }
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
public SbmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } }
|
||||
public ISbmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } }
|
||||
public SbmAccountsDfn AccountsDfn { get { if (accountsDfn == null) accountsDfn = new SbmAccountsDfn(UserContext); { return accountsDfn; } } }
|
||||
// Database.
|
||||
public ISacsDatabase BusMgrDatabase { get { return Application.GetBusMgrDatabase(SessionContext); } }
|
||||
@@ -114,6 +115,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return new List<TypeCodeDesc>(systemCodeCache.GetValueOrDefault(systemCode, new List<TypeCodeDesc>()));
|
||||
}
|
||||
public List<TypeCodeDesc> AffiliateTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.AffiliateType); } }
|
||||
public List<TypeCodeDesc> CommodityTypeCodes { get { return GetCodesOfType(Sbm.SystemCode.CommodityType); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Managers.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -11,7 +12,7 @@ using System.Collections.Generic;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmSecurityProfile : SaErrorStateItem
|
||||
public class SbmSecurityProfile : SaErrorStateItem, ISbmSecurityProfile
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -23,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmSecurityProfile(SbmUserContext userContext, bool includeHostSecurityProfile)
|
||||
public SbmSecurityProfile(ISbmUserContext userContext, bool includeHostSecurityProfile)
|
||||
{
|
||||
this.UserContext = userContext;
|
||||
this.includeHostSecurityProfile = includeHostSecurityProfile;
|
||||
@@ -37,7 +38,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
[JsonIgnore]
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Refresh profile.
|
||||
@@ -195,8 +196,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
public bool UserCanViewFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any)
|
||||
{
|
||||
if (Financial.ConfigOption_AllowFinancialsAccessControl) return true;
|
||||
if (IsSecurityRightGranted(Sbm.SecurityRight.Financial_Update) || IsSecurityRightGranted(Sbm.SecurityRight.Financial_View))
|
||||
if (!Financial.ConfigOption_AllowFinancialsAccessControl) return true;
|
||||
if (Financial.CanUpdateFinancials || Financial.CanViewFinancials)
|
||||
{
|
||||
// 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)))
|
||||
@@ -208,8 +209,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
public bool UserCanUpdateFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any)
|
||||
{
|
||||
if (Financial.ConfigOption_AllowFinancialsAccessControl) return true;
|
||||
if (IsSecurityRightGranted(Sbm.SecurityRight.Financial_Update))
|
||||
if (!Financial.ConfigOption_AllowFinancialsAccessControl) return true;
|
||||
if (Financial.CanUpdateFinancials)
|
||||
{
|
||||
// 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)))
|
||||
@@ -219,7 +220,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UserCanAccessFinancialViewOfType(Sbm.FinancialType financialType)
|
||||
public bool UserCanAccessFinancialViewOfType(Sbm.FinancialType financialType)
|
||||
{
|
||||
if ((int)financialType < 1) return false;
|
||||
// If specific type of financial is requested, check that view is not denied.
|
||||
@@ -228,7 +229,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UserCanAccessFinancialUpdateOfType(Sbm.FinancialType financialType)
|
||||
public bool UserCanAccessFinancialUpdateOfType(Sbm.FinancialType financialType)
|
||||
{
|
||||
if ((int)financialType < 1) return false;
|
||||
// If specific type of financial is requested, check that update is not denied.
|
||||
@@ -250,6 +251,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public bool CanUpdate { 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)
|
||||
{
|
||||
Contacts.CanUpdate = (UserHasSecurityRight(Sbm.SecurityRight.Affiliate_Update));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Helpers;
|
||||
@@ -26,19 +28,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
SessionIdx = sessionIdx;
|
||||
ItemIdx = itemIdx;
|
||||
SessionContext = sessionContext;
|
||||
userData = CreateUserData(SessionContext, null, null);
|
||||
userData = CreateUserData(SessionContext, null, null, null);
|
||||
organisationData = new OrganisationData(null, null);
|
||||
}
|
||||
/// <summary>
|
||||
/// Primary constructor - on user login.
|
||||
/// <para>SessionContext and UserAccount must be supplied.</para>
|
||||
/// <para>Roles list is optional.</para>
|
||||
/// </summary>
|
||||
protected SbmSessionData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser)
|
||||
protected SbmSessionData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations, SbmAssociation associationOrganisation, SbmAffiliate affiliateOrganisation)
|
||||
{
|
||||
SessionIdx = ++sessionIdxRoot;
|
||||
ItemIdx = 1000;
|
||||
SessionContext = sessionContext;
|
||||
userData = CreateUserData(SessionContext, securityItemUser, affiliateUser);
|
||||
userData = CreateUserData(SessionContext, securityItemUser, affiliateUser, supervisedOrganisations);
|
||||
organisationData = new OrganisationData(associationOrganisation, affiliateOrganisation);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -57,16 +61,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DbUpdateInfo(User.AffiliateId, StringUtil.OnEmpty(User.DisplayName, User.EmailAddress), SbmSystem.ComputerName);
|
||||
return new DbUpdateInfo(User.AffiliateId, StringUtil.OnEmpty(userData.DisplayName, userData.EmailAddress), SbmSystem.ComputerName);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User.
|
||||
public class UserData
|
||||
public class UserData : ISbmUserContext.IUserData
|
||||
{
|
||||
protected UserData() { }
|
||||
protected UserData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser)
|
||||
protected UserData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations)
|
||||
{
|
||||
if (securityItemUser != null)
|
||||
{
|
||||
@@ -75,13 +79,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (affiliateUser != null)
|
||||
{
|
||||
AffiliateId = affiliateUser.Id;
|
||||
Refresh(securityItemUser, affiliateUser);
|
||||
Refresh(securityItemUser, affiliateUser, supervisedOrganisations);
|
||||
if (sessionContext.Application == Sbm.Application.WebControl)
|
||||
KeepLoggedIn = affiliateUser.KeepLoggedIn_Control;
|
||||
else if (sessionContext.Application == Sbm.Application.WebPortal)
|
||||
KeepLoggedIn = affiliateUser.KeepLoggedIn_Portal;
|
||||
else Debugger.Break();
|
||||
}
|
||||
this.supervisedOrganisations = supervisedOrganisations;
|
||||
}
|
||||
protected UserData(UserData userData)
|
||||
{
|
||||
@@ -92,6 +97,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
LastName = userData.LastName;
|
||||
DisplayName = userData.DisplayName;
|
||||
EmailAddress = userData.EmailAddress;
|
||||
supervisedOrganisations = userData.supervisedOrganisations;
|
||||
KeepLoggedIn = userData.KeepLoggedIn;
|
||||
}
|
||||
// Properties.
|
||||
@@ -102,10 +108,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public String LastName { get; protected set; }
|
||||
public String DisplayName { get; protected set; }
|
||||
public String EmailAddress { get; protected set; }
|
||||
/// <summary>User managed associations - Id and display name.</summary>
|
||||
public List<SysIdString> SupervisedOrganisations { get { return new List<SysIdString>(supervisedOrganisations); } }
|
||||
protected List<SysIdString> supervisedOrganisations { get; } = new List<SysIdString>();
|
||||
public bool KeepLoggedIn { get; protected set; }
|
||||
public bool UserAccountSupplied { get; protected set; }
|
||||
// Refresh properties.
|
||||
protected bool Refresh(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser)
|
||||
protected bool Refresh(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations)
|
||||
{
|
||||
// Check that user matches the session.
|
||||
if (!SysId.IsValid(SecurityItemId) || !SysId.IsValid(securityItemUser?.Id ?? null) || !SecurityItemId.Equals(securityItemUser.Id)) return false;
|
||||
@@ -116,20 +125,49 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
FirstName = affiliateUser.FirstName;
|
||||
LastName = affiliateUser.LastName;
|
||||
DisplayName = affiliateUser.GetDisplayName();
|
||||
this.supervisedOrganisations.Clear();
|
||||
this.supervisedOrganisations.AddRange(supervisedOrganisations);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
protected abstract UserData CreateUserData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser);
|
||||
protected abstract UserData CreateUserData(SbmSessionContext sessionContext, SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOrganisations);
|
||||
|
||||
/// <summary>User account details.</summary>
|
||||
private UserData userData;
|
||||
public UserData User { get { return userData; } }
|
||||
public ISbmUserContext.IUserData User { get { return userData; } }
|
||||
public bool ValidUser { get { return SysId.IsValid(userData.SecurityItemId) && SysId.IsValid(userData.AffiliateId); } }
|
||||
public bool KeepLoggedIn { get { return userData.KeepLoggedIn; } }
|
||||
|
||||
/// <summary>User - JSON deserialisation route.</summary>
|
||||
protected void SetUser(UserData user)
|
||||
{
|
||||
if (this.userData != null && User.UserAccountSupplied)
|
||||
if (this.userData != null && userData.UserAccountSupplied)
|
||||
throw new NotSupportedException("Session User cannot be replaced.");
|
||||
this.userData = user;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation.
|
||||
public class OrganisationData : ISbmUserContext.IOrganisationData
|
||||
{
|
||||
private OrganisationData() { }
|
||||
public OrganisationData(SbmAssociation associationOrganisation, SbmAffiliate affiliateOrganisation)
|
||||
{
|
||||
AffiliateId = affiliateOrganisation?.Id ?? null;
|
||||
AffiliateType = affiliateOrganisation?.AffiliateType ?? Sbm.AffiliateType.Unknown;
|
||||
AssociationId = associationOrganisation?.Id ?? null;
|
||||
DisplayName = affiliateOrganisation?.GetDisplayName() ?? "";
|
||||
InterfaceContext = SbmAccountMgr.GetInterfaceContext(AffiliateId);
|
||||
}
|
||||
public SysId AffiliateId { get; protected set; }
|
||||
public Sbm.AffiliateType AffiliateType { get; protected set; }
|
||||
public SysId AssociationId { get; protected set; }
|
||||
public String DisplayName { get; protected set; }
|
||||
public String InterfaceContext { get; }
|
||||
}
|
||||
protected OrganisationData organisationData;
|
||||
public ISbmUserContext.IOrganisationData Organisation { get { return organisationData; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
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;
|
||||
@@ -23,9 +24,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
}
|
||||
// Refresh context.
|
||||
public void RefreshUser(SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
|
||||
public void RefreshUser(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
|
||||
{
|
||||
SetUserData(affiliateUser, supervisedOwners);
|
||||
SetUserData(securityItemUser, affiliateUser, supervisedOwners);
|
||||
}
|
||||
public void ClearUser()
|
||||
{
|
||||
@@ -61,8 +62,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get { return userContext; } }
|
||||
public SbmSessionContext SessionContext { get { return userContext.SessionContext; } }
|
||||
public SbmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } }
|
||||
protected SaItemOption.Cache OrganisationConfigOptionsCache { get { return UserContext.Organisation.configOptionsCache; } }
|
||||
public ISbmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } }
|
||||
protected SaItemOption.Cache OrganisationConfigOptionsCache { get { return UserContext.OrganisationConfigOptionsCache; } }
|
||||
// User parameters.
|
||||
protected SbmSysParamCache SysParamCache { get; }
|
||||
|
||||
@@ -85,8 +86,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// 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)
|
||||
{
|
||||
@@ -94,14 +100,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return false;
|
||||
}
|
||||
List<SysIdString> userSupervisedOwners = accountMgr.GetAffiliatesSupervisedBy(affiliateUser.Id);
|
||||
userContext.RefreshUser(affiliateUser, userSupervisedOwners);
|
||||
userContext.RefreshUser(securityItemUser, affiliateUser, userSupervisedOwners);
|
||||
|
||||
// Populate security rights.
|
||||
using (SbmConfigConsole configConsole = SbmGlobals.Application.CreateConfigConsole(UserContext.SessionContext))
|
||||
using (SaSecurityConsole securityConsole = SbmGlobals.Application.CreateSecurityConsole(UserContext))
|
||||
{
|
||||
SecurityProfile.RefreshProfile(configConsole, securityConsole, userId, securityRights);
|
||||
}
|
||||
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;
|
||||
@@ -154,6 +156,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
}
|
||||
|
||||
public SaSecurityConsole SaSecurityConsole { get; private set; }
|
||||
|
||||
// Data managers.
|
||||
protected SbmAccountMgr CreateAccountMgr()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
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;
|
||||
@@ -17,14 +18,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Protected Construction - use derived objects.
|
||||
public SbmSysParamCache(SbmUserContext userContext)
|
||||
public SbmSysParamCache(ISbmUserContext userContext)
|
||||
{
|
||||
this.UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public SysId AffiliateIdUser { get; private set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -23,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// R e g i s t e r C o d e T y p e s
|
||||
//-------------------------------------------------------------------
|
||||
public static void RegisterCodeTypes(SbmConfigConsole configConsole, SaCodeTypeConsole codeTypeConsole, SbmUserContext userContext)
|
||||
public static void RegisterCodeTypes(SbmConfigConsole configConsole, SaCodeTypeConsole codeTypeConsole, ISbmUserContext userContext)
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
// C o m m o d i t i e s
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
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.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -74,14 +75,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// S y s t e m C o d e s
|
||||
//-------------------------------------------------------------------
|
||||
private static String GetOwnerOption_Caption(SbmUserContext userContext, Sbm.OrgOption_Caption orgOption_Caption, String defaultValue)
|
||||
private static String GetOwnerOption_Caption(ISbmUserContext userContext, Sbm.OrgOption_Caption orgOption_Caption, String defaultValue)
|
||||
{
|
||||
// In case user context not specified, eg. Security Console initialising list of transaction types before user logged in.
|
||||
if (userContext != null)
|
||||
return userContext.GetOwnerOption_Caption(orgOption_Caption, defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
public static List<TypeCodeDesc> GetCodesOfType(SbmUserContext userContext, Sbm.SystemCode systemCode)
|
||||
public static List<TypeCodeDesc> GetCodesOfType(ISbmUserContext userContext, Sbm.SystemCode systemCode)
|
||||
{
|
||||
SbmConfigConsole configConsole = null; // SbmGlobals.GetConfigConsole(userContext.SessionContext);
|
||||
switch (systemCode)
|
||||
@@ -480,14 +481,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a M a n a g e r s
|
||||
//-------------------------------------------------------------------
|
||||
public abstract SbmAccountMgr CreateAccountMgr(SbmUserContext userContext);
|
||||
public abstract SbmAssetMgr CreateAssetMgr(SbmUserContext userContext);
|
||||
public abstract SbmCommodityMgr CreateCommodityMgr(SbmUserContext userContext);
|
||||
public abstract SbmPriceMgr CreatePriceMgr(SbmUserContext userContext);
|
||||
public abstract SbmDataItemMgr CreateDataItemMgr(SbmUserContext userContext);
|
||||
public abstract SbmProcessMgr CreateProcessMgr(SbmUserContext userContext);
|
||||
public abstract SbmStockMgr CreateStockMgr(SbmUserContext userContext);
|
||||
public abstract SbmTransactionMgr CreateTransactionMgr(SbmUserContext userContext);
|
||||
public abstract SbmAccountMgr CreateAccountMgr(ISbmUserContext userContext);
|
||||
public abstract SbmAssetMgr CreateAssetMgr(ISbmUserContext userContext);
|
||||
public abstract SbmCommodityMgr CreateCommodityMgr(ISbmUserContext userContext);
|
||||
public abstract SbmPriceMgr CreatePriceMgr(ISbmUserContext userContext);
|
||||
public abstract SbmDataItemMgr CreateDataItemMgr(ISbmUserContext userContext);
|
||||
public abstract SbmProcessMgr CreateProcessMgr(ISbmUserContext userContext);
|
||||
public abstract SbmStockMgr CreateStockMgr(ISbmUserContext userContext);
|
||||
public abstract SbmTransactionMgr CreateTransactionMgr(ISbmUserContext userContext);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A p p l i c a t i o n P r o p e r t i e s
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
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;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,45 +14,57 @@ using System.Collections.Generic;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmUserContext
|
||||
public class SbmUserContext : ISbmUserContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
// User profile.
|
||||
public class UserData
|
||||
public class UserData : ISbmUserContext.IUserData
|
||||
{
|
||||
protected UserData() { }
|
||||
protected readonly List<SysIdString> supervisedOwners = new List<SysIdString>();
|
||||
/// <summary>User Security Item Id.</summary>
|
||||
public SysId SecItemId { get; protected set; } = new SysId();
|
||||
public SysId SecurityItemId { get; protected set; } = new SysId();
|
||||
/// <summary>User Affiliate Id.</summary>
|
||||
public SysId AffiliateId { get; protected set; } = new SysId();
|
||||
/// <summary>User first name.</summary>
|
||||
public String FirstName { get; protected set; } = "";
|
||||
/// <summary>User last name.</summary>
|
||||
public String LastName { get; protected set; } = "";
|
||||
/// <summary>User display name.</summary>
|
||||
public String DisplayName { get; protected set; } = "";
|
||||
/// <summary>User email address.</summary>
|
||||
public String EmailAddress { get; protected set; } = "";
|
||||
/// <summary>User managed associations - Id and display name.</summary>
|
||||
public List<SysIdString> SupervisedOwners { get { return new List<SysIdString>(supervisedOwners); } }
|
||||
public List<SysIdString> SupervisedOrganisations { get { return new List<SysIdString>(supervisedOwners); } }
|
||||
}
|
||||
private class UserData_Internal : UserData
|
||||
{
|
||||
internal UserData_Internal() { }
|
||||
internal void Clear()
|
||||
{
|
||||
SecItemId = new SysId();
|
||||
SecurityItemId = new SysId();
|
||||
AffiliateId = new SysId();
|
||||
FirstName = "";
|
||||
LastName = "";
|
||||
DisplayName = "";
|
||||
EmailAddress = "";
|
||||
supervisedOwners.Clear();
|
||||
}
|
||||
internal void Refresh(SysId securityItemId, SysId affiliateId, String displayName, List<SysIdString> supervisedOwners)
|
||||
internal void Refresh(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
|
||||
{
|
||||
SecItemId = SysId.InvalidOnNull(securityItemId);
|
||||
AffiliateId = SysId.InvalidOnNull(affiliateId);
|
||||
DisplayName = StringUtil.EmptyOnNull(displayName).TrimAll();
|
||||
SecurityItemId = SysId.InvalidOnNull(securityItemUser?.Id ?? null);
|
||||
AffiliateId = SysId.InvalidOnNull(affiliateUser?.Id ?? null);
|
||||
FirstName = StringUtil.EmptyOnNull(affiliateUser?.FirstName ?? "").TrimAll();
|
||||
LastName = StringUtil.EmptyOnNull(affiliateUser?.LastName ?? "").TrimAll();
|
||||
DisplayName = StringUtil.EmptyOnNull(affiliateUser?.GetDisplayName() ?? "").TrimAll();
|
||||
EmailAddress = StringUtil.EmptyOnNull(securityItemUser?.EmailAddress ?? "");
|
||||
this.supervisedOwners.Clear();
|
||||
this.supervisedOwners.AddRange(supervisedOwners);
|
||||
}
|
||||
}
|
||||
// Owner profile - selected organisation to manage.
|
||||
public class OrganisationData
|
||||
public class OrganisationData : ISbmUserContext.IOrganisationData
|
||||
{
|
||||
internal OrganisationData() { }
|
||||
// Organisation options.
|
||||
@@ -115,24 +129,26 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
SessionContext = sessionContext;
|
||||
organisationData = new OrganisationData_Internal();
|
||||
SecurityProfile = new SbmSecurityProfile(this, true);
|
||||
securityProfile = new SbmSecurityProfile(this, true);
|
||||
DbUpdateInfo = new DbUpdateInfo(User.AffiliateId, User.DisplayName, SacsSystem.ComputerName);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmSessionContext SessionContext { get; protected set; }
|
||||
public UserData User { get { return userData; } }
|
||||
public bool ValidUser { get { return SysId.IsValid(userData.SecItemId) && SysId.IsValid(userData.AffiliateId); } }
|
||||
public OrganisationData Organisation { get { return organisationData; } }
|
||||
public ISbmUserContext.IUserData User { get { return userData; } }
|
||||
public bool ValidUser { get { return SysId.IsValid(userData.SecurityItemId) && SysId.IsValid(userData.AffiliateId); } }
|
||||
public ISbmUserContext.IOrganisationData Organisation { get { return organisationData; } }
|
||||
public DbUpdateInfo DbUpdateInfo { get; private set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security profile.
|
||||
public SbmSecurityProfile SecurityProfile { get; protected set; }
|
||||
private SbmSecurityProfile securityProfile { get; set; }
|
||||
public ISbmSecurityProfile SecurityProfile { get { return securityProfile; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation configuration.
|
||||
public SaItemOption.Cache OrganisationConfigOptionsCache { get { return organisationData.configOptionsCache; } }
|
||||
public String GetOrganisationOption(Sbm.OrganisationOption option, String context)
|
||||
{
|
||||
if (assocOptions == null) assocOptions = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.AssociationOption);
|
||||
@@ -142,7 +158,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public String GetOrganisationOption(String optionName, String context)
|
||||
{
|
||||
// Retrieve the requested value from the cache.
|
||||
return Organisation.configOptionsCache.ItemOptions.GetOptionValue(optionName, context);
|
||||
return organisationData.configOptionsCache.ItemOptions.GetOptionValue(optionName, context);
|
||||
}
|
||||
public String GetOwnerOption_Value(Sbm.OrgOption_Value eCol)
|
||||
{
|
||||
@@ -185,14 +201,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
String value = GetOrganisationOption(Sbm.OrganisationOption.ShowColumn, context).Trim();
|
||||
return StringUtil.ToBool(value);
|
||||
}
|
||||
public String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String sDefault)
|
||||
public String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String defautValue)
|
||||
{
|
||||
if (contextFieldLabels == null) contextFieldLabels = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_FieldLabel);
|
||||
String context = contextFieldLabels.GetCodeForType(eCol);
|
||||
String value = GetOrganisationOption(Sbm.OrganisationOption.FieldLabel, context).Trim();
|
||||
return (!value.IsEmpty() ? value : sDefault); // Return default if no label defined.
|
||||
return (!value.IsEmpty() ? value : defautValue); // Return default if no label defined.
|
||||
}
|
||||
public int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int iDefault)
|
||||
public int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int defautValue)
|
||||
{
|
||||
if (contextMinutes == null) contextMinutes = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_Minutes);
|
||||
String context = contextMinutes.GetCodeForType(eLimit);
|
||||
@@ -203,9 +219,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (iUpdateLimit > 0)
|
||||
return iUpdateLimit;
|
||||
}
|
||||
return iDefault;
|
||||
return defautValue;
|
||||
}
|
||||
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int iDefault)
|
||||
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int defautValue)
|
||||
{
|
||||
if (contextPeriodDays == null) contextPeriodDays = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_PeriodDays);
|
||||
String context = contextPeriodDays.GetCodeForType(eLimit);
|
||||
@@ -216,9 +232,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (iUpdateLimit > 0)
|
||||
return iUpdateLimit;
|
||||
}
|
||||
return iDefault;
|
||||
return defautValue;
|
||||
}
|
||||
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int iDefault)
|
||||
public int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int defautValue)
|
||||
{
|
||||
if (contextPeriodWeeks == null) contextPeriodWeeks = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_PeriodWeeks);
|
||||
String context = contextPeriodWeeks.GetCodeForType(eLimit);
|
||||
@@ -229,14 +245,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (iUpdateLimit > 0)
|
||||
return iUpdateLimit;
|
||||
}
|
||||
return iDefault;
|
||||
return defautValue;
|
||||
}
|
||||
public int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int iDefault = 2)
|
||||
public int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int defautValue = 2)
|
||||
{
|
||||
if (contextNumericDecimals == null) contextNumericDecimals = SbmSystem.GetCodesOfType(this, Sbm.SystemCode.OrgOption_NumericDecimals);
|
||||
String context = contextNumericDecimals.GetCodeForType(eNumDecimals);
|
||||
String value = GetOrganisationOption(Sbm.OrganisationOption.NumericDecimals, context).Trim();
|
||||
int iNumDecimals = iDefault;
|
||||
int iNumDecimals = defautValue;
|
||||
if (!value.IsEmpty())
|
||||
iNumDecimals = value.ToShort();
|
||||
iNumDecimals = Math.Min(4, Math.Max(0, iNumDecimals));
|
||||
@@ -264,9 +280,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Modify properties - internal only.
|
||||
protected void SetUserData(SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
|
||||
protected void SetUserData(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
|
||||
{
|
||||
userData.Refresh(affiliateUser.UserId, affiliateUser.Id, affiliateUser.GetDisplayName(), supervisedOwners);
|
||||
userData.Refresh(securityItemUser, affiliateUser, supervisedOwners);
|
||||
DbUpdateInfo = new DbUpdateInfo(User.AffiliateId, User.DisplayName, SacsSystem.ComputerName);
|
||||
}
|
||||
protected void ClearUserData()
|
||||
@@ -281,9 +297,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
String fn = GetType().Name + ".SetOrganisationData";
|
||||
|
||||
// Interface context for selected organisation.
|
||||
String interfaceContext = "";
|
||||
if (SysId.IsValid(affiliateIdOrganisation))
|
||||
interfaceContext = "ORG" + StringUtil.PadLeft(SysId.ToString(affiliateIdOrganisation), 5, '0');
|
||||
String interfaceContext = SbmAccountMgr.GetInterfaceContext(affiliateIdOrganisation);
|
||||
|
||||
SbmAffiliate affiliateOrganisation = null;
|
||||
SbmAssociation associationInternal = null;
|
||||
@@ -330,7 +344,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
protected void SetSecurityProfile(SbmSecurityProfile securityProfile)
|
||||
{
|
||||
SecurityProfile = securityProfile;
|
||||
this.securityProfile = securityProfile;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Accounts.QuickBooks.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -154,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
}
|
||||
private class QBooksParams
|
||||
{
|
||||
public QBooksParams(SbmUserContext userContext)
|
||||
public QBooksParams(ISbmUserContext userContext)
|
||||
{
|
||||
}
|
||||
// QuickBooks interface definitions.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Accounts.Sage.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
@@ -174,7 +175,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
}
|
||||
private class SageParams
|
||||
{
|
||||
public SageParams(SbmUserContext userContext, SbmInternals internals)
|
||||
public SageParams(ISbmUserContext userContext, SbmInternals internals)
|
||||
{
|
||||
UserContext = userContext;
|
||||
this.internals = internals;
|
||||
@@ -248,7 +249,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
SalesOrderColumnSources.Add(SageDbDfn.GetColumnName(SageDbDfn.ColumnIdx.SalesOrder_Notes1), "Notes line 1");
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
private SbmUserContext UserContext { get; }
|
||||
private ISbmUserContext UserContext { get; }
|
||||
private readonly SbmInternals internals;
|
||||
// Sage interface definitions.
|
||||
public SaInterface.Data dfnInt_Sage { get; set; } = new SaInterface.Data();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Accounts.QuickBooks.App;
|
||||
using Sarand.Net.Standard.Accounts.Sage.App;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
@@ -61,7 +62,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmAccountsDfn(SbmUserContext userContext)
|
||||
public SbmAccountsDfn(ISbmUserContext userContext)
|
||||
{
|
||||
UserContext = userContext;
|
||||
internals = new SbmInternals(userContext);
|
||||
@@ -81,7 +82,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
protected SaInterfaceConsole InterfaceConsole { get { return internals.InterfaceConsole; } }
|
||||
protected SaItemOptionConsole ItemOptionConsole { get { return internals.ItemOptionConsole; } }
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -354,7 +355,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAddress(SbmUserContext userContext, SysId id, Sbm.ItemType itemType, SysId itemId, Sbm.AddressType addressType) : base(userContext, id)
|
||||
protected SbmAddress(ISbmUserContext userContext, SysId id, Sbm.ItemType itemType, SysId itemId, Sbm.AddressType addressType) :
|
||||
base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemType = itemType;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -336,7 +337,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAffiliate(SbmUserContext userContext, SysId id, Sbm.AffiliateType affiliateType) : base(userContext, id)
|
||||
protected SbmAffiliate(ISbmUserContext userContext, SysId id, Sbm.AffiliateType affiliateType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateType = affiliateType;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -375,7 +376,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAsset(SbmUserContext userContext, SysId id, SysId assetCatId) : base(userContext, id)
|
||||
protected SbmAsset(ISbmUserContext userContext, SysId id, SysId assetCatId) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Id = id;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -214,7 +215,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
private readonly Data data = new Data();
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAssetCategory(SbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
protected SbmAssetCategory(ISbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Status = DefaultStatus;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -120,7 +121,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
private readonly Data data = new Data();
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAssetProcess(SbmUserContext userContext, SysId id, SysId assetId, SysId processId) : base(userContext, id)
|
||||
protected SbmAssetProcess(ISbmUserContext userContext, SysId id, SysId assetId, SysId processId) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Id = id;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -503,7 +504,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAssociation(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.AssociationType associationType, SysId affiliateIdTarget) : base(userContext, id)
|
||||
protected SbmAssociation(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.AssociationType associationType, SysId affiliateIdTarget) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -19,6 +20,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
Pos,
|
||||
Id,
|
||||
// Commodity.
|
||||
Type,
|
||||
Type_Code,
|
||||
Type_Desc,
|
||||
Code,
|
||||
DescBrief,
|
||||
@@ -1082,7 +1085,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCommodity(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.CommodityType commodityType, String code) : base(userContext, id)
|
||||
protected SbmCommodity(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.CommodityType commodityType, String code) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
@@ -1100,7 +1103,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
SaStatus.Discontinued,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> CommodityStatuses { get { return new List<SaStatus>(commodityStatuses); } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(commodityStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
switch (status)
|
||||
@@ -1803,6 +1806,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
// Commodity Ids.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
/// <summary>Organisation - if not available via Session Config. ie. must be populated for Web/Console sessions.</summary>
|
||||
public SysId AffiliateIdOrganisation {get; set; }
|
||||
// Commodity.
|
||||
public Sbm.CommodityType CommodityType { get; set; }
|
||||
public bool StockItemsOnly { get; set; } = false;
|
||||
@@ -1814,6 +1819,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public String DrawingNoPartial { get; set; }
|
||||
public String DrawingIssueFull { get; set; }
|
||||
public String DrawingIssuePartial { get; set; }
|
||||
/// <summary>Generic search value - code, descriptions, drawing no etc.</summary>
|
||||
public String Search { get; set; }
|
||||
// Category.
|
||||
public String CatalogRefPartial { get; set; }
|
||||
public List<String> Categories { get; } = new List<string>();
|
||||
@@ -1870,7 +1877,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
/// <summary>Commodity status.</summary>
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Utilities.
|
||||
public List<StringPair> GetDisplayValues(SbmUserContext userContext)
|
||||
public List<StringPair> GetDisplayValues(ISbmUserContext userContext)
|
||||
{
|
||||
SbmAccountMgr accountMgr = null;
|
||||
List<StringPair> lValue = new List<StringPair>();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -124,7 +125,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCommodityCustomer(SbmUserContext userContext, SysId commodityId, SysId assocIdCustomer) : base(userContext)
|
||||
protected SbmCommodityCustomer(ISbmUserContext userContext, SysId commodityId, SysId assocIdCustomer) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
CommodityId = commodityId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -114,7 +115,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCommoditySupplier(SbmUserContext userContext, SysId commodityId, SysId assocIdSupplier) : base(userContext)
|
||||
protected SbmCommoditySupplier(ISbmUserContext userContext, SysId commodityId, SysId assocIdSupplier) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
CommodityId = commodityId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -393,7 +394,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmConstituent(SbmUserContext userContext, SysId id, SysId affIdOwner, SysId assocId, Sbm.ConstituentType constituentType) : base(userContext)
|
||||
protected SbmConstituent(ISbmUserContext userContext, SysId id, SysId affIdOwner, SysId assocId, Sbm.ConstituentType constituentType) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
Id = id;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -154,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmContainer(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ContainerCategory containerCategory, Sbm.ContainerType containerType) : base(userContext, id)
|
||||
protected SbmContainer(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ContainerCategory containerCategory, Sbm.ContainerType containerType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -157,7 +158,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmContainerItem(SbmUserContext userContext, SysId containerId, Sbm.ItemType itemType, SysId itemId) : base(userContext)
|
||||
protected SbmContainerItem(ISbmUserContext userContext, SysId containerId, Sbm.ItemType itemType, SysId itemId) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
ContainerId = containerId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -133,13 +134,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmCostEstimate(SbmUserContext userContext, Sbm.CostEstimateCategory costEstimateCategory) : base(userContext)
|
||||
public SbmCostEstimate(ISbmUserContext userContext, Sbm.CostEstimateCategory costEstimateCategory) : base(userContext)
|
||||
{
|
||||
CostEstimateCategory = costEstimateCategory;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Conversion from ItemLink.
|
||||
public SbmCostEstimate(SbmUserContext userContext, String archive) : base(userContext)
|
||||
public SbmCostEstimate(ISbmUserContext userContext, String archive) : base(userContext)
|
||||
{
|
||||
String[] data = archive.Split(new String[] { delimArchive }, StringSplitOptions.None);
|
||||
costEstimateCategory = (Sbm.CostEstimateCategory)(data.Length > 0 ? StringUtil.ToShort(data[0]) : 0);
|
||||
@@ -442,7 +443,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public static void SetCommodityCosts(this List<SbmCostEstimate> values, SbmUserContext userContext, SbmCommodity commodity, decimal quantity)
|
||||
public static void SetCommodityCosts(this List<SbmCostEstimate> values, ISbmUserContext userContext, SbmCommodity commodity, decimal quantity)
|
||||
{
|
||||
// Retrieve costs from commodity and remove unwanted costs (for other quantities).
|
||||
List<SbmCostEstimate> costEstimatesCommodity = commodity.GetCostEstimates();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
@@ -8,18 +9,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmHierarchyItem(SbmUserContext userContext) : base()
|
||||
protected SbmHierarchyItem(ISbmUserContext userContext) : base()
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
protected SbmHierarchyItem(SbmUserContext userContext, SysId id) : base(id)
|
||||
protected SbmHierarchyItem(ISbmUserContext userContext, SysId id) : base(id)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -116,7 +117,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemBatch(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ItemBatchType itemBatchType, String refs) : base(userContext, id)
|
||||
protected SbmItemBatch(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ItemBatchType itemBatchType, String refs) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -151,7 +152,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemLink(SbmUserContext userContext, SysId id, Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeFrom, SysId itemIdFrom, Sbm.ItemType itemTypeTo, SysId itemIdTo) : base(userContext, id)
|
||||
protected SbmItemLink(ISbmUserContext userContext, SysId id, Sbm.ItemLinkType itemLinkType, Sbm.ItemType itemTypeFrom, SysId itemIdFrom, Sbm.ItemType itemTypeTo, SysId itemIdTo) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemLinkType = itemLinkType;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -91,12 +92,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmItemPrice(SbmUserContext userContext) : base(userContext)
|
||||
public SbmItemPrice(ISbmUserContext userContext) : base(userContext)
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Conversion from ItemLink.
|
||||
public SbmItemPrice(SbmUserContext userContext, String archive) : base(userContext)
|
||||
public SbmItemPrice(ISbmUserContext userContext, String archive) : base(userContext)
|
||||
{
|
||||
String[] data = archive.Split(new String[] { delimArchive }, StringSplitOptions.None);
|
||||
type = (data.Length > 1 ? data[1] : "");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -183,7 +184,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemProcess(SbmUserContext userContext, Sbm.ItemType itemType, SysId itemId, SysId processId) : base(userContext)
|
||||
protected SbmItemProcess(ISbmUserContext userContext, Sbm.ItemType itemType, SysId itemId, SysId processId) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemType = itemType;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -111,7 +112,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmLocation(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.LocationCategory locationCategory) : base(userContext, id)
|
||||
protected SbmLocation(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.LocationCategory locationCategory) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -170,7 +171,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public static readonly Byte Flag_DiaryEntry = 0x01;
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmMovement(SbmUserContext userContext, SysId id, Sbm.ItemType itemType, SysId itemId, Sbm.MovementType movementType) : base(userContext, id)
|
||||
protected SbmMovement(ISbmUserContext userContext, SysId id, Sbm.ItemType itemType, SysId itemId, Sbm.MovementType movementType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemType = itemType;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -178,7 +179,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmPortfolioItem(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.PortfolioItemType portfolioItemType) : base(userContext, id)
|
||||
protected SbmPortfolioItem(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.PortfolioItemType portfolioItemType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -161,7 +162,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmPrice(SbmUserContext userContext, SysId priceSetId, SysId commodityId, Sbm.PriceType priceType) : base(userContext)
|
||||
protected SbmPrice(ISbmUserContext userContext, SysId priceSetId, SysId commodityId, Sbm.PriceType priceType) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
PriceSetId = priceSetId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -119,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmPriceSet(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, String reference, Sbm.PriceType priceType) : base(userContext, id)
|
||||
protected SbmPriceSet(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, String reference, Sbm.PriceType priceType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -127,7 +128,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmProcess(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ProcessCategory processCategory) : base(userContext, id)
|
||||
protected SbmProcess(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.ProcessCategory processCategory) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -701,7 +702,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmRequirement(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId associationId, SysId transactionId, Sbm.RequirementType requirementType) : base(userContext, id)
|
||||
protected SbmRequirement(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId associationId, SysId transactionId, Sbm.RequirementType requirementType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -139,14 +140,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmRequirementCosts(SbmUserContext userContext)
|
||||
public SbmRequirementCosts(ISbmUserContext userContext)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Calculation.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -154,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmStockLevel(SbmUserContext userContext, SysId id, SysId idCommodity, SysId idLocation, Sbm.StockLevelType type, Sbm.StockLevelSource source) : base(userContext, id)
|
||||
protected SbmStockLevel(ISbmUserContext userContext, SysId id, SysId idCommodity, SysId idLocation, Sbm.StockLevelType type, Sbm.StockLevelSource source) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
CommodityId = idCommodity;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -121,7 +122,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSysParam(SbmUserContext userContext, SysId id, Sbm.SysParamCategory category, String name) : base(userContext, id)
|
||||
protected SbmSysParam(ISbmUserContext userContext, SysId id, Sbm.SysParamCategory category, String name) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Category = category;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -133,7 +134,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSystemAccount(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.SystemAccountType systemAccountType, SysId interfaceId, SysId associationId) : base(userContext, id)
|
||||
protected SbmSystemAccount(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, Sbm.SystemAccountType systemAccountType, SysId interfaceId, SysId associationId) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -89,7 +90,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSystemAccountUser(SbmUserContext userContext, SysId accountId, SysId userId) : base(userContext)
|
||||
protected SbmSystemAccountUser(ISbmUserContext userContext, SysId accountId, SysId userId) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
AccountId = accountId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -114,7 +115,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSystemUser(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId interfaceId, SysId affiliateId) : base(userContext, id)
|
||||
protected SbmSystemUser(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId interfaceId, SysId affiliateId) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
AffiliateIdOwner = affiliateIdOwner;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -646,7 +647,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmTransaction(SbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId associationId, Sbm.TransactionType transactionType) : base(userContext, id)
|
||||
protected SbmTransaction(ISbmUserContext userContext, SysId id, SysId affiliateIdOwner, SysId associationId, Sbm.TransactionType transactionType) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Id = id;
|
||||
@@ -788,7 +789,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status Categories.
|
||||
public static List<TypeCodeDesc> GetTransactionStatusCats(SbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
public static List<TypeCodeDesc> GetTransactionStatusCats(ISbmUserContext userContext, Sbm.TransactionType transactionType)
|
||||
{
|
||||
List<TypeCodeDesc> statusCats = new List<TypeCodeDesc>();
|
||||
List<TypeCodeDesc> statusCatsFull = SbmSystem.GetCodesOfType(userContext, Sbm.SystemCode.TransactionStatusCat);
|
||||
@@ -849,7 +850,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
{
|
||||
return GetTaxEffectiveDate(UserContext, TransactionType, Status, Raised, InProgress, Closed);
|
||||
}
|
||||
public static DateTime GetTaxEffectiveDate(SbmUserContext userContext, Sbm.TransactionType transactionType, SaStatus status, DateTime raised, DateTime inProgress, DateTime closed)
|
||||
public static DateTime GetTaxEffectiveDate(ISbmUserContext userContext, Sbm.TransactionType transactionType, SaStatus status, DateTime raised, DateTime inProgress, DateTime closed)
|
||||
{
|
||||
// Original thinking was that the status would have an effect on the tax point.
|
||||
SbmTransaction.StatusCat transactionStatusCat = GetCategoryForStatus(status);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -89,12 +90,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmTransactionPayment(SbmUserContext userContext) : base(userContext)
|
||||
public SbmTransactionPayment(ISbmUserContext userContext) : base(userContext)
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Conversion from ItemLink.
|
||||
public SbmTransactionPayment(SbmUserContext userContext, String archive) : base(userContext)
|
||||
public SbmTransactionPayment(ISbmUserContext userContext, String archive) : base(userContext)
|
||||
{
|
||||
String[] data = archive.Split(new String[] { delimArchive }, StringSplitOptions.None);
|
||||
type = (data.Length > 1 ? data[1] : "");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -331,7 +332,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmVehicle(SbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
protected SbmVehicle(ISbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
//Database = database;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -234,7 +235,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public static readonly Byte Flag_DescBriefFixed = 0x01;
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmVehicleClass(SbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
protected SbmVehicleClass(ISbmUserContext userContext, SysId id) : base(userContext, id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Status = DefaultStatus;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -183,7 +184,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmVehicleEvent(SbmUserContext userContext, SysId vehicleId, Sbm.VehicleEventType vehicleEventType) : base(userContext, vehicleId)
|
||||
protected SbmVehicleEvent(ISbmUserContext userContext, SysId vehicleId, Sbm.VehicleEventType vehicleEventType) : base(userContext, vehicleId)
|
||||
{
|
||||
base.SetData(data);
|
||||
VehicleId = vehicleId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -160,7 +161,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmVehicleFeature(SbmUserContext userContext, SysId vehicleId, Sbm.VehicleFeatureSource vehicleFeatureSource, Sbm.VehicleFeatureType vehicleFeatureType) : base(userContext)
|
||||
protected SbmVehicleFeature(ISbmUserContext userContext, SysId vehicleId, Sbm.VehicleFeatureSource vehicleFeatureSource, Sbm.VehicleFeatureType vehicleFeatureType) : base(userContext)
|
||||
{
|
||||
base.SetData(data);
|
||||
VehicleId = vehicleId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Helpers;
|
||||
using Sarand.Net.Standard.Base.Email;
|
||||
using System;
|
||||
@@ -42,7 +43,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
/// Replace dynamic tags in email message body.
|
||||
/// <para></para>
|
||||
/// </summary>
|
||||
public void ReplaceDynamicEmailBodyTags(SaEmailData emailData, SbmSessionData sessionData)
|
||||
public void ReplaceDynamicEmailBodyTags(SaEmailData emailData, ISbmUserContext userContext)
|
||||
{
|
||||
// Replace core tags, eg. main stylesheet.
|
||||
SaEmailConsole.ReplaceDynamicEmailTags(emailData);
|
||||
@@ -70,7 +71,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Consoles
|
||||
}
|
||||
|
||||
// Session data is optional.
|
||||
if (sessionData != null)
|
||||
if (userContext != null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Core
|
||||
{
|
||||
//=======================================================================
|
||||
public interface ISbmSecurityProfile
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// User properties.
|
||||
SysId UserId { get; }
|
||||
String UserDisplayName { get; }
|
||||
String UserLocation { get; }
|
||||
DateTime UserLastLogin { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security - Contacts.
|
||||
bool UserCanCreateContacts { get; }
|
||||
bool UserCanUpdateContacts { get; }
|
||||
|
||||
// Security - Financials.
|
||||
bool UserCanViewFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
|
||||
bool UserCanUpdateFinancials(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
|
||||
bool UserCanAccessFinancialViewOfType(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
|
||||
bool UserCanAccessFinancialUpdateOfType(Sbm.FinancialType financialType = Sbm.FinancialType.Any);
|
||||
|
||||
// Security - Transactions.
|
||||
bool UserCanAccessTransactionsOfType(Sbm.TransactionType transactionType);
|
||||
|
||||
// Security Item types.
|
||||
bool ItemTypeIsAllowed(Sbm.ItemType itemType);
|
||||
bool UserCanCreateItemType(Sbm.ItemType itemType);
|
||||
bool UserCanUpdateItemType(Sbm.ItemType itemType);
|
||||
bool UserCanRemoveItemType(Sbm.ItemType itemType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Refresh profile.</summary>
|
||||
void RefreshProfile(SbmConfigConsole configConsole, SaSecurityConsole securityConsole, SysId userId, List<TypeCodeDesc> securityRights);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Core
|
||||
{
|
||||
//=======================================================================
|
||||
public interface ISbmUserContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Session Context - Identifies database connections etc.</summary>
|
||||
SbmSessionContext SessionContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User data - account details.</summary>
|
||||
public interface IUserData
|
||||
{
|
||||
/// <summary>User Security Item Id.</summary>
|
||||
SysId SecurityItemId { get; }
|
||||
/// <summary>User Affiliate Id.</summary>
|
||||
SysId AffiliateId { get; }
|
||||
/// <summary>User first name.</summary>
|
||||
String FirstName { get; }
|
||||
/// <summary>User last name.</summary>
|
||||
String LastName { get; }
|
||||
/// <summary>User display name.</summary>
|
||||
String DisplayName { get; }
|
||||
/// <summary>User email address.</summary>
|
||||
String EmailAddress { get; }
|
||||
/// <summary>User managed organisations - Affiliate Id and display name.</summary>
|
||||
List<SysIdString> SupervisedOrganisations { get; }
|
||||
}
|
||||
|
||||
/// <summary>Current user account details.</summary>
|
||||
IUserData User { get; }
|
||||
bool ValidUser { get; }
|
||||
|
||||
/// <summary>Database upfate info - user session specific properties for database inserts/updates.</summary>
|
||||
DbUpdateInfo DbUpdateInfo { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Security profile - what the user is allowed to do based on security roles and groups.</summary>
|
||||
ISbmSecurityProfile SecurityProfile { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User data - logged in account details.</summary>
|
||||
public interface IOrganisationData
|
||||
{
|
||||
/// <summary>Organisation Affiliate Id.</summary>
|
||||
SysId AffiliateId { get; }
|
||||
/// <summary>Organisation Affiliate Type.</summary>
|
||||
Sbm.AffiliateType AffiliateType { get; }
|
||||
/// <summary>Organisation display name.</summary>
|
||||
String DisplayName { get; }
|
||||
/// <summary>Organisation Interface context - to qualify interfaces belonging to the organisation.</summary>
|
||||
public String InterfaceContext { get; }
|
||||
/// <summary>Organisation 'Internal' Association Id.</summary>
|
||||
public SysId AssociationId { get; }
|
||||
}
|
||||
|
||||
/// <summary>Current selected organisation.</summary>
|
||||
IOrganisationData Organisation { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation configuration.
|
||||
String GetOrganisationOption(Sbm.OrganisationOption option, String context);
|
||||
String GetOrganisationOption(String optionName, String context);
|
||||
String GetOwnerOption_Value(Sbm.OrgOption_Value eCol);
|
||||
String GetOwnerOption_Folder(Sbm.OrgOption_Folder eCol);
|
||||
bool GetOwnerOption_AllowOption(Sbm.OrgOption_AllowOption eCol);
|
||||
String GetOwnerOption_Caption(Sbm.OrgOption_Caption eCol, String defaultValue);
|
||||
bool GetOwnerOption_ShowField(SbmDbDfn.ColumnIdx eCol);
|
||||
bool GetOwnerOption_ShowColumn(Sbm.OrgOption_ShowColumn eCol);
|
||||
String GetOwnerOption_FieldLabel(SbmDbDfn.ColumnIdx eCol, String defautValue);
|
||||
int GetOwnerOption_Minutes(Sbm.OrgOption_Minutes eLimit, int defautValue);
|
||||
int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodDays eLimit, int defautValue);
|
||||
int GetOwnerOption_UpdateLimit(Sbm.OrgOption_PeriodWeeks eLimit, int defautValue);
|
||||
int GetOwnerOption_NumericDecimals(Sbm.OrgOption_NumericDecimals eNumDecimals, int defautValue = 2);
|
||||
Sbm.CommodityType GetOwnerOption_CommodityType(Sbm.OrgOption_CommodityType commodityTypeContext);
|
||||
SysId GetOwnerOption_StockLocation(Sbm.OrgOption_StockLocation eLoc);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -34,7 +35,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAccountMgr(SbmUserContext userContext) :
|
||||
protected SbmAccountMgr(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -20,12 +20,18 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
public abstract String GetAffiliateName(SysId affiliateId);
|
||||
public abstract String GetAssociationOwnerName(SysId associationIdOwner);
|
||||
public abstract String GetAssociationTargetName(SysId associationIdTarget);
|
||||
public static String GetInterfaceContext(SysId affiliateIdOrganisation)
|
||||
{
|
||||
if (SysId.IsValid(affiliateIdOrganisation))
|
||||
return "ORG" + StringUtil.PadLeft(SysId.ToString(affiliateIdOrganisation), 5, '0');
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual affiliates.
|
||||
//-------------------------------------------------------------------
|
||||
// Affiliate exists.
|
||||
public bool AffiliateExistsById(SysId affiliateId)
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual affiliates.
|
||||
//-------------------------------------------------------------------
|
||||
// Affiliate exists.
|
||||
public bool AffiliateExistsById(SysId affiliateId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(affiliateId)) return false;
|
||||
@@ -361,7 +367,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
prmAffiliate.AffiliateIdAssocTarget = affiliateIdUser;
|
||||
prmAffiliate.TargetSupervised = SbmAffiliate.Params.Supervised.Yes;
|
||||
foreach (SbmAffiliate affiliate in GetAffiliateList(prmAffiliate))
|
||||
{
|
||||
affiliateIdNames.Add(affiliate.Id, affiliate.Name);
|
||||
affiliate.Dispose();
|
||||
}
|
||||
return affiliateIdNames;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmAssetMgr(SbmUserContext userContext) :
|
||||
protected SbmAssetMgr(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -28,7 +29,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCommodityMgr(SbmUserContext userContext) :
|
||||
protected SbmCommodityMgr(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -137,7 +137,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
case SbmCommodity.Column.Type_Desc: return GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_Type, "Type");
|
||||
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");
|
||||
@@ -368,7 +371,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create commodities.
|
||||
public abstract SbmCommodity CreateCommodity(SysId id, SysId affIdOwner, Sbm.CommodityType commodityType, String code);
|
||||
public abstract SbmCommodity CreateCommodity(SysId affIdOwner, Sbm.CommodityType commodityType, String code);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate Commodity data.
|
||||
@@ -523,7 +526,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SbmCommodity.CommodityStatuses.Contains(data.Status))
|
||||
if (!SbmCommodity.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
@@ -566,10 +569,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
// Commodity TypeDesc.
|
||||
case SbmCommodity.Column.Type_Code:
|
||||
case SbmCommodity.Column.Type_Desc:
|
||||
{
|
||||
Sbm.CommodityType commodityType = (Sbm.CommodityType)values.GetValue(column.DataName).AsLong();
|
||||
value = new DataValue(CommodityTypes.GetDescForType(commodityType, ((int)commodityType).ToString()));
|
||||
if (column.Id == (int)SbmCommodity.Column.Type_Desc)
|
||||
value = new DataValue(CommodityTypes.GetDescForType(commodityType, ((int)commodityType).ToString()));
|
||||
else
|
||||
value = new DataValue(CommodityTypes.GetCodeForType(commodityType, ((int)commodityType).ToString()));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmDataItemMgr(SbmUserContext userContext) :
|
||||
protected SbmDataItemMgr(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
@@ -26,11 +27,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
/// <summary>Central repository for system codes used by manager.</summary>
|
||||
private class SystemCodeCache
|
||||
{
|
||||
public SystemCodeCache(SbmUserContext userContext)
|
||||
public SystemCodeCache(ISbmUserContext userContext)
|
||||
{
|
||||
this.userContext = userContext;
|
||||
}
|
||||
private readonly SbmUserContext userContext;
|
||||
private readonly ISbmUserContext userContext;
|
||||
private Dictionary<Sbm.SystemCode, List<TypeCodeDesc>> systemCodes = new Dictionary<Sbm.SystemCode, List<TypeCodeDesc>>();
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sbm.SystemCode systemCode)
|
||||
{
|
||||
@@ -105,7 +106,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemMgr(SbmUserContext userContext)
|
||||
protected SbmItemMgr(ISbmUserContext userContext)
|
||||
{
|
||||
if (userContext == null)
|
||||
throw new NotSupportedException("SbmItemMgr User context must be supplied");
|
||||
@@ -168,7 +169,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
protected String StatusDisabled { get; } = SacsSystem.GetStatusCode(SaStatus.Disabled);
|
||||
protected String StatusDeleted { get; } = SacsSystem.GetStatusCode(SaStatus.Deleted);
|
||||
// Session.
|
||||
protected SbmUserContext UserContext { get; }
|
||||
protected ISbmUserContext UserContext { get; }
|
||||
protected SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
protected SbmInternals Internals
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -18,7 +19,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmPriceMgr(SbmUserContext userContext) :
|
||||
protected SbmPriceMgr(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -18,7 +19,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmProcessMgr(SbmUserContext userContext) :
|
||||
protected SbmProcessMgr(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmStockMgr(SbmUserContext userContext) :
|
||||
protected SbmStockMgr(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using System;
|
||||
@@ -31,7 +32,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmTransactionMgr(SbmUserContext userContext) :
|
||||
protected SbmTransactionMgr(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.CodeTypes;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -13,11 +14,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Procs
|
||||
// Configuration.
|
||||
public new class Config : SaReport_Base.Config
|
||||
{
|
||||
protected Config(SbmUserContext userContext)
|
||||
protected Config(ISbmUserContext userContext)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -42,7 +43,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Procs
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
protected SbmInternals Internals { get { if (internals == null) internals = new SbmInternals(config.UserContext); return internals; } }
|
||||
protected SbmInternals Internals { get { if (internals == null) internals = new SbmInternals(config.UserContext); return internals; } }
|
||||
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
|
||||
protected SbmAccountMgr AccountMgr { get { return Internals.AccountMgr; } }
|
||||
protected SbmCommodityMgr CommodityMgr { get { return Internals.CommodityMgr; } }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -35,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.UpdateLog
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get { return config.Internals.UserContext; } }
|
||||
public ISbmUserContext UserContext { get { return config.Internals.UserContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Internal utilities.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Utils;
|
||||
@@ -45,35 +46,35 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.App
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a M a n a g e r s
|
||||
//-------------------------------------------------------------------
|
||||
public override SbmAccountMgr CreateAccountMgr(SbmUserContext userContext)
|
||||
public override SbmAccountMgr CreateAccountMgr(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmAccountMgr_Dbas(userContext);
|
||||
}
|
||||
public override SbmAssetMgr CreateAssetMgr(SbmUserContext userContext)
|
||||
public override SbmAssetMgr CreateAssetMgr(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmAssetMgr_Dbas(userContext);
|
||||
}
|
||||
public override SbmCommodityMgr CreateCommodityMgr(SbmUserContext userContext)
|
||||
public override SbmCommodityMgr CreateCommodityMgr(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmCommodityMgr_Dbas(userContext);
|
||||
}
|
||||
public override SbmPriceMgr CreatePriceMgr(SbmUserContext userContext)
|
||||
public override SbmPriceMgr CreatePriceMgr(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmPriceMgr_Dbas(userContext);
|
||||
}
|
||||
public override SbmDataItemMgr CreateDataItemMgr(SbmUserContext userContext)
|
||||
public override SbmDataItemMgr CreateDataItemMgr(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmDataItemMgr_Dbas(userContext);
|
||||
}
|
||||
public override SbmProcessMgr CreateProcessMgr(SbmUserContext userContext)
|
||||
public override SbmProcessMgr CreateProcessMgr(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmProcessMgr_Dbas(userContext);
|
||||
}
|
||||
public override SbmStockMgr CreateStockMgr(SbmUserContext userContext)
|
||||
public override SbmStockMgr CreateStockMgr(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmStockMgr_Dbas(userContext);
|
||||
}
|
||||
public override SbmTransactionMgr CreateTransactionMgr(SbmUserContext userContext)
|
||||
public override SbmTransactionMgr CreateTransactionMgr(ISbmUserContext userContext)
|
||||
{
|
||||
return new SbmTransactionMgr_Dbas(userContext);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.CodeTypes;
|
||||
|
||||
@@ -9,13 +10,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCodeTypeConsole_Dbas(SacsDatabase database) : base(database)
|
||||
protected SbmCodeTypeConsole_Dbas(ISbmUserContext userContext) : base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public ISbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.Diary;
|
||||
|
||||
@@ -9,13 +10,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmDiaryConsole_Dbas(SacsDatabase database) : base(database)
|
||||
protected SbmDiaryConsole_Dbas(ISbmUserContext userContext) : base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public ISbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
@@ -25,7 +26,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmInterfaceConsole_Dbas(SbmUserContext userContext) : base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext) as SacsDatabase)
|
||||
protected SbmInterfaceConsole_Dbas(ISbmUserContext userContext) : base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
dataItemTypes = SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.ItemType);
|
||||
@@ -44,7 +45,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
public override short InterfaceDataType { get { return (short)Sbm.ItemType.Interface; } }
|
||||
// Consoles.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.ItemData;
|
||||
|
||||
@@ -9,13 +10,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemDataConsole_Dbas(SacsDatabase database) : base(database)
|
||||
protected SbmItemDataConsole_Dbas(ISbmUserContext userContext) : base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public ISbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.ItemDocs;
|
||||
|
||||
@@ -9,13 +10,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemDocConsole_Dbas(SacsDatabase database) : base(database)
|
||||
protected SbmItemDocConsole_Dbas(ISbmUserContext userContext) : base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public ISbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
@@ -21,8 +22,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemOptionConsole_Dbas(SacsDatabase database) : base(database)
|
||||
protected SbmItemOptionConsole_Dbas(ISbmUserContext userContext) : base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
@@ -36,7 +38,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public ISbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
public override short ItemOptionDataType { get { return (short)Sbm.ItemType.ItemOption; } }
|
||||
private SbmAccountMgr AccountMgr { get { if (accountMgr == null) accountMgr = SbmGlobals.System.CreateAccountMgr(UserContext); return accountMgr; } }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.ReferenceData;
|
||||
@@ -14,8 +15,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmReferenceDataConsole_Dbas(SbmUserContext userContext, SacsDatabase database) :
|
||||
base(database)
|
||||
protected SbmReferenceDataConsole_Dbas(ISbmUserContext userContext) :
|
||||
base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
@@ -31,7 +32,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmSessionContext SessionContext { get; }
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
// Item types.
|
||||
public override short LanguageItemType { get { return (short)Sbm.ItemDataType.Unknown; } }
|
||||
public override short RegionItemType { get { return (short)Sbm.ItemDataType.Region; } }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -23,7 +24,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSecurityConsole_Dbas(SbmUserContext userContext, ISacsDatabase database) : base(database)
|
||||
protected SbmSecurityConsole_Dbas(ISbmUserContext userContext) :
|
||||
base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
@@ -39,7 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
public override short SecurityItemDataType { get { return (short)Sbm.ItemType.SecurityItem; } }
|
||||
public override short SecurityLinkDataType { get { return (short)Sbm.ItemType.SecurityLink; } }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
@@ -17,7 +18,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmUpdateLogConsole_Dbas(SbmUserContext userContext, ISacsDatabase database) : base(database)
|
||||
protected SbmUpdateLogConsole_Dbas(ISbmUserContext userContext) :
|
||||
base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
@@ -32,7 +34,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; }
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
// Consoles.
|
||||
public SaSecurityConsole SecurityConsole
|
||||
|
||||
@@ -813,7 +813,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SetAssociationColDfn(columnDfn, "Amount trans max", 90, SbmDbDfn.ColumnIdx.Association_AmountTransMax, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
break;
|
||||
case SbmAssociation.Column.AnnualSalesTarget:
|
||||
if (UserContext.SecurityProfile.Financial.CanViewFinancials)
|
||||
if (UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySales))
|
||||
{
|
||||
SetAssociationColDfn(columnDfn, "Annual sales target", 90, SbmDbDfn.ColumnIdx.Association_AnnualSalesTarget, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.NumDecimals = 0;
|
||||
@@ -1241,21 +1241,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
columnDfn.DataName = colAssociation_LastSaleRaised;
|
||||
break;
|
||||
case SbmAssociation.Column.Trans_SalesValue_Open: // Net open sales order value.
|
||||
if (UserContext.SecurityProfile.Financial.CanViewFinancials)
|
||||
if (UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySales))
|
||||
{
|
||||
SetAssociationColDfn(columnDfn, "Open sales", 80, SbmDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.DataName = colAssociation_SalesValueOpen;
|
||||
}
|
||||
break;
|
||||
case SbmAssociation.Column.Trans_SalesValue_Cytd: // Net sales order value closed this calendar year.
|
||||
if (UserContext.SecurityProfile.Financial.CanViewFinancials)
|
||||
if (UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySales))
|
||||
{
|
||||
SetAssociationColDfn(columnDfn, "Sales CYTD", 80, SbmDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.DataName = colAssociation_SalesValueCytd;
|
||||
}
|
||||
break;
|
||||
case SbmAssociation.Column.Trans_SalesValue_Lcy: // Net sales order value closed last calendar year.
|
||||
if (UserContext.SecurityProfile.Financial.CanViewFinancials)
|
||||
if (UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySales))
|
||||
{
|
||||
SetAssociationColDfn(columnDfn, "Sales LCY", 80, SbmDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.DataName = colAssociation_SalesValueLcy;
|
||||
@@ -1839,7 +1839,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
// Retrieve the database.
|
||||
ClearErrorState();
|
||||
bool CanManageFinancials = UserContext.SecurityProfile.Financial.CanViewFinancials;
|
||||
bool CanManageFinancials = UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySales);
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Construct Query.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -15,7 +16,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmAccountMgr_Dbas(SbmUserContext userContext) :
|
||||
public SbmAccountMgr_Dbas(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -19,7 +20,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmAssetMgr_Dbas(SbmUserContext userContext) :
|
||||
public SbmAssetMgr_Dbas(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
|
||||
@@ -593,9 +593,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Commodity.
|
||||
public override SbmCommodity CreateCommodity(SysId id, SysId affiliateIdOwner, Sbm.CommodityType commodityType, String code)
|
||||
public override SbmCommodity CreateCommodity(SysId affiliateIdOwner, Sbm.CommodityType commodityType, String code)
|
||||
{
|
||||
return new SbmCommodity_Dbas(Internals, id, affiliateIdOwner, commodityType, code, 0);
|
||||
return new SbmCommodity_Dbas(Internals, null, affiliateIdOwner, commodityType, code, 0);
|
||||
}
|
||||
private SbmCommodity_Dbas CreateCommodity(Commodity_Db dbCommodity)
|
||||
{
|
||||
@@ -1068,7 +1068,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Getting Commodity column definition.
|
||||
public override ColumnDfn GetCommodityColumnDfn(SbmCommodity.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
bool canViewFinancials = UserContext.SecurityProfile.Financial.CanViewFinancials;
|
||||
bool canViewSalesFinancials = UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySales);
|
||||
bool canViewSupplyFinancials = UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySupply);
|
||||
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
switch (columnId)
|
||||
@@ -1084,9 +1085,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
// Commodity Properties.
|
||||
case SbmCommodity.Column.Type_Desc:
|
||||
case SbmCommodity.Column.Type:
|
||||
SetCommodityColDfn(columnDfn, "Type", 70, SbmDbDfn.ColumnIdx.Commodity_Type, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
break;
|
||||
case SbmCommodity.Column.Type_Code:
|
||||
SetCommodityColDfn(columnDfn, "Type", 70, SbmDbDfn.ColumnIdx.Commodity_Type, ColumnAlignment.Center);
|
||||
break;
|
||||
case SbmCommodity.Column.Type_Desc:
|
||||
SetCommodityColDfn(columnDfn, "Type", 90, SbmDbDfn.ColumnIdx.Commodity_Type, ColumnAlignment.Center);
|
||||
break;
|
||||
case SbmCommodity.Column.Code:
|
||||
SetCommodityColDfn(columnDfn, "Code", 120, SbmDbDfn.ColumnIdx.Commodity_Code);
|
||||
if (ConfigConsole != null && AllowConfigOption(Sbm.ConfigOption.CommodityDoubleColumnWidth))
|
||||
@@ -1318,7 +1325,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SetCommodityColDfn(columnDfn, "Part number", 90, SbmDbDfn.ColumnIdx.Commodity_SupplierRef, ColumnAlignment.Center);
|
||||
break;
|
||||
case SbmCommodity.Column.CostPrice:
|
||||
if (canViewFinancials)
|
||||
if (canViewSupplyFinancials)
|
||||
{
|
||||
String label = GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CostPrice, "Cost price");
|
||||
SetCommodityColDfn(columnDfn, label, 70, SbmDbDfn.ColumnIdx.Commodity_CostPrice, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
@@ -1327,7 +1334,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.CostPrice_Fmt:
|
||||
if (canViewFinancials)
|
||||
if (canViewSupplyFinancials)
|
||||
{
|
||||
String label = GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_CostPrice, "Cost price");
|
||||
SetCommodityColDfn(columnDfn, label, 70, SbmDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||
@@ -1338,7 +1345,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SetCommodityColDfn(columnDfn, "Place of origin", 90, SbmDbDfn.ColumnIdx.Commodity_PlaceOfOrigin);
|
||||
break;
|
||||
case SbmCommodity.Column.MaterialCost:
|
||||
if (canViewFinancials)
|
||||
if (canViewSupplyFinancials)
|
||||
{
|
||||
String label = GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCost, "Material cost");
|
||||
SetCommodityColDfn(columnDfn, label, 80, SbmDbDfn.ColumnIdx.Commodity_MaterialCost, ColumnAlignment.Right, DataValue.DataType.Double, aliasCommodity_CurrencyMaterial, prefixCommodity_CurrencyMaterial);
|
||||
@@ -1347,7 +1354,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.MaterialCost_Fmt:
|
||||
if (canViewFinancials)
|
||||
if (canViewSupplyFinancials)
|
||||
{
|
||||
String label = GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCost, "Material cost");
|
||||
SetCommodityColDfn(columnDfn, label, 90, SbmDbDfn.ColumnIdx.Commodity_MaterialCost, ColumnAlignment.Right, DataValue.DataType.String, aliasCommodity_CurrencyMaterial, prefixCommodity_CurrencyMaterial);
|
||||
@@ -1421,7 +1428,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SetCommodityColDfn(columnDfn, "Customer", 100, SbmDbDfn.ColumnIdx.Affiliate_Name);
|
||||
break;
|
||||
case SbmCommodity.Column.SalesPrice:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "Sales price", 80, SbmDbDfn.ColumnIdx.Commodity_SalesPrice, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.NumDecimals = CurrencyDecimalsDefault;
|
||||
@@ -1429,14 +1436,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.SalesPrice_Fmt:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "Sales price", 90, SbmDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right, DataValue.DataType.String);
|
||||
columnDfn.ShowZeroValues = false;
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.RetailPrice:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "RRP", 80, SbmDbDfn.ColumnIdx.Commodity_RetailPrice, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.NumDecimals = CurrencyDecimalsDefault;
|
||||
@@ -1444,14 +1451,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.RetailPrice_Fmt:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "RRP", 90, SbmDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right, DataValue.DataType.String);
|
||||
columnDfn.ShowZeroValues = false;
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.RetailPricePlanned:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "Planned RRP", 80, SbmDbDfn.ColumnIdx.Commodity_RetailPricePlanned, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.NumDecimals = CurrencyDecimalsDefault;
|
||||
@@ -1459,14 +1466,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.RetailPricePlanned_Fmt:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "Planned RRP", 90, SbmDbDfn.ColumnIdx.Commodity_RetailPricePlanned, ColumnAlignment.Right, DataValue.DataType.String);
|
||||
columnDfn.ShowZeroValues = false;
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.GrossPrice:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "Gross price", 80, SbmDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.NumDecimals = CurrencyDecimalsDefault;
|
||||
@@ -1474,7 +1481,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.GrossPrice_Fmt:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "Gross price", 90, SbmDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right, DataValue.DataType.String);
|
||||
columnDfn.ShowZeroValues = false;
|
||||
@@ -1484,7 +1491,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
SetCommodityColDfn(columnDfn, "Unit of Sale", 100, SbmDbDfn.ColumnIdx.UnitMeasure_Single, ColumnAlignment.Center);
|
||||
break;
|
||||
case SbmCommodity.Column.CarriageCostIndicative:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "Carriage cost (ind)", 80, SbmDbDfn.ColumnIdx.Commodity_CarriageCostIndicative, ColumnAlignment.Right, DataValue.DataType.Double);
|
||||
columnDfn.NumDecimals = CurrencyDecimalsDefault;
|
||||
@@ -1492,7 +1499,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
break;
|
||||
case SbmCommodity.Column.CarriageCostIndicative_Fmt:
|
||||
if (canViewFinancials)
|
||||
if (canViewSalesFinancials)
|
||||
{
|
||||
SetCommodityColDfn(columnDfn, "Carriage cost (ind)", 90, SbmDbDfn.ColumnIdx.Commodity_CarriageCostIndicative, ColumnAlignment.Right, DataValue.DataType.String);
|
||||
columnDfn.ShowZeroValues = false;
|
||||
@@ -2267,23 +2274,41 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".GetCommodityQueryFilter";
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common columns.
|
||||
String colCommodity_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Id, aliasCommodity);
|
||||
String colCommodity_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_AffIdOwner, aliasCommodity);
|
||||
String colCommodity_Type = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Type, aliasCommodity);
|
||||
String colCommodity_Code = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Code, aliasCommodity);
|
||||
String colCommodity_DescBrief = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DescBrief, aliasCommodity);
|
||||
String colCommodity_DescDetail = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DescDetail, aliasCommodity);
|
||||
String colCommodity_SpecSummary = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_SpecSummary, aliasCommodity);
|
||||
String colCommodity_DrawingNo = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DrawingNo, aliasCommodity);
|
||||
String colCommodity_DrawingIssue = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DrawingIssue, aliasCommodity);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Commodity Id.
|
||||
String includedIds = prm.IncludedIds.Concat(",");
|
||||
String colCommodity_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Id, aliasCommodity);
|
||||
if (!includedIds.IsEmpty()) filter.Add(colCommodity_Id + " IN (" + includedIds + ")");
|
||||
String excludedIds = prm.ExcludedIds.Concat(",");
|
||||
if (!excludedIds.IsEmpty()) filter.Add(colCommodity_Id + " NOT IN (" + excludedIds + ")");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Owner.
|
||||
String colCommodity_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_AffIdOwner, aliasCommodity);
|
||||
bool filterByOwner = !prm.IncludedIds.HasValidIds() && !prm.PriceSetIdsIncluded.HasValidIds() && !SysId.IsValid(prm.AssociationIdCustomer) && !SysId.IsValid(prm.AssociationIdCommodityCustomer);
|
||||
if (filterByOwner) filter.Add(colCommodity_AffIdOwner + "=" + SysId.ToString(AffiliateId_Owner));
|
||||
// Organisation.
|
||||
if (SysId.IsValid(prm.AffiliateIdOrganisation))
|
||||
filter.Add(colCommodity_AffIdOwner + "=" + SysId.ToString(prm.AffiliateIdOrganisation));
|
||||
else
|
||||
{
|
||||
// Must filter by organisation if insufficient alternative filetrs.
|
||||
if (!prm.IncludedIds.HasValidIds() && !prm.PriceSetIdsIncluded.HasValidIds() && !SysId.IsValid(prm.AssociationIdCustomer) && !SysId.IsValid(prm.AssociationIdCommodityCustomer))
|
||||
{
|
||||
if (!SysId.IsValid(AffiliateId_Owner)) throw new NotSupportedException("Commodity query filter - Organisation Id must be specified");
|
||||
filter.Add(colCommodity_AffIdOwner + "=" + SysId.ToString(AffiliateId_Owner));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Type.
|
||||
String colCommodity_Type = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Type, aliasCommodity);
|
||||
if (prm.CommodityType == Sbm.CommodityType.AnyProduct)
|
||||
filter.Add(colCommodity_Type + " In (" + ((int)Sbm.CommodityType.Stock).ToString() + "," + ((int)Sbm.CommodityType.NonStock).ToString() + ")");
|
||||
else if ((int)prm.CommodityType > 0)
|
||||
@@ -2293,7 +2318,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Code.
|
||||
String colCommodity_Code = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Code, aliasCommodity);
|
||||
if (!StringUtil.IsEmpty(prm.CodeFull))
|
||||
filter.Add(colCommodity_Code + "='" + DbQuery.FormatForCondition(prm.CodeFull) + "'");
|
||||
else if (!StringUtil.IsEmpty(prm.CodePartial))
|
||||
@@ -2307,7 +2331,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Brief Desc.
|
||||
bool allowEmbeddedTextSearch = true;
|
||||
bool allowFullTextSearch = true;
|
||||
String colCommodity_DescBrief = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DescBrief, aliasCommodity);
|
||||
if (!StringUtil.IsEmpty(prm.DescBriefFull))
|
||||
filter.Add(colCommodity_DescBrief + "='" + DbQuery.FormatForCondition(prm.DescBriefFull) + "'");
|
||||
else if (!StringUtil.IsEmpty(prm.DescBriefPartial))
|
||||
@@ -2327,7 +2350,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// DrawingNumber.
|
||||
String colCommodity_DrawingNo = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DrawingNo, aliasCommodity);
|
||||
if (!StringUtil.IsEmpty(prm.DrawingNoFull))
|
||||
{
|
||||
filter.Add(colCommodity_DrawingNo + "='" + DbQuery.FormatForCondition(prm.DrawingNoFull) + "'");
|
||||
@@ -2338,12 +2360,31 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
// DrawingIssue.
|
||||
String colCommodity_DrawingIssue = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DrawingIssue, aliasCommodity);
|
||||
if (!StringUtil.IsEmpty(prm.DrawingIssueFull))
|
||||
filter.Add(colCommodity_DrawingIssue + "='" + DbQuery.FormatForCondition(prm.DrawingIssueFull) + "'");
|
||||
else if (!StringUtil.IsEmpty(prm.DrawingIssuePartial))
|
||||
filter.Add(DbQuery.FormatFn_Left(colCommodity_DrawingIssue, prm.DrawingIssuePartial.Length) + "='" + DbQuery.FormatForCondition(prm.DrawingIssuePartial) + "'");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Generic search.
|
||||
if (!StringUtil.IsEmpty(prm.Search))
|
||||
{
|
||||
List<String> searchFilter = new List<string>();
|
||||
foreach (String rawSearchValue in prm.Search.Split(new char[] { ' ', ',', ';' }))
|
||||
{
|
||||
String searchValue = DbQuery.FormatForLike(StringUtil.TrimAll(rawSearchValue));
|
||||
if (StringUtil.IsEmpty(searchValue)) continue;
|
||||
List<String> searchValueFilter = new List<string>();
|
||||
searchValueFilter.Add(colCommodity_Code + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colCommodity_DescBrief + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colCommodity_DescDetail + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colCommodity_SpecSummary + " LIKE '%" + searchValue + "%'");
|
||||
searchValueFilter.Add(colCommodity_DrawingNo + " LIKE '%" + searchValue + "%'");
|
||||
searchFilter.Add(searchValueFilter.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
filter.AddRange(searchFilter);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Catalog.
|
||||
String colCommodity_CatalogRef = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_CatalogRef, aliasCommodity);
|
||||
@@ -2670,7 +2711,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
ClearErrorState();
|
||||
PopulateLocationIdLists();
|
||||
bool canViewFinancials = UserContext.SecurityProfile.Financial.CanViewFinancials;
|
||||
bool canViewSupplyFinancials = UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySupply);
|
||||
bool canViewSalesFinancials = UserContext.SecurityProfile.UserCanViewFinancials(Sbm.FinancialType.CommoditySales);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Construct query.
|
||||
@@ -2693,8 +2735,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Commodity Properties - add columns as defined in query list.
|
||||
if (columns.HasId(SbmCommodity.Column.Id)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Id, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.Type_Desc)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Type, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.Id))
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Id, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.Type) || columns.HasId(SbmCommodity.Column.Type_Code) || columns.HasId(SbmCommodity.Column.Type_Desc))
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Type, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.Code)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_Code, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.DescBrief)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DescBrief, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.DescDetail)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_DescDetail, aliasCommodity));
|
||||
@@ -2740,18 +2784,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (columns.HasId(SbmCommodity.Column.NominalCodePurchase)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_NominalCodePurchase, aliasCommodity));
|
||||
//---------------------------------------------------------------
|
||||
// Currency (to come).
|
||||
if (canViewFinancials && (columns.HasId(SbmCommodity.Column.CostPrice_Fmt) ||
|
||||
columns.HasId(SbmCommodity.Column.SalesPrice_Fmt) ||
|
||||
columns.HasId(SbmCommodity.Column.RetailPrice_Fmt) ||
|
||||
columns.HasId(SbmCommodity.Column.RetailPricePlanned_Fmt) ||
|
||||
columns.HasId(SbmCommodity.Column.GrossPrice_Fmt) ||
|
||||
columns.HasId(SbmCommodity.Column.CarriageCostIndicative_Fmt)))
|
||||
if ((canViewSupplyFinancials && (columns.HasId(SbmCommodity.Column.CostPrice_Fmt))) ||
|
||||
(canViewSalesFinancials && (columns.HasId(SbmCommodity.Column.SalesPrice_Fmt) || columns.HasId(SbmCommodity.Column.RetailPrice_Fmt) || columns.HasId(SbmCommodity.Column.RetailPricePlanned_Fmt) || columns.HasId(SbmCommodity.Column.GrossPrice_Fmt) || columns.HasId(SbmCommodity.Column.CarriageCostIndicative_Fmt))))
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
// Purchasing.
|
||||
if (columns.HasId(SbmCommodity.Column.Supplier_Ref)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_SupplierRef, aliasCommodity));
|
||||
if (canViewFinancials && (columns.HasId(SbmCommodity.Column.CostPrice) ||
|
||||
if (canViewSupplyFinancials && (columns.HasId(SbmCommodity.Column.CostPrice) ||
|
||||
columns.HasId(SbmCommodity.Column.CostPrice_Fmt))) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_CostPrice, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.PlaceOfOrigin)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_PlaceOfOrigin, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.MaterialCost) || columns.HasId(SbmCommodity.Column.MaterialCost_Fmt)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_MaterialCost, aliasCommodity));
|
||||
@@ -2769,12 +2809,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
if (columns.HasId(SbmCommodity.Column.QtyOnOrder)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_QtyOnOrder, aliasCommodity));
|
||||
//---------------------------------------------------------------
|
||||
// Sales.
|
||||
if (canViewFinancials && (columns.HasId(SbmCommodity.Column.SalesPrice) ||
|
||||
if (canViewSalesFinancials && (columns.HasId(SbmCommodity.Column.SalesPrice) ||
|
||||
columns.HasId(SbmCommodity.Column.SalesPrice_Fmt) ||
|
||||
columns.HasId(SbmCommodity.Column.GrossPrice) || columns.HasId(SbmCommodity.Column.GrossPrice_Fmt))) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_SalesPrice, aliasCommodity));
|
||||
if (canViewFinancials && (columns.HasId(SbmCommodity.Column.RetailPrice) ||
|
||||
if (canViewSalesFinancials && (columns.HasId(SbmCommodity.Column.RetailPrice) ||
|
||||
columns.HasId(SbmCommodity.Column.RetailPrice_Fmt))) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_RetailPrice, aliasCommodity));
|
||||
if (canViewFinancials && (columns.HasId(SbmCommodity.Column.RetailPricePlanned) ||
|
||||
if (canViewSalesFinancials && (columns.HasId(SbmCommodity.Column.RetailPricePlanned) ||
|
||||
columns.HasId(SbmCommodity.Column.RetailPricePlanned_Fmt))) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_RetailPricePlanned, aliasCommodity));
|
||||
if (columns.HasId(SbmCommodity.Column.CarriageCostIndicative) ||
|
||||
columns.HasId(SbmCommodity.Column.CarriageCostIndicative_Fmt)) query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_CarriageCostIndicative, aliasCommodity));
|
||||
@@ -2973,7 +3013,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.TaxCode_Code, aliasCommodity_TaxCode_Sale), prefixCommodity_TaxCode_Sale + SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.TaxCode_Code, false));
|
||||
query.Columns.Add(SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.TaxCode_TaxRate, aliasCommodity_TaxCode_Sale), prefixCommodity_TaxCode_Sale + SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.TaxCode_TaxRate, false));
|
||||
}
|
||||
if (canViewFinancials && columns.HasId(SbmCommodity.Column.GrossPrice))
|
||||
if (canViewSalesFinancials && columns.HasId(SbmCommodity.Column.GrossPrice))
|
||||
{
|
||||
// Calculate RRP: SalesPrice + TaxRate%
|
||||
String colCommodity_SalesPrice = "(" + SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Commodity_SalesPrice, aliasCommodity) + "*(1.0+(" + prefixCommodity_TaxCode_Sale + SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.TaxCode_TaxRate, false) + "/100.0)))";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -18,7 +19,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmCommodityMgr_Dbas(SbmUserContext userContext) :
|
||||
public SbmCommodityMgr_Dbas(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -19,7 +20,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmDataItemMgr_Dbas(SbmUserContext userContext) :
|
||||
public SbmDataItemMgr_Dbas(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -16,7 +17,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmPriceMgr_Dbas(SbmUserContext userContext) :
|
||||
public SbmPriceMgr_Dbas(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -20,7 +21,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmProcessMgr_Dbas(SbmUserContext userContext) :
|
||||
public SbmProcessMgr_Dbas(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.Data;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
@@ -19,7 +20,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmStockMgr_Dbas(SbmUserContext userContext) :
|
||||
public SbmStockMgr_Dbas(ISbmUserContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user