Session Console and Internals.
This commit is contained in:
@@ -25,6 +25,7 @@ using static Sarand.Net.Standard.Dbas.Base.SacsDatabaseConsole;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.BusinessMgr.Net.Standard.Dbas.App;
|
||||
|
||||
namespace Sarand.BusinessMgr.Web.Control.App
|
||||
{
|
||||
@@ -58,7 +59,7 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
public SysId ControlRepositoryId { get; }
|
||||
public HashSet<string> RepositoryContexts { get; } = new HashSet<string>();
|
||||
public ISacsDatabase BusMgrDatabase { get; set; }
|
||||
// Core Instance config.
|
||||
// Instance config.
|
||||
private SbmInstanceConfig instanceConfig = null;
|
||||
public SbmInstanceConfig InstanceConfig
|
||||
{
|
||||
@@ -69,6 +70,17 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
return instanceConfig;
|
||||
}
|
||||
}
|
||||
// Instance data cache.
|
||||
private SbmInstanceDataCache instanceDataCache = null;
|
||||
public SbmInstanceDataCache InstanceDataCache
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instanceDataCache == null)
|
||||
instanceDataCache = new SbmInstanceDataCache_Dbas(SessionContext);
|
||||
return instanceDataCache;
|
||||
}
|
||||
}
|
||||
}
|
||||
private readonly Dictionary<ushort, CoreInstanceContextData> coreInstances = new Dictionary<ushort, CoreInstanceContextData>();
|
||||
|
||||
@@ -164,6 +176,16 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
{
|
||||
return coreInstances.GetValue(sessionContext.Index, null)?.InstanceConfig;
|
||||
}
|
||||
// Instance data cache.
|
||||
public override SbmInstanceDataCache GetInstanceDataCache(SbmSessionContext sessionContext)
|
||||
{
|
||||
return coreInstances.GetValue(sessionContext.Index, null)?.InstanceDataCache;
|
||||
}
|
||||
// Organisation configuration.
|
||||
public override SbmOrganisationConfig GetOrganisationConfig(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return new SbmOrganisationConfig_Dbas(userContext, GetInstanceDataCache(userContext.SessionContext));
|
||||
}
|
||||
// Email configuration.
|
||||
public override SbmEmailConfig EmailConfig { get { return emailConfigs.Values.ToList().getConfigForSession(AppConfig); } }
|
||||
|
||||
@@ -171,17 +193,17 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
// Consoles.
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
public override SaSecurityConsole CreateSecurityConsole(ISbmUserContext_Core userContext)
|
||||
public override SaSecurityConsole CreateSecurityConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return new SbmSecurityConsole_Web(userContext);
|
||||
}
|
||||
|
||||
public override SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext_Core userContext)
|
||||
public override SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override SbmEmailConsole CreateEmailConsole(ISbmUserContext_Core userContext)
|
||||
public override SbmEmailConsole CreateEmailConsole(ISbmUserOrganisationContext userContext)
|
||||
{
|
||||
return new SbmEmailConsole_Control(EmailConfig);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
/// <summary>
|
||||
/// Wrapper class to allow access to core internals from Control application.
|
||||
/// </summary>
|
||||
public class SbmUserContext_Control : ISbmUserContext_Core
|
||||
public class SbmUserContext_Control : ISbmUserOrganisationContext
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public SbmUserContext_Control(SbmSessionData_Control sessionData)
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
|
||||
ColumnDfn colContext = ControlItemMgr.GetItemParamColumnDfn(SbmcItemParam.Column.Context);
|
||||
ColumnDfn colName = ControlItemMgr.GetItemParamColumnDfn(SbmcItemParam.Column.Name);
|
||||
ColumnDfn colValue = ControlItemMgr.GetItemParamColumnDfn(SbmcItemParam.Column.Value);
|
||||
ColumnDfn colFlags = ControlItemMgr.GetItemParamColumnDfn(SbmcItemParam.Column.Status);
|
||||
ColumnDfn colFlags = ControlItemMgr.GetItemParamColumnDfn(SbmcItemParam.Column.Flags);
|
||||
ColumnDfn colStatus = ControlItemMgr.GetItemParamColumnDfn(SbmcItemParam.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
@@ -360,6 +360,20 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Ensure combination of item, name and context not duplicate.
|
||||
if (model.Param.Context != null && model.Param.Name != null)
|
||||
{
|
||||
string controlName = "ParamName";
|
||||
SbmcItemParam.Params prmParam = new SbmcItemParam.Params();
|
||||
if (itemParam != null)
|
||||
prmParam.IdsExcluded.Add(itemParam.Id);
|
||||
prmParam.ItemIdsIncluded.Add(itemId);
|
||||
prmParam.Context = model.Param.Context;
|
||||
prmParam.Name = model.Param.Name;
|
||||
if (ControlItemMgr.GetItemParamCount(prmParam) > 0)
|
||||
return Json(responseData.SetControlError(controlName, Localiser["msg.validation.duplicate.value"]));
|
||||
}
|
||||
|
||||
// Create new item if required.
|
||||
if (itemParam == null)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Control session data</summary>
|
||||
protected SbmSessionData_Control SessionData_Control { get { return SessionData as SbmSessionData_Control; } }
|
||||
public override ISbmUserContext_Core UserContext_Core { get { return new SbmUserContext_Control(SessionData_Control); } }
|
||||
public override ISbmUserOrganisationContext UserContext_Core { get { return new SbmUserContext_Control(SessionData_Control); } }
|
||||
protected override SbmSessionData_Web DeserializeSessionData(String sessionDataJson)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<SbmSessionData_Control>(sessionDataJson, SbmSessionDataJsonSerializerSettings);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Sarand.BusinessMgr.Web.Control.Models
|
||||
// Properties.
|
||||
protected SbmApplication_Control ControlApp { get { return SbmApplication_Control.Instance; } }
|
||||
public SbmSessionData_Control SessionData_Control { get { return SessionData as SbmSessionData_Control; } }
|
||||
public override ISbmUserContext_Core UserContext_Core { get { return new SbmUserContext_Control(SessionData_Control); } }
|
||||
public override ISbmUserOrganisationContext UserContext_Core { get { return new SbmUserContext_Control(SessionData_Control); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public IEnumerable<SelectListItem> GetInstanceContextsForSelect()
|
||||
|
||||
Reference in New Issue
Block a user