diff --git a/.gitignore b/.gitignore index 3c4efe2..fa84b51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +# PatientMgr specific files +/SaPatientMgr/Resources/BuildDate.txt + # User-specific files *.suo *.user diff --git a/SaPatMgrCore/Core/App/SpmApplication.cs b/SaPatMgrCore/Core/App/SpmApplication.cs new file mode 100644 index 0000000..beec493 --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmApplication.cs @@ -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); + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmDfn.cs b/SaPatMgrCore/Core/App/SpmDfn.cs new file mode 100644 index 0000000..172ffc2 --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmDfn.cs @@ -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, + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmGlobals.cs b/SaPatMgrCore/Core/App/SpmGlobals.cs new file mode 100644 index 0000000..09e3689 --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmGlobals.cs @@ -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; + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmSecurityContext.cs b/SaPatMgrCore/Core/App/SpmSecurityContext.cs new file mode 100644 index 0000000..ab2c9cd --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmSecurityContext.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.PatientMgr.Core.App +{ + //======================================================================= + public class SpmSecurityContext + { + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmSessionContext.cs b/SaPatMgrCore/Core/App/SpmSessionContext.cs new file mode 100644 index 0000000..9946064 --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmSessionContext.cs @@ -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; + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmSessionProfile.cs b/SaPatMgrCore/Core/App/SpmSessionProfile.cs new file mode 100644 index 0000000..554a271 --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmSessionProfile.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.PatientMgr.Core.App +{ + //======================================================================= + /// + /// PatientMgr global properties. + /// Restricted to properties that are global to all apps - desktop, console, service, web, mobile. + /// Do not store any user related information here. + /// + public class SpmSessionProfile + { + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + protected SpmSessionProfile() + { + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmSystem-CodeTypes.cs b/SaPatMgrCore/Core/App/SpmSystem-CodeTypes.cs new file mode 100644 index 0000000..a857fe8 --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmSystem-CodeTypes.cs @@ -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 + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmSystem-Statics.cs b/SaPatMgrCore/Core/App/SpmSystem-Statics.cs new file mode 100644 index 0000000..8209b0e --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmSystem-Statics.cs @@ -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"); + + //--------------------------------------------------------------- + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmSystem.cs b/SaPatMgrCore/Core/App/SpmSystem.cs new file mode 100644 index 0000000..d6f9459 --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmSystem.cs @@ -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 sites = new List(); + + //------------------------------------------------------------------- + // 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 GetCodesOfType (Spm.SystemCode systemCode) + { + // Lists are cloned to avoid modifications to the internal static lists. + switch (systemCode) + { + //----------------------------------------------------------- + case Spm.SystemCode.Site: + return new List(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 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; + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/App/SpmUserContext.cs b/SaPatMgrCore/Core/App/SpmUserContext.cs new file mode 100644 index 0000000..37b0e9b --- /dev/null +++ b/SaPatMgrCore/Core/App/SpmUserContext.cs @@ -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; } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/Mgr/SpmAdmissionMgr.cs b/SaPatMgrCore/Core/Mgr/SpmAdmissionMgr.cs new file mode 100644 index 0000000..8c9fdf1 --- /dev/null +++ b/SaPatMgrCore/Core/Mgr/SpmAdmissionMgr.cs @@ -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. + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/Core/Mgr/SpmItemMgr.cs b/SaPatMgrCore/Core/Mgr/SpmItemMgr.cs new file mode 100644 index 0000000..1c71401 --- /dev/null +++ b/SaPatMgrCore/Core/Mgr/SpmItemMgr.cs @@ -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; + } + */ + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrCore/SaPatMgrCore.csproj b/SaPatMgrCore/SaPatMgrCore.csproj new file mode 100644 index 0000000..428cd4c --- /dev/null +++ b/SaPatMgrCore/SaPatMgrCore.csproj @@ -0,0 +1,26 @@ + + + + netstandard1.3 + Sarand.PatientMgr + + + + + + + + + + + + + + + + + + + + + diff --git a/SaPatMgrUnitTests/Properties/AssemblyInfo.cs b/SaPatMgrUnitTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4a678e0 --- /dev/null +++ b/SaPatMgrUnitTests/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("SaPatMgrUnitTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SaPatMgrUnitTests")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("e133e234-02d4-43e9-9667-35b9a0fb0d2c")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SaPatMgrUnitTests/SaPatMgrUnitTests.csproj b/SaPatMgrUnitTests/SaPatMgrUnitTests.csproj new file mode 100644 index 0000000..c8d019e --- /dev/null +++ b/SaPatMgrUnitTests/SaPatMgrUnitTests.csproj @@ -0,0 +1,73 @@ + + + + + + Debug + AnyCPU + {E133E234-02D4-43E9-9667-35B9A0FB0D2C} + Library + Properties + Sarand.PatientMgr + SaPatMgrUnitTests + v4.6 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/SaPatMgrUnitTests/UnitTest1.cs b/SaPatMgrUnitTests/UnitTest1.cs new file mode 100644 index 0000000..dfed72b --- /dev/null +++ b/SaPatMgrUnitTests/UnitTest1.cs @@ -0,0 +1,14 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace SaPatMgrUnitTests +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1 () + { + } + } +} diff --git a/SaPatMgrUnitTests/packages.config b/SaPatMgrUnitTests/packages.config new file mode 100644 index 0000000..fc09f95 --- /dev/null +++ b/SaPatMgrUnitTests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/SaPatMgrWinDbas/Properties/AssemblyInfo.cs b/SaPatMgrWinDbas/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b62d461 --- /dev/null +++ b/SaPatMgrWinDbas/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SaPatMgrWinDbas")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SaPatMgrWinDbas")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9f5d8526-b4b9-457f-8dba-e6b79b938aa9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SaPatMgrWinDbas/SaPatMgrWinDbas.csproj b/SaPatMgrWinDbas/SaPatMgrWinDbas.csproj new file mode 100644 index 0000000..5259725 --- /dev/null +++ b/SaPatMgrWinDbas/SaPatMgrWinDbas.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {9F5D8526-B4B9-457F-8DBA-E6B79B938AA9} + Library + Properties + Sarand.PatientMgr + SaPatMgrWinDbas + v4.6 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + {7528f88e-a24d-4d6b-be6c-9d5fb14f0cb5} + SacsCoreBase + False + + + {86e11448-66df-4eb6-922f-c84e220608ad} + SacsWinDbas + False + + + {57674a5e-b0f1-49ca-a56f-f8b8ca12fbf6} + SaPatMgrCore + False + + + + + + + + + + + + \ No newline at end of file diff --git a/SaPatMgrWinDbas/Win/Dbas/App/SpmSystem_WinDbas.cs b/SaPatMgrWinDbas/Win/Dbas/App/SpmSystem_WinDbas.cs new file mode 100644 index 0000000..597a629 --- /dev/null +++ b/SaPatMgrWinDbas/Win/Dbas/App/SpmSystem_WinDbas.cs @@ -0,0 +1,51 @@ +using Sarand.PatientMgr.Core.App; +using Sarand.PatientMgr.Core.Mgr; +using Sarand.Core.Base; +using Sarand.Core.IO; +using Sarand.PatientMgr.Win.Dbas.Utils; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Sarand.PatientMgr.Win.Dbas.Mgr; + +namespace Sarand.PatientMgr.Win.Dbas.App +{ + //======================================================================= + public class SpmSystem_WinDbas : SpmSystem + { + //------------------------------------------------------------------- + // Static initialisation. + public static void InitStatics () + { + // Initialise static environment values. + ComputerName = System.Environment.MachineName; + UserName = Environment.UserName; + ApplicationPath = System.Reflection.Assembly.GetEntryAssembly().Location; + ApplicationFolder = Path.GetDirectoryName(ApplicationPath); + AssemblyBuildAt = FileUtil.GetFileLastWriteTime(ApplicationPath); + + // Initialise other statics. + SpmFileUtil.InitStatics(); + } + + //------------------------------------------------------------------- + // Construction. + public SpmSystem_WinDbas (PropertySet properties) : base(properties) + { + } + + //------------------------------------------------------------------- + // D a t a M a n a g e r s + //------------------------------------------------------------------- + public override SpmAdmissionMgr CreateAdmissionMgr (SpmUserContext userContext) + { + return new SpmAdmissionMgr_Dbas(userContext); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrWinDbas/Win/Dbas/Mgr/SpmAdmissionMgr_Dbas.cs b/SaPatMgrWinDbas/Win/Dbas/Mgr/SpmAdmissionMgr_Dbas.cs new file mode 100644 index 0000000..9dc6d6d --- /dev/null +++ b/SaPatMgrWinDbas/Win/Dbas/Mgr/SpmAdmissionMgr_Dbas.cs @@ -0,0 +1,31 @@ +using Sarand.PatientMgr.Core.App; +using Sarand.PatientMgr.Core.Mgr; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.PatientMgr.Win.Dbas.Mgr +{ + //======================================================================= + internal partial class SpmAdmissionMgr_Dbas : SpmAdmissionMgr + { + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SpmAdmissionMgr_Dbas (SpmUserContext userContext) : + base(userContext) + { + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // Utilities. + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrWinDbas/Win/Dbas/Utils/SpmDbDfnGenerator.cs b/SaPatMgrWinDbas/Win/Dbas/Utils/SpmDbDfnGenerator.cs new file mode 100644 index 0000000..e0616e1 --- /dev/null +++ b/SaPatMgrWinDbas/Win/Dbas/Utils/SpmDbDfnGenerator.cs @@ -0,0 +1,112 @@ +using Sarand.Core.Base; +using Sarand.Core.Bus; +using Sarand.Core.IO; +using Sarand.Win.Dbas.Base; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace Sarand.PatientMgr.Win.Dbas.Utils +{ + //======================================================================= + public static class SpmDbDfnGenerator + { + //------------------------------------------------------------------- + // Definitions. + public class DbDfnGeneratorResultData + { + public bool Success { get; internal set; } + public String ErrorMessage { get; internal set; } + } + + //------------------------------------------------------------------- + // Data members. + //private static string messageBoxTitle = "PatientMgr database definition generator"; + + //------------------------------------------------------------------- + /// Generate database definitions. + public static DbDfnGeneratorResultData Generate (String connectionString) + { + DbDfnGeneratorResultData resultData = new DbDfnGeneratorResultData(); + + // Locate output folder: + String directory = GetOutputFolder(resultData); + if (String.IsNullOrEmpty(directory) || !FileUtil.IsDirectory(directory)) return resultData; + + // Open database. + // NB Must be ODBC connection - especially to retrieve index columns. + SacsDatabaseConsole.OdbcConfig config = new SacsDatabaseConsole.OdbcConfig(); + config.connectionString = connectionString; + SacsDatabase database = SacsDatabaseConsole.OpenOdbcDatabase(config); + + // Generate database definition: + GenerateDatabaseDefinition(database, directory, resultData); + return resultData; + } + + //------------------------------------------------------------------- + private static bool GenerateDatabaseDefinition (SacsDatabase database, String directory, DbDfnGeneratorResultData resultData) + { + + DatabaseDefinitionGenerator.Config config = new DatabaseDefinitionGenerator.Config(); + config.Database = database; + config.OutputDirectory = directory; + config.NamespaceDefinition = "Sarand.PatientMgr.Core.App"; + config.NamespaceTableObjects = "Sarand.PatientMgr.Win.Dbas.Internal"; + config.ClassnameDefinition = "SpmDbDfn"; + config.TablesExcluded.AddRange(new String[] { "NextId", "SaCode", "SaCodeType", "SaSecItem", "SaSecurityItem", "SaSecLink", "SaSecurityLink", "SaItemData", "SaItemDoc", "SaItemOption", "SaInterface", "SaInterfaceProcess", "SaInterfaceProcessMessage", "SaInterfaceDataItem", "SaInterfaceProcessDataItem", "SaAttrUpdate" }); + // Columns to exclude from update. + config.InsertOnlyColumns.Add(".*", "CreateOn,CreateBy,CreateHost"); + // Table class. + config.TableClass.NamespaceBaseClass = "Sarand.PatientMgr.Win.Dbas.Data"; + config.TableClass.BaseClass = "SpmDbDataItem"; + config.TableClass.MandatoryConstructorDbInfo = true; + // Generate database definition. + DatabaseDefinitionGenerator generator = new DatabaseDefinitionGenerator(); + resultData.Success = generator.Generate(config); + return resultData.Success; + } + + //------------------------------------------------------------------- + private static String GetOutputFolder (DbDfnGeneratorResultData resultData) + { + String fn = "SpmDbDfnGenerator.GetOutputFolder"; + String assemblyDirectory = FileUtil.GetParentDirectory((Assembly.GetAssembly(typeof(DatabaseDefinitionGenerator)).Location)); + String directory = assemblyDirectory; + Logger.Debug(fn + " Assembly folder: " + directory); + // Locate the parent of the 'Workspace' solution root folder. + String projectFolder = "Workspace"; + while (!String.IsNullOrEmpty(directory)) + { + if (FileUtil.IsDirectory(directory + Path.DirectorySeparatorChar + projectFolder)) + { + break; + } + directory = FileUtil.GetParentDirectory(directory); + } + if (String.IsNullOrEmpty(directory)) + { + resultData.ErrorMessage = "Failed to find '" + projectFolder + "' solution root folder in assembly path:\n\n" + assemblyDirectory; + Logger.Warn(resultData.ErrorMessage); + return String.Empty; + } + // Code files are generated to '..\Dbas\Generated\PatientMgr\' folder. + directory += Path.DirectorySeparatorChar + "Database" + Path.DirectorySeparatorChar + "Generated" + Path.DirectorySeparatorChar + "PatientMgr"; + Logger.Debug(fn + " Output folder: " + directory); + if (!FileUtil.ValidateDirectory(directory, true)) + { + resultData.ErrorMessage = "Output folder not found:\n\n" + directory; + Logger.Warn(resultData.ErrorMessage); + return String.Empty; + } + return directory; + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrWinDbas/Win/Dbas/Utils/SpmFileUtil.cs b/SaPatMgrWinDbas/Win/Dbas/Utils/SpmFileUtil.cs new file mode 100644 index 0000000..a168cfc --- /dev/null +++ b/SaPatMgrWinDbas/Win/Dbas/Utils/SpmFileUtil.cs @@ -0,0 +1,86 @@ +using Sarand.Core.Base; +using Sarand.Core.IO; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sarand.PatientMgr.Win.Dbas.Utils +{ + //======================================================================= + /// + /// Static implementations of fucntions required by FileUtil. + /// + public class SpmFileUtil + { + //------------------------------------------------------------------- + // Initialise statics. + public static void InitStatics () + { + FileUtil.DirectoryExists = IsDirectory; + FileUtil.DirectoryGetParent = GetParentDirectory; + FileUtil.DirectoryCreateDirectory = CreateDirectory; + FileUtil.FileExists = IsFile; + FileUtil.FileReadAllLines = FileReadAllLines; + } + + //------------------------------------------------------------------- + // D i r e c t o r y + //------------------------------------------------------------------- + public static bool IsDirectory (String directoryPath) + { + try + { + return Directory.Exists(directoryPath); + } + catch (Exception exc) { Logger.Debug("SlmFileUtil.IsDirectory " + exc.GetType().Name + ": " + exc.Message); } + return false; + } + public static String GetParentDirectory (String filepath) + { + try + { + DirectoryInfo parentDirectoryInfo = Directory.GetParent(filepath); + if (parentDirectoryInfo != null) + return parentDirectoryInfo.FullName; + } + catch (Exception exc) { Logger.Debug("SlmFileUtil.GetParentDirectory " + exc.GetType().Name + ": " + exc.Message); } + return String.Empty; + } + public static bool CreateDirectory (String directoryPath) + { + try + { + DirectoryInfo info = Directory.CreateDirectory(directoryPath); + return info.Exists; + } + catch (Exception exc) { Logger.Debug("SlmFileUtil.CreateDirectory " + exc.GetType().Name + ": " + exc.Message); } + return false; + } + //------------------------------------------------------------------- + // F i l e + //------------------------------------------------------------------- + public static bool IsFile (String filePath) + { + try + { + return File.Exists(filePath); + } + catch (Exception exc) { Logger.Debug("SlmFileUtil.IsFile " + exc.GetType().Name + ": " + exc.Message); } + return false; + } + public static String[] FileReadAllLines (String filePath) + { + try + { + return File.ReadAllLines(filePath); + } + catch (Exception exc) { Logger.Debug("SlmFileUtil.FileReadAllLines " + exc.GetType().Name + ": " + exc.Message); } + return new String[0]; + } + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrWinForms/Properties/AssemblyInfo.cs b/SaPatMgrWinForms/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..442004e --- /dev/null +++ b/SaPatMgrWinForms/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SaPatMgrWinForms")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SaPatMgrWinForms")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("7601486b-9563-40bb-81f0-7b45d9f62d70")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SaPatMgrWinForms/SaPatMgrWinForms.csproj b/SaPatMgrWinForms/SaPatMgrWinForms.csproj new file mode 100644 index 0000000..b4ada52 --- /dev/null +++ b/SaPatMgrWinForms/SaPatMgrWinForms.csproj @@ -0,0 +1,76 @@ + + + + + Debug + AnyCPU + {7601486B-9563-40BB-81F0-7B45D9F62D70} + Library + Properties + Sarand.PatientMgr + SaPatMgrWinForms + v4.6 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {7528f88e-a24d-4d6b-be6c-9d5fb14f0cb5} + SacsCoreBase + False + + + {18353651-1f1a-4b23-91fb-bdb9aa56bc57} + SacsWinForms + False + + + {57674a5e-b0f1-49ca-a56f-f8b8ca12fbf6} + SaPatMgrCore + False + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SaPatMgrWinForms/Win/Forms/App/SpmGlobals_Win.cs b/SaPatMgrWinForms/Win/Forms/App/SpmGlobals_Win.cs new file mode 100644 index 0000000..7893c0c --- /dev/null +++ b/SaPatMgrWinForms/Win/Forms/App/SpmGlobals_Win.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.PatientMgr.Win.Forms.App +{ + //======================================================================= + public static class SpmGlobals_Win + { + //------------------------------------------------------------------- + // Session profile. + public static SpmSessionProfile_Win SessionProfile { get; set; } + + //------------------------------------------------------------------- + // Clear globals. + public static void clear () + { + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrWinForms/Win/Forms/App/SpmSessionProfile_Win.cs b/SaPatMgrWinForms/Win/Forms/App/SpmSessionProfile_Win.cs new file mode 100644 index 0000000..03832d4 --- /dev/null +++ b/SaPatMgrWinForms/Win/Forms/App/SpmSessionProfile_Win.cs @@ -0,0 +1,28 @@ +using Sarand.PatientMgr.Core.App; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sarand.PatientMgr.Win.Forms.App +{ + //======================================================================= + /// + /// PatientMgr global properties for desktop/console applications. + /// + public class SpmSessionProfile_Win : SpmSessionProfile + { + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + protected SpmSessionProfile_Win () + { + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatMgrWinProcs/Properties/AssemblyInfo.cs b/SaPatMgrWinProcs/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9b0e98f --- /dev/null +++ b/SaPatMgrWinProcs/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SaPatMgrWinProcs")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SaPatMgrWinProcs")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ed6a8e47-67fb-42ca-9b6e-9095c427b64c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SaPatMgrWinProcs/SaPatMgrWinProcs.csproj b/SaPatMgrWinProcs/SaPatMgrWinProcs.csproj new file mode 100644 index 0000000..cee90a6 --- /dev/null +++ b/SaPatMgrWinProcs/SaPatMgrWinProcs.csproj @@ -0,0 +1,70 @@ + + + + + Debug + AnyCPU + {ED6A8E47-67FB-42CA-9B6E-9095C427B64C} + Library + Properties + Sarand.PatientMgr + SaPatMgrWinProcs + v4.6 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + {7528f88e-a24d-4d6b-be6c-9d5fb14f0cb5} + SacsCoreBase + False + + + {e9106099-66b4-42db-af28-c34cf1aff2aa} + SacsWinOffice + False + + + {57674a5e-b0f1-49ca-a56f-f8b8ca12fbf6} + SaPatMgrCore + False + + + + + + + + + + + \ No newline at end of file diff --git a/SaPatientMgr.sln b/SaPatientMgr.sln new file mode 100644 index 0000000..5fb0e57 --- /dev/null +++ b/SaPatientMgr.sln @@ -0,0 +1,79 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.572 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaPatientMgr", "SaPatientMgr\SaPatientMgr.csproj", "{3103B105-D3FA-4A64-A3D5-1B6EA680472B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SacsCoreBase", "..\..\Common-C#\Workspace\SacsCoreBase\SacsCoreBase.csproj", "{7528F88E-A24D-4D6B-BE6C-9D5FB14F0CB5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SacsWinDbas", "..\..\Common-C#\Workspace\SacsWinDbas\SacsWinDbas.csproj", "{86E11448-66DF-4EB6-922F-C84E220608AD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SacsWinForms", "..\..\Common-C#\Workspace\SacsWinForms\SacsWinForms.csproj", "{18353651-1F1A-4B23-91FB-BDB9AA56BC57}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SacsWinOffice", "..\..\Common-C#\Workspace\SacsWinOffice\SacsWinOffice.csproj", "{E9106099-66B4-42DB-AF28-C34CF1AFF2AA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaPatMgrWinDbas", "SaPatMgrWinDbas\SaPatMgrWinDbas.csproj", "{9F5D8526-B4B9-457F-8DBA-E6B79B938AA9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaPatMgrWinForms", "SaPatMgrWinForms\SaPatMgrWinForms.csproj", "{7601486B-9563-40BB-81F0-7B45D9F62D70}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaPatMgrCore", "SaPatMgrCore\SaPatMgrCore.csproj", "{57674A5E-B0F1-49CA-A56F-F8B8CA12FBF6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaPatMgrWinProcs", "SaPatMgrWinProcs\SaPatMgrWinProcs.csproj", "{ED6A8E47-67FB-42CA-9B6E-9095C427B64C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaPatMgrUnitTests", "SaPatMgrUnitTests\SaPatMgrUnitTests.csproj", "{E133E234-02D4-43E9-9667-35B9A0FB0D2C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3103B105-D3FA-4A64-A3D5-1B6EA680472B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3103B105-D3FA-4A64-A3D5-1B6EA680472B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3103B105-D3FA-4A64-A3D5-1B6EA680472B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3103B105-D3FA-4A64-A3D5-1B6EA680472B}.Release|Any CPU.Build.0 = Release|Any CPU + {7528F88E-A24D-4D6B-BE6C-9D5FB14F0CB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7528F88E-A24D-4D6B-BE6C-9D5FB14F0CB5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7528F88E-A24D-4D6B-BE6C-9D5FB14F0CB5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7528F88E-A24D-4D6B-BE6C-9D5FB14F0CB5}.Release|Any CPU.Build.0 = Release|Any CPU + {86E11448-66DF-4EB6-922F-C84E220608AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {86E11448-66DF-4EB6-922F-C84E220608AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {86E11448-66DF-4EB6-922F-C84E220608AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {86E11448-66DF-4EB6-922F-C84E220608AD}.Release|Any CPU.Build.0 = Release|Any CPU + {18353651-1F1A-4B23-91FB-BDB9AA56BC57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18353651-1F1A-4B23-91FB-BDB9AA56BC57}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18353651-1F1A-4B23-91FB-BDB9AA56BC57}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18353651-1F1A-4B23-91FB-BDB9AA56BC57}.Release|Any CPU.Build.0 = Release|Any CPU + {E9106099-66B4-42DB-AF28-C34CF1AFF2AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E9106099-66B4-42DB-AF28-C34CF1AFF2AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E9106099-66B4-42DB-AF28-C34CF1AFF2AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E9106099-66B4-42DB-AF28-C34CF1AFF2AA}.Release|Any CPU.Build.0 = Release|Any CPU + {9F5D8526-B4B9-457F-8DBA-E6B79B938AA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F5D8526-B4B9-457F-8DBA-E6B79B938AA9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F5D8526-B4B9-457F-8DBA-E6B79B938AA9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F5D8526-B4B9-457F-8DBA-E6B79B938AA9}.Release|Any CPU.Build.0 = Release|Any CPU + {7601486B-9563-40BB-81F0-7B45D9F62D70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7601486B-9563-40BB-81F0-7B45D9F62D70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7601486B-9563-40BB-81F0-7B45D9F62D70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7601486B-9563-40BB-81F0-7B45D9F62D70}.Release|Any CPU.Build.0 = Release|Any CPU + {57674A5E-B0F1-49CA-A56F-F8B8CA12FBF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57674A5E-B0F1-49CA-A56F-F8B8CA12FBF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {57674A5E-B0F1-49CA-A56F-F8B8CA12FBF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {57674A5E-B0F1-49CA-A56F-F8B8CA12FBF6}.Release|Any CPU.Build.0 = Release|Any CPU + {ED6A8E47-67FB-42CA-9B6E-9095C427B64C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED6A8E47-67FB-42CA-9B6E-9095C427B64C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED6A8E47-67FB-42CA-9B6E-9095C427B64C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED6A8E47-67FB-42CA-9B6E-9095C427B64C}.Release|Any CPU.Build.0 = Release|Any CPU + {E133E234-02D4-43E9-9667-35B9A0FB0D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E133E234-02D4-43E9-9667-35B9A0FB0D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E133E234-02D4-43E9-9667-35B9A0FB0D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E133E234-02D4-43E9-9667-35B9A0FB0D2C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {16CEAE1F-B95C-49D0-81D8-9553FCD25988} + EndGlobalSection +EndGlobal diff --git a/SaPatientMgr/App.config b/SaPatientMgr/App.config new file mode 100644 index 0000000..8324aa6 --- /dev/null +++ b/SaPatientMgr/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SaPatientMgr/App/Forms/SaPatientMgrForm.Designer.cs b/SaPatientMgr/App/Forms/SaPatientMgrForm.Designer.cs new file mode 100644 index 0000000..062c868 --- /dev/null +++ b/SaPatientMgr/App/Forms/SaPatientMgrForm.Designer.cs @@ -0,0 +1,27 @@ +namespace Sarand.PatientMgr.App.Forms +{ + partial class SaPatientMgrForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent () + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "Form1"; + } + + #endregion + } +} + diff --git a/SaPatientMgr/App/Forms/SaPatientMgrForm.cs b/SaPatientMgr/App/Forms/SaPatientMgrForm.cs new file mode 100644 index 0000000..2aa4e17 --- /dev/null +++ b/SaPatientMgr/App/Forms/SaPatientMgrForm.cs @@ -0,0 +1,82 @@ +using Sarand.PatientMgr.Core.App; +using Sarand.Win.Forms; +using Sarand.Win.Forms.Utils; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sarand.PatientMgr.App.Forms +{ + //======================================================================= + public partial class SaPatientMgrForm : SacsForm + { + //------------------------------------------------------------------- + // Configuration. + public new class Config : SacsForm.Config + { + } + + //------------------------------------------------------------------- + // Data members. + private Config config = null; + + //------------------------------------------------------------------- + // Construction. + private SaPatientMgrForm () : this(new Config()) { } + public SaPatientMgrForm (Config config) : base(config) + { + this.config = config; + InitializeComponent(); + + // Configuration. + Text = Spm.ApplicationCaption; + ShowIcon = false; + MinimizeBox = false; + MaximizeBox = false; + WindowState = FormWindowState.Maximized; + } + protected override void Dispose (bool disposing) + { + if (disposing) + { + if (components != null) + components.Dispose(); + } + base.Dispose(disposing); + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // I n i t i a l i s a t i o n + //------------------------------------------------------------------- + protected override void OnCreateControl () + { + base.OnCreateControl(); + if (this.IsDesignerHosted()) return; + + } + protected override void OnShown (EventArgs e) + { + base.OnShown(e); + } + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + // F o r m E v e n t s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatientMgr/App/Program.cs b/SaPatientMgr/App/Program.cs new file mode 100644 index 0000000..c330738 --- /dev/null +++ b/SaPatientMgr/App/Program.cs @@ -0,0 +1,43 @@ +using Sarand.PatientMgr.Core.App; +using Sarand.Core.App; +using Sarand.Core.Base; +using Sarand.PatientMgr.App.Forms; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Sarand.PatientMgr.App +{ + //======================================================================= + static class Program + { + //------------------------------------------------------------------- + /// The main entry point for the application. + [STAThread] + static void Main (string[] args) + { + // Parse command line. + SacsCommandLineInfo CmdLineInfo = new SacsCommandLineInfo(args); + bool runProcesses = (CmdLineInfo.ProcessDefinitions.Count > 0); + + // PatientMgr Application. + String logMessageSuffix = (runProcesses ? " [auto]" : ""); + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + // Main form. + SaPatientMgrForm.Config configMainForm = new SaPatientMgrForm.Config(); + using (Form mainForm = new SaPatientMgrForm(configMainForm)) + { + Application.Run(mainForm); + } + Logger.Info(Spm.ApplicationCaption + " End" + logMessageSuffix, true); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatientMgr/App/SaPatientMgrApp.cs b/SaPatientMgr/App/SaPatientMgrApp.cs new file mode 100644 index 0000000..55e14d0 --- /dev/null +++ b/SaPatientMgr/App/SaPatientMgrApp.cs @@ -0,0 +1,128 @@ +using Sarand.PatientMgr.Core.App; +using Sarand.Core.Base; +using Sarand.Core.IO; +using Sarand.PatientMgr.Win.Dbas.App; +using Sarand.PatientMgr.Win.Forms.App; +using Sarand.Win.Dbas.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sarand.PatientMgr.App +{ + //======================================================================= + class SaPatientMgrApp : SacsStateItem, IDisposable + { + //------------------------------------------------------------------- + // Data members. + private static SaPatientMgrApp app = null; + private PropertySet properties = null; + + //------------------------------------------------------------------- + // Construction. + public SaPatientMgrApp (String initialLogMessage) + { + app = this; + SpmSystem_WinDbas.InitStatics(); + + // Locate properties file: + String propertiesFilePath = FileUtil.LocateFileRelative("SaPatientMgr.cfg", new List { "Bin" }); + properties = PropertySet.GetPropertiesFromFile(propertiesFilePath); + if (properties != null) + { + //properties.Dump(); + + Spm.Site Site = EnumUtil.ParseEnum(properties.GetPropertyValue("Config", "Site"), Spm.Site.Unknown); + + // Default logger properties. + Logger.LogFilenamePrefix = "SPM-Desktop"; + Logger.LogFolder = properties.GetPropertyValue("Logging", "Folder"); +#if DEBUG + Logger.ConsoleLevel = SaMessageLevel.Trace; +#endif + Logger.LogFileLevel = EnumUtil.StartsWith(properties.GetPropertyValue("Logging", "Level"), SaMessageLevel.Info); + Logger.Info(initialLogMessage, true); + Logger.Info("Logging level: " + Logger.LogFileLevel); + + // Configure extended logging. + List extendedLoggingOptions = StringList.Split(properties.GetPropertyValue("Logging", "ExtendedLogging")); + if (!extendedLoggingOptions.IsEmpty()) + Logger.Info("Extended logging: " + extendedLoggingOptions.Concat(",")); + } + else SetErrorState("Properties file not found"); + + SessionContext = new SpmSessionContext_Desktop(0, Site); + InitGlobals(); + //SpmGlobals.DbConsole.VerifyDatabaseSchema(); + } + public void Dispose () + { + app = null; + DeinitGlobals(); + } + + //------------------------------------------------------------------- + // Properties. + public Spm.Site Site { get; } = Spm.Site.Unknown; + public SpmSessionContext SessionContext { get; } + + //------------------------------------------------------------------- + // I n s t a n c e + //------------------------------------------------------------------- + public static SaPatientMgrApp getInstance () + { + return app; + } + + //------------------------------------------------------------------- + // G l o b a l s + //------------------------------------------------------------------- + private void InitGlobals () + { + // System. + SpmGlobals.System = new SpmSystem_WinDbas(properties); + + // Database. + SacsDatabase database = OpenDatabase(); + //SpmGlobals.DbConsole = new LogisticsMgrDbConsoleDbas(); + + // Global application. + SpmGlobals.Application = new SpmApplication_Desktop(properties, SessionContext, database); + + // Session profile. + SpmSessionProfile_Desktop sessionProfile = new SpmSessionProfile_Desktop(); + SpmGlobals_Win.SessionProfile = sessionProfile; + } + private SacsDatabase OpenDatabase () + { + SacsDatabaseConsole.OdbcConfig config = new SacsDatabaseConsole.OdbcConfig(); + config.location = properties.GetPropertyValue("Database", "Location"); + config.user = properties.GetPropertyValue("Database", "User"); + config.pword = properties.GetPropertyValue("Database", "Pword"); + Logger.Trace("BusinessMgrApp OpenDatabase Location=" + config.location); + + SacsDatabase database = SacsDatabaseConsole.OpenOdbcDatabase(config); + + bool catalogDatabase = true; + if (catalogDatabase) + { + foreach (String tableName in database.GetTableNames()) + { + database.GetTableDfn(tableName); + } + } + return database; + } + + //------------------------------------------------------------------- + private void DeinitGlobals () + { + SpmGlobals.clear(); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatientMgr/App/SpmApplication_Desktop.cs b/SaPatientMgr/App/SpmApplication_Desktop.cs new file mode 100644 index 0000000..63d1c03 --- /dev/null +++ b/SaPatientMgr/App/SpmApplication_Desktop.cs @@ -0,0 +1,51 @@ +using Sarand.PatientMgr.Core.App; +using Sarand.Core.Base; +using Sarand.Core.CodeTypes; +using Sarand.Core.Dbas.Base; +using Sarand.Win.Dbas.Base; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.PatientMgr.App +{ + //======================================================================= + public class SpmApplication_Desktop : SpmApplication + { + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SpmApplication_Desktop (PropertySet properties, SpmSessionContext sessionContext, SacsDatabase database) + { + Properties = properties; + SessionContext = sessionContext; + Database = database; + } + + //------------------------------------------------------------------- + // Properties. + public PropertySet Properties { get; } + public SpmSessionContext SessionContext { get; } + public SacsDatabase Database { get; } + + //------------------------------------------------------------------- + // Database. + public override ISacsDatabase GetDatabase (SpmSessionContext sessionContext) + { + return Database; + } + //public override bool ColumnExists (SbmSessionContext sessionContext, SbmDbDfn.ColumnIdx columnIdx) + + //------------------------------------------------------------------- + // Code Type console. + public override SaCodeTypeConsole GetCodeTypeConsole (SpmUserContext userContext) + { + return null; + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatientMgr/App/SpmSessionContext_Desktop.cs b/SaPatientMgr/App/SpmSessionContext_Desktop.cs new file mode 100644 index 0000000..dae9b34 --- /dev/null +++ b/SaPatientMgr/App/SpmSessionContext_Desktop.cs @@ -0,0 +1,23 @@ +using Sarand.PatientMgr.Core.App; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sarand.PatientMgr.App +{ + //======================================================================= + public class SpmSessionContext_Desktop : SpmSessionContext + { + //------------------------------------------------------------------- + // Construction. + public SpmSessionContext_Desktop (ushort index, Spm.Site site) : + base(index, site) + { + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatientMgr/App/SpmSessionProfile_Desktop.cs b/SaPatientMgr/App/SpmSessionProfile_Desktop.cs new file mode 100644 index 0000000..331c0b0 --- /dev/null +++ b/SaPatientMgr/App/SpmSessionProfile_Desktop.cs @@ -0,0 +1,28 @@ +using Sarand.PatientMgr.Win.Forms.App; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sarand.PatientMgr.App +{ + //======================================================================= + /// + /// PatientMgr global properties for desktop application. + /// + public class SpmSessionProfile_Desktop : SpmSessionProfile_Win + { + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SpmSessionProfile_Desktop () + { + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaPatientMgr/Properties/AssemblyInfo.cs b/SaPatientMgr/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a2a4b13 --- /dev/null +++ b/SaPatientMgr/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SaPatientMgr")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SaPatientMgr")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3103b105-d3fa-4a64-a3d5-1b6ea680472b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SaPatientMgr/Properties/Resources.Designer.cs b/SaPatientMgr/Properties/Resources.Designer.cs new file mode 100644 index 0000000..8491827 --- /dev/null +++ b/SaPatientMgr/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Sarand.PatientMgr.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sarand.PatientMgr.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/SaPatientMgr/Properties/Resources.resx b/SaPatientMgr/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/SaPatientMgr/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SaPatientMgr/Properties/Settings.Designer.cs b/SaPatientMgr/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6edcc2d --- /dev/null +++ b/SaPatientMgr/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Sarand.PatientMgr.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/SaPatientMgr/Properties/Settings.settings b/SaPatientMgr/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/SaPatientMgr/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/SaPatientMgr/Resources/icon/SaWardMgr.ico b/SaPatientMgr/Resources/icon/SaWardMgr.ico new file mode 100644 index 0000000..904666c Binary files /dev/null and b/SaPatientMgr/Resources/icon/SaWardMgr.ico differ diff --git a/SaPatientMgr/SaPatientMgr.csproj b/SaPatientMgr/SaPatientMgr.csproj new file mode 100644 index 0000000..99117a9 --- /dev/null +++ b/SaPatientMgr/SaPatientMgr.csproj @@ -0,0 +1,140 @@ + + + + + Debug + AnyCPU + {3103B105-D3FA-4A64-A3D5-1B6EA680472B} + WinExe + Sarand.PatientMgr + SaPatientMgr + v4.6 + 512 + false + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + Resources\icon\SaWardMgr.ico + + + + + + + + + + + + + + + + Form + + + SaPatientMgrForm.cs + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + {7528f88e-a24d-4d6b-be6c-9d5fb14f0cb5} + SacsCoreBase + + + {86e11448-66df-4eb6-922f-c84e220608ad} + SacsWinDbas + + + {18353651-1f1a-4b23-91fb-bdb9aa56bc57} + SacsWinForms + + + {e9106099-66b4-42db-af28-c34cf1aff2aa} + SacsWinOffice + + + {57674a5e-b0f1-49ca-a56f-f8b8ca12fbf6} + SaPatMgrCore + + + {9f5d8526-b4b9-457f-8dba-e6b79b938aa9} + SaPatMgrWinDbas + + + {7601486b-9563-40bb-81f0-7b45d9f62d70} + SaPatMgrWinForms + + + {ed6a8e47-67fb-42ca-9b6e-9095c427b64c} + SaPatMgrWinProcs + + + + + + + + if not exist "$(SolutionDir)..\Bin" ( + echo Creating '$(SolutionDir)..\Bin' folder. + mkdir "$(SolutionDir)..\Bin" +) +if not exist "$(SolutionDir)..\Bin\$(ConfigurationName)" ( + echo Creating '$(SolutionDir)..\Bin\$(ConfigurationName)' folder. + mkdir "$(SolutionDir)..\Bin\$(ConfigurationName)" +) +copy /y "$(TargetDir)*.dll" "$(SolutionDir)..\Bin\$(ConfigurationName)\" +copy /y "$(TargetDir)*.exe" "$(SolutionDir)..\Bin\$(ConfigurationName)\" + + \ No newline at end of file