using Sarand.PatientMgr.Core.Mgr; using Sarand.Core.App; using Sarand.Core.Base; using System; using System.Collections.Generic; using System.Text; namespace Sarand.PatientMgr.Core.App { //======================================================================= public abstract partial class SpmSystem : SacsSystem { //------------------------------------------------------------------- // Data members. private static List codeTypes = new List(); // System Code types. private static List sites = new List(); private static List facilityTypes = new List(); private static List scheduleTypes = new List(); private static List employeeRoles = new List(); private static List genders = new List(); private static List patientDataSources = new List(); private static List templateMapTypes = new List(); private static List sessionModels = new List(); private static List resourceCategories = new List(); private static List theatreSessionTypes = new List(); private static List clinicSessionTypes = new List(); private static List wardResourceTypes = new List(); private static List resourceCapacityTypes = new List(); private static List resourceLoadingTypes = new List(); private static List scheduleFreezeTypes = new List(); private static List templateDataTypes = new List(); private static List procedureComplexities = new List(); private static List admissionOccupancies = new List(); private static List admissionActionTypes = new List(); private static List admissionCancelTypes = new List(); private static List attendanceTypes = new List(); private static List attendanceStatuses = new List(); private static List wardPeriodLengths = new List(); private static List wardResourceDisplays = new List(); private static List wardHighlightings = new List(); private static List reportSpacings = new List(); //------------------------------------------------------------------- // Construction - use derived objects. protected SpmSystem (PropertySet properties) { // Configure extended logging. extendedLoggingOptions = StringList.Split(properties.GetPropertyValue("Logging", "ExtendedLogging")); } //------------------------------------------------------------------- // Application definitions. public static String GetCopyrightNotice (bool html = false) { return (html ? "© " : "(c) ") + "2002- " + DateTime.Today.Year + " Sarand Ltd"; } public static bool IsSysAdminSession () { // Dev mode. if (IsDevHost()) return true; // Production servers. if (UserName.ContainsCI("Sarand")) { if (ComputerName.EqualsCI("Norman")) return true; } // Development. if (ComputerName.ContainsCI("Sarand")) return true; return false; } //------------------------------------------------------------------- // S y s t e m C o d e s //------------------------------------------------------------------- public static List GetCodesOfType (Spm.SystemCode systemCode) { // Lists are cloned to avoid modifications to the internal static lists. switch (systemCode) { //----------------------------------------------------------- case Spm.SystemCode.Site: return new List(sites); case Spm.SystemCode.FacilityType: return new List(facilityTypes); case Spm.SystemCode.ScheduleType: return new List(scheduleTypes); case Spm.SystemCode.EmployeeRole: return new List(employeeRoles); case Spm.SystemCode.Gender: return new List(genders); case Spm.SystemCode.PatientDataSource: return new List(patientDataSources); case Spm.SystemCode.TemplateMapType: return new List(templateMapTypes); case Spm.SystemCode.SessionModel: return new List(sessionModels); case Spm.SystemCode.ResourceCategory: return new List(resourceCategories); case Spm.SystemCode.TheatreSessionType: return new List(theatreSessionTypes); case Spm.SystemCode.ClinicSessionType: return new List(clinicSessionTypes); case Spm.SystemCode.WardResourceType: return new List(wardResourceTypes); case Spm.SystemCode.ResourceCapacityType: return new List(resourceCapacityTypes); case Spm.SystemCode.ResourceLoadingType: return new List(resourceLoadingTypes); case Spm.SystemCode.ScheduleFreezeType: return new List(scheduleFreezeTypes); case Spm.SystemCode.TemplateDataType: return new List(templateDataTypes); case Spm.SystemCode.ProcedureComplexity: return new List(procedureComplexities); case Spm.SystemCode.AdmissionOccupancy: return new List(admissionOccupancies); case Spm.SystemCode.AdmissionActionType: return new List(admissionActionTypes); case Spm.SystemCode.AdmissionCancelType: return new List(admissionCancelTypes); case Spm.SystemCode.AttendanceType: return new List(attendanceTypes); case Spm.SystemCode.AttendanceStatus: return new List(attendanceStatuses); case Spm.SystemCode.WardPeriodLength: return new List(wardPeriodLengths); case Spm.SystemCode.WardResourceDisplay: return new List(wardResourceDisplays); case Spm.SystemCode.WardHighlighting: return new List(wardHighlightings); case Spm.SystemCode.ReportSpacing: return new List(reportSpacings); default: Logger.Warn("SpmSystem.GetCodesOfType Invalid code type: " + systemCode.ToString()); break; } //--------------------------------------------------------------- return null; } //------------------------------------------------------------------- // System code utilities. public static Spm.Site GetSiteForCode (String siteCode) { return (Spm.Site)sites.GetTypeForCode(siteCode); } public static String GetSiteCode (Spm.Site site) { return sites.GetCodeForType((int)site); } public static String GetSiteDesc (Spm.Site site) { return sites.GetDescForType((int)site, site.ToString()); } //------------------------------------------------------------------- // D a t a M a n a g e r s //------------------------------------------------------------------- public abstract SpmAdmissionMgr CreateAdmissionMgr (SpmUserContext userContext); public abstract SpmDepartmentMgr CreateDepartmentMgr(SpmUserContext userContext); public abstract SpmInstitutionMgr CreateInstitutionMgr(SpmUserContext userContext); //------------------------------------------------------------------- // E x t e n d e d L o g g i n g //------------------------------------------------------------------- // Extended logging options. public enum ExtendedLogginOption { SecurityProfile, DbQueryExecution, Printing, ServiceRequests, } public static readonly String ExtendedLogging_SecurityProfile = "SecurityProfile"; public static readonly String ExtendedLogging_DbQueryExecution = "DbQueryExecution"; public static readonly String ExtendedLogging_Printing = "Printing"; public static readonly String ExtendedLogging_ServiceRequests = "ServiceRequests"; private List extendedLoggingOptions; //------------------------------------------------------------------- public bool IsExtendedLogging (ExtendedLogginOption extendedLoggingOption) { if (extendedLoggingOptions == null) return false; if (extendedLoggingOption == ExtendedLogginOption.SecurityProfile) return extendedLoggingOptions.ContainsCI(ExtendedLogging_SecurityProfile); if (extendedLoggingOption == ExtendedLogginOption.DbQueryExecution) return extendedLoggingOptions.ContainsCI(ExtendedLogging_DbQueryExecution); if (extendedLoggingOption == ExtendedLogginOption.Printing) return extendedLoggingOptions.ContainsCI(ExtendedLogging_Printing); if (extendedLoggingOption == ExtendedLogginOption.ServiceRequests) return extendedLoggingOptions.ContainsCI(ExtendedLogging_ServiceRequests); return false; } //------------------------------------------------------------------- } //======================================================================= }