Consoles, database generated.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Win.Dbas.Consoles;
|
||||
using Sarand.Win.Dbas.Base;
|
||||
using Sarand.Win.Forms.CodeTypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.PatientMgr.App.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SpmCodeTypeConsole_App : SpmCodeTypeConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SpmCodeTypeConsole_App (SpmSessionContext sessionContext, SacsDatabase database) :
|
||||
base(sessionContext, database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Method to display Code Types dialog.
|
||||
protected override MaintainCodeTypesFunction MaintainCodeTypesFn
|
||||
{
|
||||
get
|
||||
{
|
||||
return SaForm_CodeTypes.MaintainCodeTypes;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Win.Dbas.Consoles;
|
||||
using Sarand.Win.Dbas.Base;
|
||||
using Sarand.Win.Forms.ItemOptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.PatientMgr.App.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SpmItemOptionConsole_App : SpmItemOptionConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SpmItemOptionConsole_App (SpmSessionContext sessionContext, SacsDatabase database) :
|
||||
base(sessionContext, database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Method to display Security management dialog.
|
||||
protected override ShowItemOptionsDialogFunction ShowItemOptionsDialogFn
|
||||
{
|
||||
get
|
||||
{
|
||||
return SaForm_ItemOptions.ShowItemOptionDialog;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Win.Dbas.Consoles;
|
||||
using Sarand.PatientMgr.Win.Forms.App;
|
||||
using Sarand.Win.Dbas.Base;
|
||||
using Sarand.Win.Forms.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.PatientMgr.App.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SpmSecurityConsole_App : SpmSecurityConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SpmSecurityConsole_App (SpmSessionContext sessionContext, SacsDatabase database) :
|
||||
base(sessionContext, database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security events.
|
||||
protected override void OnLogin (SysId userId)
|
||||
{
|
||||
SpmGlobals_Win.SecurityProfile.RefreshProfile(this, userId, GetSecurityRights());
|
||||
}
|
||||
protected override void OnLogout ()
|
||||
{
|
||||
SpmGlobals_Win.SecurityProfile.RefreshProfile(this, null, GetSecurityRights());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Method to show User Login form.
|
||||
protected override ShowUserLoginFormFunction ShowUserLoginFormFn
|
||||
{
|
||||
get
|
||||
{
|
||||
return SaForm_UserLogin.ShowUserLoginForm;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Method to display Security management form.
|
||||
protected override ShowManageSecurityDialogFunction ShowManageSecurityDialogFn
|
||||
{
|
||||
get
|
||||
{
|
||||
return SaForm_ManageSecurity.ShowManageSecurityDialog;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public override bool OnUserModified (SysId userId)
|
||||
{
|
||||
if (!SysId.IsValid(userId)) return false;
|
||||
SpmSecurityProfile securityProfile = SpmGlobals_Win.SecurityProfile;
|
||||
if (securityProfile.UserId.Equals(userId))
|
||||
securityProfile.RefreshProfile(this, userId, GetSecurityRights());
|
||||
return true;
|
||||
}
|
||||
public override bool OnSecurityGroupModified (SysId secGroupId)
|
||||
{
|
||||
if (!SysId.IsValid(secGroupId)) return false;
|
||||
SpmSecurityProfile securityProfile = SpmGlobals_Win.SecurityProfile;
|
||||
if (securityProfile.IsUserMemberOfSecurityGroup(secGroupId))
|
||||
securityProfile.RefreshProfile(this, securityProfile.UserId, GetSecurityRights());
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Win.Dbas.Consoles;
|
||||
using Sarand.Win.Dbas.Base;
|
||||
using Sarand.Win.Forms.UpdateLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sarand.PatientMgr.App.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SpmUpdateLogConsole_App : SpmUpdateLogConsole_Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SpmUpdateLogConsole_App (SpmSessionContext sessionContext, SacsDatabase database) :
|
||||
base(sessionContext, database)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Method to display Security management dialog.
|
||||
protected override ShowUpdateLogDialogFunction ShowUpdateLogDialogFn
|
||||
{
|
||||
get
|
||||
{
|
||||
return SaForm_UpdateLog.ShowUpdateLogDialog;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
+22
-1
@@ -15,13 +15,34 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent ()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.buttonGenerateDbDfn = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonGenerateDbDfn
|
||||
//
|
||||
this.buttonGenerateDbDfn.Location = new System.Drawing.Point(58, 63);
|
||||
this.buttonGenerateDbDfn.Name = "buttonGenerateDbDfn";
|
||||
this.buttonGenerateDbDfn.Size = new System.Drawing.Size(100, 23);
|
||||
this.buttonGenerateDbDfn.TabIndex = 0;
|
||||
this.buttonGenerateDbDfn.Text = "Generate Db dfn";
|
||||
this.buttonGenerateDbDfn.UseVisualStyleBackColor = true;
|
||||
this.buttonGenerateDbDfn.Click += new System.EventHandler(this.buttonGenerateDbDfn_Click);
|
||||
//
|
||||
// SaPatientMgrForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.buttonGenerateDbDfn);
|
||||
this.Name = "SaPatientMgrForm";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonGenerateDbDfn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Win.Dbas.Utils;
|
||||
using Sarand.PatientMgr.Win.Forms.App;
|
||||
using Sarand.Win.Forms;
|
||||
using Sarand.Win.Forms.Utils;
|
||||
using System;
|
||||
@@ -71,10 +73,24 @@ namespace Sarand.PatientMgr.App.Forms
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l A c t i v i t y
|
||||
//-------------------------------------------------------------------
|
||||
protected override void SetControlActivity ()
|
||||
{
|
||||
SetControlsReadOnly();
|
||||
}
|
||||
protected override void SetControlsReadOnly ()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// F o r m E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
private void buttonGenerateDbDfn_Click (object sender, EventArgs e)
|
||||
{
|
||||
SpmDbDfnGenerator.DbDfnGeneratorResultData result = SpmDbDfnGenerator.Generate(SpmGlobals.Application.GetDatabase(SpmGlobals_Win.SessionProfile.SessionContext).ConnectionString);
|
||||
if (result.Success)
|
||||
MessageBox.Show("Database definition generated", "Database Definition", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
else MessageBox.Show("Database definition not generated.\n\n"+result.ErrorMessage, "Database Definition", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+120
-15
@@ -7,34 +7,139 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using Sarand.PatientMgr.Win.Forms.App;
|
||||
|
||||
namespace Sarand.PatientMgr.App
|
||||
{
|
||||
//=======================================================================
|
||||
static class Program
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
[System.Runtime.InteropServices.DllImport("user32.dll")]
|
||||
private static extern bool SetProcessDPIAware ();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static Form mainForm = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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))
|
||||
bool runningProcesses = false;
|
||||
try
|
||||
{
|
||||
Application.Run(mainForm);
|
||||
// Parse command line.
|
||||
SacsCommandLineInfo CmdLineInfo = new SacsCommandLineInfo(args);
|
||||
bool runProcesses = (CmdLineInfo.ProcessDefinitions.Count > 0);
|
||||
|
||||
// PatientMgr Application.
|
||||
String logMessageSuffix = (runProcesses ? " [auto]" : "");
|
||||
using (var app = new SaPatientMgrApp(Spm.ApplicationCaption + " Start v" + Spm.Version + logMessageSuffix))
|
||||
{
|
||||
// Check for startup error.
|
||||
if (app.HasErrorState())
|
||||
{
|
||||
MessageBox.Show("Startup error: " + app.ErrorStateMessage, Spm.ApplicationCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
// Trap thread and unhandled exceptions.
|
||||
var threadExceptionHandler = new ThreadExceptionEventHandler(Application_ThreadException);
|
||||
Application.ThreadException += threadExceptionHandler;
|
||||
var unhandledExceptionHandler = new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
AppDomain.CurrentDomain.UnhandledException += unhandledExceptionHandler;
|
||||
|
||||
if (runProcesses)
|
||||
{
|
||||
// Run specified processes and close application.
|
||||
runningProcesses = true;
|
||||
/*
|
||||
foreach (SacsProcessDefinition processDfn in CmdLineInfo.ProcessDefinitions)
|
||||
SpmProcessConsole.InvokeProcessDefinition(app.SessionContext, processDfn, app.UserContext.DbUpdateInfo);
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// Configure application.
|
||||
SetProcessDPIAware();
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
// Main form.
|
||||
SaPatientMgrForm.Config configMainForm = new SaPatientMgrForm.Config();
|
||||
using (Form form = new SaPatientMgrForm(configMainForm))
|
||||
{
|
||||
mainForm = form;
|
||||
Application.Run(form);
|
||||
mainForm = null;
|
||||
}
|
||||
Application.ThreadException -= threadExceptionHandler;
|
||||
Logger.Info(Spm.ApplicationCaption + " End" + logMessageSuffix, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
String exceptionName = exc.GetType().Name + (exc.InnerException != null ? " (" + exc.InnerException.GetType().Name + ")" : "");
|
||||
if (!runningProcesses)
|
||||
MessageBox.Show(exceptionName + " encountered:\n\n" + exc.Message + "\n\nApplication will close.");
|
||||
Logger.Warn(exceptionName + ": " + exc.Message + exc.GetStackEntries(6).Concat("", "\n\t"), true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Trap thread exceptions.
|
||||
// Ref: https://stackoverflow.com/questions/36014/why-is-net-exception-not-caught-by-try-catch-block
|
||||
// See: References to Application.ThreadException above.
|
||||
public class ThreadException : Exception
|
||||
{
|
||||
public ThreadException (String message, Exception innerException) :
|
||||
base(message, innerException)
|
||||
{ }
|
||||
}
|
||||
public static void Application_ThreadException (object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
Exception exc = e.Exception;
|
||||
Logger.Error("Application_ThreadException " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 20).Concat("", "\n\t"), true);
|
||||
if (!SacsSystem.DebugMode)
|
||||
{
|
||||
// Throw on main thread.
|
||||
if (mainForm != null && mainForm.InvokeRequired) mainForm.Invoke((MethodInvoker)delegate { throw exc; });
|
||||
else throw exc; // new ThreadException(exc.Message, exc);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Trap unhandled exceptions.
|
||||
// Ref: https://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception(v=vs.110).aspx
|
||||
// See: References to Application.ThreadException above.
|
||||
public class UnhandledException : Exception
|
||||
{
|
||||
public UnhandledException (String message, Exception innerException) :
|
||||
base(message, innerException)
|
||||
{ }
|
||||
}
|
||||
public static void CurrentDomain_UnhandledException (object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Exception exc = e.ExceptionObject as Exception;
|
||||
Logger.Error("CurrentDomain_UnhandledException " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 20).Concat("", "\n\t"));
|
||||
if (!SacsSystem.DebugMode)
|
||||
{
|
||||
// Throw on main thread.
|
||||
if (mainForm != null && mainForm.InvokeRequired) mainForm.Invoke((MethodInvoker)delegate { throw exc; });
|
||||
else throw exc; // new UnhandledException(exc.ToString(), exc);
|
||||
}
|
||||
Logger.Info(Spm.ApplicationCaption + " End" + logMessageSuffix, true);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace Sarand.PatientMgr.App
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static SaPatientMgrApp app = null;
|
||||
private PropertySet properties = null;
|
||||
private readonly PropertySet properties;
|
||||
private SpmSessionProfile_Desktop sessionProfile;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
@@ -37,7 +38,7 @@ namespace Sarand.PatientMgr.App
|
||||
Spm.Site Site = EnumUtil.ParseEnum(properties.GetPropertyValue("Config", "Site"), Spm.Site.Unknown);
|
||||
|
||||
// Default logger properties.
|
||||
Logger.LogFilenamePrefix = "SPM-Desktop";
|
||||
Logger.LogFilenamePrefix = "SPM-DSK";
|
||||
Logger.LogFolder = properties.GetPropertyValue("Logging", "Folder");
|
||||
#if DEBUG
|
||||
Logger.ConsoleLevel = SaMessageLevel.Trace;
|
||||
@@ -92,16 +93,16 @@ namespace Sarand.PatientMgr.App
|
||||
SpmGlobals.Application = new SpmApplication_Desktop(properties, SessionContext, database);
|
||||
|
||||
// Session profile.
|
||||
SpmSessionProfile_Desktop sessionProfile = new SpmSessionProfile_Desktop();
|
||||
sessionProfile = new SpmSessionProfile_Desktop(SessionContext);
|
||||
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);
|
||||
config.location = properties.GetPropertyValue("Scheduling", "DataSource");
|
||||
config.user = properties.GetPropertyValue("Scheduling", "DataUser");
|
||||
config.pword = properties.GetPropertyValue("Scheduling", "DataPword");
|
||||
Logger.Trace("PatientMgrApp OpenDatabase Location=" + config.location);
|
||||
|
||||
SacsDatabase database = SacsDatabaseConsole.OpenOdbcDatabase(config);
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@ using Sarand.Win.Dbas.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.PatientMgr.App.Consoles;
|
||||
using Sarand.Core.Security;
|
||||
using Sarand.Core.ItemOptions;
|
||||
using Sarand.Core.UpdateLog;
|
||||
|
||||
namespace Sarand.PatientMgr.App
|
||||
{
|
||||
@@ -36,13 +40,63 @@ namespace Sarand.PatientMgr.App
|
||||
{
|
||||
return Database;
|
||||
}
|
||||
//public override bool ColumnExists (SbmSessionContext sessionContext, SbmDbDfn.ColumnIdx columnIdx)
|
||||
public override bool ColumnExists (SpmSessionContext sessionContext, SpmDbDfn.ColumnIdx columnIdx)
|
||||
{
|
||||
ISacsDatabase database = GetDatabase(sessionContext);
|
||||
if (database != null)
|
||||
return database.ColumnExists(SpmDbDfn.GetTableName(SpmDbDfn.GetTableForColumn(columnIdx)), SpmDbDfn.GetColumnName(columnIdx));
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security console.
|
||||
private SpmSecurityConsole_App securityConsole;
|
||||
public override SaSecurityConsole GetSecurityConsole (SpmSessionContext sessionContext)
|
||||
{
|
||||
if (securityConsole == null)
|
||||
{
|
||||
securityConsole = new SpmSecurityConsole_App(SessionContext, Database);
|
||||
securityConsole.LogSecurityProfile = SpmGlobals.System.IsExtendedLogging(SpmSystem.ExtendedLogginOption.SecurityProfile);
|
||||
securityConsole.RegisterSecurityRights();
|
||||
}
|
||||
return securityConsole;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Code Type console.
|
||||
public override SaCodeTypeConsole GetCodeTypeConsole (SpmUserContext userContext)
|
||||
private SpmCodeTypeConsole_App codeTypeConsole;
|
||||
public override SaCodeTypeConsole GetCodeTypeConsole (SpmSessionContext sessionContext)
|
||||
{
|
||||
return null;
|
||||
if (codeTypeConsole == null)
|
||||
{
|
||||
codeTypeConsole = new SpmCodeTypeConsole_App(SessionContext, Database);
|
||||
SpmSystem.RegisterCodeTypes(codeTypeConsole, SessionContext.Site);
|
||||
}
|
||||
return codeTypeConsole;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item option console.
|
||||
private SpmItemOptionConsole_App itemOptionConsole;
|
||||
public override SaItemOptionConsole GetItemOptionConsole (SpmSessionContext sessionContext)
|
||||
{
|
||||
if (itemOptionConsole == null)
|
||||
{
|
||||
itemOptionConsole = new SpmItemOptionConsole_App(SessionContext, Database);
|
||||
}
|
||||
return itemOptionConsole;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update Log console.
|
||||
private SpmUpdateLogConsole_App updateLogConsole;
|
||||
public override SaUpdateLogConsole GetUpdateLogConsole (SpmSessionContext sessionContext)
|
||||
{
|
||||
if (updateLogConsole == null)
|
||||
{
|
||||
updateLogConsole = new SpmUpdateLogConsole_App(SessionContext, Database);
|
||||
}
|
||||
return updateLogConsole;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.PatientMgr.Win.Forms.App;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Win.Forms.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -18,7 +19,8 @@ namespace Sarand.PatientMgr.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SpmSessionProfile_Desktop ()
|
||||
public SpmSessionProfile_Desktop (SpmSessionContext sessionContext) :
|
||||
base(sessionContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user