This commit is contained in:
2019-04-09 16:34:59 +01:00
parent 3ef1475d63
commit ef02a3a6ad
46 changed files with 2122 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
using Sarand.Core.CodeTypes;
using Sarand.Core.Dbas.Base;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
public abstract class SpmApplication
{
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
protected SpmApplication ()
{
}
//-------------------------------------------------------------------
// Database.
public abstract ISacsDatabase GetDatabase (SpmSessionContext sessionContext);
//public abstract bool ColumnExists (SbmSessionContext sessionContext, SbmDbDfn.ColumnIdx columnIdx);
//-------------------------------------------------------------------
// Code Type console.
public abstract SaCodeTypeConsole GetCodeTypeConsole (SpmUserContext userContext);
//-------------------------------------------------------------------
}
//=======================================================================
}
+40
View File
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
public static class Spm
{
//-------------------------------------------------------------------
// Version.
public static String Version { get; } = "0.0.1";
// History.
// 0.0.1 Apr-2019 Initial.
//-------------------------------------------------------------------
// Constants.
public static readonly String ApplicationCaption = "Sarand PatientMgr";
//-------------------------------------------------------------------
// Site. NB Only code should be used on database.
public enum Site
{
Unknown = 0,
Addenbrookes = 10, /* 'ANT' */
}
//-------------------------------------------------------------------
// System codes - predefined lists of codes that cannot be changed.
public enum SystemCode
{
Unknown = 0,
// General.
Site = 1,
}
//-------------------------------------------------------------------
}
//=======================================================================
}
+37
View File
@@ -0,0 +1,37 @@
using Sarand.Core.CodeTypes;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
public static class SpmGlobals
{
//-------------------------------------------------------------------
// System.
public static SpmSystem System { get; set; } = null;
//-------------------------------------------------------------------
// Application.
public static SpmApplication Application { get; set; }
//-------------------------------------------------------------------
// Consoles.
public static SaCodeTypeConsole GetCodeTypeConsole (SpmUserContext userContext)
{
return Application.GetCodeTypeConsole(userContext);
}
//-------------------------------------------------------------------
// Clear globals.
public static void clear ()
{
System = null;
Application = null;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
public class SpmSecurityContext
{
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
public class SpmSessionContext
{
//-------------------------------------------------------------------
// Protected construction - use derived object.
protected SpmSessionContext (ushort index, Spm.Site site)
{
Index = index;
Site = site;
}
//-------------------------------------------------------------------
// Properties.
public ushort Index { get; protected set; }
public Spm.Site Site { get; protected set; }
public String SiteCode { get { return SpmSystem.GetSiteCode(Site); } }
//-------------------------------------------------------------------
// Comparison.
public bool Equals (SpmSessionContext sessionContext)
{
if (sessionContext.Index != Index) return false;
if (sessionContext.Site != Site) return false;
return true;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
/// <summary>
/// PatientMgr global properties.
/// <para>Restricted to properties that are global to all apps - desktop, console, service, web, mobile.</para>
/// <para>Do not store any user related information here.</para>
/// </summary>
public class SpmSessionProfile
{
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
protected SpmSessionProfile()
{
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
// S P M S y s t e m - C o d e T y p e s
//=======================================================================
public partial class SpmSystem
{
//-------------------------------------------------------------------
// S y s t e m - C o d e T y p e s
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,27 @@
using Sarand.Core.Base;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
// S P M S y s t e m - S t a t i c s
//=======================================================================
public partial class SpmSystem
{
//-------------------------------------------------------------------
// SLM System - Static initialisation.
static SpmSystem ()
{
//---------------------------------------------------------------
// Sites.
sites.Add((int)Spm.Site.Addenbrookes, "ANT", "Addenbrookes");
//---------------------------------------------------------------
}
//-------------------------------------------------------------------
}
//=======================================================================
}
+116
View File
@@ -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 ? "&copy; " : "(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;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.App
{
//=======================================================================
public class SpmUserContext
{
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
//-------------------------------------------------------------------
// Properties.
public SpmSessionContext SessionContext { get; protected set; }
//-------------------------------------------------------------------
}
//=======================================================================
}
+27
View File
@@ -0,0 +1,27 @@
using Sarand.PatientMgr.Core.App;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.Mgr
{
//=======================================================================
public abstract partial class SpmAdmissionMgr : SpmItemMgr
{
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
protected SpmAdmissionMgr (SpmUserContext userContext) :
base(userContext)
{
}
//-------------------------------------------------------------------
// Properties.
//-------------------------------------------------------------------
}
//=======================================================================
}
+65
View File
@@ -0,0 +1,65 @@
using Sarand.PatientMgr.Core.App;
using Sarand.Core.Bus;
using Sarand.Core.CodeTypes;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.PatientMgr.Core.Mgr
{
//=======================================================================
public abstract class SpmItemMgr : SacsItemMgr
{
//-------------------------------------------------------------------
// Data members.
private SaCodeTypeConsole codeTypeConsole;
// Managers.
private SpmAdmissionMgr admissionMgr;
//-------------------------------------------------------------------
// Static initialisation.
static SpmItemMgr ()
{
}
//-------------------------------------------------------------------
// Construction.
protected SpmItemMgr (SpmUserContext userContext)
{
if (userContext == null)
throw new NotSupportedException("SpmItemMgr User context must be supplied");
UserContext = userContext;
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (admissionMgr != null) admissionMgr.Dispose();
}
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// Properties.
public SpmUserContext UserContext { get; }
public SpmSessionContext SessionContext { get { return UserContext.SessionContext; } }
public SaCodeTypeConsole CodeTypeConsole { get { if (codeTypeConsole == null) codeTypeConsole = SpmGlobals.GetCodeTypeConsole(UserContext); { return codeTypeConsole; } } }
// Managers.
public SpmAdmissionMgr AdmissionMgr { get { if (admissionMgr == null) admissionMgr = SpmGlobals.System.CreateAdmissionMgr(UserContext); return admissionMgr; } }
//-------------------------------------------------------------------
// Utilities.
/*
public bool ColumnExists (SpmDbDfn.ColumnIdx columnIdx)
{
SpmApplication application = SpmGlobals.Application;
if (application != null)
return application.ColumnExists(SessionContext, columnIdx);
return false;
}
*/
//-------------------------------------------------------------------
}
//=======================================================================
}
+26
View File
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<RootNamespace>Sarand.PatientMgr</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Core - Copy\**" />
<EmbeddedResource Remove="Core - Copy\**" />
<None Remove="Core - Copy\**" />
</ItemGroup>
<ItemGroup>
<Folder Include="Core\Bus\" />
<Folder Include="Core\Consoles\" />
<Folder Include="Core\Data\" />
<Folder Include="Core\UpdateLog\" />
<Folder Include="Core\WebService\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Common-C#\Workspace\SacsCoreBase\SacsCoreBase.csproj" />
</ItemGroup>
</Project>