Config - Departments - in progress

This commit is contained in:
2019-12-04 13:59:00 +00:00
parent 15541b77aa
commit 114aa49535
90 changed files with 3430 additions and 660 deletions
@@ -1,4 +1,5 @@
using Sarand.PatientMgr.Core.App;
using Sarand.Core.Bus;
using Sarand.PatientMgr.Core.App;
using System;
using System.Collections.Generic;
using System.Text;
@@ -21,6 +22,17 @@ namespace Sarand.PatientMgr.Win.Forms.App
{
}
//-------------------------------------------------------------------
// S e s s i o n P r o p e r t i e s
//-------------------------------------------------------------------
// Schedule filter.
public class FilterData
{
public SysId DepartmentId { get; private set; }
public String Name { get; private set; }
}
public static FilterData Filter { get; } = new FilterData();
//-------------------------------------------------------------------
}
//=======================================================================
@@ -1,4 +1,8 @@
using Sarand.PatientMgr.Core.App;
using Sarand.Core.Base;
using Sarand.Core.Bus;
using Sarand.PatientMgr.Core.App;
using Sarand.PatientMgr.Core.Base;
using Sarand.Win.App;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,9 +12,7 @@ using System.Threading.Tasks;
namespace Sarand.PatientMgr.Win.Forms.App
{
//=======================================================================
/// <summary>
/// PatientMgr global properties for desktop/console applications.
/// </summary>
/// <summary>PatientMgr global properties for desktop applications.</summary>
public class SpmSessionProfile_Win : SpmSessionProfile
{
//-------------------------------------------------------------------
@@ -26,19 +28,102 @@ namespace Sarand.PatientMgr.Win.Forms.App
//-------------------------------------------------------------------
// Data members.
private readonly SpmUserContext_Win userContext;
private SpmSessionProperties sessionProperties = new SpmSessionProperties();
private readonly SacsRegistry registryConfig, registryProcess;
// Registry keys.
private static String kpcProfileSectionConfig = "Config";
private static String kpcProfileSectionProcess = "Process";
//private static String kpcProfileSectionWindowPos = "WindowPos";
private static String kpcProfileKeyDeptId = "DepartmentId";
private static String kpcProfileKeyFacilityType = "FacilityType";
private static String kpcProfileKeyFacilityId = "FacilityId";
private static String kpcProfileDisplayFilter = "DisplayFilter";
private static String kpcProfileAdmExportDir = "AdmExportDir";
private static String kpcProfileStatsGenerateDir = "StatsGenerateDir";
//private static String kpcProfileWndPos_Help = "Help";
//private static String kpcProfileWndPos_Config = "Config";
//private static String kpcProfileWndPos_Lists = "Lists";
//-------------------------------------------------------------------
// Construction.
protected SpmSessionProfile_Win (SpmSessionContext sessionContext)
{
userContext = new SpmUserContext_Win(sessionContext);
// Registries.
registryConfig = new SacsRegistry("Sarand", "Sarand Patient Manager", kpcProfileSectionConfig);
registryProcess = new SacsRegistry("Sarand", "Sarand Patient Manager", kpcProfileSectionProcess);
// Filter properties.
Filter.DepartmentId = new SysId(registryConfig.GetIntValue("", kpcProfileKeyDeptId));
Filter.FacilityType = EnumUtil.ParseEnum(registryConfig.GetIntValue("", kpcProfileKeyFacilityType).ToString(), Spm.FacilityType.Unknown);
Filter.FacilityId = new SysId(registryConfig.GetIntValue("", kpcProfileKeyFacilityId));
sessionProperties.DisplayFilter = registryConfig.GetIntValue("", kpcProfileDisplayFilter) > 0 ? true : false;
sessionProperties.AdmissionExportFolder = registryProcess.GetStringValue("", kpcProfileAdmExportDir, "");
sessionProperties.StatisticsExportFolder = registryProcess.GetStringValue("", kpcProfileStatsGenerateDir, "");
}
//-------------------------------------------------------------------
// S t o r e P r o p e r t i e s
//-------------------------------------------------------------------
public void StoreProperties()
{
registryConfig.WriteInt("", kpcProfileKeyDeptId, SysId.ToInt(Filter.DepartmentId));
registryConfig.WriteInt("", kpcProfileKeyFacilityType, (int)Filter.FacilityType);
registryConfig.WriteInt("", kpcProfileKeyFacilityId, SysId.ToInt(Filter.FacilityId));
registryConfig.WriteInt("", kpcProfileDisplayFilter, sessionProperties.DisplayFilter ? 1 : 0);
registryProcess.WriteString("", kpcProfileAdmExportDir, sessionProperties.AdmissionExportFolder);
registryProcess.WriteString("", kpcProfileStatsGenerateDir, sessionProperties.StatisticsExportFolder);
}
//-------------------------------------------------------------------
// S e s s i o n P r o p e r t i e s
//-------------------------------------------------------------------
// User context.
public SpmSessionContext SessionContext { get { return userContext.SessionContext; } }
public SpmUserContext UserContext { get { return userContext; } }
//-------------------------------------------------------------------
// Schdedule display characteristics.
/// <summary>Earliest date to list - 2 year in past.</summary>
public DateTime ScheduleStart { get { return sessionProperties.ScheduleStart; } }
/// <summary>Latest date to list - 2 year in future.</summary>
public DateTime ScheduleEnd { get { return sessionProperties.ScheduleEnd; } }
/// <summary>Show filter.</summary>
public bool DisplayFilter { get { return sessionProperties.DisplayFilter; } set { sessionProperties.DisplayFilter = value; } }
//-------------------------------------------------------------------
/// <summary>Admission display text height (standard, medium, large)</summary>
public int GetTextHeight (Spm.DisplayFont displayFont)
{
return sessionProperties.GetTextHeight(displayFont);
}
public void SetTextHeight (Spm.DisplayFont displayFont, int textHeight)
{
sessionProperties.SetTextHeight(displayFont, textHeight);
}
//-------------------------------------------------------------------
private readonly Dictionary<Spm.DisplayBoundary,int> displayBoundaries = new Dictionary<Spm.DisplayBoundary,int>();
/// <summary>Width for selected boundary definition</summary>
public int GetDisplayBoundary (Spm.DisplayBoundary displayBoundary)
{
return sessionProperties.GetDisplayBoundary(displayBoundary);
}
public void SetDisplayBoundary (Spm.DisplayBoundary displayBoundary, int boundary)
{
sessionProperties.SetDisplayBoundary(displayBoundary, boundary);
}
//-------------------------------------------------------------------
// Schedule filter.
public SpmSessionProperties.FilterData Filter { get { return sessionProperties.Filter; } }
//-------------------------------------------------------------------
// Data folders.
public String AdmissionExportFolder { get { return sessionProperties.AdmissionExportFolder; } set { sessionProperties.AdmissionExportFolder = value; } }
public String StatisticsExportFolder { get { return sessionProperties.StatisticsExportFolder; } set { sessionProperties.StatisticsExportFolder = value; } }
//-------------------------------------------------------------------
}
//=======================================================================
+28 -20
View File
@@ -26,26 +26,29 @@ namespace Sarand.PatientMgr.Win.Forms.Base
[Browsable(false)]
public new class Config : SacsForm.Config
{
/// <summary>Pass Internals via Config to share cached data.</summary>
public SpmInternals Internals { get; set; } = null;
}
//-------------------------------------------------------------------
// Data members.
private readonly Config config;
private readonly SpmInternals internals;
private SpmInternals internals = null;
//-------------------------------------------------------------------
// Construction.
private SpmForm() : this(new Config()) { }
protected SpmForm(Config config) : base(config)
private SpmForm () : this(new Config()) { }
protected SpmForm (Config config) : base(config)
{
this.config = config;
InitializeComponent();
}
protected override void Dispose(bool disposing)
protected override void Dispose (bool disposing)
{
if (disposing && (components != null))
if (disposing)
{
components.Dispose();
if (components != null) components.Dispose();
if (internals != null) internals.Dispose();
}
base.Dispose(disposing);
}
@@ -55,23 +58,28 @@ namespace Sarand.PatientMgr.Win.Forms.Base
// Session.
protected SpmSessionProfile_Win SessionProfile { get; } = SpmGlobals_Win.SessionProfile;
protected SpmUserContext UserContext { get { return (SessionProfile != null ? SessionProfile.UserContext : null); } }
protected SpmSessionContext SessionContext { get { return (UserContext != null ? UserContext.SessionContext : null); } }
public SpmUserContext UserContext { get { return (SessionProfile != null ? SessionProfile.UserContext : null); } }
public SpmSessionContext SessionContext { get { return (UserContext != null ? UserContext.SessionContext : null); } }
protected SpmInternals Internals
{
get
{
if (config.Internals != null) return config.Internals;
if (internals == null) internals = new SpmInternals(UserContext);
return internals;
}
}
// Security.
protected SpmSecurityProfile SecurityProfile { get { return internals.SecurityProfile; } }
public SpmSecurityProfile SecurityProfile { get { return Internals.SecurityProfile; } }
// Managers.
protected SpmAdmissionMgr AdmissionMgr { get { return internals.AdmissionMgr; } }
protected SpmDepartmentMgr DepartmentMgr { get { return internals.DepartmentMgr; } }
protected SpmInstitutionMgr InstitutionMgr { get { return internals.InstitutionMgr; } }
public SpmInstitutionMgr InstitutionMgr { get { return Internals.InstitutionMgr; } }
public SpmDepartmentMgr DepartmentMgr { get { return Internals.DepartmentMgr; } }
public SpmAdmissionMgr AdmissionMgr { get { return Internals.AdmissionMgr; } }
// Consoles.
protected SaSecurityConsole SecurityConsole { get { return internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return internals.CodeTypeConsole; } }
protected SaUpdateLogConsole UpdateLogConsole { get { return internals.UpdateLogConsole; } }
protected SaItemOptionConsole ItemOptionConsole { get { return internals.ItemOptionConsole; } }
public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
public SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
public SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
//-------------------------------------------------------------------
}
+20 -14
View File
@@ -26,12 +26,14 @@ namespace Sarand.PatientMgr.Win.Forms.Base
// Configuration.
public new class Config : SacsPanel.Config
{
/// <summary>Pass Internals via Config to share cached data.</summary>
public SpmInternals Internals { get; set; } = null;
}
//-------------------------------------------------------------------
// Data members.
private Config config = new Config();
private readonly SpmInternals internals;
private SpmInternals internals = null;
//-------------------------------------------------------------------
// Construction.
@@ -40,7 +42,6 @@ namespace Sarand.PatientMgr.Win.Forms.Base
{
SetConfig(config);
InitializeComponent();
internals = new SpmInternals(SessionProfile != null ? SessionProfile.UserContext : null);
}
protected override void Dispose(bool disposing)
{
@@ -60,21 +61,26 @@ namespace Sarand.PatientMgr.Win.Forms.Base
protected SpmUserContext UserContext { get { return (SessionProfile != null ? SessionProfile.UserContext : null); } }
protected SpmSessionContext SessionContext { get { return (UserContext != null ? UserContext.SessionContext : null); } }
protected DbUpdateInfo DbUpdateInfo { get { return internals.DbUpdateInfo; } }
protected SpmInternals Internals
{
get
{
if (config.Internals != null) return config.Internals;
if (internals == null) internals = new SpmInternals(UserContext);
return internals;
}
}
// Security.
protected SpmSecurityProfile SecurityProfile { get { return internals.SecurityProfile; } }
public SpmSecurityProfile SecurityProfile { get { return Internals.SecurityProfile; } }
// Managers.
protected SpmAdmissionMgr AdmissionMgr { get { return internals.AdmissionMgr; } }
protected SpmDepartmentMgr DepartmentMgr { get { return internals.DepartmentMgr; } }
protected SpmInstitutionMgr InstitutionMgr { get { return internals.InstitutionMgr; } }
public SpmInstitutionMgr InstitutionMgr { get { return Internals.InstitutionMgr; } }
public SpmDepartmentMgr DepartmentMgr { get { return Internals.DepartmentMgr; } }
public SpmAdmissionMgr AdmissionMgr { get { return Internals.AdmissionMgr; } }
// Consoles.
protected SaSecurityConsole SecurityConsole { get { return internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return internals.CodeTypeConsole; } }
protected SaUpdateLogConsole UpdateLogConsole { get { return internals.UpdateLogConsole; } }
protected SaItemOptionConsole ItemOptionConsole { get { return internals.ItemOptionConsole; } }
public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
public SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
public SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
//-------------------------------------------------------------------
// Configure.
+20 -13
View File
@@ -32,12 +32,14 @@ namespace Sarand.PatientMgr.Win.Forms.Base
public virtual bool WrapSinglePanelInGroupBox { get; protected set; } = false;
/// <summary>Wrap multiple panels on tab page in group boxes. Default - multiple panels are wrapped in group boxes.</summary>
public virtual bool WrapMultiplePanelsInGroupBoxes { get; protected set; } = true;
/// <summary>Pass Internals via Config to share cached data.</summary>
public SpmInternals Internals { get; set; } = null;
}
//-------------------------------------------------------------------
// Data members.
private Config config = new Config();
private readonly SpmInternals internals;
private SpmInternals internals = null;
//-------------------------------------------------------------------
// Construction.
@@ -46,7 +48,6 @@ namespace Sarand.PatientMgr.Win.Forms.Base
{
this.config = config;
InitializeComponent();
internals = new SpmInternals(SessionProfile != null ? SessionProfile.UserContext : null);
}
protected override void Dispose(bool disposing)
{
@@ -67,20 +68,26 @@ namespace Sarand.PatientMgr.Win.Forms.Base
protected SpmSessionProfile_Win SessionProfile { get; } = SpmGlobals_Win.SessionProfile;
protected SpmUserContext UserContext { get { return SessionProfile.UserContext; } }
protected SpmSessionContext SessionContext { get { return SessionProfile.SessionContext; } }
protected SpmInternals Internals
{
get
{
if (config.Internals != null) return config.Internals;
if (internals == null) internals = new SpmInternals(UserContext);
return internals;
}
}
// Security.
protected SpmSecurityProfile SecurityProfile { get { return internals.SecurityProfile; } }
public SpmSecurityProfile SecurityProfile { get { return Internals.SecurityProfile; } }
// Managers.
protected SpmAdmissionMgr AdmissionMgr { get { return internals.AdmissionMgr; } }
protected SpmDepartmentMgr DepartmentMgr { get { return internals.DepartmentMgr; } }
protected SpmInstitutionMgr InstitutionMgr { get { return internals.InstitutionMgr; } }
public SpmInstitutionMgr InstitutionMgr { get { return Internals.InstitutionMgr; } }
public SpmDepartmentMgr DepartmentMgr { get { return Internals.DepartmentMgr; } }
public SpmAdmissionMgr AdmissionMgr { get { return Internals.AdmissionMgr; } }
// Consoles.
protected SaSecurityConsole SecurityConsole { get { return internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return internals.CodeTypeConsole; } }
protected SaUpdateLogConsole UpdateLogConsole { get { return internals.UpdateLogConsole; } }
protected SaItemOptionConsole ItemOptionConsole { get { return internals.ItemOptionConsole; } }
public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
public SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
public SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
//-------------------------------------------------------------------
// I n i t i a l i s a t i o n
@@ -0,0 +1,53 @@
namespace Sarand.PatientMgr.Win.Forms.Config
{
partial class SpmForm_Config
{
/// <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.splitContainer = new System.Windows.Forms.SplitContainer();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.SuspendLayout();
this.SuspendLayout();
//
// splitContainer
//
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer.Location = new System.Drawing.Point(0, 0);
this.splitContainer.Name = "splitContainer";
this.splitContainer.Size = new System.Drawing.Size(747, 493);
this.splitContainer.SplitterDistance = 179;
this.splitContainer.TabIndex = 0;
//
// SpmForm_Config
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(747, 493);
this.Controls.Add(this.splitContainer);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(720, 480);
this.Name = "SpmForm_Config";
this.ShowIcon = false;
this.Text = "Sarand Patient Manager - Configuration";
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer;
}
}
@@ -0,0 +1,204 @@
using Sarand.PatientMgr.Win.Forms.Base;
using Sarand.PatientMgr.Win.Forms.Panels;
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.Win.Forms.Config
{
//=======================================================================
public partial class SpmForm_Config : SpmForm
{
//-------------------------------------------------------------------
// Configuration.
public new class Config : SpmForm.Config
{
}
//-------------------------------------------------------------------
// Definitions.
public enum ConfigPanelType
{
Unknown = 0,
Departments,
Operations,
Employees,
Patients,
Procedures,
EmployeeRoles,
FacilityTemplates
}
//-------------------------------------------------------------------
// Data members.
private Config config = null;
private SpmPanel_Config_Menu panelMenu = null;
private ConfigPanelType panelType = ConfigPanelType.Unknown;
//-------------------------------------------------------------------
// Construction.
private SpmForm_Config () : this(new Config()) { }
public SpmForm_Config (Config config) : base(config)
{
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null) components.Dispose();
if (panelMenu != null) panelMenu.Dispose();
}
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// Properties.
[Browsable(false), ReadOnly(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ConfigPanelType PanelType
{
get { return panelType; }
set
{
SwitchPanel(value);
}
}
private void SwitchPanel (ConfigPanelType panelType)
{
if (this.panelType == panelType) return;
SpmPanel panel = null;
switch (panelType)
{
case ConfigPanelType.Departments:
{
SpmPanel_Departments.Config panelConfig = new SpmPanel_Departments.Config(SpmPanel_Departments.PanelMode.Maintain);
panel = new SpmPanel_Departments(panelConfig);
break;
}
case ConfigPanelType.FacilityTemplates:
{
SpmPanel_FacilityTemplates.Config panelConfig = new SpmPanel_FacilityTemplates.Config();
panelConfig.Mode = SpmPanel_FacilityTemplates.PanelMode.Maintain;
panel = new SpmPanel_FacilityTemplates(panelConfig);
break;
}
case ConfigPanelType.Operations:
{
/* ToDo Operations panel
SpmPanel_Operations.Config panelConfig = new SpmPanel_Operations.Config();
panelConfig.Mode = SpmPanel_Operations.PanelMode.Maintain;
panel = new SpmPanel_Operations(panelConfig);
*/
break;
}
case ConfigPanelType.Procedures:
{
SpmPanel_Procedures.Config panelConfig = new SpmPanel_Procedures.Config();
panelConfig.Mode = SpmPanel_Procedures.PanelMode.Maintain;
panel = new SpmPanel_Procedures(panelConfig);
break;
}
case ConfigPanelType.Patients:
{
/* ToDo Patients panel
SpmPanel_Patients.Config panelConfig = new SpmPanel_Patients.Config();
panelConfig.Mode = SpmPanel_Patients.PanelMode.Maintain;
panel = new SpmPanel_Patients(panelConfig);
*/
break;
}
case ConfigPanelType.Employees:
{
/* ToDo Employees panel
SpmPanel_Employees.Config panelConfig = new SpmPanel_Employees.Config();
panelConfig.Mode = SpmPanel_Employees.PanelMode.Maintain;
panel = new SpmPanel_Employees(panelConfig);
*/
break;
}
case ConfigPanelType.EmployeeRoles:
{
SpmPanel_EmployeeRoles.Config panelConfig = new SpmPanel_EmployeeRoles.Config();
panelConfig.Mode = SpmPanel_EmployeeRoles.PanelMode.Maintain;
panel = new SpmPanel_EmployeeRoles(panelConfig);
break;
}
}
if (panel == null) return;
// Clear existing view.
while (splitContainer.Panel2.Controls.Count > 0)
{
Control control = splitContainer.Panel2.Controls[0];
splitContainer.Panel2.Controls.RemoveAt(0);
control.Dispose();
}
// Add new view.
splitContainer.Panel2.Controls.Add(panel);
panel.Dock = DockStyle.Fill;
this.panelType = panelType;
}
//-------------------------------------------------------------------
// I n i t i a l i s a t i o n
//-------------------------------------------------------------------
protected override void OnCreateControl ()
{
base.OnCreateControl();
if (this.IsDesignerHosted()) return;
// Spliter.
splitContainer.SplitterDistance = 200;
splitContainer.FixedPanel = FixedPanel.Panel1;
splitContainer.IsSplitterFixed = true;
// Menu panel.
SpmPanel_Config_Menu.Config menuConfig = new SpmPanel_Config_Menu.Config();
menuConfig.ConfigForm = this;
panelMenu = new SpmPanel_Config_Menu(menuConfig);
splitContainer.Panel1.Controls.Add(panelMenu);
panelMenu.Dock = DockStyle.Fill;
panelMenu.RefreshPanel();
SetControlActivity();
}
protected override void OnShown (EventArgs e)
{
base.OnShown(e);
}
//-------------------------------------------------------------------
// 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 A c t i o n s
//-------------------------------------------------------------------
public void RefreshView()
{
}
//-------------------------------------------------------------------
// F o r m E v e n t s
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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>
@@ -0,0 +1,23 @@
namespace Sarand.PatientMgr.Win.Forms.Config
{
partial class SpmPanel_Config_Menu
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
#region Component 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 ()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
@@ -0,0 +1,311 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sarand.Win.Forms.Controls;
using Sarand.Win.Forms.Utils;
using Sarand.Core.Base;
using Sarand.Core.App;
using Sarand.PatientMgr.Core.Bus;
using Sarand.PatientMgr.Core.App;
using Sarand.PatientMgr.Win.Forms.Base;
using Sarand.Core.Dbas.Base;
using Sarand.Core.Security;
using Sarand.PatientMgr.Win.Forms.App;
namespace Sarand.PatientMgr.Win.Forms.Config
{
//=======================================================================
public partial class SpmPanel_Config_Menu : SacsHtmlPanel
{
//-------------------------------------------------------------------
// Configuration.
public new class Config : SacsHtmlPanel.Config
{
public SpmForm_Config ConfigForm { get; set; }
public SpmForm AdmissionListForm { get; set; }
}
//-------------------------------------------------------------------
// Data members.
private Config config = null;
private bool appCmdInProgress = false;
private static String AppCmd_AdmClose = "AdmClose";
private static String AppCmd_AdmRefresh = "AdmRefresh";
private static String AppCmd_AdmSecurity = "AdmSecurity";
private static String AppCmd_AdmCodeTypes = "AdmCodeTypes";
private static String AppCmd_AdmExport = "AdmExport";
private static String AppCmd_AdmStatistics = "AdmStatistics";
private static String AppCmd_AdmDatabase = "AdmDatabase";
private static String AppCmd_Departments = "Departments";
private static String AppCmd_Operations = "Operations";
private static String AppCmd_Employees = "Employees";
private static String AppCmd_Patients = "Patients";
private static String AppCmd_Procedures = "Procedures";
private static String AppCmd_EmployeeRoles = "EmployeeRoles";
private static String AppCmd_FacilityTemplates = "FacilityTemplates";
private static String AppCmd_PatientSearch = "PatientSearch";
private static String AppCmd_WaitingList = "WaitingList";
private static String AppCmd_RequiredActions = "RequiredActions";
private static String AppCmd_CancelTimeLimit = "CancelTimeLimit";
private static String AppCmd_CancelOther = "CancelOther";
private static String AppCmd_Deletions = "Deletions";
//-------------------------------------------------------------------
// Construction.
private SpmPanel_Config_Menu () : this(new Config()) { }
public SpmPanel_Config_Menu (Config config) : base(config)
{
this.config = config;
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null) components.Dispose();
}
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// Properties.
public bool HasActiveProcess { get { return appCmdInProgress; } }
//-------------------------------------------------------------------
// I n i t i a l i s a t i o n
//-------------------------------------------------------------------
protected override void OnCreateControl ()
{
base.OnCreateControl();
if (this.IsDesignerHosted()) return;
}
//-------------------------------------------------------------------
// R e f r e s h P a n e l
//-------------------------------------------------------------------
public void RefreshPanel ()
{
List<String> body = new List<string>();
body.Add("<div class='Title'>Sarand<br/>Patient&nbsp;Manager</div>");
// Institution.
SpmInstitution institution = config.ConfigForm.InstitutionMgr.GetInstitution();
if (institution != null)
{
body.Add("<div class='Caption'>Institution</div>");
body.Add("<div class='Institution'>" + institution.Name + "</div>");
institution.Dispose(); institution = null;
}
if (config.ConfigForm != null)
{
// Configuration options:
body.Add("<div class='Caption'>Configuration</div>");
body.Add(BuildMenuOpt(AppCmd_Departments, "Departments"));
body.Add(BuildMenuOpt(AppCmd_FacilityTemplates, "Session templates"));
body.Add(BuildMenuOpt(AppCmd_Operations, "Operations"));
body.Add(BuildMenuOpt(AppCmd_Procedures, "Procedures"));
body.Add(BuildMenuOpt(AppCmd_Patients, "Patients"));
body.Add(BuildMenuOpt(AppCmd_Employees, "Employees"));
body.Add(BuildMenuOpt(AppCmd_EmployeeRoles, "Employee roles"));
// Application options.
body.Add("<div class='Caption'>Application</div>");
body.Add(BuildMenuOpt(AppCmd_AdmRefresh, "Refresh", false));
if (config.ConfigForm.SecurityProfile.Admin.CanManageSecurity())
body.Add(BuildMenuOpt(AppCmd_AdmSecurity, "Security", false));
body.Add(BuildMenuOpt(AppCmd_AdmExport, "Export", false));
body.Add(BuildMenuOpt(AppCmd_AdmStatistics, "Statistics", false));
if (config.ConfigForm.SecurityProfile.Admin.CanManageDatabase())
{
ISacsDatabase database = SpmGlobals.Application.GetDatabase(config.ConfigForm.SessionContext);
if (database != null && database.DbmsType == DbmsType.Access)
body.Add(BuildMenuOpt(AppCmd_AdmDatabase, "Db housekeeping", false));
}
if (config.ConfigForm.SecurityProfile.Admin.CanManageConfig() && config.ConfigForm.CodeTypeConsole != null)
body.Add(BuildMenuOpt(AppCmd_AdmCodeTypes, "Codes", false));
}
else if (config.AdmissionListForm != null)
{
// Admission Lists options.
body.Add("<div class='Caption'>Admission Lists</div>");
body.Add(BuildMenuOpt(AppCmd_PatientSearch, "Patient Search"));
body.Add(BuildMenuOpt(AppCmd_WaitingList, "Waiting List"));
body.Add(BuildMenuOpt(AppCmd_RequiredActions, "Required Actions"));
body.Add(BuildMenuOpt(AppCmd_CancelTimeLimit, "Cancellations - 28 day"));
body.Add(BuildMenuOpt(AppCmd_CancelOther, "Cancellations - other"));
body.Add(BuildMenuOpt(AppCmd_Deletions, "Deletions"));
// Action options:
body.Add("<div class='Caption'>Actions</div>");
foreach (SacsCommand item in new List<SacsCommand>()) //config.AdmissionListForm.GetMenuItems())
body.Add(BuildMenuOpt(item.CommandId, item.Caption, false));
}
body.Add(BuildMenuOpt(AppCmd_AdmClose, "Close", false));
if (DocumentPopulated)
{
SetDocumentBody(body.Concat("\n"));
}
else
{
List<String> html = new List<string>();
html.Add("<html><head>" + GetMenuStyle() + GetMenuScript() + "</head><body>");
html.AddRange(body);
html.Add("</body></html>");
SetDocumentHtml(html.Concat("\n"));
DocumentPopulated = true;
}
}
private String BuildMenuOpt (String command, String display, bool panelOption = true)
{
// Is this the currently selected option:
bool currentOption = false;
if (panelOption)
{
if (config.ConfigForm != null) currentOption = GetConfigPanelType(command) == config.ConfigForm.PanelType;
else if (config.AdmissionListForm != null) currentOption = false; // GetAdmissionsPanelType(command) == config.AdmissionListForm.PanelType;
}
// Build the menu option:
String option = "";
option += currentOption ? "<b>" : "<a class='Mnu' href='" + AppHrefPrefix + command + "'>";
option += display;
option += currentOption ? "</b>" : "</a>";
option += "<br>";
return option;
}
private String GetMenuStyle ()
{
List<String> style = new List<string>();
style.Add("<style>" + SacsResourceConsole.GetTextResource(SacsResourceConsole.TextResource.SaBaseCss) + "</style>");
style.Add("<style>");
style.Add("*{font-size:14px;font-family:'sans-serif';color:#303080;background-color:#A0D0A0;scrollbar-base-color:#A0D0A0;}");
style.Add("body{padding:4;margin:0;background-color:#A0D0A0;overflow-y:auto;}");
style.Add("p{font-size:14px;margin-top:15px;margin-bottom:5px;}");
style.Add("td{font-size:14px;vertical-align:top;}");
style.Add(".Title{margin:4px 0;padding-left:32px;font-weight:bold;font-size:20px;background-image:url('" + GetImageUri(SpmResourceConsole.GetImageResource(SpmResourceConsole.ImageResource.PatientMgr_Icon_gif), "png") + "');background-position:left top;background-repeat:no-repeat;}");
style.Add(".Caption{margin-top:5px;margin-bottom:5px;padding:3px;font-size:16px;font-weight:bold;text-align:center;color:#E0E0FF;background-color:#6060E0;}");
style.Add(".Institution{margin-top:2px;margin-bottom:2px;font-weight:bold;font-size:14px;text-align:center;}");
style.Add(".SuperScript{font-size:66%;position:relative;top:-5px;}");
style.Add(".Body{text-align:left;padding-left:5%;}");
style.Add("A:link,A:visited,A:active{line-height:150%;font-weight:normal;text-decoration:none;padding:3px;}");
style.Add("A.Mnu:link,A.Mnu:visited,A.Mnu:active{font-size:13px;text-align:center;}");
style.Add("A:hover,A.Mnu:hover{font-weight:bold;padding-left:0px;padding-right:0px;}");
style.Add("</style>");
return style.Concat("\n");
}
private String GetMenuScript ()
{
List<String> script = new List<string>();
return script.Concat("\n");
}
//-------------------------------------------------------------------
// P a n e l E v e n t s
//-------------------------------------------------------------------
protected override void OnAppAction (string action)
{
Logger.Debug("OnAppAction Action: " + action);
bool optionProcessed = false;
if (action.EqualsCI(AppCmd_AdmClose))
{
if (config.ConfigForm != null) config.ConfigForm.Close();
else if (config.AdmissionListForm != null) config.AdmissionListForm.Close();
optionProcessed = true;
}
else if (action.EqualsCI(AppCmd_AdmRefresh))
{
if (config.ConfigForm != null) config.ConfigForm.RefreshView();
//else if (config.AdmissionListForm != null) config.AdmissionListForm.RefreshView();
optionProcessed = true;
}
else if (action.EqualsCI(AppCmd_AdmSecurity))
{
SaSecurityConsole securityConsole = config.ConfigForm?.SecurityConsole ?? config.AdmissionListForm?.SecurityConsole ?? null;
SpmSecurityProfile securityProfile = config.ConfigForm?.SecurityProfile ?? config.AdmissionListForm?.SecurityProfile ?? null;
if (securityConsole == null || securityProfile == null) return;
securityConsole.ManageSecurity(securityProfile.Admin.CanManageSecurity(), SpmGlobals_Win.UserContext.DbUpdateInfo);
optionProcessed = true;
}
else if (action.EqualsCI(AppCmd_AdmCodeTypes))
{
// ToDo Code Types options.
optionProcessed = true;
}
else if (action.EqualsCI(AppCmd_AdmExport))
{
// ToDo Export options.
optionProcessed = true;
}
else if (action.EqualsCI(AppCmd_AdmStatistics))
{
// ToDo Export options.
optionProcessed = true;
}
else if (action.EqualsCI(AppCmd_AdmDatabase))
{
// No longer required - database now SQL rather than Access.
// Unless SQL database housekeeping could be invoked.
optionProcessed = true;
}
else if (config.ConfigForm != null)
{
// Flag to avoid other commands during length processing:
appCmdInProgress = true;
SpmForm_Config.ConfigPanelType panelType = GetConfigPanelType (action);
if (panelType != SpmForm_Config.ConfigPanelType.Unknown)
{
config.ConfigForm.PanelType = panelType;
RefreshPanel();
}
optionProcessed = true;
}
else if (config.AdmissionListForm != null)
{
// Flag to avoid other commands during length processing (eg. multiple deletions):
appCmdInProgress = true;
// ToDo Admission List actions.
/*
SwmDlgAdmissionLists::eSwmAdmissionsPanel ePanel = SwmPanelMenu::PanelForAdmissionsCmd (sCmd);
if (ePanel != SwmDlgAdmissionLists::ePanelUnknown)
{
pDlgAdmLists->SetAdmissionsPanel(ePanel);
Refresh();
optionProcessed = true;
}
else
{
bOptionProcessed = pDlgAdmLists->DoMenuOption(String(sCmd).AsLong());
SetFocus();
}
*/
optionProcessed = true;
}
appCmdInProgress = false;
//base.OnAppAction(action);
}
private SpmForm_Config.ConfigPanelType GetConfigPanelType (String command)
{
if (config.ConfigForm == null) return SpmForm_Config.ConfigPanelType.Unknown;
if (command.EqualsCI(AppCmd_Departments)) return SpmForm_Config.ConfigPanelType.Departments;
if (command.EqualsCI(AppCmd_Operations)) return SpmForm_Config.ConfigPanelType.Operations;
if (command.EqualsCI(AppCmd_Employees)) return SpmForm_Config.ConfigPanelType.Employees;
if (command.EqualsCI(AppCmd_Patients)) return SpmForm_Config.ConfigPanelType.Patients;
if (command.EqualsCI(AppCmd_Procedures)) return SpmForm_Config.ConfigPanelType.Procedures;
if (command.EqualsCI(AppCmd_EmployeeRoles)) return SpmForm_Config.ConfigPanelType.EmployeeRoles;
if (command.EqualsCI(AppCmd_FacilityTemplates)) return SpmForm_Config.ConfigPanelType.FacilityTemplates;
return SpmForm_Config.ConfigPanelType.Unknown;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -14,6 +14,8 @@ using Sarand.Core.Security;
using Sarand.Core.CodeTypes;
using Sarand.Core.UpdateLog;
using Sarand.Core.ItemOptions;
using System.Windows.Forms;
using Sarand.Core.Dbas.Base;
namespace Sarand.PatientMgr.Win.Forms.Controls
{
@@ -24,12 +26,14 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
// Configuration.
public class Config
{
/// <summary>Pass Internals via Config to share cached data.</summary>
public SpmInternals Internals { get; set; } = null;
}
//-------------------------------------------------------------------
// Data members.
private Config config = new Config();
private readonly SpmInternals internals;
private SpmInternals internals = null;
//-------------------------------------------------------------------
// Construction.
@@ -38,7 +42,6 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
{
this.config = config;
InitializeComponent();
internals = new SpmInternals(SessionProfile != null ? SessionProfile.UserContext : null);
}
protected override void Dispose(bool disposing)
{
@@ -60,26 +63,30 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
/// <summary>Total number of items to be displayed (not items already in the list).</summary>
[Browsable(false), ReadOnly(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual int ItemTotal { get; protected set; } = 0;
// Session.
protected SpmSessionProfile_Win SessionProfile { get; } = SpmGlobals_Win.SessionProfile;
protected SpmUserContext UserContext { get { return (SessionProfile != null ? SessionProfile.UserContext : null); } }
protected SpmSessionContext SessionContext { get { return (UserContext != null ? UserContext.SessionContext : null); } }
protected SpmInternals Internals
{
get
{
if (config.Internals != null) return config.Internals;
if (internals == null) internals = new SpmInternals(UserContext);
return internals;
}
}
// Security.
protected SpmSecurityProfile SecurityProfile { get { return internals.SecurityProfile; } }
public SpmSecurityProfile SecurityProfile { get { return Internals.SecurityProfile; } }
// Managers.
protected SpmAdmissionMgr AdmissionMgr { get { return internals.AdmissionMgr; } }
protected SpmDepartmentMgr DepartmentMgr { get { return internals.DepartmentMgr; } }
protected SpmInstitutionMgr InstitutionMgr { get { return internals.InstitutionMgr; } }
public SpmInstitutionMgr InstitutionMgr { get { return Internals.InstitutionMgr; } }
public SpmDepartmentMgr DepartmentMgr { get { return Internals.DepartmentMgr; } }
public SpmAdmissionMgr AdmissionMgr { get { return Internals.AdmissionMgr; } }
// Consoles.
protected SaSecurityConsole SecurityConsole { get { return internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return internals.CodeTypeConsole; } }
protected SaUpdateLogConsole UpdateLogConsole { get { return internals.UpdateLogConsole; } }
protected SaItemOptionConsole ItemOptionConsole { get { return internals.ItemOptionConsole; } }
public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
public SaUpdateLogConsole UpdateLogConsole { get { return Internals.UpdateLogConsole; } }
public SaItemOptionConsole ItemOptionConsole { get { return Internals.ItemOptionConsole; } }
//-------------------------------------------------------------------
// Configure.
@@ -94,6 +101,34 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
{
base.OnCreateControl();
if (this.IsDesignerHosted()) return;
// List View configuration.
View = View.Details;
FullRowSelect = true;
HideSelection = false;
MultiSelect = false;
}
//-------------------------------------------------------------------
protected override void OnHandleDestroyed (EventArgs e)
{
//CancelListRefresh();
Clear();
base.OnHandleDestroyed(e);
}
//-------------------------------------------------------------------
// R e f r e s h L i s t
//-------------------------------------------------------------------
/// <summary>Close and dispose the result set, if not null.</summary>
protected void ClearResultSet (ref DbResultSet dbResultSet)
{
if (dbResultSet == null) return;
// Copy the ResultSet reference so that the original can be nulled before closing/disposing.
DbResultSet dbResultSet_Local = dbResultSet;
dbResultSet = null;
dbResultSet_Local.Close();
dbResultSet_Local.Dispose();
}
//-------------------------------------------------------------------
@@ -60,8 +60,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -1,6 +1,7 @@
using Sarand.Core.Base;
using Sarand.Core.Bus;
using Sarand.Core.Dbas.Base;
using Sarand.PatientMgr.Core.App;
using Sarand.PatientMgr.Core.Bus;
using Sarand.Win.Forms.Controls;
using Sarand.Win.Forms.Utils;
@@ -47,21 +48,24 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
public SpmItemListView_Department(Config config) : base(config)
{
this.config = config;
if (SpmGlobals.System != null)
{
columnDfnId = DepartmentMgr.GetDepartmentColumnDfn(SpmDepartment.Column.Id);
}
InitializeComponent();
/* ToDo Timers function need modifying.
timerQueryData = new Timer() { Interval = 250 };
timerQueryData.Tick += OnTimerQueryData;
timerDisplayItem = new Timer() { Interval = 5 };
timerDisplayItem.Tick += OnTimerDisplayItem;*/
timerDisplayItem.Tick += OnTimerDisplayItem;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -114,7 +118,6 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
InitDepartmentList(true);
}
//-------------------------------------------------------------------
private void InitDepartmentList(bool forceInit = false)
{
@@ -126,9 +129,9 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
// Populate list of columns to be displayed.
columnsDisplay.Add(DepartmentMgr.GetDepartmentColumnDfn(SpmDepartment.Column.Name));
columnsDisplay.Add(DepartmentMgr.GetDepartmentColumnDfn(SpmDepartment.Column.ApplicatonFrom));
columnsDisplay.Add(DepartmentMgr.GetDepartmentColumnDfn(SpmDepartment.Column.ApplicationTo));
columnsDisplay.Add(DepartmentMgr.GetDepartmentColumnDfn(SpmDepartment.Column.ApplicableFrom));
columnsDisplay.Add(DepartmentMgr.GetDepartmentColumnDfn(SpmDepartment.Column.ApplicableTo));
columnsDisplay.Add(DepartmentMgr.GetDepartmentColumnDfn(SpmDepartment.Column.Notes));
#if DEBUG
columnsDisplay.Add(DepartmentMgr.GetDepartmentColumnDfn(SpmDepartment.Column.Id));
#endif
@@ -157,8 +160,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
public void RefreshDepartments(SpmDepartment.Params prmDepartment)
{
// Clear timers.
/*timerQueryData.Enabled = false;
timerDisplayItem.Enabled = false;*/
timerQueryData.Enabled = false;
timerDisplayItem.Enabled = false;
// Item Ids in the 'Initial selection' list are automatically selected on population.
// Subsequent refreshes automatically select the current selection by repopulation of the 'Initial selection' list.
if (!InitialPopulation)
@@ -174,10 +177,12 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
ClearResultSet();
this.prmDepartment = prmDepartment;
// Enable timer.
timerQueryData.Start();
}
void OnTimerQueryData(Object myObject, EventArgs myEventArgs)
{
//timerQueryData.Enabled = false;
timerQueryData.Stop();
timerDisplayItem.Stop();
QueryData();
}
private void QueryData()
@@ -188,7 +193,7 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
ItemTotal = (int)DepartmentMgr.GetDepartmentCount(prmDepartment);
if (ItemTotal > 0) Logger.Trace(GetType().Name + ".QueryData Department count: " + ItemTotal);
dbResultSet = DepartmentMgr.ExecuteDepartmentQuery(columnsQuery, prmDepartment);
//timerDisplayItem.Enabled = true;
timerDisplayItem.Start();
InitialPopulation = false;
}
public void RefreshDepartment(SysId affiliateId)
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -60,8 +60,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -56,8 +56,8 @@ namespace Sarand.PatientMgr.Win.Forms.Controls
if (disposing)
{
if (components != null) components.Dispose();
timerQueryData.Dispose();
timerDisplayItem.Dispose();
if (timerQueryData != null) timerQueryData.Dispose();
if (timerDisplayItem != null) timerDisplayItem.Dispose();
ClearResultSet();
}
base.Dispose(disposing);
@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_Admission : SpmForm
public partial class SpmForm_Admission : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
@@ -15,17 +15,17 @@
/// </summary>
private void InitializeComponent()
{
this.groupBoxProperties = new Sarand.Win.Forms.Controls.SacsGroupBox();
this.labelApplication = new System.Windows.Forms.Label();
this.groupBoxProperties = new System.Windows.Forms.GroupBox();
this.labelApplicable = new System.Windows.Forms.Label();
this.labelthrough = new System.Windows.Forms.Label();
this.dateTimePickerApplicTo = new Sarand.Win.Forms.Controls.SacsDateTimePicker();
this.dateTimePickerApplicableTo = new Sarand.Win.Forms.Controls.SacsDateTimePicker();
this.checkBoxAllowAnyWards = new System.Windows.Forms.CheckBox();
this.checkBoxAllowAnyClinics = new System.Windows.Forms.CheckBox();
this.checkBoxWards = new System.Windows.Forms.CheckBox();
this.checkBoxClinics = new System.Windows.Forms.CheckBox();
this.checkBoxAllowAnyTheatres = new System.Windows.Forms.CheckBox();
this.checkBoxTheatres = new System.Windows.Forms.CheckBox();
this.dateTimePickerApplicFrom = new Sarand.Win.Forms.Controls.SacsDateTimePicker();
this.dateTimePickerApplicableFrom = new Sarand.Win.Forms.Controls.SacsDateTimePicker();
this.labelName = new System.Windows.Forms.Label();
this.labelInstitution = new System.Windows.Forms.Label();
this.textBoxName = new Sarand.Win.Forms.Controls.SacsTextBox();
@@ -35,6 +35,7 @@
this.tabPage2 = new System.Windows.Forms.TabPage();
this.buttonCancel = new Sarand.Win.Forms.Controls.SacsButton();
this.buttonOk = new Sarand.Win.Forms.Controls.SacsButton();
this.panelUpdateStamp = new Sarand.PatientMgr.Win.Forms.Panels.SpmPanel_UpdateStamp();
this.groupBoxProperties.SuspendLayout();
this.tabControl.SuspendLayout();
this.SuspendLayout();
@@ -43,62 +44,63 @@
//
this.groupBoxProperties.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxProperties.BorderColour = System.Drawing.Color.Gray;
this.groupBoxProperties.Controls.Add(this.labelApplication);
this.groupBoxProperties.Controls.Add(this.labelApplicable);
this.groupBoxProperties.Controls.Add(this.labelthrough);
this.groupBoxProperties.Controls.Add(this.dateTimePickerApplicTo);
this.groupBoxProperties.Controls.Add(this.dateTimePickerApplicableTo);
this.groupBoxProperties.Controls.Add(this.checkBoxAllowAnyWards);
this.groupBoxProperties.Controls.Add(this.checkBoxAllowAnyClinics);
this.groupBoxProperties.Controls.Add(this.checkBoxWards);
this.groupBoxProperties.Controls.Add(this.checkBoxClinics);
this.groupBoxProperties.Controls.Add(this.checkBoxAllowAnyTheatres);
this.groupBoxProperties.Controls.Add(this.checkBoxTheatres);
this.groupBoxProperties.Controls.Add(this.dateTimePickerApplicFrom);
this.groupBoxProperties.Controls.Add(this.dateTimePickerApplicableFrom);
this.groupBoxProperties.Controls.Add(this.labelName);
this.groupBoxProperties.Controls.Add(this.labelInstitution);
this.groupBoxProperties.Controls.Add(this.textBoxName);
this.groupBoxProperties.Controls.Add(this.textBoxInstitution);
this.groupBoxProperties.Location = new System.Drawing.Point(12, 12);
this.groupBoxProperties.Location = new System.Drawing.Point(11, 10);
this.groupBoxProperties.Margin = new System.Windows.Forms.Padding(2);
this.groupBoxProperties.Name = "groupBoxProperties";
this.groupBoxProperties.Size = new System.Drawing.Size(608, 190);
this.groupBoxProperties.Padding = new System.Windows.Forms.Padding(2);
this.groupBoxProperties.Size = new System.Drawing.Size(482, 157);
this.groupBoxProperties.TabIndex = 0;
this.groupBoxProperties.TabStop = false;
this.groupBoxProperties.Text = "Properties";
//
// labelApplication
// labelApplicable
//
this.labelApplication.AutoSize = true;
this.labelApplication.Location = new System.Drawing.Point(72, 158);
this.labelApplication.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.labelApplication.Name = "labelApplication";
this.labelApplication.Size = new System.Drawing.Size(109, 17);
this.labelApplication.TabIndex = 10;
this.labelApplication.Text = "Application from";
this.labelApplicable.AutoSize = true;
this.labelApplicable.Location = new System.Drawing.Point(26, 131);
this.labelApplicable.Name = "labelApplicable";
this.labelApplicable.Size = new System.Drawing.Size(79, 13);
this.labelApplicable.TabIndex = 10;
this.labelApplicable.Text = "Applicable from";
//
// labelthrough
//
this.labelthrough.AutoSize = true;
this.labelthrough.Location = new System.Drawing.Point(364, 160);
this.labelthrough.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.labelthrough.Location = new System.Drawing.Point(242, 131);
this.labelthrough.Name = "labelthrough";
this.labelthrough.Size = new System.Drawing.Size(57, 17);
this.labelthrough.Size = new System.Drawing.Size(43, 13);
this.labelthrough.TabIndex = 12;
this.labelthrough.Text = "through";
//
// dateTimePickerApplicTo
// dateTimePickerApplicableTo
//
this.dateTimePickerApplicTo.Location = new System.Drawing.Point(426, 157);
this.dateTimePickerApplicTo.Name = "dateTimePickerApplicTo";
this.dateTimePickerApplicTo.Size = new System.Drawing.Size(170, 22);
this.dateTimePickerApplicTo.TabIndex = 13;
this.dateTimePickerApplicTo.Value = new System.DateTime(2019, 6, 13, 0, 0, 0, 0);
this.dateTimePickerApplicableTo.Location = new System.Drawing.Point(290, 128);
this.dateTimePickerApplicableTo.Margin = new System.Windows.Forms.Padding(2);
this.dateTimePickerApplicableTo.Name = "dateTimePickerApplicableTo";
this.dateTimePickerApplicableTo.Size = new System.Drawing.Size(110, 20);
this.dateTimePickerApplicableTo.TabIndex = 13;
this.dateTimePickerApplicableTo.Value = new System.DateTime(2019, 6, 13, 0, 0, 0, 0);
//
// checkBoxAllowAnyWards
//
this.checkBoxAllowAnyWards.AutoSize = true;
this.checkBoxAllowAnyWards.Location = new System.Drawing.Point(387, 130);
this.checkBoxAllowAnyWards.Location = new System.Drawing.Point(259, 107);
this.checkBoxAllowAnyWards.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxAllowAnyWards.Name = "checkBoxAllowAnyWards";
this.checkBoxAllowAnyWards.Size = new System.Drawing.Size(141, 21);
this.checkBoxAllowAnyWards.Size = new System.Drawing.Size(110, 17);
this.checkBoxAllowAnyWards.TabIndex = 9;
this.checkBoxAllowAnyWards.Text = "Allow \'Any\' Wards";
this.checkBoxAllowAnyWards.UseVisualStyleBackColor = true;
@@ -106,9 +108,10 @@
// checkBoxAllowAnyClinics
//
this.checkBoxAllowAnyClinics.AutoSize = true;
this.checkBoxAllowAnyClinics.Location = new System.Drawing.Point(387, 103);
this.checkBoxAllowAnyClinics.Location = new System.Drawing.Point(259, 86);
this.checkBoxAllowAnyClinics.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxAllowAnyClinics.Name = "checkBoxAllowAnyClinics";
this.checkBoxAllowAnyClinics.Size = new System.Drawing.Size(140, 21);
this.checkBoxAllowAnyClinics.Size = new System.Drawing.Size(109, 17);
this.checkBoxAllowAnyClinics.TabIndex = 7;
this.checkBoxAllowAnyClinics.Text = "Allow \'Any\' Clinics";
this.checkBoxAllowAnyClinics.UseVisualStyleBackColor = true;
@@ -116,9 +119,10 @@
// checkBoxWards
//
this.checkBoxWards.AutoSize = true;
this.checkBoxWards.Location = new System.Drawing.Point(188, 130);
this.checkBoxWards.Location = new System.Drawing.Point(110, 107);
this.checkBoxWards.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxWards.Name = "checkBoxWards";
this.checkBoxWards.Size = new System.Drawing.Size(71, 21);
this.checkBoxWards.Size = new System.Drawing.Size(57, 17);
this.checkBoxWards.TabIndex = 8;
this.checkBoxWards.Text = "Wards";
this.checkBoxWards.UseVisualStyleBackColor = true;
@@ -126,9 +130,10 @@
// checkBoxClinics
//
this.checkBoxClinics.AutoSize = true;
this.checkBoxClinics.Location = new System.Drawing.Point(188, 103);
this.checkBoxClinics.Location = new System.Drawing.Point(110, 86);
this.checkBoxClinics.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxClinics.Name = "checkBoxClinics";
this.checkBoxClinics.Size = new System.Drawing.Size(70, 21);
this.checkBoxClinics.Size = new System.Drawing.Size(56, 17);
this.checkBoxClinics.TabIndex = 6;
this.checkBoxClinics.Text = "Clinics";
this.checkBoxClinics.UseVisualStyleBackColor = true;
@@ -136,9 +141,10 @@
// checkBoxAllowAnyTheatres
//
this.checkBoxAllowAnyTheatres.AutoSize = true;
this.checkBoxAllowAnyTheatres.Location = new System.Drawing.Point(387, 76);
this.checkBoxAllowAnyTheatres.Location = new System.Drawing.Point(259, 65);
this.checkBoxAllowAnyTheatres.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxAllowAnyTheatres.Name = "checkBoxAllowAnyTheatres";
this.checkBoxAllowAnyTheatres.Size = new System.Drawing.Size(157, 21);
this.checkBoxAllowAnyTheatres.Size = new System.Drawing.Size(121, 17);
this.checkBoxAllowAnyTheatres.TabIndex = 5;
this.checkBoxAllowAnyTheatres.Text = "Allow \'Any\' Theatres";
this.checkBoxAllowAnyTheatres.UseVisualStyleBackColor = true;
@@ -146,54 +152,57 @@
// checkBoxTheatres
//
this.checkBoxTheatres.AutoSize = true;
this.checkBoxTheatres.Location = new System.Drawing.Point(188, 76);
this.checkBoxTheatres.Location = new System.Drawing.Point(110, 65);
this.checkBoxTheatres.Margin = new System.Windows.Forms.Padding(2);
this.checkBoxTheatres.Name = "checkBoxTheatres";
this.checkBoxTheatres.Size = new System.Drawing.Size(87, 21);
this.checkBoxTheatres.Size = new System.Drawing.Size(68, 17);
this.checkBoxTheatres.TabIndex = 4;
this.checkBoxTheatres.Text = "Theatres";
this.checkBoxTheatres.UseVisualStyleBackColor = true;
//
// dateTimePickerApplicFrom
// dateTimePickerApplicableFrom
//
this.dateTimePickerApplicFrom.Location = new System.Drawing.Point(188, 157);
this.dateTimePickerApplicFrom.Name = "dateTimePickerApplicFrom";
this.dateTimePickerApplicFrom.Size = new System.Drawing.Size(170, 22);
this.dateTimePickerApplicFrom.TabIndex = 11;
this.dateTimePickerApplicFrom.Value = new System.DateTime(2019, 6, 13, 0, 0, 0, 0);
this.dateTimePickerApplicableFrom.Location = new System.Drawing.Point(110, 128);
this.dateTimePickerApplicableFrom.Margin = new System.Windows.Forms.Padding(2);
this.dateTimePickerApplicableFrom.Name = "dateTimePickerApplicableFrom";
this.dateTimePickerApplicableFrom.Size = new System.Drawing.Size(110, 20);
this.dateTimePickerApplicableFrom.TabIndex = 11;
this.dateTimePickerApplicableFrom.Value = new System.DateTime(2019, 6, 13, 0, 0, 0, 0);
//
// labelName
//
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(136, 51);
this.labelName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.labelName.Location = new System.Drawing.Point(70, 44);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(45, 17);
this.labelName.Size = new System.Drawing.Size(35, 13);
this.labelName.TabIndex = 2;
this.labelName.Text = "Name";
//
// labelInstitution
//
this.labelInstitution.AutoSize = true;
this.labelInstitution.Location = new System.Drawing.Point(113, 23);
this.labelInstitution.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.labelInstitution.Location = new System.Drawing.Point(53, 20);
this.labelInstitution.Name = "labelInstitution";
this.labelInstitution.Size = new System.Drawing.Size(68, 17);
this.labelInstitution.Size = new System.Drawing.Size(52, 13);
this.labelInstitution.TabIndex = 0;
this.labelInstitution.Text = "Institution";
//
// textBoxName
//
this.textBoxName.Location = new System.Drawing.Point(188, 48);
this.textBoxName.Location = new System.Drawing.Point(110, 41);
this.textBoxName.Margin = new System.Windows.Forms.Padding(2);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(408, 22);
this.textBoxName.Size = new System.Drawing.Size(307, 20);
this.textBoxName.TabIndex = 3;
this.textBoxName.TextChanged += new System.EventHandler(this.textBoxName_TextChanged);
//
// textBoxInstitution
//
this.textBoxInstitution.Location = new System.Drawing.Point(188, 20);
this.textBoxInstitution.Location = new System.Drawing.Point(110, 17);
this.textBoxInstitution.Margin = new System.Windows.Forms.Padding(2);
this.textBoxInstitution.Name = "textBoxInstitution";
this.textBoxInstitution.ReadOnly = true;
this.textBoxInstitution.Size = new System.Drawing.Size(408, 22);
this.textBoxInstitution.Size = new System.Drawing.Size(307, 20);
this.textBoxInstitution.TabIndex = 1;
//
// tabControl
@@ -203,28 +212,31 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl.Controls.Add(this.tabPage1);
this.tabControl.Controls.Add(this.tabPage2);
this.tabControl.Location = new System.Drawing.Point(12, 208);
this.tabControl.Location = new System.Drawing.Point(11, 171);
this.tabControl.Margin = new System.Windows.Forms.Padding(2);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
this.tabControl.Size = new System.Drawing.Size(608, 197);
this.tabControl.Size = new System.Drawing.Size(482, 170);
this.tabControl.TabIndex = 1;
//
// tabPage1
//
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Margin = new System.Windows.Forms.Padding(2);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(600, 168);
this.tabPage1.Padding = new System.Windows.Forms.Padding(2);
this.tabPage1.Size = new System.Drawing.Size(474, 144);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Margin = new System.Windows.Forms.Padding(2);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(600, 168);
this.tabPage2.Padding = new System.Windows.Forms.Padding(2);
this.tabPage2.Size = new System.Drawing.Size(474, 144);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -232,10 +244,9 @@
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.Location = new System.Drawing.Point(519, 412);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(4);
this.buttonCancel.Location = new System.Drawing.Point(417, 346);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(100, 28);
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
@@ -244,28 +255,38 @@
// buttonOk
//
this.buttonOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOk.Location = new System.Drawing.Point(411, 412);
this.buttonOk.Margin = new System.Windows.Forms.Padding(4);
this.buttonOk.Location = new System.Drawing.Point(336, 346);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(100, 28);
this.buttonOk.Size = new System.Drawing.Size(75, 23);
this.buttonOk.TabIndex = 2;
this.buttonOk.Text = "OK";
this.buttonOk.UseVisualStyleBackColor = true;
this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
//
// panelUpdateStamp
//
this.panelUpdateStamp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelUpdateStamp.Location = new System.Drawing.Point(11, 342);
this.panelUpdateStamp.Name = "panelUpdateStamp";
this.panelUpdateStamp.Size = new System.Drawing.Size(319, 38);
this.panelUpdateStamp.TabIndex = 4;
//
// SpmForm_Department
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(632, 453);
this.ClientSize = new System.Drawing.Size(504, 381);
this.ControlBox = false;
this.Controls.Add(this.panelUpdateStamp);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOk);
this.Controls.Add(this.tabControl);
this.Controls.Add(this.groupBoxProperties);
this.Margin = new System.Windows.Forms.Padding(2);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(650, 500);
this.MinimumSize = new System.Drawing.Size(520, 420);
this.Name = "SpmForm_Department";
this.ShowIcon = false;
this.Text = "Update Department";
@@ -278,25 +299,26 @@
#endregion
private Sarand.Win.Forms.Controls.SacsGroupBox groupBoxProperties;
private System.Windows.Forms.GroupBox groupBoxProperties;
private System.Windows.Forms.TabControl tabControl;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label labelthrough;
private Sarand.Win.Forms.Controls.SacsDateTimePicker dateTimePickerApplicTo;
private Sarand.Win.Forms.Controls.SacsDateTimePicker dateTimePickerApplicableTo;
private System.Windows.Forms.CheckBox checkBoxAllowAnyWards;
private System.Windows.Forms.CheckBox checkBoxAllowAnyClinics;
private System.Windows.Forms.CheckBox checkBoxWards;
private System.Windows.Forms.CheckBox checkBoxClinics;
private System.Windows.Forms.CheckBox checkBoxAllowAnyTheatres;
private System.Windows.Forms.CheckBox checkBoxTheatres;
private Sarand.Win.Forms.Controls.SacsDateTimePicker dateTimePickerApplicFrom;
private Sarand.Win.Forms.Controls.SacsDateTimePicker dateTimePickerApplicableFrom;
private System.Windows.Forms.Label labelName;
private System.Windows.Forms.Label labelInstitution;
private Sarand.Win.Forms.Controls.SacsTextBox textBoxName;
private Sarand.Win.Forms.Controls.SacsTextBox textBoxInstitution;
private Sarand.Win.Forms.Controls.SacsButton buttonCancel;
private Sarand.Win.Forms.Controls.SacsButton buttonOk;
private System.Windows.Forms.Label labelApplication;
private System.Windows.Forms.Label labelApplicable;
private Panels.SpmPanel_UpdateStamp panelUpdateStamp;
}
}
@@ -1,6 +1,8 @@
using Sarand.PatientMgr.Core.App;
using Sarand.Core.Bus;
using Sarand.PatientMgr.Core.App;
using Sarand.PatientMgr.Core.Bus;
using Sarand.PatientMgr.Win.Forms.Base;
using Sarand.Win.Forms.Controls;
using Sarand.Win.Forms.Utils;
using System;
using System.Collections.Generic;
@@ -15,12 +17,15 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_Department : SpmForm
public partial class SpmForm_Department : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
public new class Config : SpmForm_Item.Config
{
/// <summary>Institution - mandatory for department creation.</summary>
public SysId InstitutionId { get; set; }
/// <summary>Department to update.</summary>
public SpmDepartment DepartmentToUpdate { internal get; set; } = null;
}
@@ -30,8 +35,8 @@ namespace Sarand.PatientMgr.Win.Forms.Maint
//-------------------------------------------------------------------
// Construction.
public SpmForm_Department() : this(new Config()) { }
public SpmForm_Department(Config config) : base(config)
public SpmForm_Department () : this(new Config()) { }
public SpmForm_Department (Config config) : base(config)
{
this.config = config;
if (SpmGlobals.System != null)
@@ -39,7 +44,7 @@ namespace Sarand.PatientMgr.Win.Forms.Maint
}
InitializeComponent();
}
protected override void Dispose(bool disposing)
protected override void Dispose (bool disposing)
{
if (disposing && (components != null))
{
@@ -56,23 +61,90 @@ namespace Sarand.PatientMgr.Win.Forms.Maint
//-------------------------------------------------------------------
// S h o w D i a l o g
//-------------------------------------------------------------------
public new DialogResult ShowDialog()
public new DialogResult ShowDialog ()
{
if (!ValidateConfiguration()) return DialogResult;
if (config.DepartmentToUpdate == null)
{
// Creating new affiliate.
AddMode = true;
}
else
{
// Updating existing affiliate.
config.InstitutionId = config.DepartmentToUpdate.InstitutionId;
}
return base.ShowDialog();
}
// Validate configuration to ensure that form can be opened correctly.
private bool ValidateConfiguration()
private bool ValidateConfiguration ()
{
DialogResult = DialogResult.None;
if (config.DepartmentToUpdate == null)
{
// Creating new department.
if (!SysId.IsValid(config.InstitutionId))
return MessageConsole.ShowMessageWarning("Institution must be specified.");
if (!InstitutionMgr.InstitutionExistsById(config.InstitutionId))
return MessageConsole.ShowMessageWarning("Invalid Institution specified.");
}
else
{
if (SysId.IsValid(config.InstitutionId) && !config.InstitutionId.Equals(config.DepartmentToUpdate.InstitutionId))
return MessageConsole.ShowMessageWarning("Inconsistent Institution specified.");
}
return true;
}
//-------------------------------------------------------------------
// I n i t i a l i s a t i o n
//-------------------------------------------------------------------
protected override void OnCreateControl()
protected override void OnCreateControl ()
{
base.OnCreateControl();
if (this.IsDesignerHosted()) return;
AcceptButton = buttonOk;
CancelButton = buttonCancel;
if (ReadOnly)
{
buttonOk.Visible = false;
buttonCancel.Text = "Close";
}
else
{
buttonOk.Visible = true;
buttonCancel.Text = "Cancel";
}
// Institution.
SpmInstitution institution = InstitutionMgr.GetInstitutionById(config.InstitutionId);
textBoxInstitution.Text = institution?.Name ?? "Unknown";
// Applicable dates.
dateTimePickerApplicableFrom.Type = DateTimePickerType.Date;
dateTimePickerApplicableFrom.ShowCheckBox = true;
dateTimePickerApplicableFrom.Checked = false;
dateTimePickerApplicableTo.Type = DateTimePickerType.Date;
dateTimePickerApplicableTo.ShowCheckBox = true;
dateTimePickerApplicableTo.Checked = false;
// Configure controls.
//InitTabs();
// Initial display.
if (AddMode)
{
Text = "Create Department";
panelUpdateStamp.Visible = false;
}
else
{
Text = "Update Department";
PopulateToControls(config.DepartmentToUpdate.GetData());
panelUpdateStamp.ItemData = config.DepartmentToUpdate.GetData();
}
// Complete dialog initialisation.
PositionControls();
@@ -81,7 +153,7 @@ namespace Sarand.PatientMgr.Win.Forms.Maint
}
//-------------------------------------------------------------------
protected override void OnShown(EventArgs e)
protected override void OnShown (EventArgs e)
{
base.OnShown(e);
// Initial focus.
@@ -91,29 +163,46 @@ namespace Sarand.PatientMgr.Win.Forms.Maint
// P o p u l a t i o n
//-------------------------------------------------------------------
// PopulateToControls.
private void PopulateToControls(SpmDepartment.Data data)
private void PopulateToControls (SpmDepartment.Data data)
{
// Populate item properties to controls.
textBoxName.Text = data.Name;
dateTimePickerApplicableFrom.Value = data.ApplicableFrom;
dateTimePickerApplicableTo.Value = data.ApplicableTo;
checkBoxTheatres.Checked = data.HasFacilityType(Spm.FacilityType.Theatre);
checkBoxAllowAnyTheatres.Checked = data.AllowAnyFacility(Spm.FacilityType.Theatre);
checkBoxClinics.Checked = data.HasFacilityType(Spm.FacilityType.Clinic);
checkBoxAllowAnyClinics.Checked = data.AllowAnyFacility(Spm.FacilityType.Clinic);
checkBoxWards.Checked = data.HasFacilityType(Spm.FacilityType.Ward);
checkBoxAllowAnyWards.Checked = data.AllowAnyFacility(Spm.FacilityType.Ward);
AcceptChanges();
}
//-------------------------------------------------------------------
// Validate properties.
public bool IsDataValid(SpmDepartment.Data data)
public bool IsDataValid (SpmDepartment.Data data)
{
return true;
}
//-------------------------------------------------------------------
// PopulateFromControls.
private void PopulateFromControls(SpmDepartment.Data data)
private void PopulateFromControls (SpmDepartment.Data data)
{
if (!SysId.IsValid(data.InstitutionId))
data.InstitutionId = config.InstitutionId;
if (textBoxName.Visible && !textBoxName.ReadOnly)
data.Name = textBoxName.Text;
if (dateTimePickerApplicableFrom.Visible && !dateTimePickerApplicableFrom.ReadOnly)
data.ApplicableFrom = dateTimePickerApplicableFrom.Value;
if (dateTimePickerApplicableTo.Visible && !dateTimePickerApplicableTo.ReadOnly)
data.ApplicableTo = dateTimePickerApplicableTo.Value;
}
//-------------------------------------------------------------------
// UpdatedAssociated Data.
public bool UpdateAssociatedData()
public bool UpdateAssociatedData ()
{
return true;
}
@@ -121,40 +210,48 @@ namespace Sarand.PatientMgr.Win.Forms.Maint
//-------------------------------------------------------------------
// C l o s e F o r m
//-------------------------------------------------------------------
private void buttonOk_Click(object sender, EventArgs e)
private void buttonOk_Click (object sender, EventArgs e)
{
}
private void buttonCancel_Click(object sender, EventArgs e)
private void buttonCancel_Click (object sender, EventArgs e)
{
}
//-------------------------------------------------------------------
// C o n t r o l A c t i v i t y
//-------------------------------------------------------------------
protected override void SetControlActivity()
protected override void SetControlActivity ()
{
SetControlsReadOnly();
textBoxName.Enabled = Enabled;
}
public bool IsFieldReadOnly(SpmDbDfn.ColumnIdx col)
public bool IsFieldReadOnly (SpmDbDfn.ColumnIdx col)
{
if (ReadOnly) return true;
return false;
}
protected override void SetControlsReadOnly()
protected override void SetControlsReadOnly ()
{
textBoxName.ReadOnly = IsFieldReadOnly(SpmDbDfn.ColumnIdx.SwmDepartment_Name);
}
//-------------------------------------------------------------------
// P o s i t i o n C o n t r o l s
//-------------------------------------------------------------------
protected override void PositionControls()
protected override void PositionControls ()
{
}
//-------------------------------------------------------------------
// F o r m E v e n t s
//-------------------------------------------------------------------
private void textBoxName_TextChanged (object sender, EventArgs e)
{
Changed = true;
SetControlActivity();
}
//-------------------------------------------------------------------
}
@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_Employee : SpmForm
public partial class SpmForm_Employee : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_EmployeeRole : SpmForm
public partial class SpmForm_EmployeeRole : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_Facility : SpmForm
public partial class SpmForm_Facility : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_FacilityTemplate_Slot : SpmForm
public partial class SpmForm_FacilityTemplate_Slot : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_Operation : SpmForm
public partial class SpmForm_Operation : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_Patient : SpmForm
public partial class SpmForm_Patient : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
@@ -15,7 +15,7 @@ using System.Windows.Forms;
namespace Sarand.PatientMgr.Win.Forms.Maint
{
//=======================================================================
public partial class SpmForm_Procedure : SpmForm
public partial class SpmForm_Procedure : SpmForm_Item
{
//-------------------------------------------------------------------
// Configuration.
@@ -23,26 +23,40 @@
this.buttonRemove = new System.Windows.Forms.Button();
this.buttonUpdate = new System.Windows.Forms.Button();
this.buttonCreate = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOk = new System.Windows.Forms.Button();
this.tabControl.SuspendLayout();
this.SuspendLayout();
//
// listFilterDepartment
//
this.listFilterDepartment.Location = new System.Drawing.Point(3, 3);
this.listFilterDepartment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listFilterDepartment.Location = new System.Drawing.Point(0, 2);
this.listFilterDepartment.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.listFilterDepartment.Name = "listFilterDepartment";
this.listFilterDepartment.Size = new System.Drawing.Size(694, 37);
this.listFilterDepartment.Size = new System.Drawing.Size(400, 30);
this.listFilterDepartment.TabIndex = 0;
this.listFilterDepartment.FilterChanged += new System.EventHandler(this.listFilterDepartment_FilterChanged);
//
// listViewDepartment
//
this.listViewDepartment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listViewDepartment.FullRowSelect = true;
this.listViewDepartment.HideSelection = false;
this.listViewDepartment.Location = new System.Drawing.Point(8, 46);
this.listViewDepartment.Location = new System.Drawing.Point(0, 37);
this.listViewDepartment.Margin = new System.Windows.Forms.Padding(2);
this.listViewDepartment.Name = "listViewDepartment";
this.listViewDepartment.OwnerDraw = true;
this.listViewDepartment.Size = new System.Drawing.Size(575, 165);
this.listViewDepartment.Size = new System.Drawing.Size(317, 155);
this.listViewDepartment.TabIndex = 1;
this.listViewDepartment.UseCompatibleStateImageBehavior = false;
this.listViewDepartment.ItemCountChanged += new System.EventHandler<Sarand.Win.Forms.Controls.SacsListView.ItemCountChangedEventArgs>(this.listViewDepartment_ItemCountChanged);
this.listViewDepartment.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewDepartment_ColumnClick);
this.listViewDepartment.SelectedIndexChanged += new System.EventHandler(this.listViewDepartment_SelectedIndexChanged);
this.listViewDepartment.DoubleClick += new System.EventHandler(this.listViewDepartment_DoubleClick);
this.listViewDepartment.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listViewDepartment_MouseUp);
//
// tabControl
//
@@ -51,28 +65,31 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl.Controls.Add(this.tabPage1);
this.tabControl.Controls.Add(this.tabPage2);
this.tabControl.Location = new System.Drawing.Point(8, 217);
this.tabControl.Location = new System.Drawing.Point(2, 196);
this.tabControl.Margin = new System.Windows.Forms.Padding(2);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
this.tabControl.Size = new System.Drawing.Size(574, 236);
this.tabControl.Size = new System.Drawing.Size(398, 154);
this.tabControl.TabIndex = 6;
//
// tabPage1
//
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Margin = new System.Windows.Forms.Padding(2);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(566, 207);
this.tabPage1.Padding = new System.Windows.Forms.Padding(2);
this.tabPage1.Size = new System.Drawing.Size(390, 128);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Margin = new System.Windows.Forms.Padding(2);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(566, 207);
this.tabPage2.Padding = new System.Windows.Forms.Padding(2);
this.tabPage2.Size = new System.Drawing.Size(390, 128);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -80,49 +97,74 @@
// buttonRemove
//
this.buttonRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRemove.Location = new System.Drawing.Point(594, 182);
this.buttonRemove.Margin = new System.Windows.Forms.Padding(4);
this.buttonRemove.Location = new System.Drawing.Point(322, 95);
this.buttonRemove.Name = "buttonRemove";
this.buttonRemove.Size = new System.Drawing.Size(100, 28);
this.buttonRemove.Size = new System.Drawing.Size(75, 23);
this.buttonRemove.TabIndex = 15;
this.buttonRemove.Text = "Remove";
this.buttonRemove.UseVisualStyleBackColor = true;
this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
//
// buttonUpdate
//
this.buttonUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUpdate.Location = new System.Drawing.Point(594, 114);
this.buttonUpdate.Margin = new System.Windows.Forms.Padding(4);
this.buttonUpdate.Location = new System.Drawing.Point(322, 66);
this.buttonUpdate.Name = "buttonUpdate";
this.buttonUpdate.Size = new System.Drawing.Size(100, 28);
this.buttonUpdate.Size = new System.Drawing.Size(75, 23);
this.buttonUpdate.TabIndex = 14;
this.buttonUpdate.Text = "Update";
this.buttonUpdate.UseVisualStyleBackColor = true;
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
//
// buttonCreate
//
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCreate.Location = new System.Drawing.Point(594, 46);
this.buttonCreate.Margin = new System.Windows.Forms.Padding(4);
this.buttonCreate.Location = new System.Drawing.Point(322, 37);
this.buttonCreate.Name = "buttonCreate";
this.buttonCreate.Size = new System.Drawing.Size(100, 28);
this.buttonCreate.Size = new System.Drawing.Size(75, 23);
this.buttonCreate.TabIndex = 13;
this.buttonCreate.Text = "Create";
this.buttonCreate.UseVisualStyleBackColor = true;
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.Location = new System.Drawing.Point(322, 168);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 15;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// buttonOk
//
this.buttonOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOk.Location = new System.Drawing.Point(322, 139);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(75, 23);
this.buttonOk.TabIndex = 15;
this.buttonOk.Text = "OK";
this.buttonOk.UseVisualStyleBackColor = true;
this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
//
// SpmPanel_Departments
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.buttonOk);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonRemove);
this.Controls.Add(this.buttonUpdate);
this.Controls.Add(this.buttonCreate);
this.Controls.Add(this.tabControl);
this.Controls.Add(this.listViewDepartment);
this.Controls.Add(this.listFilterDepartment);
this.MinimumSize = new System.Drawing.Size(700, 460);
this.Margin = new System.Windows.Forms.Padding(2);
this.MinimumSize = new System.Drawing.Size(400, 350);
this.Name = "SpmPanel_Departments";
this.Size = new System.Drawing.Size(700, 460);
this.Size = new System.Drawing.Size(400, 350);
this.tabControl.ResumeLayout(false);
this.ResumeLayout(false);
@@ -138,5 +180,7 @@
private System.Windows.Forms.Button buttonRemove;
private System.Windows.Forms.Button buttonUpdate;
private System.Windows.Forms.Button buttonCreate;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.Button buttonOk;
}
}
@@ -14,6 +14,9 @@ using Sarand.Core.Base;
using Sarand.PatientMgr.Core.App;
using Sarand.PatientMgr.Win.Forms.Maint;
using Sarand.PatientMgr.Win.Forms.Controls;
using Sarand.PatientMgr.Win.Forms.TabPages;
using Sarand.PatientMgr.Win.Forms.Filters;
using Sarand.PatientMgr.Win.Forms.Base;
namespace Sarand.PatientMgr.Win.Forms.Panels
{
@@ -29,22 +32,39 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
}
public new class Config : SpmPanel_Items.Config
{
public PanelMode Mode { get; set; } = PanelMode.Maintain;
public Config (PanelMode mode)
{
Mode = mode;
// Defaults based on mode.
DisplayFilter = false; // Mode == PanelMode.Maintain || Mode == PanelMode.Search;
DisplayTabs = Mode == PanelMode.Maintain;
DisplayActionButtons = Mode == PanelMode.Maintain;
DisplayNavigationButtons = Mode == PanelMode.Search;
}
public PanelMode Mode { get; } = PanelMode.Maintain;
public SpmForm SearchForm { get; set; }
// Display options.
public bool DisplayFilter { get; set; } = false;
public bool DisplayContextMenu { get; set; } = true;
public bool DisplayActionButtons { get; set; } = false;
public bool DisplayNavigationButtons { get; set; } = false;
public bool DisplayTabs { get; set; } = false;
}
//-------------------------------------------------------------------
// Data members.
private Config config = new Config();
private Config config = new Config(PanelMode.Search);
private readonly List<SpmTabPage_Department> tabPages = new List<SpmTabPage_Department>();
//-------------------------------------------------------------------
// Construction.
public SpmPanel_Departments() : this(new Config()) { }
public SpmPanel_Departments(Config config) : base(config)
private SpmPanel_Departments () : this(new Config(PanelMode.Search)) { }
public SpmPanel_Departments (Config config) : base(config)
{
this.config = config;
InitializeComponent();
}
protected override void Dispose(bool disposing)
protected override void Dispose (bool disposing)
{
if (disposing)
{
@@ -65,7 +85,7 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
//-------------------------------------------------------------------
// Configure.
public void SetConfig(Config config)
public void SetConfig (Config config)
{
base.SetConfig(config);
this.config = config;
@@ -73,8 +93,9 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
}
//-------------------------------------------------------------------
// Initialisation.
protected override void OnCreateControl()
// I n i t i a l i s a t i o n
//-------------------------------------------------------------------
protected override void OnCreateControl ()
{
base.OnCreateControl();
if (this.IsDesignerHosted()) return;
@@ -82,38 +103,173 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
ConfigurePanel();
}
private void ConfigurePanel()
private void ConfigurePanel ()
{
if (!Created) return;
if (this.IsDesignerHosted()) return;
if (!Created || this.IsDesignerHosted()) return;
// Configure filter.
if (config.DisplayFilter)
{
SpmItemListFilter_Department.Config configFilter = new SpmItemListFilter_Department.Config();
configFilter.Internals = Internals;
listFilterDepartment.SetConfig(configFilter);
}
listFilterDepartment.Visible = config.DisplayFilter;
// Configure list.
SpmItemListView_Department.Config configList = new SpmItemListView_Department.Config();
configList.Internals = Internals;
configList.Mode = SpmItemListView_Department.ListMode.General;
listViewDepartment.SetConfig(configList);
// Tabs.
tabControl.TabPages.Clear();
tabControl.Visible = config.DisplayTabs;
RefreshTabs();
// Configure buttons.
buttonCreate.Visible = config.DisplayActionButtons && SecurityProfile.Admin.CanManageConfig();
buttonUpdate.Visible = config.DisplayActionButtons;
buttonRemove.Visible = config.DisplayActionButtons && buttonCreate.Visible;
buttonOk.Visible = config.DisplayNavigationButtons && config.Mode == PanelMode.Search;
buttonCancel.Visible = config.DisplayNavigationButtons;
// Complete form initialisation.
RefreshDataItems();
SetControlActivity();
PositionControls();
}
//-------------------------------------------------------------------
// Initialise tabs.
private void InitTabs()
private void InitTabs ()
{
/*tabControl.TabPages.Clear();
String fn = GetType().Name + ".InitTabs";
tabControl.TabPages.Clear();
tabPages.Clear();
if (!config.DisplayTabs) return;
if (!config.DisplayTabs)
{
tabPages.Clear();
tabControl.TabPages.Clear();
tabControl.Visible = false;
return;
}
// Selected Department.
SpmDepartment department = SelectedDepartment;
// Theatres.
List<SpmTabPage_Department.PanelType> panelTypes_Theatres = new List<SpmTabPage_Department.PanelType>();
if (department?.HasFacilityType(Spm.FacilityType.Theatre) ?? false)
panelTypes_Theatres.Add(SpmTabPage_Department.PanelType.Theatres);
if (panelTypes_Theatres.Count > 0)
{
SpmTabPage_Department.Config configTabPage = new SpmTabPage_Department.Config();
configTabPage.Internals = Internals;
configTabPage.ReadOnly = ReadOnly;
configTabPage.PanelTypes.AddRange(panelTypes_Theatres);
SpmTabPage_Department tabPage = new SpmTabPage_Department(configTabPage) { Text = "Theatres" };
tabPages.Add(tabPage);
}
// Clinics.
List<SpmTabPage_Department.PanelType> panelTypes_Clinics = new List<SpmTabPage_Department.PanelType>();
if (department?.HasFacilityType(Spm.FacilityType.Clinic) ?? false)
panelTypes_Clinics.Add(SpmTabPage_Department.PanelType.Clinics);
if (panelTypes_Clinics.Count > 0)
{
SpmTabPage_Department.Config configTabPage = new SpmTabPage_Department.Config();
configTabPage.Internals = Internals;
configTabPage.ReadOnly = ReadOnly;
configTabPage.PanelTypes.AddRange(panelTypes_Clinics);
SpmTabPage_Department tabPage = new SpmTabPage_Department(configTabPage) { Text = "Clinics" };
tabPages.Add(tabPage);
}
// Wards.
List<SpmTabPage_Department.PanelType> panelTypes_Wards = new List<SpmTabPage_Department.PanelType>();
if (department?.HasFacilityType(Spm.FacilityType.Ward) ?? false)
panelTypes_Wards.Add(SpmTabPage_Department.PanelType.Wards);
if (panelTypes_Wards.Count > 0)
{
SpmTabPage_Department.Config configTabPage = new SpmTabPage_Department.Config();
configTabPage.Internals = Internals;
configTabPage.ReadOnly = ReadOnly;
configTabPage.PanelTypes.AddRange(panelTypes_Wards);
SpmTabPage_Department tabPage = new SpmTabPage_Department(configTabPage) { Text = "Wards" };
tabPages.Add(tabPage);
}
// Updates.
List<SpmTabPage_Department.PanelType> panelTypes_Updates = new List<SpmTabPage_Department.PanelType>();
panelTypes_Updates.Add(SpmTabPage_Department.PanelType.Updates);
if (panelTypes_Updates.Count > 0)
{
SpmTabPage_Department.Config configTabPage = new SpmTabPage_Department.Config();
configTabPage.Internals = Internals;
configTabPage.ReadOnly = ReadOnly;
configTabPage.PanelTypes.AddRange(panelTypes_Updates);
SpmTabPage_Department tabPage = new SpmTabPage_Department(configTabPage) { Text = "Updates" };
tabPages.Add(tabPage);
}
// Populate tab pages.
tabControl.Visible = tabPages.Count > 0;
foreach (var tabPage in tabPages)
tabControl.TabPages.Add(tabPage);
tabControl.Visible = (tabControl.TabPages.Count > 0);*/
}
//-------------------------------------------------------------------
// P a n e l I n t e r f a c e
//-------------------------------------------------------------------
private String previouslySelectedTabPageText = "";
private void RefreshTabs ()
{
if (tabControl.SelectedTab != null)
previouslySelectedTabPageText = tabControl.SelectedTab.Text;
// Reinitialise tabs whenever the selection changes in case the set of tab pages displayed needs to be changed.
InitTabs();
// Select previous tab page if still present.
if (!StringUtil.IsEmpty(previouslySelectedTabPageText))
{
foreach (TabPage tabPage in tabControl.TabPages)
{
if (tabPage.Text.Equals(previouslySelectedTabPageText))
{
tabControl.SelectTab(tabPage);
break;
}
}
}
RefreshTabPages();
SetControlActivity();
PositionControls();
}
private void RefreshTabPages ()
{
// Selected Department - populated when needed.
SpmDepartment department = null;
// Refresh tabs.
if (tabControl.Visible)
{
if (department == null) department = SelectedDepartment;
SpmDepartment.Data departmentData = department != null ? department.GetData() : new SpmDepartment.Data();
tabPages.PopulateToControls(departmentData);
}
}
//-------------------------------------------------------------------
// F i l t e r
//-------------------------------------------------------------------
public SpmDepartment.Params GetParams()
public bool ParamsAreValid (SpmDepartment.Params prmDepartment)
{
return true;
}
public SpmDepartment.Params GetParams ()
{
SpmDepartment.Params prmDepartment = new SpmDepartment.Params();
@@ -125,27 +281,31 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
//-------------------------------------------------------------------
// A c t i o n s
//-------------------------------------------------------------------
public override void RefreshDataItems()
// Refresh.
public override void RefreshDataItems ()
{
listViewDepartment.RefreshDepartments(GetParams());
SpmDepartment.Params prmDepartment = GetParams();
if (!ParamsAreValid(prmDepartment)) prmDepartment = null;
listViewDepartment.RefreshDepartments(prmDepartment);
}
public override void RefreshDataItem(SysId id)
public override void RefreshDataItem (SysId id)
{
listViewDepartment.RefreshDepartment(id);
}
public override void RemoveDataItem(SysId id)
public override void RemoveDataItem (SysId id)
{
listViewDepartment.RemoveItemById(id);
}
//-------------------------------------------------------------------
// Create item.
public override bool CanCreateItem()
public override bool CanCreateItem ()
{
if (ReadOnly) return false;
//if (!SecurityProfile.UserCanCreateItemType(Spm.DataItemType.Department)) return false;
if (!SecurityProfile.Admin.CanManageConfig()) return false;
return true;
}
public override void CreateItem()
public override void CreateItem ()
{
if (!CanCreateItem()) return;
if (config.Mode == PanelMode.Search) return;
@@ -155,26 +315,25 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
{
if (form.ShowDialog() == DialogResult.OK)
{
/*RefreshDataItem(form.NewItemId);
InvokeItemCreatedEvent(Spm.ItemType.Department, form.NewItemId);*/
RefreshDataItem(form.NewItemId);
InvokeItemCreatedEvent(Spm.DataItemType.Department, form.NewItemId);
}
}
}
//-------------------------------------------------------------------
// View/Update item.
public override bool CanViewItem()
public override bool CanViewItem ()
{
return true;
}
public override bool CanUpdateItem()
public override bool CanUpdateItem ()
{
if (ReadOnly) return false;
/*bool canMaintainDepartments = SecurityProfile.UserCanCreateItemType(Spm.ItemType.Department) || SecurityProfile.UserCanUpdateItemType(Spm.ItemType.Department);
if (!canMaintainDepartments) return false;*/
if (!SecurityProfile.Admin.CanManageConfig()) return false;
return true;
}
public override void UpdateItem(bool updateItem = true)
public override void UpdateItem (bool updateItem = true)
{
if (config.Mode == PanelMode.Search) return;
SpmDepartment department = SelectedDepartment;
@@ -204,13 +363,13 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
//-------------------------------------------------------------------
// Delete item.
public override bool CanDeleteItem()
public override bool CanDeleteItem ()
{
if (ReadOnly) return false;
//if (!SecurityProfile.UserCanRemoveItemType(Spm.ItemType.Department)) return false;
if (!SecurityProfile.Admin.CanManageConfig()) return false;
return true;
}
public override void DeleteItem()
public override void DeleteItem ()
{
if (!CanDeleteItem()) return;
if (config.Mode == PanelMode.Search) return;
@@ -240,41 +399,24 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
}
}
//-------------------------------------------------------------------
// Status change - Deactivate.
protected void DeactivateItem(object sender, EventArgs e) { DeactivateItem(); }
public void DeactivateItem()
{
SpmDepartment department = SelectedDepartment;
if (department != null && department.Status == SaStatus.Active)
{
department.Status = SaStatus.Inactive;
if (DepartmentMgr.UpdateDepartment(department, DbUpdateInfo))
{
RefreshDataItem(department.Id);
//InvokeItemUpdatedEvent(Spm.ItemType.Department, department.Id);
}
}
}
//-------------------------------------------------------------------
// Import data.
public override bool CanImportData()
public override bool CanImportData ()
{
return false;
}
public override void ImportData()
public override void ImportData ()
{
if (!CanImportData()) return;
}
//-------------------------------------------------------------------
// Export data.
public override bool CanExportData()
public override bool CanExportData ()
{
return false;
}
public override void ExportData()
public override void ExportData ()
{
}
@@ -282,7 +424,7 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
// C o n t e x t M e n u
//-------------------------------------------------------------------
private SpmContextMenuStrip contextMenuStrip = new SpmContextMenuStrip();
private void RefreshContextMenu()
private void RefreshContextMenu ()
{
contextMenuStrip.Name = "Department";
contextMenuStrip.Items.Clear();
@@ -293,11 +435,13 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
SpmDepartment department = SelectedDepartment;
if (department != null)
{
if (CanUpdateItem())
if (CanUpdateItem() || CanDeleteItem())
{
if (contextMenuStrip.Items.Count > 0)
contextMenuStrip.Items.Add(new ToolStripSeparator());
contextMenuStrip.Items.Add("Update", null, UpdateItem);
contextMenuStrip.Items.Add(CanUpdateItem() ? "Update" : "View", null, UpdateItem);
if (CanDeleteItem())
contextMenuStrip.Items.Add("Remove", null, DeleteItem);
}
}
}
@@ -315,31 +459,186 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
//-------------------------------------------------------------------
// C o n t r o l A c t i v i t y
//-------------------------------------------------------------------
protected override void SetControlActivity()
protected override void SetControlActivity ()
{
// Department list:
listViewDepartment.Enabled = Enabled;
SetControlsReadOnly();
bool itemSelected = SysId.IsValid(SelectedItemId);
//ToDo SpmPanel_Department > UpdateStats
listViewDepartment.Enabled = Enabled;
buttonCreate.Enabled = Enabled;
buttonUpdate.Enabled = Enabled && itemSelected;
buttonRemove.Enabled = Enabled && itemSelected;
buttonOk.Enabled = Enabled;
buttonCancel.Enabled = Enabled;
}
protected override void SetControlsReadOnly()
protected override void SetControlsReadOnly ()
{
}
//-------------------------------------------------------------------
// P o s i t i o n C o n t r o l s
//-------------------------------------------------------------------
protected override void PositionControls()
protected override void PositionControls ()
{
if (this.IsDesignerHosted()) return;
base.PositionControls();
if (this.IsDesignerHosted() || !Created) return;
Rectangle clientRect = ClientRectangle;
//---------------------------------------------------------------
// Filter panel.
if (listFilterDepartment.Visible)
{
listFilterDepartment.PositionAtTopLeftOf(this);
listFilterDepartment.SetFullWidthOf(this);
listFilterDepartment.ResizeToBottomControl();
listViewDepartment.PositionBelow(listFilterDepartment);
}
else
{
listViewDepartment.PositionAtTopLeftOf(this);
}
//---------------------------------------------------------------
// List view.
int buttonLeft = clientRect.Width - buttonCreate.Width - buttonCreate.Margin.Right - Padding.Right;
listViewDepartment.Left = listViewDepartment.Margin.Left;
listViewDepartment.Width = buttonLeft - buttonCreate.Margin.Left - listViewDepartment.Left - listViewDepartment.Margin.Right;
if (!(buttonCreate.Visible || buttonUpdate.Visible || buttonRemove.Visible || buttonOk.Visible || buttonCancel.Visible))
listViewDepartment.Width = clientRect.Width - Padding.Right - listViewDepartment.Left - listViewDepartment.Margin.Right;
//---------------------------------------------------------------
// Tab control.
if (tabControl.Visible)
{
tabControl.Left = listViewDepartment.Left;
tabControl.Width = clientRect.Width - (tabControl.Left * 2);
listViewDepartment.Height = (int)((clientRect.Height - listViewDepartment.Top) * 0.40);
tabControl.Top = listViewDepartment.Bottom + listViewDepartment.Margin.Bottom + tabControl.Margin.Top;
tabControl.Height = clientRect.Height - tabControl.Top - tabControl.Margin.Bottom - Padding.Bottom;
}
else
{
listViewDepartment.Height = clientRect.Height - listViewDepartment.Top - listViewDepartment.Margin.Bottom - Padding.Bottom;
}
//---------------------------------------------------------------
// Create button.
int buttonTop = listViewDepartment.Top + listViewDepartment.HeaderHeight;
buttonCreate.Top = buttonTop;
buttonCreate.Left = buttonLeft;
if (buttonCreate.Visible)
buttonTop += buttonCreate.Height + buttonCreate.Margin.Bottom;
// Update button.
buttonUpdate.Top = buttonTop;
buttonUpdate.Left = buttonLeft;
if (buttonUpdate.Visible)
buttonTop += buttonUpdate.Height + buttonUpdate.Margin.Bottom;
// Remove button.
buttonRemove.Top = buttonTop;
buttonRemove.Left = buttonLeft;
if (buttonRemove.Visible)
buttonTop += buttonRemove.Height + buttonRemove.Margin.Bottom;
//---------------------------------------------------------------
// Navigation buttons.
// Cancel button.
buttonCancel.Top = clientRect.Bottom - Padding.Bottom - buttonCancel.Margin.Bottom - buttonCancel.Height;
buttonCancel.Left = buttonLeft;
// OK button.
buttonOk.Top = buttonCancel.Top - buttonOk.Height - buttonCancel.Padding.Top - buttonCancel.Margin.Bottom;
buttonOk.Left = buttonLeft;
if (buttonOk.Visible)
buttonTop += buttonOk.Height + buttonOk.Margin.Bottom;
//---------------------------------------------------------------
}
//-------------------------------------------------------------------
// F o r m E v e n t s
// P a n e l E v e n t s
//-------------------------------------------------------------------
// Filter.
private void listFilterDepartment_FilterChanged (object sender, EventArgs e)
{
RefreshDataItems();
SetControlActivity();
}
//-------------------------------------------------------------------
// Item list.
private void listViewDepartment_ColumnClick (object sender, ColumnClickEventArgs e)
{
RefreshDataItems();
}
private void listViewDepartment_ItemCountChanged (object sender, Sarand.Win.Forms.Controls.SacsListView.ItemCountChangedEventArgs e)
{
InvokeItemCountChangedEvent(e);
}
private void listViewDepartment_SelectedIndexChanged (object sender, EventArgs e)
{
RefreshTabs();
InvokeItemSelectionChangedEvent(e);
SetControlActivity();
}
private void listViewDepartment_DoubleClick (object sender, EventArgs e)
{
if (config.Mode == PanelMode.Search)
{
//if (config.SearchForm != null) config.SearchForm.OnOK();
}
else
UpdateItem();
SetControlActivity();
}
private void listViewDepartment_MouseUp (object sender, MouseEventArgs e)
{
switch (e.Button)
{
case MouseButtons.Right:
// Refresh the context menu and display at pointer position.
RefreshContextMenu();
contextMenuStrip.Show(listViewDepartment, new Point(e.X, e.Y), ToolStripDropDownDirection.Default);
break;
}
SetControlActivity();
}
//-------------------------------------------------------------------
// Actions.
private void buttonCreate_Click (object sender, EventArgs e)
{
CreateItem();
SetControlActivity();
}
private void buttonUpdate_Click (object sender, EventArgs e)
{
UpdateItem();
SetControlActivity();
}
private void buttonRemove_Click (object sender, EventArgs e)
{
DeleteItem();
SetControlActivity();
}
private void buttonOk_Click (object sender, EventArgs e)
{
if (config.SearchForm != null)
{
//config.SearchForm.OnOK();
return;
}
SetControlActivity();
}
private void buttonCancel_Click (object sender, EventArgs e)
{
if (config.SearchForm != null)
{
//config.SearchForm.OnCancel();
return;
}
SetControlActivity();
}
//-------------------------------------------------------------------
}
@@ -30,11 +30,13 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
public new class Config : SpmPanel_Items.Config
{
public PanelMode Mode { get; set; } = PanelMode.Maintain;
public Spm.FacilityType FacilityType { get; set; } = Spm.FacilityType.Unknown;
}
//-------------------------------------------------------------------
// Data members.
private Config config = new Config();
private SysId departmentId = null;
//-------------------------------------------------------------------
// Construction.
@@ -56,6 +58,17 @@ namespace Sarand.PatientMgr.Win.Forms.Panels
//-------------------------------------------------------------------
// Properties.
protected override String DefaultMessageTitle { get { return "Facility"; } }
[Browsable(false), ReadOnly(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public SysId DepartmentId
{
get { return departmentId; }
set
{
if (SysId.ToInt(departmentId) == SysId.ToInt(value)) return;
departmentId = value;
RefreshDataItems();
}
}
public override int ItemTotal { get { return listViewFacility.ItemTotal; } }
public override int ItemCount { get { return listViewFacility.ItemCount; } }
public override int SelectedItemCount { get { return listViewFacility.SelectedItemCount; } }
@@ -0,0 +1,57 @@
namespace Sarand.PatientMgr.Win.Forms.Panels
{
partial class SpmPanel_UpdateStamp
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
#region Component 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.htmlPanel = new Sarand.Win.Forms.Controls.SacsHtmlPanel();
this.sacsHtmlPanel1 = new Sarand.Win.Forms.Controls.SacsHtmlPanel();
this.SuspendLayout();
//
// htmlPanel
//
this.htmlPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.htmlPanel.Location = new System.Drawing.Point(0, 0);
this.htmlPanel.MinimumSize = new System.Drawing.Size(20, 20);
this.htmlPanel.Name = "htmlPanel";
this.htmlPanel.Size = new System.Drawing.Size(405, 104);
this.htmlPanel.TabIndex = 0;
//
// sacsHtmlPanel1
//
this.sacsHtmlPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.sacsHtmlPanel1.Location = new System.Drawing.Point(0, 0);
this.sacsHtmlPanel1.MinimumSize = new System.Drawing.Size(20, 20);
this.sacsHtmlPanel1.Name = "sacsHtmlPanel1";
this.sacsHtmlPanel1.Size = new System.Drawing.Size(405, 104);
this.sacsHtmlPanel1.TabIndex = 1;
//
// SpmPanel_UPdateStamp
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.sacsHtmlPanel1);
this.Controls.Add(this.htmlPanel);
this.Name = "SpmPanel_UPdateStamp";
this.Size = new System.Drawing.Size(405, 104);
this.ResumeLayout(false);
}
#endregion
private Sarand.Win.Forms.Controls.SacsHtmlPanel htmlPanel;
private Sarand.Win.Forms.Controls.SacsHtmlPanel sacsHtmlPanel1;
}
}
@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sarand.Win.Forms.Controls;
using Sarand.PatientMgr.Win.Forms.App;
using Sarand.Core.Bus;
using Sarand.Core.Security;
using Sarand.Win.Forms.Utils;
using Sarand.Core.Base;
using Sarand.PatientMgr.Core.App;
namespace Sarand.PatientMgr.Win.Forms.Panels
{
//=======================================================================
public partial class SpmPanel_UpdateStamp : SacsUserControl
{
//-------------------------------------------------------------------
// Data members.
private SpmSessionProfile_Win sessionProfile = null;
private SacsHierarchyItem.Data itemData = null;
private SaSecurityConsole securityConsole;
//-------------------------------------------------------------------
// Construction.
public SpmPanel_UpdateStamp ()
{
if (SpmGlobals.System != null)
{
sessionProfile = SpmGlobals_Win.SessionProfile;
securityConsole = SpmGlobals.Application.GetSecurityConsole(sessionProfile.SessionContext);
}
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// I n i t i a l i s a t i o n
//-------------------------------------------------------------------
protected override void OnCreateControl ()
{
base.OnCreateControl();
if (this.IsDesignerHosted()) return;
BorderStyle = BorderStyle.None;
RefreshDisplay();
}
//-------------------------------------------------------------------
// Properties.
public SacsHierarchyItem.Data ItemData
{
set
{
if (itemData == value) return;
itemData = value;
RefreshDisplay();
}
}
//-------------------------------------------------------------------
// Refresh display.
private void RefreshDisplay ()
{
List<String> body = new List<String>();
if (itemData != null)
{
// Users.
string createUser = (securityConsole != null ? securityConsole.GetNameForItemId(itemData.CreateStamp.By) : "");
string updateUser = (securityConsole != null ? securityConsole.GetNameForItemId(itemData.UpdateStamp.By) : "");
// Display update stamp.
body.Add("<div><span class='label'>Created:</span> <span class='value'>" + DateUtil.Format(itemData.CreateStamp.On, "d-MMM-yyyy HH:mm") + (!StringUtil.IsEmpty(createUser) ? " by " + createUser : "") + "</div>");
body.Add("<div><span class='label'>Updated:</span> <span class='value'>" + DateUtil.Format(itemData.UpdateStamp.On, "d-MMM-yyyy HH:mm") + (!StringUtil.IsEmpty(updateUser) ? " by " + updateUser : "") + "</div>");
}
else
{
body.Add("<div><span class='label'>Created:</span> <span class='value'>" + DateUtil.Format(DateTime.Now, "d-MMM-yyyy HH:mm") + "</span></div>");
}
if (htmlPanel.DocumentPopulated && htmlPanel.Document != null && htmlPanel.Document.Body != null && false)
{
htmlPanel.SetDocumentBody(body.Concat("\n"));
}
else
{
List<String> html = new List<String>();
html.Add("<html><head>" + GetStyle() + "</html><body>");
html.AddRange(body);
html.Add("</body></html>");
htmlPanel.SetDocumentHtml(html.Concat("\n"));
htmlPanel.DocumentPopulated = true;
}
}
private String GetStyle ()
{
List<String> style = new List<String>();
style.Add("<style>");
style.Add("body{margin:0;padding:4px;font-family:arial;font-size:10px;background-color:#F0F0F0;border:1px solid #D0D0D0;overflow:hidden;}");
style.Add(".label{color:#606060;font-weight:bold;}");
style.Add("</style>");
return style.Concat("\n");
}
//-------------------------------------------------------------------
// C o n t r o l A c t i v i t y
//-------------------------------------------------------------------
protected override void SetControlActivity ()
{
SetControlsReadOnly();
}
protected override void SetControlsReadOnly ()
{
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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>
@@ -0,0 +1,23 @@
namespace Sarand.PatientMgr.Win.Forms.TabPages
{
partial class SpmTabPage_Department
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
#region Component 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()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
@@ -0,0 +1,240 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sarand.PatientMgr.Win.Forms.Base;
using Sarand.PatientMgr.Core.Bus;
using Sarand.Core.Base;
using Sarand.PatientMgr.Win.Forms.Panels;
using Sarand.Win.Forms.UpdateLog;
using Sarand.Win.Forms.Controls;
using Sarand.PatientMgr.Win.Forms.Maint;
using Sarand.PatientMgr.Core.App;
using Sarand.Core.Bus;
using Sarand.Win.Forms.Utils;
namespace Sarand.PatientMgr.Win.Forms.TabPages
{
//=======================================================================
public partial class SpmTabPage_Department : SpmTabPage
{
//-------------------------------------------------------------------
// Configuration.
public enum PanelType
{
Unknown = 0,
// Department properties.
Notes,
// Department list.
Theatres,
Clinics,
Wards,
// Common.
Config,
Updates,
}
public new class Config : SpmTabPage.Config
{
/// <summary>Department form hosting the tab control.</summary>
public SpmForm_Department DepartmentForm { get; set; } = null;
/// <summary>Panels to display on this tab page.</summary>
public List<PanelType> PanelTypes { get; } = new List<PanelType>();
/// <summary>Number of panels on this tab page.</summary>
public override int PanelCount { get { return PanelTypes.Count; } }
}
//-------------------------------------------------------------------
// Data members.
private Config config = new Config();
private SpmPanel_Facilities panelTheatres = null;
private SpmPanel_Facilities panelWards = null;
private SpmPanel_Facilities panelClinics = null;
private SaPanel_UpdateLog panelUpdates = null;
//-------------------------------------------------------------------
// Construction.
public SpmTabPage_Department (Config config) : base(config)
{
this.config = config;
InitializeComponent();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null) components.Dispose();
}
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// Properties.
/// <summary>Panels to display on this tab page.</summary>
public List<PanelType> PanelTypes { get { return config.PanelTypes; } }
//-------------------------------------------------------------------
// Initialisation.
protected override void OnCreateControl()
{
base.OnCreateControl();
if (this.IsDesignerHosted()) return;
// Configure page.
// Initial panels.
List<SacsPanel> panels = new List<SacsPanel>();
foreach (var panelType in config.PanelTypes)
{
SacsPanel panel = null;
switch (panelType)
{
case PanelType.Theatres:
{
SpmPanel_Facilities.Config configPanel = new SpmPanel_Facilities.Config();
configPanel.Mode = SpmPanel_Facilities.PanelMode.Maintain;
configPanel.FacilityType = Spm.FacilityType.Theatre;
panelTheatres = new SpmPanel_Facilities(configPanel);
panel = panelTheatres;
panel.SizeChanged += Panel_Resize;
break;
}
case PanelType.Clinics:
{
SpmPanel_Facilities.Config configPanel = new SpmPanel_Facilities.Config();
configPanel.Mode = SpmPanel_Facilities.PanelMode.Maintain;
configPanel.FacilityType = Spm.FacilityType.Clinic;
panelClinics = new SpmPanel_Facilities(configPanel);
panel = panelClinics;
panel.SizeChanged += Panel_Resize;
break;
}
case PanelType.Wards:
{
SpmPanel_Facilities.Config configPanel = new SpmPanel_Facilities.Config();
configPanel.Mode = SpmPanel_Facilities.PanelMode.Maintain;
configPanel.FacilityType = Spm.FacilityType.Ward;
panelWards = new SpmPanel_Facilities(configPanel);
panel = panelWards;
panel.SizeChanged += Panel_Resize;
break;
}
case PanelType.Updates:
{
SaPanel_UpdateLog.Config configPanel = new SaPanel_UpdateLog.Config();
configPanel.UpdateLogConsole = UpdateLogConsole;
panelUpdates = new SaPanel_UpdateLog();
panelUpdates.SetConfig(configPanel);
panel = panelUpdates;
panel.SizeChanged += Panel_Resize;
break;
}
}
if (panel != null)
panels.Add(panel);
else Logger.Warn(GetType().Name + ".OnCreateControl Panel type not supported: " + panelType.ToString());
}
AddPanelsToPage(panels);
// Complete panel initialisation.
SetControlsReadOnly();
SetControlActivity();
}
//-------------------------------------------------------------------
// P a g e I n t e r f a c e
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// P o p u l a t i o n
//-------------------------------------------------------------------
public void PopulateToControls(SpmDepartment.Data data)
{
if (panelTheatres != null)
panelTheatres.DepartmentId = data.Id;
if (panelClinics != null)
panelClinics.DepartmentId = data.Id;
if (panelWards != null)
panelWards.DepartmentId = data.Id;
if (panelUpdates != null)
panelUpdates.ItemId = new ItemId((short)Spm.DataItemType.Department, data.Id);
}
public bool IsDataValid(SpmDepartment.Data data)
{
return true;
}
public void PopulateFromControls(SpmDepartment.Data data)
{
}
public bool UpdateAssociatedData(SpmDepartment.Data data)
{
return true;
}
//-------------------------------------------------------------------
// C o n t r o l A c t i v i t y
//-------------------------------------------------------------------
protected void SetControlActivity()
{
if (panelUpdates != null)
panelUpdates.Enabled = Enabled;
}
public bool IsFieldReadOnly(SpmDbDfn.ColumnIdx col)
{
return false;
}
protected void SetControlsReadOnly()
{
return;
}
//-------------------------------------------------------------------
// P a n e l E v e n t s
//-------------------------------------------------------------------
private void panel_ItemCreated(object sender, SpmPanel_Items.ItemModifiedEventArgs e)
{
InvokeItemCreatedEvent((short)e.ItemType, e.ItemId);
}
private void panel_ItemUpdated(object sender, SpmPanel_Items.ItemModifiedEventArgs e)
{
InvokeItemUpdatedEvent((short)e.ItemType, e.ItemId);
}
private void panel_ItemDeleted(object sender, SpmPanel_Items.ItemModifiedEventArgs e)
{
InvokeItemDeletedEvent((short)e.ItemType, e.ItemId);
}
//-------------------------------------------------------------------
// P a n e l S i z e a n d P o s i t i o n
//-------------------------------------------------------------------
protected override void PositionControls()
{
base.PositionControls();
Rectangle clientRect = ClientRectangle;
}
//-------------------------------------------------------------------
}
//=======================================================================
public static class SpmTabPage_DepartmentList
{
public static void PopulateToControls (this List<SpmTabPage_Department> tabPages, SpmDepartment.Data data)
{
foreach (SpmTabPage_Department tabPage in tabPages)
tabPage.PopulateToControls(data);
}
public static void PopulateFromControls (this List<SpmTabPage_Department> tabPages, SpmDepartment.Data data)
{
foreach (SpmTabPage_Department tabPage in tabPages)
tabPage.PopulateFromControls(data);
}
}
//=======================================================================
}