Files
PatientMgr-CSharp/SaPatMgrWinForms/Win/Forms/Base/SpmPanel.cs
T

97 lines
3.3 KiB
C#

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.Core.App;
using Sarand.PatientMgr.Win.Forms.App;
using Sarand.PatientMgr.Core.Mgr;
using Sarand.Core.Security;
using Sarand.Core.CodeTypes;
using Sarand.Core.ItemOptions;
using Sarand.Core.UpdateLog;
using Sarand.Core.Dbas.Base;
namespace Sarand.PatientMgr.Win.Forms.Base
{
//=======================================================================
public partial class SpmPanel : SacsPanel
{
//-------------------------------------------------------------------
// 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 SpmInternals internals = null;
//-------------------------------------------------------------------
// Construction.
public SpmPanel() : this(new Config()) { }
public SpmPanel(Config config) : base()
{
SetConfig(config);
InitializeComponent();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null) components.Dispose();
if (internals != null) internals.Dispose();
}
base.Dispose(disposing);
}
//-------------------------------------------------------------------
// Properties.
// 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 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.
public SpmSecurityProfile SecurityProfile { get { return Internals.SecurityProfile; } }
// Managers.
public SpmInstitutionMgr InstitutionMgr { get { return Internals.InstitutionMgr; } }
public SpmDepartmentMgr DepartmentMgr { get { return Internals.DepartmentMgr; } }
public SpmAdmissionMgr AdmissionMgr { get { return Internals.AdmissionMgr; } }
// Consoles.
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.
protected void SetConfig(Config config)
{
base.SetConfig(config);
this.config = config;
}
//-------------------------------------------------------------------
}
//=======================================================================
}