Core
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
using Sarand.PatientMgr.Core.Mgr;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.App
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class SpmSystem : SacsSystem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// System Code types.
|
||||
private static List<TypeCodeDesc> sites = new List<TypeCodeDesc>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction - use derived objects.
|
||||
protected SpmSystem (PropertySet properties)
|
||||
{
|
||||
// Configure extended logging.
|
||||
extendedLoggingOptions = StringList.Split(properties.GetPropertyValue("Logging", "ExtendedLogging"));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Application definitions.
|
||||
public static String GetCopyrightNotice (bool html = false)
|
||||
{
|
||||
return (html ? "© " : "(c) ") + "2002- " + DateTime.Today.Year + " Sarand Ltd";
|
||||
}
|
||||
public static bool IsSysAdminSession ()
|
||||
{
|
||||
// Dev mode.
|
||||
if (IsDevHost()) return true;
|
||||
// Production servers.
|
||||
if (UserName.ContainsCI("Sarand"))
|
||||
{
|
||||
if (ComputerName.EqualsCI("Norman")) return true;
|
||||
}
|
||||
// Development.
|
||||
if (ComputerName.ContainsCI("Sarand")) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// S y s t e m C o d e s
|
||||
//-------------------------------------------------------------------
|
||||
public static List<TypeCodeDesc> GetCodesOfType (Spm.SystemCode systemCode)
|
||||
{
|
||||
// Lists are cloned to avoid modifications to the internal static lists.
|
||||
switch (systemCode)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
case Spm.SystemCode.Site:
|
||||
return new List<TypeCodeDesc>(sites);
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// System code utilities.
|
||||
public static Spm.Site GetSiteForCode (String siteCode)
|
||||
{
|
||||
return (Spm.Site)sites.GetTypeForCode(siteCode);
|
||||
}
|
||||
public static String GetSiteCode (Spm.Site site)
|
||||
{
|
||||
return sites.GetCodeForType((int)site);
|
||||
}
|
||||
public static String GetSiteDesc (Spm.Site site)
|
||||
{
|
||||
return sites.GetDescForType((int)site, site.ToString());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a M a n a g e r s
|
||||
//-------------------------------------------------------------------
|
||||
public abstract SpmAdmissionMgr CreateAdmissionMgr (SpmUserContext userContext);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// E x t e n d e d L o g g i n g
|
||||
//-------------------------------------------------------------------
|
||||
// Extended logging options.
|
||||
public enum ExtendedLogginOption
|
||||
{
|
||||
SecurityProfile,
|
||||
DbQueryExecution,
|
||||
Printing,
|
||||
ServiceRequests,
|
||||
}
|
||||
public static readonly String ExtendedLogging_SecurityProfile = "SecurityProfile";
|
||||
public static readonly String ExtendedLogging_DbQueryExecution = "DbQueryExecution";
|
||||
public static readonly String ExtendedLogging_Printing = "Printing";
|
||||
public static readonly String ExtendedLogging_ServiceRequests = "ServiceRequests";
|
||||
private List<String> extendedLoggingOptions;
|
||||
//-------------------------------------------------------------------
|
||||
public bool IsExtendedLogging (ExtendedLogginOption extendedLoggingOption)
|
||||
{
|
||||
if (extendedLoggingOptions == null) return false;
|
||||
if (extendedLoggingOption == ExtendedLogginOption.SecurityProfile)
|
||||
return extendedLoggingOptions.ContainsCI(ExtendedLogging_SecurityProfile);
|
||||
if (extendedLoggingOption == ExtendedLogginOption.DbQueryExecution)
|
||||
return extendedLoggingOptions.ContainsCI(ExtendedLogging_DbQueryExecution);
|
||||
if (extendedLoggingOption == ExtendedLogginOption.Printing)
|
||||
return extendedLoggingOptions.ContainsCI(ExtendedLogging_Printing);
|
||||
if (extendedLoggingOption == ExtendedLogginOption.ServiceRequests)
|
||||
return extendedLoggingOptions.ContainsCI(ExtendedLogging_ServiceRequests);
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user