Add project files.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.CodeTypes;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmCodeTypeConsole_Dbas : SaCodeTypeConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmCodeTypeConsole_Dbas(SacsDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.Diary;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmDiaryConsole_Dbas : SaDiaryConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmDiaryConsole_Dbas(SacsDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.ItemOptions;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmInterfaceConsole_Dbas : SaInterfaceConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly List<TypeCodeDesc> dataItemTypes;
|
||||
private readonly List<TypeCodeDesc> interfaceDataTypes;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmInterfaceConsole_Dbas(SbmUserContext userContext) : base(SbmGlobals.Application.GetDatabase(userContext.SessionContext) as SacsDatabase)
|
||||
{
|
||||
UserContext = userContext;
|
||||
dataItemTypes = SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.ItemType);
|
||||
interfaceDataTypes = SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.InterfaceDataType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
public override short InterfaceDataType { get { return (short)Sbm.ItemType.Interface; } }
|
||||
public override SaItemOptionConsole ItemOptionConsole { get { return SbmGlobals.Application.GetItemOptionConsole(UserContext); } }
|
||||
public override SaUpdateLogConsole UpdateLogConsole { get { return SbmGlobals.Application.GetUpdateLogConsole(UserContext); } }
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Utilities.
|
||||
public override String GetItemTypeDesc(short itemType)
|
||||
{
|
||||
return dataItemTypes.GetDescForType(itemType);
|
||||
}
|
||||
public override String GetItemCaption(ItemId itemId)
|
||||
{
|
||||
return GetItemTypeDesc(itemId.Type) + " #" + SysId.ToString(itemId.Id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// R e g i s t e r I n t e r f a c e s
|
||||
//-------------------------------------------------------------------
|
||||
private List<TypeCodeDesc> GetInterfaceTypesForCategory(SaInterfaceCategory interfaceCategory)
|
||||
{
|
||||
if (interfaceCategory == SaInterfaceCategory.Website)
|
||||
return SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.InterfaceType_Website);
|
||||
if (interfaceCategory == SaInterfaceCategory.Accounts)
|
||||
return SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.InterfaceType_Accounts);
|
||||
if (interfaceCategory == SaInterfaceCategory.System)
|
||||
return SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.InterfaceType_System);
|
||||
if (interfaceCategory == SaInterfaceCategory.File)
|
||||
return SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.InterfaceType_File);
|
||||
return new List<TypeCodeDesc>();
|
||||
}
|
||||
public void RegisterInterfaces(String context)
|
||||
{
|
||||
foreach (SaInterfaceCategory interfaceCategory in EnumUtil.GetValues<SaInterfaceCategory>())
|
||||
{
|
||||
List<TypeCodeDesc> interfaceTypesForCategory = new List<TypeCodeDesc>();
|
||||
foreach (TypeCodeDesc interfaceType in GetInterfaceTypesForCategory(interfaceCategory))
|
||||
{
|
||||
if (InterfaceTypeValidForContextCategory(interfaceCategory, (short)interfaceType.Type))
|
||||
interfaceTypesForCategory.Add(interfaceType);
|
||||
}
|
||||
if (interfaceTypesForCategory.Count > 0)
|
||||
RegisterInterfaces(context, interfaceCategory, interfaceTypesForCategory, InterfaceAllowsDuplicates(interfaceCategory));
|
||||
}
|
||||
}
|
||||
public bool InterfaceAllowsDuplicates(SaInterfaceCategory interfaceCategory)
|
||||
{
|
||||
switch (interfaceCategory)
|
||||
{
|
||||
case SaInterfaceCategory.File:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool InterfaceTypeValidForContextCategory(SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
{
|
||||
return SbmGlobals.GetConfigConsole(UserContext.SessionContext).AllowInterface(UserContext, interfaceCategory, interfaceType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I n t e r f a c e A c c e s s C o n t r o l
|
||||
//-------------------------------------------------------------------
|
||||
public override bool CanCreateInterfaces()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool CanCreateInterfaces(String context, SaInterfaceCategory interfaceCategory)
|
||||
{
|
||||
switch (interfaceCategory)
|
||||
{
|
||||
case SaInterfaceCategory.System:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override bool CanCreateInterface(String context, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
{
|
||||
switch (interfaceCategory)
|
||||
{
|
||||
case SaInterfaceCategory.System:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override bool CanUpdateInterface(SaInterface interfaceObj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool CanCopyInterfaces()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool CanCopyInterfaces(String context, SaInterfaceCategory interfaceCategory)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool CanCopyInterface(String context, SaInterfaceCategory interfaceCategory, short interfaceType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool CanCopyInterface(SaInterface interfaceObj)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool IsCompatibleForInterfaceCopy(String context, SaInterfaceCategory interfaceCategory, int typeFrom, int typeTo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool CanRemoveInterface(SaInterface interfaceObj)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// I n t e r f a c e E v e n t s
|
||||
//---------------------------------------------------------------
|
||||
public override void OnInterfaceCreated(SysId interfaceId)
|
||||
{
|
||||
}
|
||||
public override void OnInterfaceUpdated(SysId interfaceId)
|
||||
{
|
||||
}
|
||||
public override void OnInterfaceRemoved(SysId interfaceId)
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.ItemData;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmItemDataConsole_Dbas : SaItemDataConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemDataConsole_Dbas(SacsDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.ItemDocs;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmItemDocConsole_Dbas : SaItemDocConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemDocConsole_Dbas(SacsDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.ItemOptions;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.ItemOptions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmItemOptionConsole_Dbas : SaItemOptionConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SbmAccountMgr accountMgr = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmItemOptionConsole_Dbas(SacsDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
public override short ItemOptionDataType { get { return (short)Sbm.ItemType.ItemOption; } }
|
||||
public override SaUpdateLogConsole UpdateLogConsole { get { return SbmGlobals.Application.GetUpdateLogConsole(UserContext); } }
|
||||
private SbmAccountMgr AccountMgr { get { if (accountMgr == null) accountMgr = SbmGlobals.System.CreateAccountMgr(UserContext); return accountMgr; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I t e m O p t i o n D e f i n i t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
public override List<SaItemOptionDfn> GetItemOptionDfnsForItem(ItemId itemId)
|
||||
{
|
||||
if (itemId.Type == (int)Sbm.ItemType.Association)
|
||||
return AccountMgr.GetOrganisationItemOptionDfns(itemId.Id);
|
||||
if (itemId.Type == (int)Sbm.ItemType.Interface)
|
||||
return SbmGlobals.Application.GetInterfaceConsole(UserContext).GetInterfaceItemOptionDfns(itemId.Id);
|
||||
return new List<SaItemOptionDfn>();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.ReferenceData;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmReferenceDataConsole_Dbas : SaReferenceDataConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmReferenceDataConsole_Dbas(SbmUserContext userContext, SacsDatabase database) :
|
||||
base(database)
|
||||
{
|
||||
UserContext = userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmSessionContext SessionContext { get; }
|
||||
public SbmUserContext UserContext { get; }
|
||||
public override SaUpdateLogConsole UpdateLogConsole { get { return SbmGlobals.Application.GetUpdateLogConsole(UserContext); } }
|
||||
// Item types.
|
||||
public override short LanguageItemType { get { return (short)Sbm.ItemDataType.Unknown; } }
|
||||
public override short RegionItemType { get { return (short)Sbm.ItemDataType.Region; } }
|
||||
public override short CurrencyItemType { get { return (short)Sbm.ItemDataType.Currency; } }
|
||||
public override short TaxCodeItemType { get { return (short)Sbm.ItemDataType.Unknown; } }
|
||||
public override short UnitMeasureItemType { get { return (short)Sbm.ItemDataType.Unknown; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.UpdateLog;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmSecurityConsole_Dbas : SaSecurityConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly SbmConfigConsole configConsole;
|
||||
private List<TypeCodeDesc> securityRights;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmSecurityConsole_Dbas(SacsDatabase database, SbmConfigConsole configConsole) : base(database)
|
||||
{
|
||||
this.configConsole = configConsole;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
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; } }
|
||||
public override SaUpdateLogConsole UpdateLogConsole { get { return SbmGlobals.Application.GetUpdateLogConsole(UserContext); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// S e c u r i t y R i g h t s
|
||||
//-------------------------------------------------------------------
|
||||
protected List<TypeCodeDesc> GetSecurityRights()
|
||||
{
|
||||
if (securityRights == null)
|
||||
{
|
||||
securityRights = new List<TypeCodeDesc>();
|
||||
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowContacts))
|
||||
{
|
||||
securityRights.Add(Sbm.SecurityRight.Affiliate_Create, "AffIns", "Affiliates - Create");
|
||||
securityRights.Add(Sbm.SecurityRight.Affiliate_Update, "AffUpd", "Affiliates - Update");
|
||||
securityRights.Add(Sbm.SecurityRight.Association_Create, "AssIns", "Associations - Create");
|
||||
securityRights.Add(Sbm.SecurityRight.Association_Update, "AssUpd", "Associations - Update");
|
||||
}
|
||||
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowCommodities))
|
||||
{
|
||||
securityRights.Add(Sbm.SecurityRight.Commodity_Create, "CmdIns", "Commodities - Create");
|
||||
securityRights.Add(Sbm.SecurityRight.Commodity_Update, "CmdUpd", "Commodities - Update");
|
||||
if (configConsole.GetStockControlConfig(UserContext).AllowStockControl())
|
||||
{
|
||||
securityRights.Add(Sbm.SecurityRight.StockTake, "CmdStkTak", "Commodities - Stock Take");
|
||||
}
|
||||
}
|
||||
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowAssets))
|
||||
{
|
||||
securityRights.Add(Sbm.SecurityRight.Asset_Create, "AssetIns", "Assets - Create");
|
||||
securityRights.Add(Sbm.SecurityRight.Asset_Update, "AssetUpd", "Assets - Update");
|
||||
}
|
||||
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowTransactions))
|
||||
{
|
||||
securityRights.Add(Sbm.SecurityRight.Transaction_Create, "TraIns", "Transactions - Create");
|
||||
securityRights.Add(Sbm.SecurityRight.Transaction_Update, "TraUpd", "Transactions - Update");
|
||||
securityRights.Add(Sbm.SecurityRight.Transaction_Remove, "TraRem", "Transactions - Remove");
|
||||
securityRights.Add(Sbm.SecurityRight.Transaction_ByType, "TransType", "Transactions - Allow by type");
|
||||
securityRights.Add(Sbm.SecurityRight.Transaction_UpdateByTypeStatus, "UpdTransTypeStat", "Transactions - Update by type and status");
|
||||
}
|
||||
securityRights.Add(Sbm.SecurityRight.Security_Admin, "SecAdm", "Admin - Security");
|
||||
securityRights.Add(Sbm.SecurityRight.Database_Admin, "DbAdm", "Admin - Database");
|
||||
securityRights.Add(Sbm.SecurityRight.ReferenceData_Admin, "RefAdm", "Admin - Reference data");
|
||||
if (configConsole != null && configConsole.AllowInterfaces(UserContext))
|
||||
{
|
||||
securityRights.Add(Sbm.SecurityRight.InterfaceConfig, "IntCfg", "Interfaces - Configuration");
|
||||
securityRights.Add(Sbm.SecurityRight.InterfaceByCategory, "IntCategory", "Interfaces - Allow by category");
|
||||
}
|
||||
securityRights.Add(Sbm.SecurityRight.Financial_Update, "FinUpd", "Financials - Update");
|
||||
securityRights.Add(Sbm.SecurityRight.Financial_View, "FinLst", "Financials - View");
|
||||
securityRights.Add(Sbm.SecurityRight.Financial_ViewByType, "FinType", "Financials - View by type");
|
||||
securityRights.Add(Sbm.SecurityRight.Financial_UpdateByType, "FinTypeUpd", "Financials - Update by type");
|
||||
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.TimeRecording))
|
||||
{
|
||||
securityRights.Add(Sbm.SecurityRight.TimesheetManager, "TimMgr", "Manage - Timesheets");
|
||||
}
|
||||
if (configConsole != null && configConsole.AllowOption(UserContext, Sbm.ConfigOption.AllowTasks))
|
||||
{
|
||||
securityRights.Add(Sbm.SecurityRight.TaskManager, "TskMgr", "Manage - Tasks");
|
||||
}
|
||||
}
|
||||
return securityRights;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// T r a n s a c t i o n s
|
||||
//-------------------------------------------------------------------
|
||||
private List<SysIdString> GetTransactionTypeStatusRights(bool fullList)
|
||||
{
|
||||
// Construct list of transaction types and statuses to use in security rights.
|
||||
List<SysIdString> transactionTypesStatus = new List<SysIdString>();
|
||||
foreach (TypeCodeDesc transactionType in SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.TransactionType))
|
||||
{
|
||||
Sbm.TransactionType transType = (Sbm.TransactionType)transactionType.Type;
|
||||
// Only interested in sales quotes and orders for now.
|
||||
bool bValidTransType = false;
|
||||
if (!bValidTransType) bValidTransType = (transType == Sbm.TransactionType.SalesQuote);
|
||||
if (!bValidTransType) bValidTransType = (transType == Sbm.TransactionType.SalesOrder);
|
||||
if (fullList || bValidTransType && configConsole.AllowTransactionType(UserContext, transType))
|
||||
{
|
||||
// Retrieve status categories for transaction type:
|
||||
foreach (TypeCodeDesc transactionStatus in GetTransactionStatusCats(transType))
|
||||
{
|
||||
SbmTransaction.StatusCat transStatusCat = (SbmTransaction.StatusCat)transactionStatus.Type;
|
||||
String sDesc = transactionType.Desc + " - " + transactionType.Desc;
|
||||
SysId transactionTypeIdStatus = GetTransactionTypeStatusId(transType, transStatusCat);
|
||||
if (fullList || configConsole.AllowTransactionType(UserContext, transType))
|
||||
transactionTypesStatus.Add(transactionTypeIdStatus, transactionStatus.Desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
return transactionTypesStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status Cats
|
||||
private List<TypeCodeDesc> GetTransactionStatusCats(Sbm.TransactionType eType)
|
||||
{
|
||||
List<TypeCodeDesc> transactionStatusCats = new List<TypeCodeDesc>();
|
||||
List<TypeCodeDesc> transactionStatusCatsAllowed = SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.TransactionStatusCat);
|
||||
switch (eType)
|
||||
{
|
||||
// NB Changes here may also need to be made in SapTransaction::GetTaxEffectiveDate()
|
||||
// and SapphireConsole::UseInProgressTaxDateAsTaxPoint():
|
||||
// Transaction types that have no 'Pending' stage:
|
||||
case Sbm.TransactionType.SalesLead:
|
||||
transactionStatusCatsAllowed.Add(transactionStatusCats.Find(item => item.Type == (int)SbmTransaction.StatusCat.Open));
|
||||
transactionStatusCatsAllowed.Add(transactionStatusCats.Find(item => item.Type == (int)SbmTransaction.StatusCat.Closed));
|
||||
break;
|
||||
// Transaction types that have no 'Open' stage:
|
||||
case Sbm.TransactionType.ProformaSalesOrder:
|
||||
case Sbm.TransactionType.SalesDispatch:
|
||||
case Sbm.TransactionType.ProformaPurchaseOrder:
|
||||
case Sbm.TransactionType.PurchaseDelivery:
|
||||
case Sbm.TransactionType.ProformaSalesInvoice:
|
||||
transactionStatusCatsAllowed.Add(transactionStatusCatsAllowed.Find(item => item.Type == (int)SbmTransaction.StatusCat.Pending));
|
||||
transactionStatusCatsAllowed.Add(transactionStatusCatsAllowed.Find(item => item.Type == (int)SbmTransaction.StatusCat.Closed));
|
||||
break;
|
||||
default:
|
||||
// All other types have the complete set:
|
||||
transactionStatusCats = transactionStatusCatsAllowed;
|
||||
break;
|
||||
}
|
||||
return transactionStatusCats;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Status Id.
|
||||
private SysId GetTransactionTypeStatusId(Sbm.TransactionType transactionType, SbmTransaction.StatusCat transactionStatusCat)
|
||||
{
|
||||
return new SysId(((int)transactionType * 100) + (int)transactionStatusCat);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// R e g i t e r S e c u r i t y R i g h t s
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Register Security Rights.
|
||||
public override void RegisterSecurityRights()
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
// Register data item types. [Not used - to demonstrate option]
|
||||
RegisterDataItemType((short)Sbm.ItemType.Commodity, "Commodity");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Register security rights.
|
||||
foreach (TypeCodeDesc securityRight in GetSecurityRights())
|
||||
{
|
||||
TypeCodeDesc secRight = securityRight;
|
||||
switch (secRight.Type)
|
||||
{
|
||||
case (int)Sbm.SecurityRight.Transaction_ByType:
|
||||
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.TransactionType);
|
||||
break;
|
||||
case (int)Sbm.SecurityRight.Transaction_UpdateByTypeStatus:
|
||||
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.TransactionTypeStatus);
|
||||
break;
|
||||
case (int)Sbm.SecurityRight.InterfaceByCategory:
|
||||
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.InterfaceCategory);
|
||||
break;
|
||||
case (int)Sbm.SecurityRight.Financial_ViewByType:
|
||||
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.FinancialType);
|
||||
break;
|
||||
case (int)Sbm.SecurityRight.Financial_UpdateByType:
|
||||
RegisterSecurityRight(secRight.Code, secRight.Desc, (short)Sbm.ItemType.FinancialType);
|
||||
break;
|
||||
default:
|
||||
RegisterSecurityRight(secRight.Code, secRight.Desc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Register the security data item types.
|
||||
if (configConsole != null)
|
||||
{
|
||||
// Transaction types:
|
||||
List<SysIdString> transactionTypesDesc = new List<SysIdString>();
|
||||
List<SysIdString> transactionTypesDescAllowed = new List<SysIdString>();
|
||||
foreach (TypeCodeDesc transactionType in SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.TransactionType))
|
||||
{
|
||||
if (configConsole.AllowTransactionType(UserContext, (Sbm.TransactionType)transactionType.Type))
|
||||
transactionTypesDescAllowed.Add(new SysId(transactionType.Type), transactionType.Desc);
|
||||
transactionTypesDesc.Add(new SysId(transactionType.Type), transactionType.Desc);
|
||||
}
|
||||
RegisterDataItems((short)Sbm.ItemType.TransactionType, transactionTypesDescAllowed, transactionTypesDesc);
|
||||
|
||||
// Transaction types with statuses:
|
||||
List<SysIdString> transactionTypesDescStatus = GetTransactionTypeStatusRights(false);
|
||||
List<SysIdString> transactionTypesDescStatusAllowed = GetTransactionTypeStatusRights(true);
|
||||
RegisterDataItems((short)Sbm.ItemType.TransactionTypeStatus, transactionTypesDescStatusAllowed, transactionTypesDescStatus);
|
||||
|
||||
// Interface Categories:
|
||||
List<SysIdString> interfaceCategoriesDesc = new List<SysIdString>();
|
||||
List<SysIdString> interfaceCategoriesDescAllowed = new List<SysIdString>();
|
||||
foreach (TypeCodeDesc interfaceCategory in SacsSystem.GetCodesOfType(SaSysCodeType.InterfaceCategory))
|
||||
{
|
||||
if (configConsole.AllowInterfaceCategory(UserContext, (SaInterfaceCategory)interfaceCategory.Type))
|
||||
interfaceCategoriesDescAllowed.Add(new SysId(interfaceCategory.Type), interfaceCategory.Desc);
|
||||
interfaceCategoriesDesc.Add(new SysId(interfaceCategory.Type), interfaceCategory.Desc);
|
||||
}
|
||||
RegisterDataItems((short)Sbm.ItemType.InterfaceCategory, interfaceCategoriesDescAllowed, interfaceCategoriesDesc);
|
||||
|
||||
// Financial types:
|
||||
List<SysIdString> financialTypesDesc = new List<SysIdString>();
|
||||
List<SysIdString> financialTypesDescAllowed = new List<SysIdString>();
|
||||
foreach (TypeCodeDesc financialType in SbmSystem.GetCodesOfType(UserContext, Sbm.SystemCode.FinancialType))
|
||||
{
|
||||
financialTypesDescAllowed.Add(new SysId(financialType.Type), financialType.Desc);
|
||||
financialTypesDesc.Add(new SysId(financialType.Type), financialType.Desc);
|
||||
}
|
||||
RegisterDataItems((short)Sbm.ItemType.FinancialType, financialTypesDescAllowed, financialTypesDesc);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
|
||||
CodeDesc GetSecurityRight(Sbm.SecurityRight securityRight)
|
||||
{
|
||||
return securityRights.GetCodeDescForType(securityRight);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using Sarand.Net.Standard.Dbas.UpdateLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SbmUpdateLogConsole_Dbas : SaUpdateLogConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmUpdateLogConsole_Dbas(SacsDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public SbmUserContext UserContext { get; set; }
|
||||
public SbmSessionContext SessionContext { get { return UserContext.SessionContext; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get name for User Id.
|
||||
public override Dictionary<SysId, String> GetNameForUserIds(List<SysId> userIds)
|
||||
{
|
||||
Dictionary<SysId, String> userNames = new Dictionary<SysId, String>();
|
||||
SaSecurityConsole securityConsole = SbmGlobals.Application.GetSecurityConsole(UserContext);
|
||||
if (securityConsole != null)
|
||||
{
|
||||
userNames = securityConsole.GetSecurityItemDescriptions(userIds);
|
||||
}
|
||||
return userNames;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user