Files
BusinessMgr-2019/SaBusMgrStandardDbas/Dbas/Consoles/SbmItemOptionConsole_Dbas.cs
T
2021-08-04 21:32:35 +01:00

81 lines
3.0 KiB
C#

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;
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;
private SaInterfaceConsole interfaceConsole;
private SaUpdateLogConsole updateLogConsole;
//-------------------------------------------------------------------
// Construction.
protected SbmItemOptionConsole_Dbas(ISbmUserContext userContext) : base(SbmGlobals.Application.GetBusMgrDatabase(userContext.SessionContext))
{
UserContext = userContext;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (accountMgr != null) accountMgr.Dispose(); accountMgr = null;
if (updateLogConsole != null) updateLogConsole.Dispose(); updateLogConsole = null;
}
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// Properties.
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; } }
// Consoles.
public SaInterfaceConsole InterfaceConsole
{
get
{
if (interfaceConsole == null)
interfaceConsole = SbmGlobals.Application.CreateInterfaceConsole(UserContext);
return interfaceConsole;
}
}
public override SaUpdateLogConsole UpdateLogConsole
{
get
{
if (updateLogConsole == null)
updateLogConsole = SbmGlobals.Application.CreateUpdateLogConsole(UserContext);
return updateLogConsole;
}
}
//-------------------------------------------------------------------
// 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 InterfaceConsole.GetInterfaceItemOptionDfns(itemId.Id);
return new List<SaItemOptionDfn>();
}
//-------------------------------------------------------------------
}
//=======================================================================
}