Core
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
namespace Sarand.PatientMgr.App.Forms
|
||||
{
|
||||
partial class SaPatientMgrForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>The main entry point for the application.</summary>
|
||||
[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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -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<String> { "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<String> 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();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
//=======================================================================
|
||||
/// <summary>
|
||||
/// PatientMgr global properties for desktop application.
|
||||
/// </summary>
|
||||
public class SpmSessionProfile_Desktop : SpmSessionProfile_Win
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SpmSessionProfile_Desktop ()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user