SB 20-Jun-2019
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
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_Admission : SpmTabPage
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Configuration.
|
||||
public enum PanelType
|
||||
{
|
||||
Unknown = 0,
|
||||
Updates,
|
||||
}
|
||||
public new class Config : SpmTabPage.Config
|
||||
{
|
||||
/// <summary>Admission form hosting the tab control.</summary>
|
||||
public SpmForm_Admission AdmissionForm { 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 SaPanel_UpdateLog panelUpdates = null;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SpmTabPage_Admission(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.Updates:
|
||||
{
|
||||
SaPanel_UpdateLog.Config configUpdateLog = new SaPanel_UpdateLog.Config();
|
||||
configUpdateLog.UpdateLogConsole = UpdateLogConsole;
|
||||
panelUpdates = new SaPanel_UpdateLog();
|
||||
panelUpdates.SetConfig(configUpdateLog);
|
||||
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(SpmAdmission.Data data)
|
||||
{
|
||||
if (panelUpdates != null)
|
||||
panelUpdates.ItemId = new ItemId((short)Spm.DataItemType.Admission, data.Id);
|
||||
}
|
||||
public bool IsDataValid(SpmAdmission.Data data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public void PopulateFromControls(SpmAdmission.Data data)
|
||||
{
|
||||
}
|
||||
public bool UpdateAssociatedData(SpmAdmission.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;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user