diff --git a/SaPatMgrCore/Core/App/SpmApplication.cs b/SaPatMgrCore/Core/App/SpmApplication.cs
index beec493..b1a1cef 100644
--- a/SaPatMgrCore/Core/App/SpmApplication.cs
+++ b/SaPatMgrCore/Core/App/SpmApplication.cs
@@ -1,5 +1,8 @@
using Sarand.Core.CodeTypes;
using Sarand.Core.Dbas.Base;
+using Sarand.Core.ItemOptions;
+using Sarand.Core.Security;
+using Sarand.Core.UpdateLog;
using System;
using System.Collections.Generic;
using System.Text;
@@ -21,11 +24,14 @@ namespace Sarand.PatientMgr.Core.App
//-------------------------------------------------------------------
// Database.
public abstract ISacsDatabase GetDatabase (SpmSessionContext sessionContext);
- //public abstract bool ColumnExists (SbmSessionContext sessionContext, SbmDbDfn.ColumnIdx columnIdx);
+ public abstract bool ColumnExists (SpmSessionContext sessionContext, SpmDbDfn.ColumnIdx columnIdx);
//-------------------------------------------------------------------
- // Code Type console.
- public abstract SaCodeTypeConsole GetCodeTypeConsole (SpmUserContext userContext);
+ // Retrieve Global Consoles by session context.
+ public abstract SaSecurityConsole GetSecurityConsole (SpmSessionContext sessionContext);
+ public abstract SaCodeTypeConsole GetCodeTypeConsole (SpmSessionContext sessionContext);
+ public abstract SaItemOptionConsole GetItemOptionConsole (SpmSessionContext sessionContext);
+ public abstract SaUpdateLogConsole GetUpdateLogConsole (SpmSessionContext sessionContext);
//-------------------------------------------------------------------
}
diff --git a/SaPatMgrCore/Core/App/SpmDbDfn.cs b/SaPatMgrCore/Core/App/SpmDbDfn.cs
new file mode 100644
index 0000000..c8b0a3d
--- /dev/null
+++ b/SaPatMgrCore/Core/App/SpmDbDfn.cs
@@ -0,0 +1,1071 @@
+using Sarand.Core.Base;
+using Sarand.Core.Dbas.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Core.App
+{
+ public class SpmDbDfn
+ {
+ //-------------------------------------------------------------------
+ // Table identifiers.
+ public enum TableIdx
+ {
+ Unknown = 0,
+ IndexDefragLog,
+ SaItemNamedValue,
+ SwmAdmission,
+ SwmAdmissionAction,
+ SwmAdmissionData,
+ SwmAdmissionRole,
+ SwmDepartment,
+ SwmDepartmentCode,
+ SwmEmployee,
+ SwmEmployeeRole,
+ SwmFacility,
+ SwmFacilitySession,
+ SwmFacilityTemplate,
+ SwmInstitution,
+ SwmOperation,
+ SwmPatient,
+ SwmProcedure,
+ SwmTemplateData,
+ }
+
+ //-------------------------------------------------------------------
+ // Column identifiers.
+ public enum ColumnIdx
+ {
+ Unknown = 0,
+ IndexDefragLog_IndexDefragId,
+ IndexDefragLog_DatabaseID,
+ IndexDefragLog_DatabaseName,
+ IndexDefragLog_ObjectID,
+ IndexDefragLog_ObjectName,
+ IndexDefragLog_IndexID,
+ IndexDefragLog_IndexName,
+ IndexDefragLog_PartitionNumber,
+ IndexDefragLog_Fragmentation,
+ IndexDefragLog_PageCount,
+ IndexDefragLog_DateTimeStart,
+ IndexDefragLog_DurationSeconds,
+ SaItemNamedValue_ItemType,
+ SaItemNamedValue_ItemId,
+ SaItemNamedValue_Name,
+ SaItemNamedValue_Seq,
+ SaItemNamedValue_Value,
+ SaItemNamedValue_Notes,
+ SaItemNamedValue_Flags,
+ SaItemNamedValue_Status,
+ SaItemNamedValue_CreateOn,
+ SaItemNamedValue_CreateBy,
+ SaItemNamedValue_CreateHost,
+ SaItemNamedValue_UpdateOn,
+ SaItemNamedValue_UpdateBy,
+ SaItemNamedValue_UpdateHost,
+ SwmAdmission_Id,
+ SwmAdmission_FacilityId,
+ SwmAdmission_FacilityTemplateId,
+ SwmAdmission_AdmissionFrom,
+ SwmAdmission_AdmissionTo,
+ SwmAdmission_DecisionToReferOn,
+ SwmAdmission_ReferredOn,
+ SwmAdmission_BreechOn,
+ SwmAdmission_DecisionToAdmitOn,
+ SwmAdmission_PreAssessment,
+ SwmAdmission_ToComeIn,
+ SwmAdmission_Seq,
+ SwmAdmission_Type,
+ SwmAdmission_Occupancy,
+ SwmAdmission_PatientId,
+ SwmAdmission_PatientNo,
+ SwmAdmission_NhsNumber,
+ SwmAdmission_Title,
+ SwmAdmission_Surname,
+ SwmAdmission_Forename,
+ SwmAdmission_Gender,
+ SwmAdmission_BirthOn,
+ SwmAdmission_Age,
+ SwmAdmission_AgeOn,
+ SwmAdmission_PhoneMobile,
+ SwmAdmission_Email,
+ SwmAdmission_ContactFlags,
+ SwmAdmission_SystemRef,
+ SwmAdmission_AttendanceType,
+ SwmAdmission_AttendanceStatus,
+ SwmAdmission_FacilityIdWard,
+ SwmAdmission_Ward,
+ SwmAdmission_SpecialityCode,
+ SwmAdmission_ProcedureId,
+ SwmAdmission_ProcedureCode,
+ SwmAdmission_ProcedureDesc,
+ SwmAdmission_ComplexityCode,
+ SwmAdmission_ProcedureIndication,
+ SwmAdmission_PatientHistory,
+ SwmAdmission_GestationPeriod,
+ SwmAdmission_DurationExp,
+ SwmAdmission_DurationAct,
+ SwmAdmission_UnitsExp,
+ SwmAdmission_UnitsAct,
+ SwmAdmission_Anaesthetic,
+ SwmAdmission_Position,
+ SwmAdmission_SpecialEquipment,
+ SwmAdmission_ComfortScore,
+ SwmAdmission_TimeCalled,
+ SwmAdmission_TimeArrived,
+ SwmAdmission_TimeAnaesStart,
+ SwmAdmission_TimeProcStart,
+ SwmAdmission_TimeProcEnd,
+ SwmAdmission_TimeInRecovery,
+ SwmAdmission_TimeInformDest,
+ SwmAdmission_TimeLeave,
+ SwmAdmission_CancelType,
+ SwmAdmission_CancelDate,
+ SwmAdmission_CancelCount,
+ SwmAdmission_CancelCode,
+ SwmAdmission_CancelReason,
+ SwmAdmission_Notes,
+ SwmAdmission_Flags,
+ SwmAdmission_Status,
+ SwmAdmission_CreateOn,
+ SwmAdmission_CreateBy,
+ SwmAdmission_CreateHost,
+ SwmAdmission_UpdateOn,
+ SwmAdmission_UpdateBy,
+ SwmAdmission_UpdateHost,
+ SwmAdmission_DecisionToRefer,
+ SwmAdmission_Referred,
+ SwmAdmissionAction_Id,
+ SwmAdmissionAction_AdmissionId,
+ SwmAdmissionAction_Type,
+ SwmAdmissionAction_Raised,
+ SwmAdmissionAction_EmployeeIdRaised,
+ SwmAdmissionAction_Completed,
+ SwmAdmissionAction_EmployeeIdCompleted,
+ SwmAdmissionAction_ActionData,
+ SwmAdmissionAction_Notes,
+ SwmAdmissionAction_Flags,
+ SwmAdmissionAction_Status,
+ SwmAdmissionAction_CreateOn,
+ SwmAdmissionAction_CreateBy,
+ SwmAdmissionAction_CreateHost,
+ SwmAdmissionAction_UpdateOn,
+ SwmAdmissionAction_UpdateBy,
+ SwmAdmissionAction_UpdateHost,
+ SwmAdmissionData_AdmissionId,
+ SwmAdmissionData_Type,
+ SwmAdmissionData_Data,
+ SwmAdmissionData_Notes,
+ SwmAdmissionData_Flags,
+ SwmAdmissionData_Status,
+ SwmAdmissionData_CreateOn,
+ SwmAdmissionData_CreateBy,
+ SwmAdmissionData_CreateHost,
+ SwmAdmissionData_UpdateOn,
+ SwmAdmissionData_UpdateBy,
+ SwmAdmissionData_UpdateHost,
+ SwmAdmissionRole_AdmissionId,
+ SwmAdmissionRole_Role,
+ SwmAdmissionRole_Seq,
+ SwmAdmissionRole_EmployeeRoleId,
+ SwmAdmissionRole_EmployeeCode,
+ SwmAdmissionRole_Category,
+ SwmAdmissionRole_Notes,
+ SwmAdmissionRole_Flags,
+ SwmAdmissionRole_Status,
+ SwmAdmissionRole_CreateOn,
+ SwmAdmissionRole_CreateBy,
+ SwmAdmissionRole_CreateHost,
+ SwmAdmissionRole_UpdateOn,
+ SwmAdmissionRole_UpdateBy,
+ SwmAdmissionRole_UpdateHost,
+ SwmDepartment_Id,
+ SwmDepartment_InstitutionId,
+ SwmDepartment_Name,
+ SwmDepartment_FacilityTypes,
+ SwmDepartment_AllowAnyFacility,
+ SwmDepartment_CancellReBookLimit,
+ SwmDepartment_ApplicFrom,
+ SwmDepartment_ApplicTo,
+ SwmDepartment_Notes,
+ SwmDepartment_Flags,
+ SwmDepartment_Status,
+ SwmDepartment_CreateOn,
+ SwmDepartment_CreateBy,
+ SwmDepartment_CreateHost,
+ SwmDepartment_UpdateOn,
+ SwmDepartment_UpdateBy,
+ SwmDepartment_UpdateHost,
+ SwmDepartmentCode_Id,
+ SwmDepartmentCode_DepartmentId,
+ SwmDepartmentCode_CodeType,
+ SwmDepartmentCode_Code,
+ SwmDepartmentCode_Description,
+ SwmDepartmentCode_Notes,
+ SwmDepartmentCode_Flags,
+ SwmDepartmentCode_Status,
+ SwmDepartmentCode_CreateOn,
+ SwmDepartmentCode_CreateBy,
+ SwmDepartmentCode_CreateHost,
+ SwmDepartmentCode_UpdateOn,
+ SwmDepartmentCode_UpdateBy,
+ SwmDepartmentCode_UpdateHost,
+ SwmEmployee_Id,
+ SwmEmployee_InstitutionId,
+ SwmEmployee_EmployeeNo,
+ SwmEmployee_Code,
+ SwmEmployee_Initials,
+ SwmEmployee_Title,
+ SwmEmployee_Surname,
+ SwmEmployee_Forename,
+ SwmEmployee_Notes,
+ SwmEmployee_Flags,
+ SwmEmployee_Status,
+ SwmEmployee_CreateOn,
+ SwmEmployee_CreateBy,
+ SwmEmployee_CreateHost,
+ SwmEmployee_UpdateOn,
+ SwmEmployee_UpdateBy,
+ SwmEmployee_UpdateHost,
+ SwmEmployeeRole_Id,
+ SwmEmployeeRole_DepartmentId,
+ SwmEmployeeRole_EmployeeId,
+ SwmEmployeeRole_Role,
+ SwmEmployeeRole_ApplicFrom,
+ SwmEmployeeRole_ApplicTo,
+ SwmEmployeeRole_Notes,
+ SwmEmployeeRole_Flags,
+ SwmEmployeeRole_Status,
+ SwmEmployeeRole_CreateOn,
+ SwmEmployeeRole_CreateBy,
+ SwmEmployeeRole_CreateHost,
+ SwmEmployeeRole_UpdateOn,
+ SwmEmployeeRole_UpdateBy,
+ SwmEmployeeRole_UpdateHost,
+ SwmFacility_Id,
+ SwmFacility_DepartmentId,
+ SwmFacility_Type,
+ SwmFacility_Name,
+ SwmFacility_SortCode,
+ SwmFacility_Description,
+ SwmFacility_TemplateMapType,
+ SwmFacility_TemplateMapFrom,
+ SwmFacility_ScheduleFreezeType,
+ SwmFacility_ScheduleFreezeData,
+ SwmFacility_ApplicFrom,
+ SwmFacility_ApplicTo,
+ SwmFacility_Notes,
+ SwmFacility_Flags,
+ SwmFacility_Status,
+ SwmFacility_CreateOn,
+ SwmFacility_CreateBy,
+ SwmFacility_CreateHost,
+ SwmFacility_UpdateOn,
+ SwmFacility_UpdateBy,
+ SwmFacility_UpdateHost,
+ SwmFacilitySession_FacilityId,
+ SwmFacilitySession_FacilityTemplateId,
+ SwmFacilitySession_Session,
+ SwmFacilitySession_Type,
+ SwmFacilitySession_Name,
+ SwmFacilitySession_Description,
+ SwmFacilitySession_SessionCode,
+ SwmFacilitySession_StartAt,
+ SwmFacilitySession_FinishAt,
+ SwmFacilitySession_ConsultantId,
+ SwmFacilitySession_ConsultantCode,
+ SwmFacilitySession_SpecialityCode,
+ SwmFacilitySession_CapacityType,
+ SwmFacilitySession_CapacityMin,
+ SwmFacilitySession_CapacityMax,
+ SwmFacilitySession_DurationInterval,
+ SwmFacilitySession_DurationMin,
+ SwmFacilitySession_DurationMax,
+ SwmFacilitySession_DurationBreaks,
+ SwmFacilitySession_UnitsExp,
+ SwmFacilitySession_BookingsProhibited_ResourceGroups,
+ SwmFacilitySession_Overrides,
+ SwmFacilitySession_Notes,
+ SwmFacilitySession_Flags,
+ SwmFacilitySession_Status,
+ SwmFacilitySession_CreateOn,
+ SwmFacilitySession_CreateBy,
+ SwmFacilitySession_CreateHost,
+ SwmFacilitySession_UpdateOn,
+ SwmFacilitySession_UpdateBy,
+ SwmFacilitySession_UpdateHost,
+ SwmFacilityTemplate_Id,
+ SwmFacilityTemplate_FacilityId,
+ SwmFacilityTemplate_Category,
+ SwmFacilityTemplate_Type,
+ SwmFacilityTemplate_Group,
+ SwmFacilityTemplate_Name,
+ SwmFacilityTemplate_SortCode,
+ SwmFacilityTemplate_Description,
+ SwmFacilityTemplate_SessionCode,
+ SwmFacilityTemplate_TemplateMapType,
+ SwmFacilityTemplate_TemplateMapFrom,
+ SwmFacilityTemplate_WeekOfMonth,
+ SwmFacilityTemplate_DayOfWeek,
+ SwmFacilityTemplate_StartAt,
+ SwmFacilityTemplate_FinishAt,
+ SwmFacilityTemplate_ConsultantId,
+ SwmFacilityTemplate_ConsultantCode,
+ SwmFacilityTemplate_SpecialityCode,
+ SwmFacilityTemplate_CapacityType,
+ SwmFacilityTemplate_CapacityMin,
+ SwmFacilityTemplate_CapacityMax,
+ SwmFacilityTemplate_DurationInterval,
+ SwmFacilityTemplate_DurationMin,
+ SwmFacilityTemplate_DurationMax,
+ SwmFacilityTemplate_DurationBreaks,
+ SwmFacilityTemplate_UnitsExp,
+ SwmFacilityTemplate_ApplicFrom,
+ SwmFacilityTemplate_ApplicTo,
+ SwmFacilityTemplate_Notes,
+ SwmFacilityTemplate_Flags,
+ SwmFacilityTemplate_Status,
+ SwmFacilityTemplate_CreateOn,
+ SwmFacilityTemplate_CreateBy,
+ SwmFacilityTemplate_CreateHost,
+ SwmFacilityTemplate_UpdateOn,
+ SwmFacilityTemplate_UpdateBy,
+ SwmFacilityTemplate_UpdateHost,
+ SwmInstitution_Id,
+ SwmInstitution_Name,
+ SwmInstitution_Notes,
+ SwmInstitution_Flags,
+ SwmInstitution_Status,
+ SwmInstitution_CreateOn,
+ SwmInstitution_CreateBy,
+ SwmInstitution_CreateHost,
+ SwmInstitution_UpdateOn,
+ SwmInstitution_UpdateBy,
+ SwmInstitution_UpdateHost,
+ SwmOperation_Id,
+ SwmOperation_InstitutionId,
+ SwmOperation_Code,
+ SwmOperation_Description,
+ SwmOperation_Notes,
+ SwmOperation_Flags,
+ SwmOperation_Status,
+ SwmOperation_CreateOn,
+ SwmOperation_CreateBy,
+ SwmOperation_CreateHost,
+ SwmOperation_UpdateOn,
+ SwmOperation_UpdateBy,
+ SwmOperation_UpdateHost,
+ SwmPatient_Id,
+ SwmPatient_InstitutionId,
+ SwmPatient_PatientNo,
+ SwmPatient_NhsNumber,
+ SwmPatient_Title,
+ SwmPatient_Surname,
+ SwmPatient_Forename,
+ SwmPatient_Gender,
+ SwmPatient_BirthOn,
+ SwmPatient_Age,
+ SwmPatient_AgeOn,
+ SwmPatient_PhoneMobile,
+ SwmPatient_Email,
+ SwmPatient_Notes,
+ SwmPatient_Flags,
+ SwmPatient_Status,
+ SwmPatient_CreateOn,
+ SwmPatient_CreateBy,
+ SwmPatient_CreateHost,
+ SwmPatient_UpdateOn,
+ SwmPatient_UpdateBy,
+ SwmPatient_UpdateHost,
+ SwmProcedure_Id,
+ SwmProcedure_DepartmentId,
+ SwmProcedure_OperationId,
+ SwmProcedure_OpnCode,
+ SwmProcedure_Description,
+ SwmProcedure_SpecialityCode,
+ SwmProcedure_ComplexityCode,
+ SwmProcedure_Duration,
+ SwmProcedure_Units,
+ SwmProcedure_Duration_Training,
+ SwmProcedure_Units_Training,
+ SwmProcedure_Notes,
+ SwmProcedure_Flags,
+ SwmProcedure_Status,
+ SwmProcedure_CreateOn,
+ SwmProcedure_CreateBy,
+ SwmProcedure_CreateHost,
+ SwmProcedure_UpdateOn,
+ SwmProcedure_UpdateBy,
+ SwmProcedure_UpdateHost,
+ SwmTemplateData_FacilityTemplateId,
+ SwmTemplateData_Type,
+ SwmTemplateData_Seq,
+ SwmTemplateData_Identifier,
+ SwmTemplateData_Value,
+ SwmTemplateData_Notes,
+ SwmTemplateData_Flags,
+ SwmTemplateData_Status,
+ SwmTemplateData_CreateOn,
+ SwmTemplateData_CreateBy,
+ SwmTemplateData_CreateHost,
+ SwmTemplateData_UpdateOn,
+ SwmTemplateData_UpdateBy,
+ SwmTemplateData_UpdateHost,
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static readonly int tableCount = 18;
+ private static readonly int columnCount = 374;
+ private static ulong maxTextLen = 0;
+
+ //-------------------------------------------------------------------
+ // Retrieve Table details (eg. name: 'Company').
+ public static int GetTableCount ()
+ {
+ return tableCount;
+ }
+ public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
+ {
+ int tableIdx = (int)table - 1;
+ if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
+ String tableName = tables[(int)tableIdx];
+ if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
+ return tableName;
+ }
+
+ //-------------------------------------------------------------------
+ // Identify the table that corresponds with the specified column.
+ public static TableIdx GetTableForColumn (ColumnIdx column)
+ {
+ int columnIdx = (int)column - 1;
+ if (columnIdx < 0 || columnIdx >= columnCount) return TableIdx.Unknown;
+ return columns[columnIdx].TableIdx;
+ }
+
+ //-------------------------------------------------------------------
+ // Retrieve the specified Column's name (Qualified include table name: '(
.Column>)').
+ public static String GetColumnName (ColumnIdx column, bool delimitReservedWords = true)
+ {
+ int columnIdx = (int)column - 1;
+ if (columnIdx < 0 || columnIdx >= columnCount) return String.Empty;
+ String columnName = columns[columnIdx].Name;
+ if (delimitReservedWords) columnName = DelimitReservedWord(columnName);
+ return columnName;
+ }
+ public static String GetColumnNameQual (ColumnIdx column, String tableAlias = "", bool braces = false)
+ {
+ String columnName = GetColumnName(column);
+ if (!String.IsNullOrEmpty(columnName))
+ {
+ String tableName = StringUtil.EmptyOnNull(tableAlias);
+ if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
+ columnName = tableName + (tableName.Length > 0 ? "." : "") + columnName;
+ if (braces)
+ columnName = "(" + columnName + ")";
+ }
+ return columnName;
+ }
+
+ //-------------------------------------------------------------------
+ // Reserved words.
+ private static DbReservedWordDelim reservedWordDelim = DbReservedWordDelim.SquareBrackets;
+ public static void SetReservedWordDelim (DbReservedWordDelim reservedWordDelim)
+ {
+ SpmDbDfn.reservedWordDelim = reservedWordDelim;
+ }
+ public static bool IsReservedWord (String word)
+ {
+ if (String.IsNullOrEmpty(word)) return false;
+ if (reservedWords.Contains(word, StringComparer.OrdinalIgnoreCase)) return true;
+ return false;
+ }
+ public static String DelimitReservedWord (String word)
+ {
+ if (!IsReservedWord(word)) return word;
+ switch (reservedWordDelim)
+ {
+ case DbReservedWordDelim.None:
+ break;
+ case DbReservedWordDelim.DoubleQuotes:
+ word = "\"" + word + "\"";
+ break;
+ case DbReservedWordDelim.SquareBrackets:
+ default:
+ word = "[" + word + "]";
+ break;
+ }
+ return word;
+ }
+
+ //-------------------------------------------------------------------
+ // Retrieve information about the specified Column.
+ public static DbColumnDataType GetColDataType (ColumnIdx column)
+ {
+ int columnIdx = (int)column - 1;
+ if (columnIdx < 0 || columnIdx >= columnCount) return DbColumnDataType.Unknown;
+ return columns[columnIdx].DataType;
+ }
+ public static short GetColNativeDataType (ColumnIdx column)
+ {
+ int columnIdx = (int)column - 1;
+ if (columnIdx < 0 || columnIdx >= columnCount) return 0;
+ return columns[columnIdx].NativeDataType;
+ }
+ public static void SetMaxTextLen (ulong maxTextLen)
+ {
+ SpmDbDfn.maxTextLen = maxTextLen;
+ }
+ public static bool IsColFmtText (ColumnIdx column)
+ {
+ int columnIdx = (int)column - 1;
+ if (columnIdx < 0 || columnIdx >= columnCount) return false;
+ return (columns[columnIdx].DataType == DbColumnDataType.VarChar);
+ }
+ public static ulong GetColTextLen (ColumnIdx column)
+ {
+ int columnIdx = (int)column - 1;
+ if (columnIdx < 0 || columnIdx >= columnCount) return 0;
+ if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
+ {
+ ulong textLen = columns[columnIdx].DataLen;
+ if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;
+ return textLen;
+ }
+ return 0;
+ }
+ public static bool IsColFmtBool (ColumnIdx column)
+ {
+ int columnIdx = (int)column - 1;
+ if (columnIdx < 0 || columnIdx >= columnCount) return false;
+ return (columns[columnIdx].DataType == DbColumnDataType.Bit);
+ }
+ public static bool IsColFmtNumeric (ColumnIdx column)
+ {
+ int columnIdx = (int)column - 1;
+ if (columnIdx < 0 || columnIdx >= columnCount) return false;
+ switch (columns[columnIdx].DataType)
+ {
+ case DbColumnDataType.TinyInt:
+ case DbColumnDataType.SmallInt:
+ case DbColumnDataType.Int:
+ case DbColumnDataType.BigInt:
+ case DbColumnDataType.Single:
+ case DbColumnDataType.Double:
+ case DbColumnDataType.Decimal:
+ return true;
+ }
+ return false;
+ }
+
+ //-------------------------------------------------------------------
+ // Table definitions.
+ private static readonly String[] tables =
+ {
+ "IndexDefragLog",
+ "SaItemNamedValue",
+ "SwmAdmission",
+ "SwmAdmissionAction",
+ "SwmAdmissionData",
+ "SwmAdmissionRole",
+ "SwmDepartment",
+ "SwmDepartmentCode",
+ "SwmEmployee",
+ "SwmEmployeeRole",
+ "SwmFacility",
+ "SwmFacilitySession",
+ "SwmFacilityTemplate",
+ "SwmInstitution",
+ "SwmOperation",
+ "SwmPatient",
+ "SwmProcedure",
+ "SwmTemplateData",
+ };
+
+ //-------------------------------------------------------------------
+ // Table column definitions.
+ internal class ColumnDfn
+ {
+ internal TableIdx TableIdx { get; set; }
+ internal String Name { get; set; }
+ internal DbColumnDataType DataType { get; set; }
+ internal short NativeDataType { get; set; }
+ internal bool IsIdentity { get; set; }
+ internal ulong DataLen { get; set; }
+ internal ColumnDfn (int tableIdx, String name, int dataType, short nativeDataType, bool isIdentity, ulong dataLen)
+ {
+ this.TableIdx = (TableIdx)tableIdx;
+ this.Name = name;
+ this.DataType = (DbColumnDataType)dataType;
+ this.NativeDataType = nativeDataType;
+ this.IsIdentity = isIdentity;
+ this.DataLen = dataLen;
+ }
+ }
+
+ //-------------------------------------------------------------------
+ private static readonly ColumnDfn[] columns =
+ {
+ new ColumnDfn(1,"IndexDefragId",4,4,true,10),
+ new ColumnDfn(1,"DatabaseID",4,4,false,10),
+ new ColumnDfn(1,"DatabaseName",0,-9,false,128),
+ new ColumnDfn(1,"ObjectID",4,4,false,10),
+ new ColumnDfn(1,"ObjectName",0,-9,false,128),
+ new ColumnDfn(1,"IndexID",4,4,false,10),
+ new ColumnDfn(1,"IndexName",0,-9,false,128),
+ new ColumnDfn(1,"PartitionNumber",3,5,false,5),
+ new ColumnDfn(1,"Fragmentation",7,6,false,53),
+ new ColumnDfn(1,"PageCount",4,4,false,10),
+ new ColumnDfn(1,"DateTimeStart",9,93,false,23),
+ new ColumnDfn(1,"DurationSeconds",4,4,false,10),
+ new ColumnDfn(2,"ItemType",3,5,false,5),
+ new ColumnDfn(2,"ItemId",4,4,false,10),
+ new ColumnDfn(2,"Name",0,-9,false,64),
+ new ColumnDfn(2,"Seq",3,5,false,5),
+ new ColumnDfn(2,"Value",0,-9,false,255),
+ new ColumnDfn(2,"Notes",0,-9,false,255),
+ new ColumnDfn(2,"Flags",3,5,false,5),
+ new ColumnDfn(2,"Status",0,-9,false,3),
+ new ColumnDfn(2,"CreateOn",9,93,false,23),
+ new ColumnDfn(2,"CreateBy",4,4,false,10),
+ new ColumnDfn(2,"CreateHost",0,-9,false,64),
+ new ColumnDfn(2,"UpdateOn",9,93,false,23),
+ new ColumnDfn(2,"UpdateBy",4,4,false,10),
+ new ColumnDfn(2,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(3,"Id",4,4,false,10),
+ new ColumnDfn(3,"FacilityId",4,4,false,10),
+ new ColumnDfn(3,"FacilityTemplateId",4,4,false,10),
+ new ColumnDfn(3,"AdmissionFrom",9,93,false,23),
+ new ColumnDfn(3,"AdmissionTo",9,93,false,23),
+ new ColumnDfn(3,"DecisionToReferOn",9,93,false,23),
+ new ColumnDfn(3,"ReferredOn",9,93,false,23),
+ new ColumnDfn(3,"BreechOn",9,93,false,23),
+ new ColumnDfn(3,"DecisionToAdmitOn",9,93,false,23),
+ new ColumnDfn(3,"PreAssessment",9,93,false,23),
+ new ColumnDfn(3,"ToComeIn",9,93,false,23),
+ new ColumnDfn(3,"Seq",2,-6,false,3),
+ new ColumnDfn(3,"Type",3,5,false,5),
+ new ColumnDfn(3,"Occupancy",3,5,false,5),
+ new ColumnDfn(3,"PatientId",4,4,false,10),
+ new ColumnDfn(3,"PatientNo",0,12,false,12),
+ new ColumnDfn(3,"NhsNumber",0,12,false,16),
+ new ColumnDfn(3,"Title",0,-9,false,12),
+ new ColumnDfn(3,"Surname",0,-9,false,50),
+ new ColumnDfn(3,"Forename",0,-9,false,50),
+ new ColumnDfn(3,"Gender",3,5,false,5),
+ new ColumnDfn(3,"BirthOn",4,4,false,10),
+ new ColumnDfn(3,"Age",0,12,false,3),
+ new ColumnDfn(3,"AgeOn",9,93,false,23),
+ new ColumnDfn(3,"PhoneMobile",0,12,false,32),
+ new ColumnDfn(3,"Email",0,12,false,64),
+ new ColumnDfn(3,"ContactFlags",3,5,false,5),
+ new ColumnDfn(3,"SystemRef",0,12,false,16),
+ new ColumnDfn(3,"AttendanceType",3,5,false,5),
+ new ColumnDfn(3,"AttendanceStatus",0,-9,false,3),
+ new ColumnDfn(3,"FacilityIdWard",4,4,false,10),
+ new ColumnDfn(3,"Ward",0,-9,false,12),
+ new ColumnDfn(3,"SpecialityCode",0,-9,false,12),
+ new ColumnDfn(3,"ProcedureId",4,4,false,10),
+ new ColumnDfn(3,"ProcedureCode",0,-9,false,12),
+ new ColumnDfn(3,"ProcedureDesc",0,-9,false,255),
+ new ColumnDfn(3,"ComplexityCode",0,-9,false,12),
+ new ColumnDfn(3,"ProcedureIndication",0,-9,false,64),
+ new ColumnDfn(3,"PatientHistory",0,-9,false,32),
+ new ColumnDfn(3,"GestationPeriod",0,-9,false,32),
+ new ColumnDfn(3,"DurationExp",3,5,false,5),
+ new ColumnDfn(3,"DurationAct",3,5,false,5),
+ new ColumnDfn(3,"UnitsExp",6,7,false,24),
+ new ColumnDfn(3,"UnitsAct",6,7,false,24),
+ new ColumnDfn(3,"Anaesthetic",0,-9,false,3),
+ new ColumnDfn(3,"Position",0,-9,false,12),
+ new ColumnDfn(3,"SpecialEquipment",0,-9,false,50),
+ new ColumnDfn(3,"ComfortScore",0,-9,false,12),
+ new ColumnDfn(3,"TimeCalled",9,93,false,23),
+ new ColumnDfn(3,"TimeArrived",9,93,false,23),
+ new ColumnDfn(3,"TimeAnaesStart",9,93,false,23),
+ new ColumnDfn(3,"TimeProcStart",9,93,false,23),
+ new ColumnDfn(3,"TimeProcEnd",9,93,false,23),
+ new ColumnDfn(3,"TimeInRecovery",9,93,false,23),
+ new ColumnDfn(3,"TimeInformDest",9,93,false,23),
+ new ColumnDfn(3,"TimeLeave",9,93,false,23),
+ new ColumnDfn(3,"CancelType",3,5,false,5),
+ new ColumnDfn(3,"CancelDate",9,93,false,23),
+ new ColumnDfn(3,"CancelCount",3,5,false,5),
+ new ColumnDfn(3,"CancelCode",0,-9,false,20),
+ new ColumnDfn(3,"CancelReason",0,-9,false,255),
+ new ColumnDfn(3,"Notes",0,-9,false,255),
+ new ColumnDfn(3,"Flags",3,5,false,5),
+ new ColumnDfn(3,"Status",0,12,false,3),
+ new ColumnDfn(3,"CreateOn",9,93,false,23),
+ new ColumnDfn(3,"CreateBy",4,4,false,10),
+ new ColumnDfn(3,"CreateHost",0,12,false,64),
+ new ColumnDfn(3,"UpdateOn",9,93,false,23),
+ new ColumnDfn(3,"UpdateBy",4,4,false,10),
+ new ColumnDfn(3,"UpdateHost",0,12,false,64),
+ new ColumnDfn(3,"DecisionToRefer",9,93,false,23),
+ new ColumnDfn(3,"Referred",9,93,false,23),
+ new ColumnDfn(4,"Id",4,4,false,10),
+ new ColumnDfn(4,"AdmissionId",4,4,false,10),
+ new ColumnDfn(4,"Type",3,5,false,5),
+ new ColumnDfn(4,"Raised",9,93,false,23),
+ new ColumnDfn(4,"EmployeeIdRaised",4,4,false,10),
+ new ColumnDfn(4,"Completed",9,93,false,23),
+ new ColumnDfn(4,"EmployeeIdCompleted",4,4,false,10),
+ new ColumnDfn(4,"ActionData",0,12,false,255),
+ new ColumnDfn(4,"Notes",0,-9,false,255),
+ new ColumnDfn(4,"Flags",3,5,false,5),
+ new ColumnDfn(4,"Status",0,12,false,3),
+ new ColumnDfn(4,"CreateOn",9,93,false,23),
+ new ColumnDfn(4,"CreateBy",4,4,false,10),
+ new ColumnDfn(4,"CreateHost",0,12,false,64),
+ new ColumnDfn(4,"UpdateOn",9,93,false,23),
+ new ColumnDfn(4,"UpdateBy",4,4,false,10),
+ new ColumnDfn(4,"UpdateHost",0,12,false,64),
+ new ColumnDfn(5,"AdmissionId",4,4,false,10),
+ new ColumnDfn(5,"Type",3,5,false,5),
+ new ColumnDfn(5,"Data",0,12,false,255),
+ new ColumnDfn(5,"Notes",0,-9,false,255),
+ new ColumnDfn(5,"Flags",3,5,false,5),
+ new ColumnDfn(5,"Status",0,12,false,3),
+ new ColumnDfn(5,"CreateOn",9,93,false,23),
+ new ColumnDfn(5,"CreateBy",4,4,false,10),
+ new ColumnDfn(5,"CreateHost",0,12,false,64),
+ new ColumnDfn(5,"UpdateOn",9,93,false,23),
+ new ColumnDfn(5,"UpdateBy",4,4,false,10),
+ new ColumnDfn(5,"UpdateHost",0,12,false,64),
+ new ColumnDfn(6,"AdmissionId",4,4,false,10),
+ new ColumnDfn(6,"Role",3,5,false,5),
+ new ColumnDfn(6,"Seq",3,5,false,5),
+ new ColumnDfn(6,"EmployeeRoleId",4,4,false,10),
+ new ColumnDfn(6,"EmployeeCode",0,12,false,12),
+ new ColumnDfn(6,"Category",3,5,false,5),
+ new ColumnDfn(6,"Notes",0,-9,false,255),
+ new ColumnDfn(6,"Flags",3,5,false,5),
+ new ColumnDfn(6,"Status",0,12,false,3),
+ new ColumnDfn(6,"CreateOn",9,93,false,23),
+ new ColumnDfn(6,"CreateBy",4,4,false,10),
+ new ColumnDfn(6,"CreateHost",0,12,false,64),
+ new ColumnDfn(6,"UpdateOn",9,93,false,23),
+ new ColumnDfn(6,"UpdateBy",4,4,false,10),
+ new ColumnDfn(6,"UpdateHost",0,12,false,64),
+ new ColumnDfn(7,"Id",4,4,false,10),
+ new ColumnDfn(7,"InstitutionId",4,4,false,10),
+ new ColumnDfn(7,"Name",0,-9,false,60),
+ new ColumnDfn(7,"FacilityTypes",4,4,false,10),
+ new ColumnDfn(7,"AllowAnyFacility",4,4,false,10),
+ new ColumnDfn(7,"CancellReBookLimit",0,-9,false,50),
+ new ColumnDfn(7,"ApplicFrom",9,93,false,23),
+ new ColumnDfn(7,"ApplicTo",9,93,false,23),
+ new ColumnDfn(7,"Notes",0,-9,false,255),
+ new ColumnDfn(7,"Flags",3,5,false,5),
+ new ColumnDfn(7,"Status",0,-9,false,3),
+ new ColumnDfn(7,"CreateOn",9,93,false,23),
+ new ColumnDfn(7,"CreateBy",4,4,false,10),
+ new ColumnDfn(7,"CreateHost",0,-9,false,64),
+ new ColumnDfn(7,"UpdateOn",9,93,false,23),
+ new ColumnDfn(7,"UpdateBy",4,4,false,10),
+ new ColumnDfn(7,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(8,"Id",4,4,false,10),
+ new ColumnDfn(8,"DepartmentId",4,4,false,10),
+ new ColumnDfn(8,"CodeType",3,5,false,5),
+ new ColumnDfn(8,"Code",0,-9,false,16),
+ new ColumnDfn(8,"Description",0,-9,false,64),
+ new ColumnDfn(8,"Notes",0,-9,false,255),
+ new ColumnDfn(8,"Flags",3,5,false,5),
+ new ColumnDfn(8,"Status",0,-9,false,3),
+ new ColumnDfn(8,"CreateOn",9,93,false,23),
+ new ColumnDfn(8,"CreateBy",4,4,false,10),
+ new ColumnDfn(8,"CreateHost",0,-9,false,64),
+ new ColumnDfn(8,"UpdateOn",9,93,false,23),
+ new ColumnDfn(8,"UpdateBy",4,4,false,10),
+ new ColumnDfn(8,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(9,"Id",4,4,false,10),
+ new ColumnDfn(9,"InstitutionId",4,4,false,10),
+ new ColumnDfn(9,"EmployeeNo",0,-9,false,12),
+ new ColumnDfn(9,"Code",0,-9,false,12),
+ new ColumnDfn(9,"Initials",0,-9,false,6),
+ new ColumnDfn(9,"Title",0,-9,false,12),
+ new ColumnDfn(9,"Surname",0,-9,false,50),
+ new ColumnDfn(9,"Forename",0,-9,false,50),
+ new ColumnDfn(9,"Notes",0,-9,false,255),
+ new ColumnDfn(9,"Flags",3,5,false,5),
+ new ColumnDfn(9,"Status",0,-9,false,3),
+ new ColumnDfn(9,"CreateOn",9,93,false,23),
+ new ColumnDfn(9,"CreateBy",4,4,false,10),
+ new ColumnDfn(9,"CreateHost",0,-9,false,64),
+ new ColumnDfn(9,"UpdateOn",9,93,false,23),
+ new ColumnDfn(9,"UpdateBy",4,4,false,10),
+ new ColumnDfn(9,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(10,"Id",4,4,false,10),
+ new ColumnDfn(10,"DepartmentId",4,4,false,10),
+ new ColumnDfn(10,"EmployeeId",4,4,false,10),
+ new ColumnDfn(10,"Role",3,5,false,5),
+ new ColumnDfn(10,"ApplicFrom",9,93,false,23),
+ new ColumnDfn(10,"ApplicTo",9,93,false,23),
+ new ColumnDfn(10,"Notes",0,-9,false,255),
+ new ColumnDfn(10,"Flags",3,5,false,5),
+ new ColumnDfn(10,"Status",0,-9,false,3),
+ new ColumnDfn(10,"CreateOn",9,93,false,23),
+ new ColumnDfn(10,"CreateBy",4,4,false,10),
+ new ColumnDfn(10,"CreateHost",0,-9,false,64),
+ new ColumnDfn(10,"UpdateOn",9,93,false,23),
+ new ColumnDfn(10,"UpdateBy",4,4,false,10),
+ new ColumnDfn(10,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(11,"Id",4,4,false,10),
+ new ColumnDfn(11,"DepartmentId",4,4,false,10),
+ new ColumnDfn(11,"Type",3,5,false,5),
+ new ColumnDfn(11,"Name",0,-9,false,16),
+ new ColumnDfn(11,"SortCode",0,-9,false,16),
+ new ColumnDfn(11,"Description",0,-9,false,64),
+ new ColumnDfn(11,"TemplateMapType",3,5,false,5),
+ new ColumnDfn(11,"TemplateMapFrom",9,93,false,23),
+ new ColumnDfn(11,"ScheduleFreezeType",3,5,false,5),
+ new ColumnDfn(11,"ScheduleFreezeData",0,-9,false,50),
+ new ColumnDfn(11,"ApplicFrom",9,93,false,23),
+ new ColumnDfn(11,"ApplicTo",9,93,false,23),
+ new ColumnDfn(11,"Notes",0,-9,false,255),
+ new ColumnDfn(11,"Flags",3,5,false,5),
+ new ColumnDfn(11,"Status",0,-9,false,3),
+ new ColumnDfn(11,"CreateOn",9,93,false,23),
+ new ColumnDfn(11,"CreateBy",4,4,false,10),
+ new ColumnDfn(11,"CreateHost",0,-9,false,64),
+ new ColumnDfn(11,"UpdateOn",9,93,false,23),
+ new ColumnDfn(11,"UpdateBy",4,4,false,10),
+ new ColumnDfn(11,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(12,"FacilityId",4,4,false,10),
+ new ColumnDfn(12,"FacilityTemplateId",4,4,false,10),
+ new ColumnDfn(12,"Session",9,93,false,23),
+ new ColumnDfn(12,"Type",3,5,false,5),
+ new ColumnDfn(12,"Name",0,-9,false,32),
+ new ColumnDfn(12,"Description",0,-9,false,255),
+ new ColumnDfn(12,"SessionCode",0,12,false,32),
+ new ColumnDfn(12,"StartAt",9,93,false,23),
+ new ColumnDfn(12,"FinishAt",9,93,false,23),
+ new ColumnDfn(12,"ConsultantId",4,4,false,10),
+ new ColumnDfn(12,"ConsultantCode",0,-9,false,12),
+ new ColumnDfn(12,"SpecialityCode",0,-9,false,12),
+ new ColumnDfn(12,"CapacityType",3,5,false,5),
+ new ColumnDfn(12,"CapacityMin",3,5,false,5),
+ new ColumnDfn(12,"CapacityMax",3,5,false,5),
+ new ColumnDfn(12,"DurationInterval",3,5,false,5),
+ new ColumnDfn(12,"DurationMin",3,5,false,5),
+ new ColumnDfn(12,"DurationMax",3,5,false,5),
+ new ColumnDfn(12,"DurationBreaks",3,5,false,5),
+ new ColumnDfn(12,"UnitsExp",6,7,false,24),
+ new ColumnDfn(12,"BookingsProhibited_ResourceGroups",0,12,false,1024),
+ new ColumnDfn(12,"Overrides",3,5,false,5),
+ new ColumnDfn(12,"Notes",0,-9,false,255),
+ new ColumnDfn(12,"Flags",3,5,false,5),
+ new ColumnDfn(12,"Status",0,12,false,3),
+ new ColumnDfn(12,"CreateOn",9,93,false,23),
+ new ColumnDfn(12,"CreateBy",4,4,false,10),
+ new ColumnDfn(12,"CreateHost",0,-9,false,64),
+ new ColumnDfn(12,"UpdateOn",9,93,false,23),
+ new ColumnDfn(12,"UpdateBy",4,4,false,10),
+ new ColumnDfn(12,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(13,"Id",4,4,false,10),
+ new ColumnDfn(13,"FacilityId",4,4,false,10),
+ new ColumnDfn(13,"Category",3,5,false,5),
+ new ColumnDfn(13,"Type",3,5,false,5),
+ new ColumnDfn(13,"Group",0,-9,false,16),
+ new ColumnDfn(13,"Name",0,-9,false,32),
+ new ColumnDfn(13,"SortCode",0,-9,false,16),
+ new ColumnDfn(13,"Description",0,-9,false,255),
+ new ColumnDfn(13,"SessionCode",0,12,false,32),
+ new ColumnDfn(13,"TemplateMapType",3,5,false,5),
+ new ColumnDfn(13,"TemplateMapFrom",9,93,false,23),
+ new ColumnDfn(13,"WeekOfMonth",3,5,false,5),
+ new ColumnDfn(13,"DayOfWeek",3,5,false,5),
+ new ColumnDfn(13,"StartAt",9,93,false,23),
+ new ColumnDfn(13,"FinishAt",9,93,false,23),
+ new ColumnDfn(13,"ConsultantId",4,4,false,10),
+ new ColumnDfn(13,"ConsultantCode",0,-9,false,12),
+ new ColumnDfn(13,"SpecialityCode",0,-9,false,12),
+ new ColumnDfn(13,"CapacityType",3,5,false,5),
+ new ColumnDfn(13,"CapacityMin",3,5,false,5),
+ new ColumnDfn(13,"CapacityMax",3,5,false,5),
+ new ColumnDfn(13,"DurationInterval",3,5,false,5),
+ new ColumnDfn(13,"DurationMin",3,5,false,5),
+ new ColumnDfn(13,"DurationMax",3,5,false,5),
+ new ColumnDfn(13,"DurationBreaks",3,5,false,5),
+ new ColumnDfn(13,"UnitsExp",6,7,false,24),
+ new ColumnDfn(13,"ApplicFrom",9,93,false,23),
+ new ColumnDfn(13,"ApplicTo",9,93,false,23),
+ new ColumnDfn(13,"Notes",0,-9,false,255),
+ new ColumnDfn(13,"Flags",3,5,false,5),
+ new ColumnDfn(13,"Status",0,12,false,3),
+ new ColumnDfn(13,"CreateOn",9,93,false,23),
+ new ColumnDfn(13,"CreateBy",4,4,false,10),
+ new ColumnDfn(13,"CreateHost",0,-9,false,64),
+ new ColumnDfn(13,"UpdateOn",9,93,false,23),
+ new ColumnDfn(13,"UpdateBy",4,4,false,10),
+ new ColumnDfn(13,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(14,"Id",4,4,false,10),
+ new ColumnDfn(14,"Name",0,-9,false,60),
+ new ColumnDfn(14,"Notes",0,-9,false,255),
+ new ColumnDfn(14,"Flags",3,5,false,5),
+ new ColumnDfn(14,"Status",0,-9,false,3),
+ new ColumnDfn(14,"CreateOn",9,93,false,23),
+ new ColumnDfn(14,"CreateBy",4,4,false,10),
+ new ColumnDfn(14,"CreateHost",0,-9,false,64),
+ new ColumnDfn(14,"UpdateOn",9,93,false,23),
+ new ColumnDfn(14,"UpdateBy",4,4,false,10),
+ new ColumnDfn(14,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(15,"Id",4,4,false,10),
+ new ColumnDfn(15,"InstitutionId",4,4,false,10),
+ new ColumnDfn(15,"Code",0,-9,false,20),
+ new ColumnDfn(15,"Description",0,-9,false,255),
+ new ColumnDfn(15,"Notes",0,-9,false,255),
+ new ColumnDfn(15,"Flags",3,5,false,5),
+ new ColumnDfn(15,"Status",0,-9,false,3),
+ new ColumnDfn(15,"CreateOn",9,93,false,23),
+ new ColumnDfn(15,"CreateBy",4,4,false,10),
+ new ColumnDfn(15,"CreateHost",0,-9,false,64),
+ new ColumnDfn(15,"UpdateOn",9,93,false,23),
+ new ColumnDfn(15,"UpdateBy",4,4,false,10),
+ new ColumnDfn(15,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(16,"Id",4,4,false,10),
+ new ColumnDfn(16,"InstitutionId",4,4,false,10),
+ new ColumnDfn(16,"PatientNo",0,-9,false,12),
+ new ColumnDfn(16,"NhsNumber",0,-9,false,16),
+ new ColumnDfn(16,"Title",0,-9,false,12),
+ new ColumnDfn(16,"Surname",0,-9,false,50),
+ new ColumnDfn(16,"Forename",0,-9,false,50),
+ new ColumnDfn(16,"Gender",3,5,false,5),
+ new ColumnDfn(16,"BirthOn",4,4,false,10),
+ new ColumnDfn(16,"Age",0,-9,false,3),
+ new ColumnDfn(16,"AgeOn",9,93,false,23),
+ new ColumnDfn(16,"PhoneMobile",0,-9,false,32),
+ new ColumnDfn(16,"Email",0,-9,false,64),
+ new ColumnDfn(16,"Notes",0,-9,false,255),
+ new ColumnDfn(16,"Flags",3,5,false,5),
+ new ColumnDfn(16,"Status",0,-9,false,3),
+ new ColumnDfn(16,"CreateOn",9,93,false,23),
+ new ColumnDfn(16,"CreateBy",4,4,false,10),
+ new ColumnDfn(16,"CreateHost",0,-9,false,64),
+ new ColumnDfn(16,"UpdateOn",9,93,false,23),
+ new ColumnDfn(16,"UpdateBy",4,4,false,10),
+ new ColumnDfn(16,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(17,"Id",4,4,false,10),
+ new ColumnDfn(17,"DepartmentId",4,4,false,10),
+ new ColumnDfn(17,"OperationId",4,4,false,10),
+ new ColumnDfn(17,"OpnCode",0,-9,false,12),
+ new ColumnDfn(17,"Description",0,-9,false,255),
+ new ColumnDfn(17,"SpecialityCode",0,-9,false,12),
+ new ColumnDfn(17,"ComplexityCode",0,-9,false,12),
+ new ColumnDfn(17,"Duration",3,5,false,5),
+ new ColumnDfn(17,"Units",6,7,false,24),
+ new ColumnDfn(17,"Duration_Training",3,5,false,5),
+ new ColumnDfn(17,"Units_Training",6,7,false,24),
+ new ColumnDfn(17,"Notes",0,-9,false,255),
+ new ColumnDfn(17,"Flags",3,5,false,5),
+ new ColumnDfn(17,"Status",0,-9,false,3),
+ new ColumnDfn(17,"CreateOn",9,93,false,23),
+ new ColumnDfn(17,"CreateBy",4,4,false,10),
+ new ColumnDfn(17,"CreateHost",0,-9,false,64),
+ new ColumnDfn(17,"UpdateOn",9,93,false,23),
+ new ColumnDfn(17,"UpdateBy",4,4,false,10),
+ new ColumnDfn(17,"UpdateHost",0,-9,false,64),
+ new ColumnDfn(18,"FacilityTemplateId",4,4,false,10),
+ new ColumnDfn(18,"Type",3,5,false,5),
+ new ColumnDfn(18,"Seq",3,5,false,5),
+ new ColumnDfn(18,"Identifier",0,-9,false,50),
+ new ColumnDfn(18,"Value",0,-9,false,50),
+ new ColumnDfn(18,"Notes",0,-9,false,255),
+ new ColumnDfn(18,"Flags",3,5,false,5),
+ new ColumnDfn(18,"Status",0,-9,false,3),
+ new ColumnDfn(18,"CreateOn",9,93,false,23),
+ new ColumnDfn(18,"CreateBy",4,4,false,10),
+ new ColumnDfn(18,"CreateHost",0,-9,false,64),
+ new ColumnDfn(18,"UpdateOn",9,93,false,23),
+ new ColumnDfn(18,"UpdateBy",4,4,false,10),
+ new ColumnDfn(18,"UpdateHost",0,-9,false,64),
+ };
+
+ //-------------------------------------------------------------------
+ // Reserved words.
+ private static readonly List reservedWords = new List()
+ {
+ "ADD",
+ "ALL",
+ "ALTER",
+ "AND",
+ "ANY",
+ "AS",
+ "ASC",
+ "AVG",
+ "BEGIN",
+ "BETWEEN",
+ "BY",
+ "CASE",
+ "CAST",
+ "COLUMN",
+ "COMMIT",
+ "CONSTRAINT",
+ "CONVERT",
+ "COUNT",
+ "CREATE",
+ "CURRENCY",
+ "DEFAULT",
+ "DELETE",
+ "DESC",
+ "DISTINCT",
+ "DROP",
+ "ELSE",
+ "END",
+ "EXECUTE",
+ "EXISTS",
+ "FALSE",
+ "FROM",
+ "GRANT",
+ "GROUP",
+ "HAVING",
+ "IN",
+ "INDEX",
+ "INNER",
+ "INSERT",
+ "INTO",
+ "IS",
+ "JOIN",
+ "KEY",
+ "LEFT",
+ "LIKE",
+ "MAX",
+ "MIN",
+ "NOT",
+ "NULL",
+ "ON",
+ "OR",
+ "ORDER",
+ "OUTER",
+ "OUTPUT",
+ "PRIMARY",
+ "PROCEDURE",
+ "REVOKE",
+ "ROLLBACK",
+ "ROWCOUNT",
+ "SELECT",
+ "SET",
+ "SQL",
+ "SUM",
+ "TABLE",
+ "THEN",
+ "TRANSACTION",
+ "TRUE",
+ "UNION",
+ "UNIQUE",
+ "UPDATE",
+ "USER",
+ "VALUES",
+ "VIEW",
+ "WHEN",
+ "WHERE",
+ };
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrCore/Core/App/SpmDfn.cs b/SaPatMgrCore/Core/App/SpmDfn.cs
index 172ffc2..3dec0c2 100644
--- a/SaPatMgrCore/Core/App/SpmDfn.cs
+++ b/SaPatMgrCore/Core/App/SpmDfn.cs
@@ -1,4 +1,5 @@
-using System;
+using Sarand.Core.Base;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -16,13 +17,17 @@ namespace Sarand.PatientMgr.Core.App
//-------------------------------------------------------------------
// Constants.
public static readonly String ApplicationCaption = "Sarand PatientMgr";
+ // System defaults.
+ public static int Default_UpdateLimitDaysInPast { get; } = 7;
+ public static int Default_UpdateLimitDaysInPast_Min { get; } = 1;
+ public static int Default_UpdateLimitDaysInPast_Max { get; } = 60;
//-------------------------------------------------------------------
// Site. NB Only code should be used on database.
public enum Site
{
Unknown = 0,
- Addenbrookes = 10, /* 'ANT' */
+ ANT = 10, /* Addenbrookes */
}
//-------------------------------------------------------------------
@@ -32,8 +37,634 @@ namespace Sarand.PatientMgr.Core.App
Unknown = 0,
// General.
Site = 1,
+ DataItemType,
+ // Item options.
+ ItemOption,
+ ItemOptionContext_Flag,
+ ItemOptionContext_Value,
+ ItemOptionContext_CodeList,
+ ItemOptionContext_ScheduleColour,
+ ItemOptionContext_FieldLabel,
+ ItemOptionContext_ShowField,
+ ItemOptionContext_ExportField,
+ ItemOptionContext_AdmissionTiming,
+ ItemOptionContext_AdmValueList,
+ ItemOptionContext_CombineAdmNotes,
+ ItemOptionContext_CombinePatDetails,
+ ItemOptionContext_SessionUtilMeasure,
+ ItemOptionContext_SessionUtilisation,
+ ItemOptionContext_SessionUtilThreshold,
+ ItemOptionContext_ScheduleHighlight,
+ // Employees
+ EmployeeRole,
+ // Patient.
+ Gender,
+ PatientDataSource,
+ // Facilities.
+ FacilityType,
+ ScheduleType,
+ TemplateMapType,
+ SessionModel,
+ ScheduleFreezeType,
+ ResourceCategory,
+ //TemplateType, Not used directly.
+ TheatreSessionType, // Subset of TemplateType values.
+ ClinicSessionType, // Subset of TemplateType values.
+ WardResourceType, // Subset of TemplateType values.
+ ResourceCapacityType,
+ ResourceLoadingType,
+ TemplateDataType,
+ ProcedureComplexity,
+ // Admissions.
+ AdmissionOccupancy,
+ AdmissionActionType,
+ AdmissionCancelType,
+ AttendanceType,
+ AttendanceStatus,
+ WardPeriodLength,
+ WardResourceDisplay,
+ WardHighlighting,
+ // Reports.
+ ReportSpacing,
}
+ //-----------------------------------------------------------------------
+ // Code types - defined by the user.
+ public enum SystemCodeType
+ {
+ Unknown = 0,
+ Ward,
+ // Anaesthetic,
+ // OperationPosition,
+ ComfortScore,
+ };
+ public enum CodeType
+ {
+ Unknown = 0,
+ Anaesthetic,
+ OperationPosition,
+ OperatingSpeciality,
+ Allergy,
+ RiskFactor,
+ };
+
+ //-----------------------------------------------------------------------
+ // Data Item Types - identifiers the types of data items.
+ // NB Do not change the value associated with each item - these are tied to the database.
+ public enum DataItemType
+ {
+ Unknown = -1,
+ // Values are tied to the database - do not change.
+ Institution = 10,
+ Department = 11,
+ Facility = 20,
+ Employee = 21,
+ Patient = 22,
+ Operation = 23,
+ FacilityTemplate = 30,
+ TemplateSlot = 31,
+ FacilitySession = 32,
+ EmployeeRole = 33,
+ Procedure = 34,
+ Admission = 40,
+ AdmissionRole = 41,
+ // 'Virtual' item types - subsets of main item type.
+ /* Employee Roles of type 'Consultant'. */
+ RoleConsultant = 100,
+ /* Codes of type 'Speciality'. */
+ CodeSpeciality = 101,
+ // System data types.
+ SecItem = SaDataItemType.SecItem,
+ CodeType = SaDataItemType.CodeType,
+ Code = SaDataItemType.Code,
+ Interface = SaDataItemType.Interface,
+ ItemOption = SaDataItemType.ItemOption,
+ };
+ //-----------------------------------------------------------------------
+ // Item Configuration Options.
+ public enum ItemOptionType
+ {
+ Flag, // Discrete Yes/No values (tailored context list by item type).
+ Value, // Discrete values (tailored context list by item type).
+ CodeList, // Comma separated list of codes - tailored context list by item type.
+ SessionModel, // See defined list, eg. Maternity
+ ScheduleColour, // Schedule colour options.
+ FieldLabel, // Used to change default field label (eg. admission system ref)
+ Admission_DefaultProcedure, // Free text eg. 'Caesarian Section'
+ Admission_DefaultSpeciality, // Speciality code
+ Admission_DefaultComplexity, // Complexity code
+ Admission_DefaultWard, // Ward code
+ Admission_ValueList, // Comma separated list, eg. Procedure indications.
+ Admission_ShowField, // Used to identify optional fields to be shown in dialogs, views and reports.
+ Admission_ExportField, // Used to identify additional fields to export with schedule details.
+ Admission_AdmissionTiming, // Flag timing events that are to be recorded.
+ FilterAttrTypes, // To store user's filter sequence (system maintained).
+ Schedule_MinWeeks,
+ Schedule_CombineAdmNotes,
+ Schedule_CombinePatDetails,
+ Schedule_ReportAdmissionSpacing,
+ UpdateLimitDaysInPast,
+ SpecialityBackgroundColour,
+ SessionUtilMeasure,
+ SessionUtilisation,
+ SessionUtilThreshold,
+ ScheduleHighlight,
+ TheatreListTypeDisplay, // Associated types from SystemCodeTheatreSessionType codes.
+ ClinicListTypeDisplay, // Associated types from SystemCodeClinicSessionType codes.
+ AttendanceBorderColour,
+ };
+ // Discrete Flags - NB Default should always be 'No'.
+ public enum ItemOptionContext_Flag
+ {
+ // Configuration flag options.
+ Admission_AllowOverlappingTemplates, // Otherwise, Templates in each facility must have different times.
+ Admission_AllowMultiplePatientSessionBookings, // Otherwise, patient can only be booked once in a session.
+ Admission_GenerateChangeSessionMovement, // Auto store 'Moved' type cancellation for session change.
+ Admission_RecordTimings, // Show timimgs page on admission on and after day of admission.
+ Admission_AllowAdmissionDuplication, // Allow unassigned admissions to be duplicated against future sessions.
+ Template_AllowUnits, // Allow Units to be defined against Templates and entered against admissions.
+ };
+ // Discrete values.
+ public enum ItemOptionContext_Value
+ {
+ // Configuration value options.
+ ScheduleDisplayWeeks_Theatre,
+ ScheduleDisplayWeeks_Clinic,
+ ScheduleDisplayWeeks_Ward,
+ FacilityCapacity,
+ FacilityCapacity_Male,
+ FacilityCapacity_Female,
+ };
+ // Comma separated lists of codes.
+ public enum ItemOptionContext_CodeList
+ {
+ // Department configuration code lists.
+ WaitingListSpeciality_Include,
+ WaitingListSpeciality_Exclude,
+ };
+ // Fields whose labels can be specified
+ public enum ItemOptionContext_FieldLabel
+ {
+ Admission_SystemRef,
+ Admission_AttendingSurgeon,
+ };
+ // Admission fields that are optionally shown.
+ public enum ItemOptionContext_ShowField
+ {
+ Tci,
+ Gender,
+ PatientHistory,
+ BreechOn,
+ DecisionToAdmitOn,
+ SystemRef,
+ ReferringConsultant,
+ AttendingSurgeon,
+ ProcedureIndication,
+ Operation,
+ Position,
+ SpecialEquipment,
+ ComfortScore,
+ AttendanceType,
+ AttendanceStatus,
+ CancelTimeLimit,
+ CancelReason,
+ CancelNotes,
+ };
+ // Admission fields that are optionally Exported.
+ public enum ItemOptionContext_ExportField
+ {
+ OperatingConsultantCode,
+ OperatingSurgeonCode,
+ PatientNo,
+ PatientName,
+ PatientForename,
+ PatientSurname,
+ ProcedureIndication,
+ BreechOn,
+ DecisionToAdmitOn,
+ };
+ // Admission timings.
+ public enum ItemOptionContext_AdmissionTiming
+ {
+ Called,
+ Arrived,
+ AnaesStart,
+ ProcStart,
+ ProcEnd,
+ InRecovery,
+ InformDest,
+ Leave,
+ };
+ // Admission fields with default lists.
+ public enum ItemOptionContext_AdmValueList
+ {
+ ProcedureDesc,
+ ProcedureIndication,
+ Ward,
+ ComfortScore,
+ CancelReason,
+ ProcedureKit,
+ };
+ // Admission fields to combine with notes.
+ public enum ItemOptionContext_CombineAdmNotes
+ {
+ PatientHistory,
+ GestationPeriod,
+ BreechOn,
+ DecisionToAdmitOn,
+ ProcedureIndication,
+ };
+ // Admission fields to combine with patient details.
+ public enum ItemOptionContext_CombinePatDetails
+ {
+ SystemRef,
+ };
+ // Session utilisation options.
+ public enum ItemOptionContext_SessionUtilMeasure
+ {
+ Duration = 10,
+ Units = 20,
+ Default = Duration,
+ };
+ public enum ItemOptionContext_SessionUtilisation
+ {
+ BlankPatientNoIsReservedAdmission,
+ ExcludeReservedAdmissions,
+ IncludeSessionBreakDuration,
+ };
+ public enum ItemOptionContext_SessionUtilThreshold
+ {
+ SessionUtilThreshold_Low,
+ SessionUtilThreshold_High,
+ };
+ public enum ItemOptionContext_ScheduleHighlight
+ {
+ FacilityName,
+ SessionName,
+ };
+ public enum ItemOptionContext_ScheduleColour
+ {
+ SessionBackground,
+ };
+ //-----------------------------------------------------------------------
+ // Employee roles.
+ public enum EmployeeRole
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Consultant = 10,
+ Surgeon = 11,
+ Anaesthetist = 12,
+ };
+ // Employee role categories.
+ public enum EmployeeRoleCategory
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Operating = 10, // Surgeon/Consultant designated for operation.
+ Referring = 11, // Surgeon/Consultant referring the patient for procedure.
+ Attending = 12, // Surgeon/Consultant actually carrying out the procedure.
+ };
+ //-----------------------------------------------------------------------
+ // Patient definitions.
+ public enum Gender
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Female = 1,
+ Male = 2,
+ Unspecified = 9,
+ };
+ public enum PatientDataSource
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Patient = 10, // Internal tables.
+ Admission,
+ Demographics, // Interfaces.
+ WaitingList,
+ };
+ //-----------------------------------------------------------------------
+ // Facility type.
+ public enum FacilityType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Theatre = 10,
+ Clinic = 20,
+ Ward = 30,
+ Apparatus = 40,
+ };
+ // Schedule type.
+ public enum ScheduleType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Theatre = 10,
+ Clinic = 20,
+ Ward = 30,
+ };
+ //-----------------------------------------------------------------------
+ // Ward admission mode.
+ public enum WardAdmissionMode
+ {
+ Unknown = 0,
+ ByResource, // Booking against bed, chair etc.
+ ByWard, // Booking direct to ward (not specific resource).
+ };
+ // Ward Period length.
+ public enum WardPeriodLength
+ {
+ Unknown,
+ Week,
+ Weeks_2,
+ Weeks_4,
+ Weeks_6,
+ Weeks_8,
+ };
+ // Ward Resource display.
+ public enum WardResourceDisplay
+ {
+ Unknown,
+ Summary,
+ Narrow,
+ Standard,
+ Wide,
+ };
+ // Ward Highlighting.
+ public enum WardHighlighting
+ {
+ Unknown,
+ None,
+ Duration,
+ Gender,
+ ReferringCons,
+ Speciality,
+ };
+ //-----------------------------------------------------------------------
+ // Facility template map type.
+ public enum FacilityTemplateMapType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ None = 1,
+ RollingWeek = 10,
+ WeekdayInstanceInMonth = 11,
+ WorkingWeekInMonth = 12,
+ };
+ //-----------------------------------------------------------------------
+ // Template Session format.
+ public enum SessionModel
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Default = 1,
+ Standard = 10,
+ Maternity = 20,
+ };
+ //-----------------------------------------------------------------------
+ // Schedule Freeze type.
+ public enum ScheduleFreezeType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ None = 1,
+ FixedTimePreviousDay = 10,
+ };
+ //-----------------------------------------------------------------------
+ public enum ResourceCategory
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ TheatreList = 10,
+ ClinicList = 20,
+ WardResource = 30,
+ WardAdmissionList = 31,
+ WardDischargeList = 32,
+ };
+ public enum TemplateType
+ {
+ Unknown = -1,
+ // Values are tied to the database - do not change.
+ None = 0,
+ // Theatre template types.
+ TheatreSession_Service = 10,
+ TheatreSession_Training = 20,
+ // Clinic template types.
+ ClinicSession_Service = 10,
+ ClinicSession_Training = 20,
+ // Ward resource types.
+ WardResource_Bed = 10,
+ WardResource_Chair = 11,
+ WardResource_Bay = 20,
+ WardResource_Room = 21,
+ };
+ // Ward resource capacity types.
+ public enum ResourceCapacityTypeContext
+ {
+ WardResource,
+ ClinicSession,
+ };
+ public enum ResourceCapacityType
+ {
+ Unknown = -1,
+ // Values are tied to the database - do not change.
+ None = 0,
+ Single = 10,
+ Double = 20,
+ DoubleExclusive = 21, // Exclusive booking takes all slots.
+ Triple = 30,
+ TripleExclusive = 31,
+ Quadruple = 40,
+ QuadrupleExclusive = 41,
+ };
+ public enum ResourceLoadingType
+ {
+ Unknown = -1,
+ // Values are tied to the database - do not change.
+ None = 0,
+ Units = 10,
+ };
+ // Template associated Data Type.
+ public enum TemplateDataType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ ComplexityCapacity = 10,
+ };
+ //-----------------------------------------------------------------------
+ // Procedure complexity.
+ public enum ProcedureComplexity
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Minor = 10,
+ Intermediate = 20,
+ Major = 30,
+ };
+ //-----------------------------------------------------------------------
+ // Admission type.
+ public enum AdmissionType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ TheatreDayCase = 10,
+ TheatreInPatientElective = 12,
+ TheatreEmergency = 13,
+ ClinicBooking = 20,
+ WardAdmission = 30,
+ WardReservation = 39,
+ };
+ //-----------------------------------------------------------------------
+ // Admission Occupancy.
+ public enum AdmissionOccupancy
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Single = 10,
+ Exclusive = 11,
+ };
+ //-----------------------------------------------------------------------
+ // Admission Data type.
+ public enum AdmissionDataType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Allergy = 10,
+ RiskFactor = 11,
+ ProcedureKit = 20, // Added Apr2014. Add code & Caption to AdmissionData table.
+ };
+ //-----------------------------------------------------------------------
+ // Admission Action type.
+ public enum AdmissionActionType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ SendLetter = 10,
+ RepeatAdmission = 20,
+ ArrangeTransport = 30,
+ Filing = 40,
+ Prescription = 50,
+ General = 990,
+ };
+ //-----------------------------------------------------------------------
+ // Attendance Type.
+ public enum AttendanceType
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ OutPatient = 10,
+ InPatient = 20,
+ };
+ //-----------------------------------------------------------------------
+ // Attendance status.
+ public enum AttendanceStatus
+ {
+ Unknown = 0,
+ // Values are tied to the database - do not change.
+ Arrived = 10,
+ Discharged = 15,
+ Cancelled = 20,
+ Dna = 30,
+ };
+ //-----------------------------------------------------------------------
+ // Admission cancellation type.
+ public enum AdmissionCancelType
+ {
+ // Anything other than 'None' ('0').
+ Cancelled = -2,
+ Unknown = -1,
+ // Values are tied to the database - do not change.
+ None = 0,
+ CancelTimeLimit = 10,
+ CancelOther = 11,
+ Deletion = 12,
+ ChangeSession = 20,
+ };
+ //-----------------------------------------------------------------------
+ // Security Rights.
+ public enum SecurityRight
+ {
+ ManageSecurity,
+ ManageConfig,
+ ManageDb,
+ // Security rights associated with specific department.
+ DepartmentView,
+ DepartmentReserve,
+ DepartmentUpdate,
+ DepartmentConfig,
+ // Security rights associated with specific consultant.
+ ConsultantView,
+ ConsultantUpdate,
+ // Security rights associated with specific speciality.
+ SpecialityView,
+ SpecialityUpdate,
+ };
+ //-----------------------------------------------------------------------
+ // List controls.
+ public enum ListCtrl
+ {
+ Cancellations = 140,
+ };
+ //-----------------------------------------------------------------------
+ // Spacing for reports.
+ public enum ReportSpacing
+ {
+ Narrow,
+ Standard,
+ Wide,
+ };
+ //-----------------------------------------------------------------------
+ // Schedule display.
+ // Text justification.
+ public enum Justification
+ {
+ Left,
+ Center,
+ Right
+ };
+ // Display columns.
+ public enum DisplayColumn
+ {
+ Ref,
+ Period,
+ Facility,
+ Patient, // Summary - number and name.
+ PatientNo,
+ PatientName,
+ PatientDob,
+ PatientAge,
+ PatientHistory,
+ GestationPeriod,
+ Ward,
+ Consultant,
+ Surgeon,
+ Procedure,
+ SpecialEquipment,
+ Time,
+ Anaesthetic,
+ Position,
+ Kit,
+ HasRisk,
+ Notes,
+ LastUpdate
+ };
+ // Display font sizes.
+ public enum DisplayFont
+ {
+ Standard,
+ Medium,
+ Large
+ };
+ // Display boundaries.
+ public enum DisplayBoundary
+ {
+ Period,
+ Session,
+ Admission
+ };
+ //-----------------------------------------------------------------------
+
//-------------------------------------------------------------------
}
//=======================================================================
diff --git a/SaPatMgrCore/Core/App/SpmGlobals.cs b/SaPatMgrCore/Core/App/SpmGlobals.cs
index 09e3689..35b3f35 100644
--- a/SaPatMgrCore/Core/App/SpmGlobals.cs
+++ b/SaPatMgrCore/Core/App/SpmGlobals.cs
@@ -1,4 +1,7 @@
using Sarand.Core.CodeTypes;
+using Sarand.Core.ItemOptions;
+using Sarand.Core.Security;
+using Sarand.Core.UpdateLog;
using System;
using System.Collections.Generic;
using System.Text;
@@ -18,9 +21,21 @@ namespace Sarand.PatientMgr.Core.App
//-------------------------------------------------------------------
// Consoles.
+ public static SaSecurityConsole GetSecurityConsole (SpmUserContext userContext)
+ {
+ return Application.GetSecurityConsole(userContext.SessionContext);
+ }
public static SaCodeTypeConsole GetCodeTypeConsole (SpmUserContext userContext)
{
- return Application.GetCodeTypeConsole(userContext);
+ return Application.GetCodeTypeConsole(userContext.SessionContext);
+ }
+ public static SaItemOptionConsole GetItemOptionConsole (SpmUserContext userContext)
+ {
+ return Application.GetItemOptionConsole(userContext.SessionContext);
+ }
+ public static SaUpdateLogConsole GetUpdateLogConsole (SpmUserContext userContext)
+ {
+ return Application.GetUpdateLogConsole(userContext.SessionContext);
}
//-------------------------------------------------------------------
diff --git a/SaPatMgrCore/Core/App/SpmSecurityContext.cs b/SaPatMgrCore/Core/App/SpmSecurityContext.cs
deleted file mode 100644
index ab2c9cd..0000000
--- a/SaPatMgrCore/Core/App/SpmSecurityContext.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Sarand.PatientMgr.Core.App
-{
- //=======================================================================
- public class SpmSecurityContext
- {
- //-------------------------------------------------------------------
-
- //-------------------------------------------------------------------
- }
- //=======================================================================
-}
diff --git a/SaPatMgrCore/Core/App/SpmSecurityProfile.cs b/SaPatMgrCore/Core/App/SpmSecurityProfile.cs
new file mode 100644
index 0000000..adc71f6
--- /dev/null
+++ b/SaPatMgrCore/Core/App/SpmSecurityProfile.cs
@@ -0,0 +1,230 @@
+using Sarand.Core.Base;
+using Sarand.Core.Bus;
+using Sarand.Core.Security;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Sarand.PatientMgr.Core.App
+{
+ //=======================================================================
+ public class SpmSecurityProfile : SaErrorStateItem
+ {
+ //-------------------------------------------------------------------
+ // Security .
+ internal class ProfileParams
+ {
+ public SaSecurityProfile UserSecurityProfile { get; set; }
+ public SaSecurityProfile HostSecurityProfile { get; set; }
+ public readonly List SecurityRights = new List();
+ private bool UserHasSecurityRight (Spm.SecurityRight securityRight, SysId dataItemId = null)
+ {
+ String rightCode = SecurityRights.GetCodeForType((int)securityRight);
+ if (StringUtil.IsEmpty(rightCode)) return false;
+ // Check if right is denied by either user or host profiles.
+ if (UserSecurityProfile != null && UserSecurityProfile.IsSecurityRightDenied(rightCode)) return false;
+ if (HostSecurityProfile != null && HostSecurityProfile.IsSecurityRightDenied(rightCode)) return false;
+ // Check if right is granted by either user or host profiles.
+ if (UserSecurityProfile != null && UserSecurityProfile.IsSecurityRightGranted(rightCode)) return true;
+ if (HostSecurityProfile != null && HostSecurityProfile.IsSecurityRightGranted(rightCode)) return true;
+ return false;
+ }
+ public bool IsUserMemberOfSecurityGroup (SysId secGroupId)
+ {
+ if (UserSecurityProfile != null)
+ return UserSecurityProfile.IsMemberOfSecurityGroup(secGroupId);
+ return false;
+ }
+ public bool IsSecurityRightGranted (Spm.SecurityRight securityRight, SysId id = null)
+ {
+ return UserSecurityProfile.IsSecurityRightGranted(SecurityRights.GetCodeForType((int)securityRight), id);
+ }
+ public bool IsSecurityRightDenied (Spm.SecurityRight securityRight, SysId id = null)
+ {
+ return UserSecurityProfile.IsSecurityRightDenied(SecurityRights.GetCodeForType((int)securityRight), id);
+ }
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static readonly String userNameUnknown = "Unknown";
+ private bool includeHostSecurityProfile = false;
+ private readonly SpmSessionContext sessionContext;
+ private ProfileParams Params { get; } = new ProfileParams();
+
+ //-------------------------------------------------------------------
+ // Construction.
+ public SpmSecurityProfile (bool includeHostSecurityProfile)
+ {
+ this.includeHostSecurityProfile = includeHostSecurityProfile;
+ Admin = new AdminProfile(Params);
+ Departments = new DepartmentsProfile(Params);
+ Consultants = new ConsultantsProfile(Params);
+ }
+
+ //-------------------------------------------------------------------
+ // User.
+ public SysId UserId { get; private set; } = new SysId();
+ public String UserDisplayName { get { return (Params.UserSecurityProfile != null ? Params.UserSecurityProfile.Description : userNameUnknown); } }
+ public String UserLocation { get { return (Params.UserSecurityProfile != null ? Params.UserSecurityProfile.Location : ""); } }
+ public DateTime UserLastLogin { get { return (Params.UserSecurityProfile != null ? Params.UserSecurityProfile.LastLogin : DateTime.MinValue); } }
+
+ //-------------------------------------------------------------------
+ // Refresh profile.
+ public void RefreshProfile (SaSecurityConsole securityConsole, SysId userId, List securityRights)
+ {
+ String fn = GetType().Name + ".RefreshProfile";
+ ClearErrorState();
+
+ // Make a note of the security right.
+ Params.SecurityRights.Clear();
+ Params.SecurityRights.AddRange(securityRights);
+
+ SysId previousUserId = UserId;
+
+ // Clear existing profile.
+ UserId = SysId.InvalidOnNull(userId);
+
+ // Load new profile.
+ if (securityConsole != null)
+ {
+ Params.UserSecurityProfile = securityConsole.GetUserSecurityProfile(UserId);
+ if (Params.HostSecurityProfile == null && includeHostSecurityProfile)
+ Params.HostSecurityProfile = securityConsole.GetHostSecurityProfile();
+ }
+ Logger.Debug(fn + " User: '" + UserDisplayName + "' [Id: " + UserId + "]" + (SysId.IsValid(previousUserId) ? ". Previous UserId: " + SysId.ToString(previousUserId) : ""));
+
+ // ToDo SpmSecurityProfile.RefreshProfile
+
+ }
+ private void ClearProfile ()
+ {
+ // Reset security profiles.
+ Admin.Clear();
+ Departments.Clear();
+ Consultants.Clear();
+ }
+
+ //-------------------------------------------------------------------
+ // Utilities.
+ public bool IsUserMemberOfSecurityGroup (SysId secGroupId)
+ {
+ if (Params.UserSecurityProfile != null)
+ return Params.UserSecurityProfile.IsMemberOfSecurityGroup(secGroupId);
+ return false;
+ }
+ public bool IsSecurityRightGranted (Spm.SecurityRight securityRight, SysId id = null)
+ {
+ return Params.IsSecurityRightGranted(securityRight, id);
+ }
+ public bool IsSecurityRightDenied (Spm.SecurityRight securityRight, SysId id = null)
+ {
+ return Params.IsSecurityRightDenied(securityRight, id);
+ }
+
+ //-------------------------------------------------------------------
+ // Security rights - Admin.
+ public class AdminProfile
+ {
+ internal AdminProfile (ProfileParams paramsData) { Params = paramsData; }
+ private ProfileParams Params { get; set; }
+ public bool CanManageSecurity { get; internal set; } = false;
+ public bool CanManageDatabase { get; internal set; } = false;
+ public bool CanManageConfig { get; internal set; } = false;
+ internal void Clear ()
+ {
+ CanManageSecurity = false;
+ CanManageDatabase = false;
+ CanManageConfig = false;
+ }
+ }
+ public AdminProfile Admin { get; }
+
+ //-------------------------------------------------------------------
+ // Security rights - Departments.
+ public class DepartmentsProfile
+ {
+ internal DepartmentsProfile (ProfileParams paramsData) { Params = paramsData; }
+ private ProfileParams Params { get; set; }
+ public bool CanConfigure (SysId departmentId)
+ {
+ if (!SysId.IsValid(departmentId)) return false;
+ if (Params.IsSecurityRightDenied(Spm.SecurityRight.DepartmentConfig, departmentId)) return false;
+ return Params.IsSecurityRightGranted(Spm.SecurityRight.DepartmentConfig, departmentId);
+ }
+ public bool CanUpdate (SysId departmentId)
+ {
+ if (!SysId.IsValid(departmentId)) return false;
+ if (Params.IsSecurityRightDenied(Spm.SecurityRight.DepartmentUpdate, departmentId)) return false;
+ return CanConfigure(departmentId) || Params.IsSecurityRightGranted(Spm.SecurityRight.DepartmentUpdate, departmentId);
+ }
+ public bool CanReserve (SysId departmentId)
+ {
+ if (!SysId.IsValid(departmentId)) return false;
+ if (Params.IsSecurityRightDenied(Spm.SecurityRight.DepartmentReserve, departmentId)) return false;
+ return CanConfigure(departmentId) || CanUpdate(departmentId) || Params.IsSecurityRightGranted(Spm.SecurityRight.DepartmentReserve, departmentId);
+ }
+ public bool CanView (SysId departmentId)
+ {
+ if (!SysId.IsValid(departmentId)) return false;
+ if (Params.IsSecurityRightDenied(Spm.SecurityRight.DepartmentView, departmentId)) return false;
+ return CanConfigure(departmentId) || CanUpdate(departmentId) || CanReserve(departmentId) || Params.IsSecurityRightGranted(Spm.SecurityRight.DepartmentView, departmentId);
+ }
+ internal void Clear ()
+ {
+ }
+ }
+ public DepartmentsProfile Departments { get; }
+ public bool UserCanConfigureDepartment (SysId departmentId)
+ {
+ return Departments.CanConfigure(departmentId);
+ }
+ public bool UserCanUpdateDepartment (SysId departmentId)
+ {
+ return Departments.CanUpdate(departmentId);
+ }
+ public bool UserCanReserveDepartment (SysId departmentId)
+ {
+ return Departments.CanReserve(departmentId);
+ }
+ public bool UserCanViewDepartment (SysId departmentId)
+ {
+ return Departments.CanView(departmentId);
+ }
+
+ //-------------------------------------------------------------------
+ // Security rights - Consultants.
+ public class ConsultantsProfile
+ {
+ internal ConsultantsProfile (ProfileParams paramsData) { Params = paramsData; }
+ private ProfileParams Params { get; set; }
+ public bool CanUpdate (SysId consultantId)
+ {
+ if (!SysId.IsValid(consultantId)) return false;
+ if (Params.IsSecurityRightDenied(Spm.SecurityRight.ConsultantUpdate, consultantId)) return false;
+ return Params.IsSecurityRightGranted(Spm.SecurityRight.ConsultantUpdate, consultantId);
+ }
+ public bool CanView (SysId consultantId)
+ {
+ if (!SysId.IsValid(consultantId)) return false;
+ if (Params.IsSecurityRightDenied(Spm.SecurityRight.ConsultantView, consultantId)) return false;
+ return CanUpdate(consultantId) || Params.IsSecurityRightGranted(Spm.SecurityRight.ConsultantView, consultantId);
+ }
+ internal void Clear ()
+ {
+ }
+ }
+ public ConsultantsProfile Consultants { get; }
+ public bool UserCanUpdateConsultant (SysId consultantId)
+ {
+ return Consultants.CanUpdate(consultantId);
+ }
+ public bool UserCanViewConsultant (SysId consultantId)
+ {
+ return Consultants.CanView(consultantId);
+ }
+
+ //-------------------------------------------------------------------
+ }
+ //=======================================================================
+}
diff --git a/SaPatMgrCore/Core/App/SpmSystem-CodeTypes.cs b/SaPatMgrCore/Core/App/SpmSystem-CodeTypes.cs
index a857fe8..7c03a5c 100644
--- a/SaPatMgrCore/Core/App/SpmSystem-CodeTypes.cs
+++ b/SaPatMgrCore/Core/App/SpmSystem-CodeTypes.cs
@@ -1,4 +1,6 @@
-using System;
+using Sarand.Core.Base;
+using Sarand.Core.CodeTypes;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -10,8 +12,108 @@ namespace Sarand.PatientMgr.Core.App
public partial class SpmSystem
{
//-------------------------------------------------------------------
- // S y s t e m - C o d e T y p e s
+ // C o d e T y p e s
//-------------------------------------------------------------------
+ public static String GetCodeTypeCode (Spm.CodeType codeType) { return codeTypes.GetCodeForType((int)codeType); }
+
+ //-------------------------------------------------------------------
+ // R e g i s t e r C o d e T y p e s
+ //-------------------------------------------------------------------
+ public static void RegisterCodeTypes (SaCodeTypeConsole codeTypeConsole, Spm.Site site)
+ {
+ if (codeTypeConsole == null) return;
+
+ //---------------------------------------------------------------------
+ // Anaesthetic code type:
+ String codeTypeCode_Anaesthetic = GetCodeTypeCode(Spm.CodeType.Anaesthetic);
+ List codeTypes_Anaesthetic = new List();
+ if (site == Spm.Site.ANT)
+ {
+ codeTypes_Anaesthetic.Add("LA", "Local infiltration");
+ codeTypes_Anaesthetic.Add("GA", "General anaesthetic");
+ codeTypes_Anaesthetic.Add("SED", "Sedation");
+ codeTypes_Anaesthetic.Add("SPI", "Spinal");
+ codeTypes_Anaesthetic.Add("ORB", "Other Regional Block");
+ }
+ codeTypeConsole.RegisterCodeType(new SaCodeTypeDfn(codeTypeCode_Anaesthetic, "Anaesthetic", 3));
+ codeTypeConsole.RegisterCodesOfType(codeTypeCode_Anaesthetic, codeTypes_Anaesthetic);
+
+ //---------------------------------------------------------------------
+ // Operation Position code type:
+ String codeTypeCode_OperationPosition = GetCodeTypeCode(Spm.CodeType.OperationPosition);
+ List codeTypes_OperationPosition = new List();
+ if (site == Spm.Site.ANT)
+ {
+ codeTypes_OperationPosition.Add("PRO", "Prone");
+ codeTypes_OperationPosition.Add("SUP", "Supine");
+ }
+ codeTypeConsole.RegisterCodeType(new SaCodeTypeDfn(codeTypeCode_OperationPosition, "Operating Position", 6));
+ codeTypeConsole.RegisterCodesOfType(codeTypeCode_OperationPosition, codeTypes_OperationPosition);
+
+ //---------------------------------------------------------------------
+ // Operating Speciality code type:
+ String codeTypeCode_OperatingSpeciality = GetCodeTypeCode(Spm.CodeType.OperatingSpeciality);
+ List codeTypes_OperatingSpeciality = new List();
+ if (site == Spm.Site.ANT)
+ {
+ codeTypes_OperatingSpeciality.Add("ASSE", "Medical Assessment");
+ codeTypes_OperatingSpeciality.Add("CARD", "Cardiology");
+ codeTypes_OperatingSpeciality.Add("ENT", "ENT"); // Otorhinolaryngology
+ codeTypes_OperatingSpeciality.Add("ECT", "Electroconvulsive Therapy");
+ codeTypes_OperatingSpeciality.Add("GENS", "General Surgery");
+ codeTypes_OperatingSpeciality.Add("GMED", "General Medicine");
+ codeTypes_OperatingSpeciality.Add("GYNA", "Gynaecology");
+ codeTypes_OperatingSpeciality.Add("HAEM", "General Haematology");
+ codeTypes_OperatingSpeciality.Add("HEPB", "Hepatology Biopsy");
+ codeTypes_OperatingSpeciality.Add("NEPH", "Nephrology");
+ codeTypes_OperatingSpeciality.Add("NLGY", "Neurology");
+ codeTypes_OperatingSpeciality.Add("OBS", "Obstetrics");
+ codeTypes_OperatingSpeciality.Add("OPTH", "Ophthalmology");
+ codeTypes_OperatingSpeciality.Add("ORAL", "Oral Surgery");
+ codeTypes_OperatingSpeciality.Add("ORTH", "Orthopaedic");
+ codeTypes_OperatingSpeciality.Add("PLAS", "Plastic Surgery");
+ codeTypes_OperatingSpeciality.Add("PSUR", "Paediatric Surgery");
+ codeTypes_OperatingSpeciality.Add("RENF", "Renal Transplant Follow Up");
+ codeTypes_OperatingSpeciality.Add("RENV", "Vascular Access");
+ codeTypes_OperatingSpeciality.Add("RHEU", "Rheumatology");
+ codeTypes_OperatingSpeciality.Add("UROL", "Urology");
+ //lOpnSpec.Insert(CodeDesc ("MaxFac", "Maxillofacial Surgery");
+ }
+ codeTypeConsole.RegisterCodeType(new SaCodeTypeDfn(codeTypeCode_OperatingSpeciality, "Operating Speciality", 12));
+ codeTypeConsole.RegisterCodesOfType(codeTypeCode_OperatingSpeciality, codeTypes_OperatingSpeciality);
+
+ //---------------------------------------------------------------------
+ // Allergies:
+ String codeTypeCode_Allergy = GetCodeTypeCode(Spm.CodeType.Allergy);
+ List codeTypes_Allergy = new List();
+ if (site == Spm.Site.ANT)
+ {
+ }
+#if DEBUG
+ codeTypes_Allergy.Add("ChAsth", "Childhood asthma");
+ codeTypes_Allergy.Add("Eczema", "Eczema");
+ codeTypes_Allergy.Add("Rhinit", "Rhinitis");
+ codeTypes_Allergy.Add("Food", "Food allergies");
+ codeTypes_Allergy.Add("HayFev", "Hay fever");
+#endif
+ codeTypeConsole.RegisterCodeType(new SaCodeTypeDfn(codeTypeCode_Allergy, "Allergy", 6));
+ codeTypeConsole.RegisterCodesOfType(codeTypeCode_Allergy, codeTypes_Allergy);
+
+ //---------------------------------------------------------------------
+ // Risk factors:
+ String codeTypeCode_RiskFactor = GetCodeTypeCode(Spm.CodeType.RiskFactor);
+ List codeTypes_RiskFactor = new List();
+ if (site == Spm.Site.ANT)
+ {
+ }
+#if DEBUG
+ codeTypes_RiskFactor.Add("MRSA", "MRSA");
+ codeTypes_RiskFactor.Add("CDIFF", "C.Diff");
+ codeTypes_RiskFactor.Add("HIV", "HIV+");
+#endif
+ codeTypeConsole.RegisterCodeType(new SaCodeTypeDfn(codeTypeCode_RiskFactor, "Risk Factor", 6));
+ codeTypeConsole.RegisterCodesOfType(codeTypeCode_RiskFactor, codeTypes_RiskFactor);
+ }
//-------------------------------------------------------------------
}
diff --git a/SaPatMgrCore/Core/App/SpmSystem-Statics.cs b/SaPatMgrCore/Core/App/SpmSystem-Statics.cs
index 8209b0e..667e256 100644
--- a/SaPatMgrCore/Core/App/SpmSystem-Statics.cs
+++ b/SaPatMgrCore/Core/App/SpmSystem-Statics.cs
@@ -14,9 +14,160 @@ namespace Sarand.PatientMgr.Core.App
// SLM System - Static initialisation.
static SpmSystem ()
{
+ // Code types.
+ codeTypes.Add(Spm.CodeType.Anaesthetic, "Anaes", "Anaesthetic");
+ codeTypes.Add(Spm.CodeType.OperationPosition, "OpnPos", "Operation position");
+ codeTypes.Add(Spm.CodeType.OperatingSpeciality, "OptgSpec", "Operating speciality");
+ codeTypes.Add(Spm.CodeType.Allergy, "Allergy", "Allergy");
+ codeTypes.Add(Spm.CodeType.RiskFactor, "RiskFactor", "Risk factor");
+
//---------------------------------------------------------------
// Sites.
- sites.Add((int)Spm.Site.Addenbrookes, "ANT", "Addenbrookes");
+ sites.Add((int)Spm.Site.ANT, "ANT", "Addenbrookes");
+
+ //---------------------------------------------------------------
+ // Facility type.
+ facilityTypes.Add((int)Spm.FacilityType.Theatre, "THTR", "Theatre");
+ facilityTypes.Add((int)Spm.FacilityType.Clinic, "CLNC", "Clinic");
+ facilityTypes.Add((int)Spm.FacilityType.Ward, "WARD", "Ward");
+ facilityTypes.Add((int)Spm.FacilityType.Apparatus, "APTS", "Apparatus");
+
+ // Schedule type.
+ scheduleTypes.Add((int)Spm.ScheduleType.Theatre, "Theatre", "Theatre");
+ scheduleTypes.Add((int)Spm.ScheduleType.Clinic, "Clinic", "Clinic");
+ scheduleTypes.Add((int)Spm.ScheduleType.Ward, "Ward", "Ward");
+
+ // Employee role.
+ employeeRoles.Add((int)Spm.EmployeeRole.Consultant, "CONS", "Consultant");
+ employeeRoles.Add((int)Spm.EmployeeRole.Surgeon, "SURG", "Surgeon");
+ employeeRoles.Add((int)Spm.EmployeeRole.Anaesthetist, "ANAE", "Anaesthetist");
+
+ //---------------------------------------------------------------
+ // Gender.
+ genders.Add((int)Spm.Gender.Female, "FEM", "Female");
+ genders.Add((int)Spm.Gender.Male, "MAL", "Male");
+
+ // Patient data source.
+ patientDataSources.Add((int)Spm.PatientDataSource.Patient, "PAT", "Patient");
+ patientDataSources.Add((int)Spm.PatientDataSource.Admission, "ADM", "Admission");
+ patientDataSources.Add((int)Spm.PatientDataSource.Demographics, "DEM", "Demographics");
+ patientDataSources.Add((int)Spm.PatientDataSource.WaitingList, "WTL", "Waiting list");
+
+ //---------------------------------------------------------------
+ // Template map type.
+ templateMapTypes.Add((int)Spm.FacilityTemplateMapType.RollingWeek, "RWK", "Rolling week");
+ templateMapTypes.Add((int)Spm.FacilityTemplateMapType.WeekdayInstanceInMonth, "WIM", "Weekday instance within month");
+ templateMapTypes.Add((int)Spm.FacilityTemplateMapType.WorkingWeekInMonth, "WWM", "Working week within month");
+
+ // Session model.
+ sessionModels.Add((int)Spm.SessionModel.Default, "SesMdlDefault", "Default model");
+ sessionModels.Add((int)Spm.SessionModel.Maternity, "SesMdlMaternity", "Maternity");
+
+ // Resource category.
+ resourceCategories.Add((int)Spm.ResourceCategory.TheatreList, "THELST", "Theatre list");
+ resourceCategories.Add((int)Spm.ResourceCategory.ClinicList, "CLILST", "Clinic list");
+ resourceCategories.Add((int)Spm.ResourceCategory.WardResource, "WRDRES", "Ward resource");
+ resourceCategories.Add((int)Spm.ResourceCategory.WardAdmissionList, "WRDADM", "Admission list");
+ resourceCategories.Add((int)Spm.ResourceCategory.WardDischargeList, "WRDDIS", "Discharge list");
+
+ //---------------------------------------------------------------
+ // Theatre session type.
+ theatreSessionTypes.Add((int)Spm.TemplateType.TheatreSession_Service, "SRV", "Service");
+ theatreSessionTypes.Add((int)Spm.TemplateType.TheatreSession_Training, "TRN", "Training");
+
+ // Clinic session type.
+ clinicSessionTypes.Add((int)Spm.TemplateType.ClinicSession_Service, "SRV", "Service");
+ clinicSessionTypes.Add((int)Spm.TemplateType.ClinicSession_Training, "TRN", "Training");
+
+ // Ward resource type.
+ wardResourceTypes.Add((int)Spm.TemplateType.WardResource_Bed, "BED", "Bed");
+ wardResourceTypes.Add((int)Spm.TemplateType.WardResource_Chair, "CHAIR", "Chair");
+ wardResourceTypes.Add((int)Spm.TemplateType.WardResource_Bay, "Bay", "Bay");
+ wardResourceTypes.Add((int)Spm.TemplateType.WardResource_Room, "Room", "Room");
+
+ //---------------------------------------------------------------
+ // Resource capacity type.
+ resourceCapacityTypes.Add((int)Spm.ResourceCapacityType.None, "None", "None");
+ resourceCapacityTypes.Add((int)Spm.ResourceCapacityType.Single, "Single", "Single");
+ resourceCapacityTypes.Add((int)Spm.ResourceCapacityType.Double, "Dbl", "Double");
+ resourceCapacityTypes.Add((int)Spm.ResourceCapacityType.DoubleExclusive, "DblExc", "Double - exclusive option");
+ resourceCapacityTypes.Add((int)Spm.ResourceCapacityType.Triple, "Tri", "Triple");
+ resourceCapacityTypes.Add((int)Spm.ResourceCapacityType.TripleExclusive, "TriExc", "Triple - exclusive option");
+ resourceCapacityTypes.Add((int)Spm.ResourceCapacityType.Quadruple, "Quad", "Quadruple");
+ resourceCapacityTypes.Add((int)Spm.ResourceCapacityType.QuadrupleExclusive, "QuadExc", "Quadruple - exclusive option");
+
+ // Resource loading type.
+ resourceLoadingTypes.Add((int)Spm.ResourceLoadingType.None, "None", "None");
+ resourceLoadingTypes.Add((int)Spm.ResourceLoadingType.Units, "Units", "Units");
+
+ // Schedule freeze type.
+ scheduleFreezeTypes.Add((int)Spm.ScheduleFreezeType.None, "NONE", "None - schedule always open");
+ scheduleFreezeTypes.Add((int)Spm.ScheduleFreezeType.FixedTimePreviousDay, "FTPD", "From set time on the previous day (for 24 hours)");
+
+ // Template data type.
+ templateDataTypes.Add((int)Spm.TemplateDataType.ComplexityCapacity, "CompCap", "Complexity Capacity");
+
+ //---------------------------------------------------------------
+ // Procedure complexity.
+ procedureComplexities.Add((int)Spm.ProcedureComplexity.Minor, "MIN", "Minor");
+ procedureComplexities.Add((int)Spm.ProcedureComplexity.Intermediate, "INT", "Intermediate");
+ procedureComplexities.Add((int)Spm.ProcedureComplexity.Major, "MAJ", "Major");
+
+ //---------------------------------------------------------------
+ // Admission occupancy.
+ admissionOccupancies.Add((int)Spm.AdmissionOccupancy.Single, "SINGLE", "Single");
+ admissionOccupancies.Add((int)Spm.AdmissionOccupancy.Exclusive, "EXCLUS", "Exclusive");
+
+ // Admission action type.
+ admissionActionTypes.Add((int)Spm.AdmissionActionType.SendLetter, "Let", "Send letter");
+ admissionActionTypes.Add((int)Spm.AdmissionActionType.RepeatAdmission, "REP", "Repeat admission");
+ admissionActionTypes.Add((int)Spm.AdmissionActionType.ArrangeTransport, "TRA", "Arrange Transport");
+ admissionActionTypes.Add((int)Spm.AdmissionActionType.Filing, "FIL", "Filing");
+ admissionActionTypes.Add((int)Spm.AdmissionActionType.Prescription, "PRE", "Prescription");
+ admissionActionTypes.Add((int)Spm.AdmissionActionType.General, "GEN", "General");
+
+ // Admission cancel type.
+ admissionCancelTypes.Add((int)Spm.AdmissionCancelType.CancelTimeLimit, "CANTIM", "Cancel - Time limit");
+ admissionCancelTypes.Add((int)Spm.AdmissionCancelType.CancelOther, "CANOTH", "Cancel - Other");
+ admissionCancelTypes.Add((int)Spm.AdmissionCancelType.Deletion, "DELETE", "Deletion");
+ admissionCancelTypes.Add((int)Spm.AdmissionCancelType.ChangeSession, "CHGSES", "Change Session");
+
+ // Attendance type.
+ attendanceTypes.Add((int)Spm.AttendanceType.OutPatient, "OTP", "Out-Patient");
+ attendanceTypes.Add((int)Spm.AttendanceType.InPatient, "INP", "In-Patient");
+
+ // Attendance status.
+ attendanceStatuses.Add((int)Spm.AttendanceStatus.Arrived, "ARR", "Arrived");
+ attendanceStatuses.Add((int)Spm.AttendanceStatus.Discharged, "DIS", "Discharged");
+ attendanceStatuses.Add((int)Spm.AttendanceStatus.Cancelled, "CAN", "Cancelled");
+ attendanceStatuses.Add((int)Spm.AttendanceStatus.Dna, "DNA", "DNA");
+
+ //---------------------------------------------------------------
+ // Ward period length.
+ wardPeriodLengths.Add((int)Spm.WardPeriodLength.Week, "1Week", "1 week");
+ wardPeriodLengths.Add((int)Spm.WardPeriodLength.Weeks_2, "2Weeks", "2 weeks");
+ wardPeriodLengths.Add((int)Spm.WardPeriodLength.Weeks_4, "4Weeks", "4 weeks");
+ wardPeriodLengths.Add((int)Spm.WardPeriodLength.Weeks_6, "6Weeks", "6 weeks");
+ wardPeriodLengths.Add((int)Spm.WardPeriodLength.Weeks_8, "8Weeks", "8 weeks");
+
+ // Ward resource display.
+ wardResourceDisplays.Add((int)Spm.WardResourceDisplay.Summary, "Summary", "Summary");
+ wardResourceDisplays.Add((int)Spm.WardResourceDisplay.Narrow, "Narrow", "Narrow");
+ wardResourceDisplays.Add((int)Spm.WardResourceDisplay.Standard, "Standard", "Standard");
+ wardResourceDisplays.Add((int)Spm.WardResourceDisplay.Wide, "Wide", "Wide");
+
+ // Ward highlighting.
+ wardHighlightings.Add((int)Spm.WardHighlighting.None, "None", "None");
+ wardHighlightings.Add((int)Spm.WardHighlighting.Duration, "Duration", "Duration");
+ wardHighlightings.Add((int)Spm.WardHighlighting.Gender, "Gender", "Gender");
+ wardHighlightings.Add((int)Spm.WardHighlighting.ReferringCons, "RefCons", "Referring consultant");
+ wardHighlightings.Add((int)Spm.WardHighlighting.Speciality, "Speciality", "Speciality");
+
+ //---------------------------------------------------------------
+ // Report spacing.
+ reportSpacings.Add((int)Spm.ReportSpacing.Narrow, "NARROW", "Narrow");
+ reportSpacings.Add((int)Spm.ReportSpacing.Standard, "STANDARD", "Standard");
+ reportSpacings.Add((int)Spm.ReportSpacing.Wide, "WIDE", "Wide");
//---------------------------------------------------------------
}
diff --git a/SaPatMgrCore/Core/App/SpmSystem.cs b/SaPatMgrCore/Core/App/SpmSystem.cs
index d6f9459..60a58e2 100644
--- a/SaPatMgrCore/Core/App/SpmSystem.cs
+++ b/SaPatMgrCore/Core/App/SpmSystem.cs
@@ -11,8 +11,35 @@ 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.
@@ -53,13 +80,65 @@ namespace Sarand.PatientMgr.Core.App
//-----------------------------------------------------------
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)
{
diff --git a/SaPatMgrCore/Core/App/SpmUserContext.cs b/SaPatMgrCore/Core/App/SpmUserContext.cs
index 37b0e9b..e164a17 100644
--- a/SaPatMgrCore/Core/App/SpmUserContext.cs
+++ b/SaPatMgrCore/Core/App/SpmUserContext.cs
@@ -1,4 +1,5 @@
-using System;
+using Sarand.Core.Bus;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -7,15 +8,28 @@ namespace Sarand.PatientMgr.Core.App
//=======================================================================
public class SpmUserContext
{
+ //-------------------------------------------------------------------
+ public class UserData
+ {
+ public SysId SecurityItemId { get; internal set; } = new SysId();
+ public String Name { get; internal set; } = "";
+ }
+
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
+ protected SpmUserContext (SpmSessionContext sessionContext)
+ {
+ SessionContext = sessionContext;
+ }
//-------------------------------------------------------------------
// Properties.
- public SpmSessionContext SessionContext { get; protected set; }
+ public SpmSessionContext SessionContext { get; }
+ public UserData User { get; } = new UserData();
+ public SpmSecurityProfile SecurityProfile { get; } = new SpmSecurityProfile(false);
//-------------------------------------------------------------------
}
diff --git a/SaPatMgrCore/Core/Mgr/SpmAdmissionMgr.cs b/SaPatMgrCore/Core/Mgr/SpmAdmissionMgr.cs
index 8c9fdf1..260bfd5 100644
--- a/SaPatMgrCore/Core/Mgr/SpmAdmissionMgr.cs
+++ b/SaPatMgrCore/Core/Mgr/SpmAdmissionMgr.cs
@@ -5,6 +5,12 @@ using System.Text;
namespace Sarand.PatientMgr.Core.Mgr
{
+ //=======================================================================
+ // AdmissionMgr manages:
+ // Admission
+ // Admission Role
+ // Admission Data
+ // Admission Action
//=======================================================================
public abstract partial class SpmAdmissionMgr : SpmItemMgr
{
diff --git a/SaPatMgrCore/Core/Mgr/SpmDepartmentMgr.cs b/SaPatMgrCore/Core/Mgr/SpmDepartmentMgr.cs
new file mode 100644
index 0000000..6443d21
--- /dev/null
+++ b/SaPatMgrCore/Core/Mgr/SpmDepartmentMgr.cs
@@ -0,0 +1,36 @@
+using Sarand.PatientMgr.Core.App;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Sarand.PatientMgr.Core.Mgr
+{
+ //=======================================================================
+ // DepartmentMgr manages:
+ // Department
+ // Employee Role
+ // Facility
+ // Facility Template
+ // Template Data
+ // Facility Session
+ // Procedure
+ //=======================================================================
+ public abstract partial class SpmDepartmentMgr : SpmItemMgr
+ {
+ //-------------------------------------------------------------------
+ // Data members.
+
+ //-------------------------------------------------------------------
+ // Construction.
+ protected SpmDepartmentMgr (SpmUserContext userContext) :
+ base(userContext)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+
+ //-------------------------------------------------------------------
+ }
+ //=======================================================================
+}
diff --git a/SaPatMgrCore/Core/Mgr/SpmInstitutionMgr.cs b/SaPatMgrCore/Core/Mgr/SpmInstitutionMgr.cs
new file mode 100644
index 0000000..a540075
--- /dev/null
+++ b/SaPatMgrCore/Core/Mgr/SpmInstitutionMgr.cs
@@ -0,0 +1,33 @@
+using Sarand.PatientMgr.Core.App;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Sarand.PatientMgr.Core.Mgr
+{
+ //=======================================================================
+ // InstitutionMgr manages:
+ // Institution
+ // Operation
+ // Employee
+ // Patient
+ //=======================================================================
+ public abstract partial class SpmInstitutionMgr : SpmItemMgr
+ {
+ //-------------------------------------------------------------------
+ // Data members.
+
+ //-------------------------------------------------------------------
+ // Construction.
+ protected SpmInstitutionMgr (SpmUserContext userContext) :
+ base(userContext)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+
+ //-------------------------------------------------------------------
+ }
+ //=======================================================================
+}
diff --git a/SaPatMgrWinDbas/SaPatMgrWinDbas.csproj b/SaPatMgrWinDbas/SaPatMgrWinDbas.csproj
index 5259725..989a6af 100644
--- a/SaPatMgrWinDbas/SaPatMgrWinDbas.csproj
+++ b/SaPatMgrWinDbas/SaPatMgrWinDbas.csproj
@@ -42,6 +42,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -66,10 +89,10 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmCodeTypeConsole_Dbas.cs b/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmCodeTypeConsole_Dbas.cs
new file mode 100644
index 0000000..90d16a1
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmCodeTypeConsole_Dbas.cs
@@ -0,0 +1,24 @@
+using Sarand.PatientMgr.Core.App;
+using Sarand.Win.Dbas.Base;
+using Sarand.Win.Dbas.CodeTypes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sarand.PatientMgr.Win.Dbas.Consoles
+{
+ //=======================================================================
+ public abstract class SpmCodeTypeConsole_Dbas : SaCodeTypeConsole_Dbas
+ {
+ //-------------------------------------------------------------------
+ // Construction.
+ protected SpmCodeTypeConsole_Dbas (SpmSessionContext sessionContext, SacsDatabase database) : base(database)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ }
+ //=======================================================================
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmItemOptionConsole_Dbas.cs b/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmItemOptionConsole_Dbas.cs
new file mode 100644
index 0000000..0350fec
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmItemOptionConsole_Dbas.cs
@@ -0,0 +1,47 @@
+using Sarand.Core.Bus;
+using Sarand.Core.ItemOptions;
+using Sarand.Core.UpdateLog;
+using Sarand.PatientMgr.Core.App;
+using Sarand.Win.Dbas.Base;
+using Sarand.Win.Dbas.ItemOptions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sarand.PatientMgr.Win.Dbas.Consoles
+{
+ //=======================================================================
+ public abstract class SpmItemOptionConsole_Dbas : SaItemOptionConsole_Dbas
+ {
+ //-------------------------------------------------------------------
+ // Construction.
+ protected SpmItemOptionConsole_Dbas (SpmSessionContext sessionContext, SacsDatabase database) : base(database)
+ {
+ SessionContext = sessionContext;
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public SpmSessionContext SessionContext { get; }
+ public override short ItemOptionDataType { get { return (short)Spm.DataItemType.ItemOption; } }
+ public override SaUpdateLogConsole UpdateLogConsole { get { return SpmGlobals.Application.GetUpdateLogConsole(SessionContext); } }
+
+ //-------------------------------------------------------------------
+ // I t e m O p t i o n D e f i n i t i o n s
+ //-------------------------------------------------------------------
+ public override List GetItemOptionDfnsForItem (ItemId itemId)
+ {
+ // ToDo SpmItemOptionConsole_Dbas.GetItemOptionDfnsForItem
+ /*
+ if (itemId.Type == (int)Spm.DataItemType.Interface)
+ return SpmGlobals.ConsoleHelper.GetInterfaceConsole(SessionContext).GetInterfaceItemOptionDfns(itemId.Id);
+ */
+ return null;
+ }
+
+ //-------------------------------------------------------------------
+ }
+ //=======================================================================
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmSecurityConsole_Dbas.cs b/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmSecurityConsole_Dbas.cs
new file mode 100644
index 0000000..11094a5
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmSecurityConsole_Dbas.cs
@@ -0,0 +1,105 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Core.App;
+using Sarand.Win.Dbas.Base;
+using Sarand.Win.Dbas.Security;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sarand.PatientMgr.Win.Dbas.Consoles
+{
+ //=======================================================================
+ public abstract class SpmSecurityConsole_Dbas : SaSecurityConsole_Dbas
+ {
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List securityRights = new List();
+
+ //-------------------------------------------------------------------
+ // Static initialisation.
+ static SpmSecurityConsole_Dbas ()
+ {
+ securityRights.Add((int)Spm.SecurityRight.ManageSecurity, "MngSec", "Manage Security");
+ securityRights.Add((int)Spm.SecurityRight.ManageConfig, "MngCfg", "Manage Config");
+ securityRights.Add((int)Spm.SecurityRight.ManageDb, "MngDb", "Manage Database");
+ securityRights.Add((int)Spm.SecurityRight.DepartmentView, "DeptView", "View department");
+ securityRights.Add((int)Spm.SecurityRight.DepartmentReserve, "DeptReserve", "Reserve department");
+ securityRights.Add((int)Spm.SecurityRight.DepartmentUpdate, "DeptUpd", "Update department");
+ securityRights.Add((int)Spm.SecurityRight.DepartmentConfig, "DeptCfg", "Manage department");
+ securityRights.Add((int)Spm.SecurityRight.ConsultantView, "ConsView", "View Consultant");
+ securityRights.Add((int)Spm.SecurityRight.ConsultantUpdate, "ConsUpd", "Update Consultant");
+ securityRights.Add((int)Spm.SecurityRight.SpecialityView, "SpecView", "View Speciality");
+ securityRights.Add((int)Spm.SecurityRight.SpecialityUpdate, "SpecUpd", "Update Speciality");
+ }
+
+ //-------------------------------------------------------------------
+ // Construction.
+ protected SpmSecurityConsole_Dbas (SpmSessionContext sessionContext, SacsDatabase database) : base(database)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public List GetSecurityRights () { return new List(securityRights); }
+
+ //-------------------------------------------------------------------
+ // Register Security Rights.
+ public override void RegisterSecurityRights ()
+ {
+ //---------------------------------------------------------------
+ // Register data item types.
+ RegisterDataItemType((short)Spm.DataItemType.Department, "Department");
+ RegisterDataItemType((short)Spm.DataItemType.RoleConsultant, "Consultant");
+ RegisterDataItemType((short)Spm.DataItemType.CodeSpeciality, "Speciality");
+
+ //---------------------------------------------------------------
+ // Manage security.
+ CodeDesc securityRight = GetSecurityRight(Spm.SecurityRight.ManageSecurity);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc);
+ // Manage configuration.
+ securityRight = GetSecurityRight(Spm.SecurityRight.ManageConfig);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc);
+ // Manage database.
+ securityRight = GetSecurityRight(Spm.SecurityRight.ManageDb);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc);
+
+ //---------------------------------------------------------------
+ // View department:
+ securityRight = GetSecurityRight(Spm.SecurityRight.DepartmentView);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.Department);
+ // Make reservation in department:
+ securityRight = GetSecurityRight(Spm.SecurityRight.DepartmentReserve);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.Department);
+ // Update department:
+ securityRight = GetSecurityRight(Spm.SecurityRight.DepartmentUpdate);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.Department);
+ // Manage department:
+ securityRight = GetSecurityRight(Spm.SecurityRight.DepartmentConfig);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.Department);
+ //---------------------------------------------------------------
+ // Security rights associated with specific consultant:
+ securityRight = GetSecurityRight(Spm.SecurityRight.ConsultantView);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.RoleConsultant);
+ securityRight = GetSecurityRight(Spm.SecurityRight.ConsultantUpdate);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.RoleConsultant);
+ //---------------------------------------------------------------
+ // Security rights associated with specific speciality:
+ securityRight = GetSecurityRight(Spm.SecurityRight.SpecialityView);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.CodeSpeciality);
+ securityRight = GetSecurityRight(Spm.SecurityRight.SpecialityUpdate);
+ RegisterSecurityRight(securityRight.Code, securityRight.Desc, (short)Spm.DataItemType.CodeSpeciality);
+
+ //---------------------------------------------------------------
+ }
+
+ CodeDesc GetSecurityRight (Spm.SecurityRight securityRight)
+ {
+ return securityRights.GetCodeDescForType((int)securityRight);
+ }
+
+ //-------------------------------------------------------------------
+ }
+ //=======================================================================
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmUpdateLogConsole_Dbas.cs b/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmUpdateLogConsole_Dbas.cs
new file mode 100644
index 0000000..7426fa4
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Consoles/SpmUpdateLogConsole_Dbas.cs
@@ -0,0 +1,44 @@
+using Sarand.Core.Bus;
+using Sarand.Core.Security;
+using Sarand.PatientMgr.Core.App;
+using Sarand.Win.Dbas.Base;
+using Sarand.Win.Dbas.UpdateLog;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sarand.PatientMgr.Win.Dbas.Consoles
+{
+ //=======================================================================
+ public abstract class SpmUpdateLogConsole_Dbas : SaUpdateLogConsole_Dbas
+ {
+ //-------------------------------------------------------------------
+ // Construction.
+ protected SpmUpdateLogConsole_Dbas (SpmSessionContext sessionContext, SacsDatabase database) : base(database)
+ {
+ SessionContext = sessionContext;
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public SpmSessionContext SessionContext { get; }
+
+ //-------------------------------------------------------------------
+ // Get name for User Id.
+ public override Dictionary GetNameForUserIds (List userIds)
+ {
+ Dictionary userNames = new Dictionary();
+ SaSecurityConsole securityConsole = SpmGlobals.Application.GetSecurityConsole(SessionContext);
+ if (securityConsole != null)
+ {
+ userNames = securityConsole.GetSecurityItemDescriptions(userIds);
+ }
+ return userNames;
+ }
+
+ //-------------------------------------------------------------------
+ }
+ //=======================================================================
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Data/SpmDbDataItem.cs b/SaPatMgrWinDbas/Win/Dbas/Data/SpmDbDataItem.cs
new file mode 100644
index 0000000..9ac03d5
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Data/SpmDbDataItem.cs
@@ -0,0 +1,79 @@
+using Sarand.Core.Base;
+using Sarand.Core.Dbas.Base;
+using Sarand.PatientMgr.Core.App;
+using Sarand.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static Sarand.Win.Dbas.Data.DbDataItem;
+
+namespace Sarand.PatientMgr.Win.Dbas.Data
+{
+ //=======================================================================
+ public abstract class SpmDbDataItem : DbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Definitions.
+ ///
+ /// Database information - object supplied by main application.
+ /// NB Application may have multiple databases with schema differences.
+ /// Each instance of a DbDataItem must be database specific.
+ ///
+ public class SlmDatabaseInfo : IDatabaseInfo
+ {
+ // Data members.
+ private readonly List tables;
+ private static readonly String defaultSchemaName = "dbo";
+ // Construction.
+ public SlmDatabaseInfo (Spm.Site site, String databaseName, List tables)
+ {
+ this.Site = site;
+ this.DatabaseName = databaseName;
+ this.tables = tables;
+ }
+ // Properties.
+ public Spm.Site Site { get; }
+ public String DatabaseName { get; }
+ public String Context { get { return StringUtil.OnEmpty(SpmSystem.GetSiteCode(Site), "UnknownSite") + "." + StringUtil.OnEmpty(DatabaseName, "UnknownDb"); } }
+ // Database schema.
+ public DbDfnTable GetTableDefinition (String schemaName, String tableName)
+ {
+ foreach (DbDfnTable table in tables.FindAll(item => item.Name.EqualsCI(tableName)))
+ {
+ if (StringUtil.OnEmpty(table.Schema, defaultSchemaName).EqualsCI(StringUtil.OnEmpty(schemaName, defaultSchemaName)))
+ return table;
+ }
+ return null;
+ }
+ public bool TableExists (String schemaName, String tableName)
+ {
+ return GetTableDefinition(schemaName, tableName) != null;
+ }
+ public bool ColumnExists (String schemaName, String tableName, String columnName)
+ {
+ DbDfnTable table = GetTableDefinition(schemaName, tableName);
+ if (table == null) return false;
+ return table.HasColumnByName(columnName);
+ }
+ public List GetColumnsForTable (String schemaName, String tableName)
+ {
+ DbDfnTable table = GetTableDefinition(schemaName, tableName);
+ if (table != null) return table.Columns;
+ return new List();
+ }
+ }
+
+ //-------------------------------------------------------------------
+ // Construction.
+ protected SpmDbDataItem (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+
+ //-------------------------------------------------------------------
+ }
+ //=======================================================================
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/IndexDefragLog_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/IndexDefragLog_Db.cs
new file mode 100644
index 0000000..cad3fef
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/IndexDefragLog_Db.cs
@@ -0,0 +1,211 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class IndexDefragLog_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt32 _IndexDefragId { get; } = new ColumnDataInt32("IndexDefragId", true);
+ public ColumnDataInt32 _DatabaseID { get; } = new ColumnDataInt32("DatabaseID");
+ public ColumnDataString _DatabaseName { get; } = new ColumnDataString("DatabaseName");
+ public ColumnDataInt32 _ObjectID { get; } = new ColumnDataInt32("ObjectID");
+ public ColumnDataString _ObjectName { get; } = new ColumnDataString("ObjectName");
+ public ColumnDataInt32 _IndexID { get; } = new ColumnDataInt32("IndexID");
+ public ColumnDataString _IndexName { get; } = new ColumnDataString("IndexName");
+ public ColumnDataInt16 _PartitionNumber { get; } = new ColumnDataInt16("PartitionNumber");
+ public ColumnDataDouble _Fragmentation { get; } = new ColumnDataDouble("Fragmentation");
+ public ColumnDataInt32 _PageCount { get; } = new ColumnDataInt32("PageCount");
+ public ColumnDataDateTime _DateTimeStart { get; } = new ColumnDataDateTime("DateTimeStart");
+ public ColumnDataInt32 _DurationSeconds { get; } = new ColumnDataInt32("DurationSeconds");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "IndexDefragId",
+ "DatabaseID",
+ "DatabaseName",
+ "ObjectID",
+ "ObjectName",
+ "IndexID",
+ "IndexName",
+ "PartitionNumber",
+ "Fragmentation",
+ "PageCount",
+ "DateTimeStart",
+ "DurationSeconds",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ "IndexDefragId",
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "IndexDefragId",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List()
+ {
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ };
+
+ //-------------------------------------------------------------------
+ // Construction.
+ internal IndexDefragLog_Db (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public override String SchemaName { get; } = "dbo";
+ public override String TableName { get; } = "IndexDefragLog";
+ public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
+ public static List Fields { get { return new List(fields); } }
+ public static List FieldsId { get { return new List(fieldsId); } }
+ public static List FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
+ // Columns.
+ public ColumnsData Cols { get; } = new ColumnsData();
+ public Int32 _IndexDefragId { get { return Cols._IndexDefragId.Value; } set { Cols._IndexDefragId.Value = value; } }
+ public Int32 _DatabaseID { get { return Cols._DatabaseID.Value; } set { Cols._DatabaseID.Value = value; } }
+ public String _DatabaseName { get { return Cols._DatabaseName.Value; } set { Cols._DatabaseName.Value = value; } }
+ public Int32 _ObjectID { get { return Cols._ObjectID.Value; } set { Cols._ObjectID.Value = value; } }
+ public String _ObjectName { get { return Cols._ObjectName.Value; } set { Cols._ObjectName.Value = value; } }
+ public Int32 _IndexID { get { return Cols._IndexID.Value; } set { Cols._IndexID.Value = value; } }
+ public String _IndexName { get { return Cols._IndexName.Value; } set { Cols._IndexName.Value = value; } }
+ public Int16 _PartitionNumber { get { return Cols._PartitionNumber.Value; } set { Cols._PartitionNumber.Value = value; } }
+ public Double _Fragmentation { get { return Cols._Fragmentation.Value; } set { Cols._Fragmentation.Value = value; } }
+ public Int32 _PageCount { get { return Cols._PageCount.Value; } set { Cols._PageCount.Value = value; } }
+ public DateTime _DateTimeStart { get { return Cols._DateTimeStart.Value; } set { Cols._DateTimeStart.Value = value; } }
+ public Int32 _DurationSeconds { get { return Cols._DurationSeconds.Value; } set { Cols._DurationSeconds.Value = value; } }
+ // Existing columns - confirmed on database if table exists.
+ public List ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
+ public List ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
+
+ //-------------------------------------------------------------------
+ // Population.
+ public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
+ {
+ dbCommand.CommandText =
+ "SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
+ "FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
+ (!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
+ using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
+ {
+ dbDataReader.Read();
+ PopulateFrom(dbDataReader);
+ }
+ }
+ public override void PopulateFrom (DbDataReader dbDataReader)
+ {
+ _IndexDefragId = GetFieldInt32(dbDataReader, "IndexDefragId", _IndexDefragId);
+ _DatabaseID = GetFieldInt32(dbDataReader, "DatabaseID", _DatabaseID);
+ _DatabaseName = GetFieldString(dbDataReader, "DatabaseName", _DatabaseName);
+ _ObjectID = GetFieldInt32(dbDataReader, "ObjectID", _ObjectID);
+ _ObjectName = GetFieldString(dbDataReader, "ObjectName", _ObjectName);
+ _IndexID = GetFieldInt32(dbDataReader, "IndexID", _IndexID);
+ _IndexName = GetFieldString(dbDataReader, "IndexName", _IndexName);
+ _PartitionNumber = GetFieldInt16(dbDataReader, "PartitionNumber", _PartitionNumber);
+ _Fragmentation = GetFieldDouble(dbDataReader, "Fragmentation", _Fragmentation);
+ _PageCount = GetFieldInt32(dbDataReader, "PageCount", _PageCount);
+ _DateTimeStart = GetFieldDateTime(dbDataReader, "DateTimeStart", _DateTimeStart);
+ _DurationSeconds = GetFieldInt32(dbDataReader, "DurationSeconds", _DurationSeconds);
+ }
+
+ //-------------------------------------------------------------------
+ // Insert command.
+ public override bool ExecuteInsertCommand (DbCommand dbCommand)
+ {
+ List columnNames = ExistingColumnNamesNonId;
+ // Avoid insert if Identity field is already valid.
+ if (_IndexDefragId != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
+ // Construct query.
+ String query =
+ "INSERT INTO " + TableNameFmt + " " +
+ "("+columnNames.Concat(",","[","]")+") ";
+ query += "Output Inserted.IndexDefragId ";
+ if (dbCommand is SqlCommand)
+ query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
+ else query += "VALUES (" + StringList.CreateList("?", columnNames.Count).Concat(",") + ") ";
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("DatabaseID")) AddCommandParameter(dbCommand, "@DatabaseID", _DatabaseID);
+ if (columnNames.ContainsCI("DatabaseName")) AddCommandParameter(dbCommand, "@DatabaseName", _DatabaseName);
+ if (columnNames.ContainsCI("ObjectID")) AddCommandParameter(dbCommand, "@ObjectID", _ObjectID);
+ if (columnNames.ContainsCI("ObjectName")) AddCommandParameter(dbCommand, "@ObjectName", _ObjectName);
+ if (columnNames.ContainsCI("IndexID")) AddCommandParameter(dbCommand, "@IndexID", _IndexID);
+ if (columnNames.ContainsCI("IndexName")) AddCommandParameter(dbCommand, "@IndexName", _IndexName);
+ if (columnNames.ContainsCI("PartitionNumber")) AddCommandParameter(dbCommand, "@PartitionNumber", _PartitionNumber);
+ if (columnNames.ContainsCI("Fragmentation")) AddCommandParameter(dbCommand, "@Fragmentation", _Fragmentation);
+ if (columnNames.ContainsCI("PageCount")) AddCommandParameter(dbCommand, "@PageCount", _PageCount);
+ if (columnNames.ContainsCI("DateTimeStart")) AddCommandParameter(dbCommand, "@DateTimeStart", _DateTimeStart);
+ if (columnNames.ContainsCI("DurationSeconds")) AddCommandParameter(dbCommand, "@DurationSeconds", _DurationSeconds);
+ // Execute insert command.
+ bool commandSuccess = false;
+ int executeNonQuery = dbCommand.ExecuteNonQuery();
+ if (executeNonQuery == 1)
+ {
+ dbCommand.CommandText = "SELECT Max(IndexDefragId) FROM " + TableNameFmt + ";";
+ _IndexDefragId = Convert.ToInt32(dbCommand.ExecuteScalar());
+ commandSuccess = (_IndexDefragId > 0);
+ }
+ return commandSuccess;
+ }
+
+ //-------------------------------------------------------------------
+ // Update command.
+ public override bool ExecuteUpdateCommand (DbCommand dbCommand)
+ {
+ // Avoid update if Identity field isn't valid.
+ if (_IndexDefragId == 0) throw new Exception("Invalid for Update - item has an invalid Id");
+ // Columns to update.
+ List columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
+ // Construct query.
+ String query = "UPDATE " + TableNameFmt + " SET ";
+ if (dbCommand is SqlCommand)
+ {
+ query += StringPairList.CreateFrom(columnNames,true).Concat("=@").Concat(", ") + " ";
+ query += "WHERE IndexDefragId=@IndexDefragId;";
+ }
+ else
+ {
+ query += columnNames.Concat(", ", "", "=?") + " ";
+ query += "WHERE IndexDefragId=?;";
+ }
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("DatabaseID")) AddCommandParameter(dbCommand, "@DatabaseID", _DatabaseID);
+ if (columnNames.ContainsCI("DatabaseName")) AddCommandParameter(dbCommand, "@DatabaseName", _DatabaseName);
+ if (columnNames.ContainsCI("ObjectID")) AddCommandParameter(dbCommand, "@ObjectID", _ObjectID);
+ if (columnNames.ContainsCI("ObjectName")) AddCommandParameter(dbCommand, "@ObjectName", _ObjectName);
+ if (columnNames.ContainsCI("IndexID")) AddCommandParameter(dbCommand, "@IndexID", _IndexID);
+ if (columnNames.ContainsCI("IndexName")) AddCommandParameter(dbCommand, "@IndexName", _IndexName);
+ if (columnNames.ContainsCI("PartitionNumber")) AddCommandParameter(dbCommand, "@PartitionNumber", _PartitionNumber);
+ if (columnNames.ContainsCI("Fragmentation")) AddCommandParameter(dbCommand, "@Fragmentation", _Fragmentation);
+ if (columnNames.ContainsCI("PageCount")) AddCommandParameter(dbCommand, "@PageCount", _PageCount);
+ if (columnNames.ContainsCI("DateTimeStart")) AddCommandParameter(dbCommand, "@DateTimeStart", _DateTimeStart);
+ if (columnNames.ContainsCI("DurationSeconds")) AddCommandParameter(dbCommand, "@DurationSeconds", _DurationSeconds);
+ AddCommandParameter(dbCommand, "@IndexDefragId", _IndexDefragId);
+ int executeNonQueryResult = dbCommand.ExecuteNonQuery();
+ return (executeNonQueryResult == 1);
+ }
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SaItemNamedValue_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/SaItemNamedValue_Db.cs
new file mode 100644
index 0000000..5e91dd3
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SaItemNamedValue_Db.cs
@@ -0,0 +1,216 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class SaItemNamedValue_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt16 _ItemType { get; } = new ColumnDataInt16("ItemType");
+ public ColumnDataInt32 _ItemId { get; } = new ColumnDataInt32("ItemId");
+ public ColumnDataString _Name { get; } = new ColumnDataString("Name");
+ public ColumnDataInt16 _Seq { get; } = new ColumnDataInt16("Seq");
+ public ColumnDataString _Value { get; } = new ColumnDataString("Value");
+ public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
+ public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
+ public ColumnDataString _Status { get; } = new ColumnDataString("Status");
+ public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
+ public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
+ public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
+ public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
+ public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
+ public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "ItemType",
+ "ItemId",
+ "Name",
+ "Seq",
+ "Value",
+ "Notes",
+ "Flags",
+ "Status",
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ "UpdateOn",
+ "UpdateBy",
+ "UpdateHost",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "ItemType",
+ "ItemId",
+ "Name",
+ "Seq",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List()
+ {
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ };
+
+ //-------------------------------------------------------------------
+ // Construction.
+ internal SaItemNamedValue_Db (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public override String SchemaName { get; } = "dbo";
+ public override String TableName { get; } = "SaItemNamedValue";
+ public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
+ public static List Fields { get { return new List(fields); } }
+ public static List FieldsId { get { return new List(fieldsId); } }
+ public static List FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
+ // Columns.
+ public ColumnsData Cols { get; } = new ColumnsData();
+ public Int16 _ItemType { get { return Cols._ItemType.Value; } set { Cols._ItemType.Value = value; } }
+ public Int32 _ItemId { get { return Cols._ItemId.Value; } set { Cols._ItemId.Value = value; } }
+ public String _Name { get { return Cols._Name.Value; } set { Cols._Name.Value = value; } }
+ public Int16 _Seq { get { return Cols._Seq.Value; } set { Cols._Seq.Value = value; } }
+ public String _Value { get { return Cols._Value.Value; } set { Cols._Value.Value = value; } }
+ public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
+ public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
+ public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
+ public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
+ public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
+ public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
+ public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
+ public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
+ public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
+ // Existing columns - confirmed on database if table exists.
+ public List ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
+ public List ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
+
+ //-------------------------------------------------------------------
+ // Population.
+ public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
+ {
+ dbCommand.CommandText =
+ "SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
+ "FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
+ (!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
+ using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
+ {
+ dbDataReader.Read();
+ PopulateFrom(dbDataReader);
+ }
+ }
+ public override void PopulateFrom (DbDataReader dbDataReader)
+ {
+ _ItemType = GetFieldInt16(dbDataReader, "ItemType", _ItemType);
+ _ItemId = GetFieldInt32(dbDataReader, "ItemId", _ItemId);
+ _Name = GetFieldString(dbDataReader, "Name", _Name);
+ _Seq = GetFieldInt16(dbDataReader, "Seq", _Seq);
+ _Value = GetFieldString(dbDataReader, "Value", _Value);
+ _Notes = GetFieldString(dbDataReader, "Notes", _Notes);
+ _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
+ _Status = GetFieldString(dbDataReader, "Status", _Status);
+ _CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
+ _CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
+ _CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
+ _UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
+ _UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
+ _UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
+ }
+
+ //-------------------------------------------------------------------
+ // Insert command.
+ public override bool ExecuteInsertCommand (DbCommand dbCommand)
+ {
+ List columnNames = ExistingColumnNamesNonId;
+ // Construct query.
+ String query =
+ "INSERT INTO " + TableNameFmt + " " +
+ "("+columnNames.Concat(",","[","]")+") ";
+ if (dbCommand is SqlCommand)
+ query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
+ else query += "VALUES (" + StringList.CreateList("?", columnNames.Count).Concat(",") + ") ";
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("ItemType")) AddCommandParameter(dbCommand, "@ItemType", _ItemType);
+ if (columnNames.ContainsCI("ItemId")) AddCommandParameter(dbCommand, "@ItemId", _ItemId);
+ if (columnNames.ContainsCI("Name")) AddCommandParameter(dbCommand, "@Name", _Name);
+ if (columnNames.ContainsCI("Seq")) AddCommandParameter(dbCommand, "@Seq", _Seq);
+ if (columnNames.ContainsCI("Value")) AddCommandParameter(dbCommand, "@Value", _Value);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
+ if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
+ if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ // Execute insert command.
+ bool commandSuccess = false;
+ int executeNonQuery = dbCommand.ExecuteNonQuery();
+ if (executeNonQuery == 1)
+ {
+ commandSuccess = true;
+ }
+ return commandSuccess;
+ }
+
+ //-------------------------------------------------------------------
+ // Update command.
+ public override bool ExecuteUpdateCommand (DbCommand dbCommand)
+ {
+ // Columns to update.
+ List columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
+ // Construct query.
+ String query = "UPDATE " + TableNameFmt + " SET ";
+ if (dbCommand is SqlCommand)
+ {
+ query += StringPairList.CreateFrom(columnNames,true).Concat("=@").Concat(", ") + " ";
+ query += "WHERE ItemType=@ItemType AND ItemId=@ItemId AND Name=@Name AND Seq=@Seq;";
+ }
+ else
+ {
+ query += columnNames.Concat(", ", "", "=?") + " ";
+ query += "WHERE ItemType=? AND ItemId=? AND Name=? AND Seq=?;";
+ }
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("Value")) AddCommandParameter(dbCommand, "@Value", _Value);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ AddCommandParameter(dbCommand, "@ItemType", _ItemType);
+ AddCommandParameter(dbCommand, "@ItemId", _ItemId);
+ AddCommandParameter(dbCommand, "@Name", _Name);
+ AddCommandParameter(dbCommand, "@Seq", _Seq);
+ int executeNonQueryResult = dbCommand.ExecuteNonQuery();
+ return (executeNonQueryResult == 1);
+ }
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SpmDbDfn.xml b/SaPatMgrWinDbas/Win/Dbas/Internal/SpmDbDfn.xml
new file mode 100644
index 0000000..b827539
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SpmDbDfn.xml
@@ -0,0 +1,8505 @@
+
+
+
+
+ dbo
+ IndexDefragLog
+
+
+
+ dbo
+
+ 1
+ IndexDefragId
+ Int
+
+ 4
+ int
+ true
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ DatabaseID
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ DatabaseName
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 128
+ 256
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 4
+ ObjectID
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 5
+ ObjectName
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 128
+ 256
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 6
+ IndexID
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 7
+ IndexName
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 128
+ 256
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 8
+ PartitionNumber
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 9
+ Fragmentation
+ Double
+
+ 6
+ float
+ false
+ 53
+ 8
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 10
+ PageCount
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 11
+ DateTimeStart
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 12
+ DurationSeconds
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+
+
+ dbo
+
+ PK_IndexDefragLog
+ 1
+ true
+ false
+ false
+ false
+ 20
+ 869
+ false
+
+
+ 1
+ IndexDefragId
+ true
+
+
+
+
+
+
+ dbo
+ SaItemNamedValue
+
+
+
+ dbo
+
+ 1
+ ItemType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ ItemId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ Name
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 4
+ Seq
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 5
+ Value
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 10
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SaItemNamedValue
+ 1
+ true
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ItemType
+ true
+
+
+ 2
+ ItemId
+ true
+
+
+ 3
+ Name
+ true
+
+
+ 4
+ Seq
+ true
+
+
+
+
+ dbo
+
+ IDX_SaItemNamedValue_Item
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ItemType
+ true
+
+
+ 2
+ ItemId
+ true
+
+
+
+
+ dbo
+
+ IDX_SaItemNamedValue_ItemName
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ItemType
+ true
+
+
+ 2
+ ItemId
+ true
+
+
+ 3
+ Name
+ true
+
+
+
+
+ dbo
+
+ IDX_SaItemNamedValue_Name
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Name
+ true
+
+
+
+
+
+
+ dbo
+ SwmAdmission
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ FacilityId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 3
+ FacilityTemplateId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ AdmissionFrom
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ AdmissionTo
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ DecisionToReferOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ ReferredOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ BreechOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ DecisionToAdmitOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ PreAssessment
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ ToComeIn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ Seq
+ TinyInt
+
+ -6
+ tinyint
+ false
+ 3
+ 1
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ Type
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ Occupancy
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ PatientId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 16
+ PatientNo
+ VarChar
+
+ 12
+ varchar
+ false
+ 12
+ 12
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 17
+ NhsNumber
+ VarChar
+
+ 12
+ varchar
+ false
+ 16
+ 16
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 18
+ Title
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 19
+ Surname
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 20
+ Forename
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 21
+ Gender
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 22
+ BirthOn
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 23
+ Age
+ VarChar
+
+ 12
+ varchar
+ false
+ 3
+ 3
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 24
+ AgeOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 25
+ PhoneMobile
+ VarChar
+
+ 12
+ varchar
+ false
+ 32
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 26
+ Email
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 27
+ ContactFlags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 28
+ SystemRef
+ VarChar
+
+ 12
+ varchar
+ false
+ 16
+ 16
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 29
+ AttendanceType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 30
+ AttendanceStatus
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 31
+ FacilityIdWard
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 32
+ Ward
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 33
+ SpecialityCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 34
+ ProcedureId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 35
+ ProcedureCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 36
+ ProcedureDesc
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 37
+ ComplexityCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 38
+ ProcedureIndication
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 39
+ PatientHistory
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 32
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 40
+ GestationPeriod
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 32
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 41
+ DurationExp
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 42
+ DurationAct
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 43
+ UnitsExp
+ Single
+
+ 7
+ real
+ false
+ 24
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 44
+ UnitsAct
+ Single
+
+ 7
+ real
+ false
+ 24
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 45
+ Anaesthetic
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 46
+ Position
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 47
+ SpecialEquipment
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 48
+ ComfortScore
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 49
+ TimeCalled
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 50
+ TimeArrived
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 51
+ TimeAnaesStart
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 52
+ TimeProcStart
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 53
+ TimeProcEnd
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 54
+ TimeInRecovery
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 55
+ TimeInformDest
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 56
+ TimeLeave
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 57
+ CancelType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 58
+ CancelDate
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 59
+ CancelCount
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 60
+ CancelCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 20
+ 40
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 61
+ CancelReason
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 62
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 63
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 64
+ Status
+ VarChar
+
+ 12
+ varchar
+ false
+ 3
+ 3
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 65
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 66
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 67
+ CreateHost
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 68
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 69
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 70
+ UpdateHost
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 71
+ DecisionToRefer
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 72
+ Referred
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmAdmission
+ 1
+ true
+ false
+ false
+ false
+ 26912
+ 474099
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_Admission
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityTemplateId
+ true
+
+
+ 2
+ AdmissionFrom
+ true
+
+
+ 3
+ Seq
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_AdmissionFrom
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ AdmissionFrom
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_Facility
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_FacilityCancelAdmission
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+ 2
+ CancelType
+ true
+
+
+ 3
+ AdmissionFrom
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_FacilityTemplateAdmission
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+ 2
+ FacilityTemplateId
+ true
+
+
+ 3
+ AdmissionFrom
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_Patient
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ PatientId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_PatientNo
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ PatientNo
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_Procedure
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ProcedureId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_Surname
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Surname
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_SystemRef
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ SystemRef
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmission_Template
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityTemplateId
+ true
+
+
+
+
+
+
+ dbo
+ SwmAdmissionAction
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ AdmissionId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ Type
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ Raised
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ EmployeeIdRaised
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Completed
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ EmployeeIdCompleted
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ ActionData
+ VarChar
+
+ 12
+ varchar
+ false
+ 255
+ 255
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ Status
+ VarChar
+
+ 12
+ varchar
+ false
+ 3
+ 3
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 12
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 13
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ CreateHost
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 16
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 17
+ UpdateHost
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmAdmissionAction
+ 1
+ true
+ false
+ false
+ false
+ 332
+ 24577
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmissionAction_Admission
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ AdmissionId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmissionAction_Raised
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Raised
+ true
+
+
+
+
+
+
+ dbo
+ SwmAdmissionData
+
+
+
+ dbo
+
+ 1
+ AdmissionId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ Type
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ Data
+ VarChar
+
+ 12
+ varchar
+ false
+ 255
+ 255
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Status
+ VarChar
+
+ 12
+ varchar
+ false
+ 3
+ 3
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 8
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ CreateHost
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ UpdateHost
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmAdmissionData
+ 1
+ true
+ false
+ false
+ false
+ 16
+ 1515
+ false
+
+
+ 1
+ AdmissionId
+ true
+
+
+ 2
+ Type
+ true
+
+
+
+
+
+
+ dbo
+ SwmAdmissionRole
+
+
+
+ dbo
+
+ 1
+ AdmissionId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ Role
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ Seq
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 4
+ EmployeeRoleId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 5
+ EmployeeCode
+ VarChar
+
+ 12
+ varchar
+ false
+ 12
+ 12
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 6
+ Category
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 7
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ Status
+ VarChar
+
+ 12
+ varchar
+ false
+ 3
+ 3
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 10
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 11
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ CreateHost
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ UpdateHost
+ VarChar
+
+ 12
+ varchar
+ false
+ 64
+ 64
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmAdmissionRole
+ 1
+ true
+ false
+ false
+ false
+ 2049
+ 198386
+ false
+
+
+ 1
+ AdmissionId
+ true
+
+
+ 2
+ Role
+ true
+
+
+ 3
+ Seq
+ true
+
+
+ 4
+ EmployeeRoleId
+ true
+
+
+ 5
+ EmployeeCode
+ true
+
+
+ 6
+ Category
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmissionRole_AdmissionRoleCatSeq
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ AdmissionId
+ true
+
+
+ 2
+ Role
+ true
+
+
+ 3
+ Category
+ true
+
+
+ 4
+ Seq
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmAdmissionRole_EmployeeRole
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ EmployeeRoleId
+ true
+
+
+
+
+
+
+ dbo
+ SwmDepartment
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ InstitutionId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 3
+ Name
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 60
+ 120
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ FacilityTypes
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ AllowAnyFacility
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ CancellReBookLimit
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ ApplicFrom
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ ApplicTo
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 13
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 16
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 17
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmDepartment
+ 1
+ true
+ false
+ false
+ false
+ 1
+ 21
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmDepartment_ApplicableFrom
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ApplicFrom
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmDepartment_ApplicableTo
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ApplicTo
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmDepartment_Institution
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ InstitutionId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmDepartment_Name
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Name
+ true
+
+
+
+
+
+
+ dbo
+ SwmDepartmentCode
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ DepartmentId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 3
+ CodeType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ Code
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 16
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ Description
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 10
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmDepartmentCode
+ 1
+ true
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmDepartmentCode_DeptTypeCode
+ 3
+ true
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+ 2
+ CodeType
+ true
+
+
+ 3
+ Code
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmDepartmentCode_Department
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+
+
+
+
+ dbo
+ SwmEmployee
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ InstitutionId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ EmployeeNo
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ Code
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ Initials
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 6
+ 12
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Title
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ Surname
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 8
+ Forename
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 13
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 16
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 17
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmEmployee
+ 1
+ true
+ false
+ false
+ false
+ 6
+ 395
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployee_InstCode
+ 3
+ true
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ InstitutionId
+ true
+
+
+ 2
+ Code
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployee_Code
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Code
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployee_EmployeeNo
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ EmployeeNo
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployee_Institution
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ InstitutionId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployee_InstNumber
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ InstitutionId
+ true
+
+
+ 2
+ EmployeeNo
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployee_Surname
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Surname
+ true
+
+
+
+
+
+
+ dbo
+ SwmEmployeeRole
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ DepartmentId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ EmployeeId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 4
+ Role
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 5
+ ApplicFrom
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ ApplicTo
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 10
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 11
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmEmployeeRole
+ 1
+ true
+ false
+ false
+ false
+ 6
+ 480
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployeeRole_ApplicFrom
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ApplicFrom
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployeeRole_ApplicTo
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ApplicTo
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployeeRole_Department
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployeeRole_DeptRole
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+ 2
+ Role
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployeeRole_Employee
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ EmployeeId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmEmployeeRole_Role
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Role
+ true
+
+
+
+
+
+
+ dbo
+ SwmFacility
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ DepartmentId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 3
+ Type
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ Name
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 16
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ SortCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 16
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Description
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ TemplateMapType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ TemplateMapFrom
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ ScheduleFreezeType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ ScheduleFreezeData
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ ApplicFrom
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ ApplicTo
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 16
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 17
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 18
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 19
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 20
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 21
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmFacility
+ 1
+ true
+ false
+ false
+ false
+ 3
+ 89
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacility_Department
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacility_DeptName
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+ 2
+ Name
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacility_DeptSort
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+ 2
+ SortCode
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacility_DeptType
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+ 2
+ Type
+ true
+
+
+
+
+
+
+ dbo
+ SwmFacilitySession
+
+
+
+ dbo
+
+ 1
+ FacilityId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ FacilityTemplateId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ Session
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 4
+ Type
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ Name
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 32
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Description
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ SessionCode
+ VarChar
+
+ 12
+ varchar
+ false
+ 32
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ StartAt
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ FinishAt
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ ConsultantId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ ConsultantCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ SpecialityCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ CapacityType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ CapacityMin
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ CapacityMax
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 16
+ DurationInterval
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 17
+ DurationMin
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 18
+ DurationMax
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 19
+ DurationBreaks
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 20
+ UnitsExp
+ Single
+
+ 7
+ real
+ false
+ 24
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 21
+ BookingsProhibited_ResourceGroups
+ VarChar
+
+ 12
+ varchar
+ false
+ 1024
+ 1024
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 22
+ Overrides
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 23
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 24
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 25
+ Status
+ VarChar
+
+ 12
+ varchar
+ false
+ 3
+ 3
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 26
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 27
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 28
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 29
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 30
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 31
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmFacilitySession
+ 1
+ true
+ false
+ false
+ false
+ 1105
+ 40052
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+ 2
+ FacilityTemplateId
+ true
+
+
+ 3
+ Session
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilitySession_Consultant
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ConsultantId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilitySession_ConsultantCode
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ConsultantCode
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilitySession_Facility
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilitySession_FacilitySession
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+ 2
+ Session
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilitySession_FacilityTemplate
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityTemplateId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilitySession_Session
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Session
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilitySession_SpecialityCode
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ SpecialityCode
+ true
+
+
+
+
+
+
+ dbo
+ SwmFacilityTemplate
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ FacilityId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 3
+ Category
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ Type
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ Group
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 16
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Name
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 32
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ SortCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 16
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ Description
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ SessionCode
+ VarChar
+
+ 12
+ varchar
+ false
+ 32
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ TemplateMapType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ TemplateMapFrom
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ WeekOfMonth
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ DayOfWeek
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ StartAt
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ FinishAt
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 16
+ ConsultantId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 17
+ ConsultantCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 18
+ SpecialityCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 19
+ CapacityType
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 20
+ CapacityMin
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 21
+ CapacityMax
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 22
+ DurationInterval
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 23
+ DurationMin
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 24
+ DurationMax
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 25
+ DurationBreaks
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 26
+ UnitsExp
+ Single
+
+ 7
+ real
+ false
+ 24
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 27
+ ApplicFrom
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 28
+ ApplicTo
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 29
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 30
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 31
+ Status
+ VarChar
+
+ 12
+ varchar
+ false
+ 3
+ 3
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 32
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 33
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 34
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 35
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 36
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 37
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmFacilityTemplate
+ 1
+ true
+ false
+ false
+ false
+ 61
+ 2122
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilityTemplate_Consultant
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ConsultantId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilityTemplate_ConsultantCode
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ConsultantCode
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilityTemplate_Facility
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilityTemplate_FacilityCategoryType
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+ 2
+ Category
+ true
+
+
+ 3
+ Type
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilityTemplate_FacilityTypeDay
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityId
+ true
+
+
+ 2
+ Type
+ true
+
+
+ 3
+ DayOfWeek
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmFacilityTemplate_SpecialityCode
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ SpecialityCode
+ true
+
+
+
+
+
+
+ dbo
+ SwmInstitution
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ Name
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 60
+ 120
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 5
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 6
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 7
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 8
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmInstitution
+ 1
+ true
+ false
+ false
+ false
+ 1
+ 1
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmInstitution_Name
+ 3
+ true
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Name
+ true
+
+
+
+
+
+
+ dbo
+ SwmOperation
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ InstitutionId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 3
+ Code
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 20
+ 40
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ Description
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 9
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmOperation
+ 1
+ true
+ false
+ false
+ false
+ 14
+ 641
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmOperation_Code
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Code
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmOperation_Description
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Description
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmOperation_Institution
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ InstitutionId
+ true
+
+
+
+
+
+
+ dbo
+ SwmPatient
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ InstitutionId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 3
+ PatientNo
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 4
+ NhsNumber
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 16
+ 32
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ Title
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Surname
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 7
+ Forename
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 8
+ Gender
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ BirthOn
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ Age
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ AgeOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ PhoneMobile
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 32
+ 64
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ Email
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 16
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 17
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 18
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 19
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 20
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 21
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 22
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmPatient
+ 1
+ true
+ false
+ false
+ false
+ 4442
+ 224607
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmPatient_InstNumber
+ 3
+ true
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ InstitutionId
+ true
+
+
+ 2
+ PatientNo
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmPatient_Institution
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ InstitutionId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmPatient_NhsNumber
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ NhsNumber
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmPatient_PatientNo
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ PatientNo
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmPatient_Surname
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Surname
+ true
+
+
+
+
+
+
+ dbo
+ SwmProcedure
+
+
+
+ dbo
+
+ 1
+ Id
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ DepartmentId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 3
+ OperationId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 4
+ OpnCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 5
+ Description
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ SpecialityCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ ComplexityCode
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 12
+ 24
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ Duration
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ Units
+ Single
+
+ 7
+ real
+ false
+ 24
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ Duration_Training
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ Units_Training
+ Single
+
+ 7
+ real
+ false
+ 24
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 15
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 16
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 17
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 18
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 19
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 20
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmProcedure
+ 1
+ true
+ false
+ false
+ false
+ 18
+ 750
+ false
+
+
+ 1
+ Id
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmProcedure_ComplexityCode
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ ComplexityCode
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmProcedure_Department
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ DepartmentId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmProcedure_Description
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Description
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmProcedure_Operation
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ OperationId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmProcedure_OpnCode
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ OpnCode
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmProcedure_SpecialityCode
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ SpecialityCode
+ true
+
+
+
+
+
+
+ dbo
+ SwmTemplateData
+
+
+
+ dbo
+
+ 1
+ FacilityTemplateId
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 2
+ Type
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 3
+ Seq
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 4
+ Identifier
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ NoNulls
+ false
+
+
+
+ dbo
+
+ 5
+ Value
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 50
+ 100
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 6
+ Notes
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 255
+ 510
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 7
+ Flags
+ SmallInt
+
+ 5
+ smallint
+ false
+ 5
+ 2
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 8
+ Status
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 3
+ 6
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 9
+ CreateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 10
+ CreateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 11
+ CreateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 12
+ UpdateOn
+ DateTime
+
+ 93
+ datetime
+ false
+ 23
+ 16
+ 3
+ Nullable
+ true
+
+
+
+ dbo
+
+ 13
+ UpdateBy
+ Int
+
+ 4
+ int
+ false
+ 10
+ 4
+ 0
+ Nullable
+ true
+
+
+
+ dbo
+
+ 14
+ UpdateHost
+ VarChar
+
+ -9
+ nvarchar
+ false
+ 64
+ 128
+ 0
+ Nullable
+ true
+
+
+
+
+
+ dbo
+
+ PK_SwmTemplateData
+ 1
+ true
+ false
+ false
+ false
+ 8
+ 533
+ false
+
+
+ 1
+ FacilityTemplateId
+ true
+
+
+ 2
+ Type
+ true
+
+
+ 3
+ Seq
+ true
+
+
+ 4
+ Identifier
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmTemplateData_Identifier
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Identifier
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmTemplateData_Template
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ FacilityTemplateId
+ true
+
+
+
+
+ dbo
+
+ IDX_SwmTemplateData_Type
+ 3
+ false
+ false
+ false
+ false
+ 0
+ 0
+ false
+
+
+ 1
+ Type
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionAction_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionAction_Db.cs
new file mode 100644
index 0000000..fd245f1
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionAction_Db.cs
@@ -0,0 +1,231 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class SwmAdmissionAction_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id");
+ public ColumnDataInt32 _AdmissionId { get; } = new ColumnDataInt32("AdmissionId");
+ public ColumnDataInt16 _Type { get; } = new ColumnDataInt16("Type");
+ public ColumnDataDateTime _Raised { get; } = new ColumnDataDateTime("Raised");
+ public ColumnDataInt32 _EmployeeIdRaised { get; } = new ColumnDataInt32("EmployeeIdRaised");
+ public ColumnDataDateTime _Completed { get; } = new ColumnDataDateTime("Completed");
+ public ColumnDataInt32 _EmployeeIdCompleted { get; } = new ColumnDataInt32("EmployeeIdCompleted");
+ public ColumnDataString _ActionData { get; } = new ColumnDataString("ActionData");
+ public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
+ public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
+ public ColumnDataString _Status { get; } = new ColumnDataString("Status");
+ public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
+ public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
+ public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
+ public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
+ public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
+ public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "Id",
+ "AdmissionId",
+ "Type",
+ "Raised",
+ "EmployeeIdRaised",
+ "Completed",
+ "EmployeeIdCompleted",
+ "ActionData",
+ "Notes",
+ "Flags",
+ "Status",
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ "UpdateOn",
+ "UpdateBy",
+ "UpdateHost",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "Id",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List()
+ {
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ };
+
+ //-------------------------------------------------------------------
+ // Construction.
+ internal SwmAdmissionAction_Db (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public override String SchemaName { get; } = "dbo";
+ public override String TableName { get; } = "SwmAdmissionAction";
+ public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
+ public static List Fields { get { return new List(fields); } }
+ public static List FieldsId { get { return new List(fieldsId); } }
+ public static List FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
+ // Columns.
+ public ColumnsData Cols { get; } = new ColumnsData();
+ public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
+ public Int32 _AdmissionId { get { return Cols._AdmissionId.Value; } set { Cols._AdmissionId.Value = value; } }
+ public Int16 _Type { get { return Cols._Type.Value; } set { Cols._Type.Value = value; } }
+ public DateTime _Raised { get { return Cols._Raised.Value; } set { Cols._Raised.Value = value; } }
+ public Int32 _EmployeeIdRaised { get { return Cols._EmployeeIdRaised.Value; } set { Cols._EmployeeIdRaised.Value = value; } }
+ public DateTime _Completed { get { return Cols._Completed.Value; } set { Cols._Completed.Value = value; } }
+ public Int32 _EmployeeIdCompleted { get { return Cols._EmployeeIdCompleted.Value; } set { Cols._EmployeeIdCompleted.Value = value; } }
+ public String _ActionData { get { return Cols._ActionData.Value; } set { Cols._ActionData.Value = value; } }
+ public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
+ public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
+ public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
+ public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
+ public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
+ public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
+ public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
+ public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
+ public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
+ // Existing columns - confirmed on database if table exists.
+ public List ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
+ public List ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
+
+ //-------------------------------------------------------------------
+ // Population.
+ public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
+ {
+ dbCommand.CommandText =
+ "SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
+ "FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
+ (!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
+ using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
+ {
+ dbDataReader.Read();
+ PopulateFrom(dbDataReader);
+ }
+ }
+ public override void PopulateFrom (DbDataReader dbDataReader)
+ {
+ _Id = GetFieldInt32(dbDataReader, "Id", _Id);
+ _AdmissionId = GetFieldInt32(dbDataReader, "AdmissionId", _AdmissionId);
+ _Type = GetFieldInt16(dbDataReader, "Type", _Type);
+ _Raised = GetFieldDateTime(dbDataReader, "Raised", _Raised);
+ _EmployeeIdRaised = GetFieldInt32(dbDataReader, "EmployeeIdRaised", _EmployeeIdRaised);
+ _Completed = GetFieldDateTime(dbDataReader, "Completed", _Completed);
+ _EmployeeIdCompleted = GetFieldInt32(dbDataReader, "EmployeeIdCompleted", _EmployeeIdCompleted);
+ _ActionData = GetFieldString(dbDataReader, "ActionData", _ActionData);
+ _Notes = GetFieldString(dbDataReader, "Notes", _Notes);
+ _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
+ _Status = GetFieldString(dbDataReader, "Status", _Status);
+ _CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
+ _CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
+ _CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
+ _UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
+ _UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
+ _UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
+ }
+
+ //-------------------------------------------------------------------
+ // Insert command.
+ public override bool ExecuteInsertCommand (DbCommand dbCommand)
+ {
+ List columnNames = ExistingColumnNamesNonId;
+ // Construct query.
+ String query =
+ "INSERT INTO " + TableNameFmt + " " +
+ "("+columnNames.Concat(",","[","]")+") ";
+ if (dbCommand is SqlCommand)
+ query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
+ else query += "VALUES (" + StringList.CreateList("?", columnNames.Count).Concat(",") + ") ";
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("Id")) AddCommandParameter(dbCommand, "@Id", _Id);
+ if (columnNames.ContainsCI("AdmissionId")) AddCommandParameter(dbCommand, "@AdmissionId", _AdmissionId);
+ if (columnNames.ContainsCI("Type")) AddCommandParameter(dbCommand, "@Type", _Type);
+ if (columnNames.ContainsCI("Raised")) AddCommandParameter(dbCommand, "@Raised", _Raised);
+ if (columnNames.ContainsCI("EmployeeIdRaised")) AddCommandParameter(dbCommand, "@EmployeeIdRaised", _EmployeeIdRaised);
+ if (columnNames.ContainsCI("Completed")) AddCommandParameter(dbCommand, "@Completed", _Completed);
+ if (columnNames.ContainsCI("EmployeeIdCompleted")) AddCommandParameter(dbCommand, "@EmployeeIdCompleted", _EmployeeIdCompleted);
+ if (columnNames.ContainsCI("ActionData")) AddCommandParameter(dbCommand, "@ActionData", _ActionData);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
+ if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
+ if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ // Execute insert command.
+ bool commandSuccess = false;
+ int executeNonQuery = dbCommand.ExecuteNonQuery();
+ if (executeNonQuery == 1)
+ {
+ commandSuccess = true;
+ }
+ return commandSuccess;
+ }
+
+ //-------------------------------------------------------------------
+ // Update command.
+ public override bool ExecuteUpdateCommand (DbCommand dbCommand)
+ {
+ // Columns to update.
+ List columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
+ // Construct query.
+ String query = "UPDATE " + TableNameFmt + " SET ";
+ if (dbCommand is SqlCommand)
+ {
+ query += StringPairList.CreateFrom(columnNames,true).Concat("=@").Concat(", ") + " ";
+ query += "WHERE Id=@Id;";
+ }
+ else
+ {
+ query += columnNames.Concat(", ", "", "=?") + " ";
+ query += "WHERE Id=?;";
+ }
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("AdmissionId")) AddCommandParameter(dbCommand, "@AdmissionId", _AdmissionId);
+ if (columnNames.ContainsCI("Type")) AddCommandParameter(dbCommand, "@Type", _Type);
+ if (columnNames.ContainsCI("Raised")) AddCommandParameter(dbCommand, "@Raised", _Raised);
+ if (columnNames.ContainsCI("EmployeeIdRaised")) AddCommandParameter(dbCommand, "@EmployeeIdRaised", _EmployeeIdRaised);
+ if (columnNames.ContainsCI("Completed")) AddCommandParameter(dbCommand, "@Completed", _Completed);
+ if (columnNames.ContainsCI("EmployeeIdCompleted")) AddCommandParameter(dbCommand, "@EmployeeIdCompleted", _EmployeeIdCompleted);
+ if (columnNames.ContainsCI("ActionData")) AddCommandParameter(dbCommand, "@ActionData", _ActionData);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ AddCommandParameter(dbCommand, "@Id", _Id);
+ int executeNonQueryResult = dbCommand.ExecuteNonQuery();
+ return (executeNonQueryResult == 1);
+ }
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionData_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionData_Db.cs
new file mode 100644
index 0000000..f141c5b
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionData_Db.cs
@@ -0,0 +1,202 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class SwmAdmissionData_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt32 _AdmissionId { get; } = new ColumnDataInt32("AdmissionId");
+ public ColumnDataInt16 _Type { get; } = new ColumnDataInt16("Type");
+ public ColumnDataString _Data { get; } = new ColumnDataString("Data");
+ public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
+ public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
+ public ColumnDataString _Status { get; } = new ColumnDataString("Status");
+ public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
+ public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
+ public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
+ public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
+ public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
+ public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "AdmissionId",
+ "Type",
+ "Data",
+ "Notes",
+ "Flags",
+ "Status",
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ "UpdateOn",
+ "UpdateBy",
+ "UpdateHost",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "AdmissionId",
+ "Type",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List()
+ {
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ };
+
+ //-------------------------------------------------------------------
+ // Construction.
+ internal SwmAdmissionData_Db (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public override String SchemaName { get; } = "dbo";
+ public override String TableName { get; } = "SwmAdmissionData";
+ public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
+ public static List Fields { get { return new List(fields); } }
+ public static List FieldsId { get { return new List(fieldsId); } }
+ public static List FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
+ // Columns.
+ public ColumnsData Cols { get; } = new ColumnsData();
+ public Int32 _AdmissionId { get { return Cols._AdmissionId.Value; } set { Cols._AdmissionId.Value = value; } }
+ public Int16 _Type { get { return Cols._Type.Value; } set { Cols._Type.Value = value; } }
+ public String _Data { get { return Cols._Data.Value; } set { Cols._Data.Value = value; } }
+ public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
+ public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
+ public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
+ public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
+ public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
+ public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
+ public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
+ public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
+ public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
+ // Existing columns - confirmed on database if table exists.
+ public List ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
+ public List ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
+
+ //-------------------------------------------------------------------
+ // Population.
+ public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
+ {
+ dbCommand.CommandText =
+ "SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
+ "FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
+ (!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
+ using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
+ {
+ dbDataReader.Read();
+ PopulateFrom(dbDataReader);
+ }
+ }
+ public override void PopulateFrom (DbDataReader dbDataReader)
+ {
+ _AdmissionId = GetFieldInt32(dbDataReader, "AdmissionId", _AdmissionId);
+ _Type = GetFieldInt16(dbDataReader, "Type", _Type);
+ _Data = GetFieldString(dbDataReader, "Data", _Data);
+ _Notes = GetFieldString(dbDataReader, "Notes", _Notes);
+ _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
+ _Status = GetFieldString(dbDataReader, "Status", _Status);
+ _CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
+ _CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
+ _CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
+ _UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
+ _UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
+ _UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
+ }
+
+ //-------------------------------------------------------------------
+ // Insert command.
+ public override bool ExecuteInsertCommand (DbCommand dbCommand)
+ {
+ List columnNames = ExistingColumnNamesNonId;
+ // Construct query.
+ String query =
+ "INSERT INTO " + TableNameFmt + " " +
+ "("+columnNames.Concat(",","[","]")+") ";
+ if (dbCommand is SqlCommand)
+ query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
+ else query += "VALUES (" + StringList.CreateList("?", columnNames.Count).Concat(",") + ") ";
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("AdmissionId")) AddCommandParameter(dbCommand, "@AdmissionId", _AdmissionId);
+ if (columnNames.ContainsCI("Type")) AddCommandParameter(dbCommand, "@Type", _Type);
+ if (columnNames.ContainsCI("Data")) AddCommandParameter(dbCommand, "@Data", _Data);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
+ if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
+ if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ // Execute insert command.
+ bool commandSuccess = false;
+ int executeNonQuery = dbCommand.ExecuteNonQuery();
+ if (executeNonQuery == 1)
+ {
+ commandSuccess = true;
+ }
+ return commandSuccess;
+ }
+
+ //-------------------------------------------------------------------
+ // Update command.
+ public override bool ExecuteUpdateCommand (DbCommand dbCommand)
+ {
+ // Columns to update.
+ List columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
+ // Construct query.
+ String query = "UPDATE " + TableNameFmt + " SET ";
+ if (dbCommand is SqlCommand)
+ {
+ query += StringPairList.CreateFrom(columnNames,true).Concat("=@").Concat(", ") + " ";
+ query += "WHERE AdmissionId=@AdmissionId AND Type=@Type;";
+ }
+ else
+ {
+ query += columnNames.Concat(", ", "", "=?") + " ";
+ query += "WHERE AdmissionId=? AND Type=?;";
+ }
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("Data")) AddCommandParameter(dbCommand, "@Data", _Data);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ AddCommandParameter(dbCommand, "@AdmissionId", _AdmissionId);
+ AddCommandParameter(dbCommand, "@Type", _Type);
+ int executeNonQueryResult = dbCommand.ExecuteNonQuery();
+ return (executeNonQueryResult == 1);
+ }
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionRole_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionRole_Db.cs
new file mode 100644
index 0000000..252dbbf
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmissionRole_Db.cs
@@ -0,0 +1,224 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class SwmAdmissionRole_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt32 _AdmissionId { get; } = new ColumnDataInt32("AdmissionId");
+ public ColumnDataInt16 _Role { get; } = new ColumnDataInt16("Role");
+ public ColumnDataInt16 _Seq { get; } = new ColumnDataInt16("Seq");
+ public ColumnDataInt32 _EmployeeRoleId { get; } = new ColumnDataInt32("EmployeeRoleId");
+ public ColumnDataString _EmployeeCode { get; } = new ColumnDataString("EmployeeCode");
+ public ColumnDataInt16 _Category { get; } = new ColumnDataInt16("Category");
+ public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
+ public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
+ public ColumnDataString _Status { get; } = new ColumnDataString("Status");
+ public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
+ public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
+ public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
+ public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
+ public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
+ public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "AdmissionId",
+ "Role",
+ "Seq",
+ "EmployeeRoleId",
+ "EmployeeCode",
+ "Category",
+ "Notes",
+ "Flags",
+ "Status",
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ "UpdateOn",
+ "UpdateBy",
+ "UpdateHost",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "AdmissionId",
+ "Role",
+ "Seq",
+ "EmployeeRoleId",
+ "EmployeeCode",
+ "Category",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List()
+ {
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ };
+
+ //-------------------------------------------------------------------
+ // Construction.
+ internal SwmAdmissionRole_Db (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public override String SchemaName { get; } = "dbo";
+ public override String TableName { get; } = "SwmAdmissionRole";
+ public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
+ public static List Fields { get { return new List(fields); } }
+ public static List FieldsId { get { return new List(fieldsId); } }
+ public static List FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
+ // Columns.
+ public ColumnsData Cols { get; } = new ColumnsData();
+ public Int32 _AdmissionId { get { return Cols._AdmissionId.Value; } set { Cols._AdmissionId.Value = value; } }
+ public Int16 _Role { get { return Cols._Role.Value; } set { Cols._Role.Value = value; } }
+ public Int16 _Seq { get { return Cols._Seq.Value; } set { Cols._Seq.Value = value; } }
+ public Int32 _EmployeeRoleId { get { return Cols._EmployeeRoleId.Value; } set { Cols._EmployeeRoleId.Value = value; } }
+ public String _EmployeeCode { get { return Cols._EmployeeCode.Value; } set { Cols._EmployeeCode.Value = value; } }
+ public Int16 _Category { get { return Cols._Category.Value; } set { Cols._Category.Value = value; } }
+ public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
+ public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
+ public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
+ public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
+ public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
+ public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
+ public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
+ public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
+ public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
+ // Existing columns - confirmed on database if table exists.
+ public List ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
+ public List ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
+
+ //-------------------------------------------------------------------
+ // Population.
+ public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
+ {
+ dbCommand.CommandText =
+ "SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
+ "FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
+ (!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
+ using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
+ {
+ dbDataReader.Read();
+ PopulateFrom(dbDataReader);
+ }
+ }
+ public override void PopulateFrom (DbDataReader dbDataReader)
+ {
+ _AdmissionId = GetFieldInt32(dbDataReader, "AdmissionId", _AdmissionId);
+ _Role = GetFieldInt16(dbDataReader, "Role", _Role);
+ _Seq = GetFieldInt16(dbDataReader, "Seq", _Seq);
+ _EmployeeRoleId = GetFieldInt32(dbDataReader, "EmployeeRoleId", _EmployeeRoleId);
+ _EmployeeCode = GetFieldString(dbDataReader, "EmployeeCode", _EmployeeCode);
+ _Category = GetFieldInt16(dbDataReader, "Category", _Category);
+ _Notes = GetFieldString(dbDataReader, "Notes", _Notes);
+ _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
+ _Status = GetFieldString(dbDataReader, "Status", _Status);
+ _CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
+ _CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
+ _CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
+ _UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
+ _UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
+ _UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
+ }
+
+ //-------------------------------------------------------------------
+ // Insert command.
+ public override bool ExecuteInsertCommand (DbCommand dbCommand)
+ {
+ List columnNames = ExistingColumnNamesNonId;
+ // Construct query.
+ String query =
+ "INSERT INTO " + TableNameFmt + " " +
+ "("+columnNames.Concat(",","[","]")+") ";
+ if (dbCommand is SqlCommand)
+ query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
+ else query += "VALUES (" + StringList.CreateList("?", columnNames.Count).Concat(",") + ") ";
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("AdmissionId")) AddCommandParameter(dbCommand, "@AdmissionId", _AdmissionId);
+ if (columnNames.ContainsCI("Role")) AddCommandParameter(dbCommand, "@Role", _Role);
+ if (columnNames.ContainsCI("Seq")) AddCommandParameter(dbCommand, "@Seq", _Seq);
+ if (columnNames.ContainsCI("EmployeeRoleId")) AddCommandParameter(dbCommand, "@EmployeeRoleId", _EmployeeRoleId);
+ if (columnNames.ContainsCI("EmployeeCode")) AddCommandParameter(dbCommand, "@EmployeeCode", _EmployeeCode);
+ if (columnNames.ContainsCI("Category")) AddCommandParameter(dbCommand, "@Category", _Category);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
+ if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
+ if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ // Execute insert command.
+ bool commandSuccess = false;
+ int executeNonQuery = dbCommand.ExecuteNonQuery();
+ if (executeNonQuery == 1)
+ {
+ commandSuccess = true;
+ }
+ return commandSuccess;
+ }
+
+ //-------------------------------------------------------------------
+ // Update command.
+ public override bool ExecuteUpdateCommand (DbCommand dbCommand)
+ {
+ // Columns to update.
+ List columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
+ // Construct query.
+ String query = "UPDATE " + TableNameFmt + " SET ";
+ if (dbCommand is SqlCommand)
+ {
+ query += StringPairList.CreateFrom(columnNames,true).Concat("=@").Concat(", ") + " ";
+ query += "WHERE AdmissionId=@AdmissionId AND Role=@Role AND Seq=@Seq AND EmployeeRoleId=@EmployeeRoleId AND EmployeeCode=@EmployeeCode AND Category=@Category;";
+ }
+ else
+ {
+ query += columnNames.Concat(", ", "", "=?") + " ";
+ query += "WHERE AdmissionId=? AND Role=? AND Seq=? AND EmployeeRoleId=? AND EmployeeCode=? AND Category=?;";
+ }
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ AddCommandParameter(dbCommand, "@AdmissionId", _AdmissionId);
+ AddCommandParameter(dbCommand, "@Role", _Role);
+ AddCommandParameter(dbCommand, "@Seq", _Seq);
+ AddCommandParameter(dbCommand, "@EmployeeRoleId", _EmployeeRoleId);
+ AddCommandParameter(dbCommand, "@EmployeeCode", _EmployeeCode);
+ AddCommandParameter(dbCommand, "@Category", _Category);
+ int executeNonQueryResult = dbCommand.ExecuteNonQuery();
+ return (executeNonQueryResult == 1);
+ }
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmission_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmission_Db.cs
new file mode 100644
index 0000000..3616b23
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmAdmission_Db.cs
@@ -0,0 +1,561 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class SwmAdmission_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id");
+ public ColumnDataInt32 _FacilityId { get; } = new ColumnDataInt32("FacilityId");
+ public ColumnDataInt32 _FacilityTemplateId { get; } = new ColumnDataInt32("FacilityTemplateId");
+ public ColumnDataDateTime _AdmissionFrom { get; } = new ColumnDataDateTime("AdmissionFrom");
+ public ColumnDataDateTime _AdmissionTo { get; } = new ColumnDataDateTime("AdmissionTo");
+ public ColumnDataDateTime _DecisionToReferOn { get; } = new ColumnDataDateTime("DecisionToReferOn");
+ public ColumnDataDateTime _ReferredOn { get; } = new ColumnDataDateTime("ReferredOn");
+ public ColumnDataDateTime _BreechOn { get; } = new ColumnDataDateTime("BreechOn");
+ public ColumnDataDateTime _DecisionToAdmitOn { get; } = new ColumnDataDateTime("DecisionToAdmitOn");
+ public ColumnDataDateTime _PreAssessment { get; } = new ColumnDataDateTime("PreAssessment");
+ public ColumnDataDateTime _ToComeIn { get; } = new ColumnDataDateTime("ToComeIn");
+ public ColumnDataByte _Seq { get; } = new ColumnDataByte("Seq");
+ public ColumnDataInt16 _Type { get; } = new ColumnDataInt16("Type");
+ public ColumnDataInt16 _Occupancy { get; } = new ColumnDataInt16("Occupancy");
+ public ColumnDataInt32 _PatientId { get; } = new ColumnDataInt32("PatientId");
+ public ColumnDataString _PatientNo { get; } = new ColumnDataString("PatientNo");
+ public ColumnDataString _NhsNumber { get; } = new ColumnDataString("NhsNumber");
+ public ColumnDataString _Title { get; } = new ColumnDataString("Title");
+ public ColumnDataString _Surname { get; } = new ColumnDataString("Surname");
+ public ColumnDataString _Forename { get; } = new ColumnDataString("Forename");
+ public ColumnDataInt16 _Gender { get; } = new ColumnDataInt16("Gender");
+ public ColumnDataInt32 _BirthOn { get; } = new ColumnDataInt32("BirthOn");
+ public ColumnDataString _Age { get; } = new ColumnDataString("Age");
+ public ColumnDataDateTime _AgeOn { get; } = new ColumnDataDateTime("AgeOn");
+ public ColumnDataString _PhoneMobile { get; } = new ColumnDataString("PhoneMobile");
+ public ColumnDataString _Email { get; } = new ColumnDataString("Email");
+ public ColumnDataInt16 _ContactFlags { get; } = new ColumnDataInt16("ContactFlags");
+ public ColumnDataString _SystemRef { get; } = new ColumnDataString("SystemRef");
+ public ColumnDataInt16 _AttendanceType { get; } = new ColumnDataInt16("AttendanceType");
+ public ColumnDataString _AttendanceStatus { get; } = new ColumnDataString("AttendanceStatus");
+ public ColumnDataInt32 _FacilityIdWard { get; } = new ColumnDataInt32("FacilityIdWard");
+ public ColumnDataString _Ward { get; } = new ColumnDataString("Ward");
+ public ColumnDataString _SpecialityCode { get; } = new ColumnDataString("SpecialityCode");
+ public ColumnDataInt32 _ProcedureId { get; } = new ColumnDataInt32("ProcedureId");
+ public ColumnDataString _ProcedureCode { get; } = new ColumnDataString("ProcedureCode");
+ public ColumnDataString _ProcedureDesc { get; } = new ColumnDataString("ProcedureDesc");
+ public ColumnDataString _ComplexityCode { get; } = new ColumnDataString("ComplexityCode");
+ public ColumnDataString _ProcedureIndication { get; } = new ColumnDataString("ProcedureIndication");
+ public ColumnDataString _PatientHistory { get; } = new ColumnDataString("PatientHistory");
+ public ColumnDataString _GestationPeriod { get; } = new ColumnDataString("GestationPeriod");
+ public ColumnDataInt16 _DurationExp { get; } = new ColumnDataInt16("DurationExp");
+ public ColumnDataInt16 _DurationAct { get; } = new ColumnDataInt16("DurationAct");
+ public ColumnDataSingle _UnitsExp { get; } = new ColumnDataSingle("UnitsExp");
+ public ColumnDataSingle _UnitsAct { get; } = new ColumnDataSingle("UnitsAct");
+ public ColumnDataString _Anaesthetic { get; } = new ColumnDataString("Anaesthetic");
+ public ColumnDataString _Position { get; } = new ColumnDataString("Position");
+ public ColumnDataString _SpecialEquipment { get; } = new ColumnDataString("SpecialEquipment");
+ public ColumnDataString _ComfortScore { get; } = new ColumnDataString("ComfortScore");
+ public ColumnDataDateTime _TimeCalled { get; } = new ColumnDataDateTime("TimeCalled");
+ public ColumnDataDateTime _TimeArrived { get; } = new ColumnDataDateTime("TimeArrived");
+ public ColumnDataDateTime _TimeAnaesStart { get; } = new ColumnDataDateTime("TimeAnaesStart");
+ public ColumnDataDateTime _TimeProcStart { get; } = new ColumnDataDateTime("TimeProcStart");
+ public ColumnDataDateTime _TimeProcEnd { get; } = new ColumnDataDateTime("TimeProcEnd");
+ public ColumnDataDateTime _TimeInRecovery { get; } = new ColumnDataDateTime("TimeInRecovery");
+ public ColumnDataDateTime _TimeInformDest { get; } = new ColumnDataDateTime("TimeInformDest");
+ public ColumnDataDateTime _TimeLeave { get; } = new ColumnDataDateTime("TimeLeave");
+ public ColumnDataInt16 _CancelType { get; } = new ColumnDataInt16("CancelType");
+ public ColumnDataDateTime _CancelDate { get; } = new ColumnDataDateTime("CancelDate");
+ public ColumnDataInt16 _CancelCount { get; } = new ColumnDataInt16("CancelCount");
+ public ColumnDataString _CancelCode { get; } = new ColumnDataString("CancelCode");
+ public ColumnDataString _CancelReason { get; } = new ColumnDataString("CancelReason");
+ public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
+ public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
+ public ColumnDataString _Status { get; } = new ColumnDataString("Status");
+ public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
+ public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
+ public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
+ public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
+ public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
+ public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
+ public ColumnDataDateTime _DecisionToRefer { get; } = new ColumnDataDateTime("DecisionToRefer");
+ public ColumnDataDateTime _Referred { get; } = new ColumnDataDateTime("Referred");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "Id",
+ "FacilityId",
+ "FacilityTemplateId",
+ "AdmissionFrom",
+ "AdmissionTo",
+ "DecisionToReferOn",
+ "ReferredOn",
+ "BreechOn",
+ "DecisionToAdmitOn",
+ "PreAssessment",
+ "ToComeIn",
+ "Seq",
+ "Type",
+ "Occupancy",
+ "PatientId",
+ "PatientNo",
+ "NhsNumber",
+ "Title",
+ "Surname",
+ "Forename",
+ "Gender",
+ "BirthOn",
+ "Age",
+ "AgeOn",
+ "PhoneMobile",
+ "Email",
+ "ContactFlags",
+ "SystemRef",
+ "AttendanceType",
+ "AttendanceStatus",
+ "FacilityIdWard",
+ "Ward",
+ "SpecialityCode",
+ "ProcedureId",
+ "ProcedureCode",
+ "ProcedureDesc",
+ "ComplexityCode",
+ "ProcedureIndication",
+ "PatientHistory",
+ "GestationPeriod",
+ "DurationExp",
+ "DurationAct",
+ "UnitsExp",
+ "UnitsAct",
+ "Anaesthetic",
+ "Position",
+ "SpecialEquipment",
+ "ComfortScore",
+ "TimeCalled",
+ "TimeArrived",
+ "TimeAnaesStart",
+ "TimeProcStart",
+ "TimeProcEnd",
+ "TimeInRecovery",
+ "TimeInformDest",
+ "TimeLeave",
+ "CancelType",
+ "CancelDate",
+ "CancelCount",
+ "CancelCode",
+ "CancelReason",
+ "Notes",
+ "Flags",
+ "Status",
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ "UpdateOn",
+ "UpdateBy",
+ "UpdateHost",
+ "DecisionToRefer",
+ "Referred",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "Id",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List()
+ {
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ };
+
+ //-------------------------------------------------------------------
+ // Construction.
+ internal SwmAdmission_Db (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public override String SchemaName { get; } = "dbo";
+ public override String TableName { get; } = "SwmAdmission";
+ public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
+ public static List Fields { get { return new List(fields); } }
+ public static List FieldsId { get { return new List(fieldsId); } }
+ public static List FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
+ // Columns.
+ public ColumnsData Cols { get; } = new ColumnsData();
+ public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
+ public Int32 _FacilityId { get { return Cols._FacilityId.Value; } set { Cols._FacilityId.Value = value; } }
+ public Int32 _FacilityTemplateId { get { return Cols._FacilityTemplateId.Value; } set { Cols._FacilityTemplateId.Value = value; } }
+ public DateTime _AdmissionFrom { get { return Cols._AdmissionFrom.Value; } set { Cols._AdmissionFrom.Value = value; } }
+ public DateTime _AdmissionTo { get { return Cols._AdmissionTo.Value; } set { Cols._AdmissionTo.Value = value; } }
+ public DateTime _DecisionToReferOn { get { return Cols._DecisionToReferOn.Value; } set { Cols._DecisionToReferOn.Value = value; } }
+ public DateTime _ReferredOn { get { return Cols._ReferredOn.Value; } set { Cols._ReferredOn.Value = value; } }
+ public DateTime _BreechOn { get { return Cols._BreechOn.Value; } set { Cols._BreechOn.Value = value; } }
+ public DateTime _DecisionToAdmitOn { get { return Cols._DecisionToAdmitOn.Value; } set { Cols._DecisionToAdmitOn.Value = value; } }
+ public DateTime _PreAssessment { get { return Cols._PreAssessment.Value; } set { Cols._PreAssessment.Value = value; } }
+ public DateTime _ToComeIn { get { return Cols._ToComeIn.Value; } set { Cols._ToComeIn.Value = value; } }
+ public Byte _Seq { get { return Cols._Seq.Value; } set { Cols._Seq.Value = value; } }
+ public Int16 _Type { get { return Cols._Type.Value; } set { Cols._Type.Value = value; } }
+ public Int16 _Occupancy { get { return Cols._Occupancy.Value; } set { Cols._Occupancy.Value = value; } }
+ public Int32 _PatientId { get { return Cols._PatientId.Value; } set { Cols._PatientId.Value = value; } }
+ public String _PatientNo { get { return Cols._PatientNo.Value; } set { Cols._PatientNo.Value = value; } }
+ public String _NhsNumber { get { return Cols._NhsNumber.Value; } set { Cols._NhsNumber.Value = value; } }
+ public String _Title { get { return Cols._Title.Value; } set { Cols._Title.Value = value; } }
+ public String _Surname { get { return Cols._Surname.Value; } set { Cols._Surname.Value = value; } }
+ public String _Forename { get { return Cols._Forename.Value; } set { Cols._Forename.Value = value; } }
+ public Int16 _Gender { get { return Cols._Gender.Value; } set { Cols._Gender.Value = value; } }
+ public Int32 _BirthOn { get { return Cols._BirthOn.Value; } set { Cols._BirthOn.Value = value; } }
+ public String _Age { get { return Cols._Age.Value; } set { Cols._Age.Value = value; } }
+ public DateTime _AgeOn { get { return Cols._AgeOn.Value; } set { Cols._AgeOn.Value = value; } }
+ public String _PhoneMobile { get { return Cols._PhoneMobile.Value; } set { Cols._PhoneMobile.Value = value; } }
+ public String _Email { get { return Cols._Email.Value; } set { Cols._Email.Value = value; } }
+ public Int16 _ContactFlags { get { return Cols._ContactFlags.Value; } set { Cols._ContactFlags.Value = value; } }
+ public String _SystemRef { get { return Cols._SystemRef.Value; } set { Cols._SystemRef.Value = value; } }
+ public Int16 _AttendanceType { get { return Cols._AttendanceType.Value; } set { Cols._AttendanceType.Value = value; } }
+ public String _AttendanceStatus { get { return Cols._AttendanceStatus.Value; } set { Cols._AttendanceStatus.Value = value; } }
+ public Int32 _FacilityIdWard { get { return Cols._FacilityIdWard.Value; } set { Cols._FacilityIdWard.Value = value; } }
+ public String _Ward { get { return Cols._Ward.Value; } set { Cols._Ward.Value = value; } }
+ public String _SpecialityCode { get { return Cols._SpecialityCode.Value; } set { Cols._SpecialityCode.Value = value; } }
+ public Int32 _ProcedureId { get { return Cols._ProcedureId.Value; } set { Cols._ProcedureId.Value = value; } }
+ public String _ProcedureCode { get { return Cols._ProcedureCode.Value; } set { Cols._ProcedureCode.Value = value; } }
+ public String _ProcedureDesc { get { return Cols._ProcedureDesc.Value; } set { Cols._ProcedureDesc.Value = value; } }
+ public String _ComplexityCode { get { return Cols._ComplexityCode.Value; } set { Cols._ComplexityCode.Value = value; } }
+ public String _ProcedureIndication { get { return Cols._ProcedureIndication.Value; } set { Cols._ProcedureIndication.Value = value; } }
+ public String _PatientHistory { get { return Cols._PatientHistory.Value; } set { Cols._PatientHistory.Value = value; } }
+ public String _GestationPeriod { get { return Cols._GestationPeriod.Value; } set { Cols._GestationPeriod.Value = value; } }
+ public Int16 _DurationExp { get { return Cols._DurationExp.Value; } set { Cols._DurationExp.Value = value; } }
+ public Int16 _DurationAct { get { return Cols._DurationAct.Value; } set { Cols._DurationAct.Value = value; } }
+ public Single _UnitsExp { get { return Cols._UnitsExp.Value; } set { Cols._UnitsExp.Value = value; } }
+ public Single _UnitsAct { get { return Cols._UnitsAct.Value; } set { Cols._UnitsAct.Value = value; } }
+ public String _Anaesthetic { get { return Cols._Anaesthetic.Value; } set { Cols._Anaesthetic.Value = value; } }
+ public String _Position { get { return Cols._Position.Value; } set { Cols._Position.Value = value; } }
+ public String _SpecialEquipment { get { return Cols._SpecialEquipment.Value; } set { Cols._SpecialEquipment.Value = value; } }
+ public String _ComfortScore { get { return Cols._ComfortScore.Value; } set { Cols._ComfortScore.Value = value; } }
+ public DateTime _TimeCalled { get { return Cols._TimeCalled.Value; } set { Cols._TimeCalled.Value = value; } }
+ public DateTime _TimeArrived { get { return Cols._TimeArrived.Value; } set { Cols._TimeArrived.Value = value; } }
+ public DateTime _TimeAnaesStart { get { return Cols._TimeAnaesStart.Value; } set { Cols._TimeAnaesStart.Value = value; } }
+ public DateTime _TimeProcStart { get { return Cols._TimeProcStart.Value; } set { Cols._TimeProcStart.Value = value; } }
+ public DateTime _TimeProcEnd { get { return Cols._TimeProcEnd.Value; } set { Cols._TimeProcEnd.Value = value; } }
+ public DateTime _TimeInRecovery { get { return Cols._TimeInRecovery.Value; } set { Cols._TimeInRecovery.Value = value; } }
+ public DateTime _TimeInformDest { get { return Cols._TimeInformDest.Value; } set { Cols._TimeInformDest.Value = value; } }
+ public DateTime _TimeLeave { get { return Cols._TimeLeave.Value; } set { Cols._TimeLeave.Value = value; } }
+ public Int16 _CancelType { get { return Cols._CancelType.Value; } set { Cols._CancelType.Value = value; } }
+ public DateTime _CancelDate { get { return Cols._CancelDate.Value; } set { Cols._CancelDate.Value = value; } }
+ public Int16 _CancelCount { get { return Cols._CancelCount.Value; } set { Cols._CancelCount.Value = value; } }
+ public String _CancelCode { get { return Cols._CancelCode.Value; } set { Cols._CancelCode.Value = value; } }
+ public String _CancelReason { get { return Cols._CancelReason.Value; } set { Cols._CancelReason.Value = value; } }
+ public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
+ public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
+ public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
+ public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
+ public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
+ public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
+ public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
+ public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
+ public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
+ public DateTime _DecisionToRefer { get { return Cols._DecisionToRefer.Value; } set { Cols._DecisionToRefer.Value = value; } }
+ public DateTime _Referred { get { return Cols._Referred.Value; } set { Cols._Referred.Value = value; } }
+ // Existing columns - confirmed on database if table exists.
+ public List ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
+ public List ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
+
+ //-------------------------------------------------------------------
+ // Population.
+ public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
+ {
+ dbCommand.CommandText =
+ "SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
+ "FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
+ (!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
+ using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
+ {
+ dbDataReader.Read();
+ PopulateFrom(dbDataReader);
+ }
+ }
+ public override void PopulateFrom (DbDataReader dbDataReader)
+ {
+ _Id = GetFieldInt32(dbDataReader, "Id", _Id);
+ _FacilityId = GetFieldInt32(dbDataReader, "FacilityId", _FacilityId);
+ _FacilityTemplateId = GetFieldInt32(dbDataReader, "FacilityTemplateId", _FacilityTemplateId);
+ _AdmissionFrom = GetFieldDateTime(dbDataReader, "AdmissionFrom", _AdmissionFrom);
+ _AdmissionTo = GetFieldDateTime(dbDataReader, "AdmissionTo", _AdmissionTo);
+ _DecisionToReferOn = GetFieldDateTime(dbDataReader, "DecisionToReferOn", _DecisionToReferOn);
+ _ReferredOn = GetFieldDateTime(dbDataReader, "ReferredOn", _ReferredOn);
+ _BreechOn = GetFieldDateTime(dbDataReader, "BreechOn", _BreechOn);
+ _DecisionToAdmitOn = GetFieldDateTime(dbDataReader, "DecisionToAdmitOn", _DecisionToAdmitOn);
+ _PreAssessment = GetFieldDateTime(dbDataReader, "PreAssessment", _PreAssessment);
+ _ToComeIn = GetFieldDateTime(dbDataReader, "ToComeIn", _ToComeIn);
+ _Seq = GetFieldByte(dbDataReader, "Seq", _Seq);
+ _Type = GetFieldInt16(dbDataReader, "Type", _Type);
+ _Occupancy = GetFieldInt16(dbDataReader, "Occupancy", _Occupancy);
+ _PatientId = GetFieldInt32(dbDataReader, "PatientId", _PatientId);
+ _PatientNo = GetFieldString(dbDataReader, "PatientNo", _PatientNo);
+ _NhsNumber = GetFieldString(dbDataReader, "NhsNumber", _NhsNumber);
+ _Title = GetFieldString(dbDataReader, "Title", _Title);
+ _Surname = GetFieldString(dbDataReader, "Surname", _Surname);
+ _Forename = GetFieldString(dbDataReader, "Forename", _Forename);
+ _Gender = GetFieldInt16(dbDataReader, "Gender", _Gender);
+ _BirthOn = GetFieldInt32(dbDataReader, "BirthOn", _BirthOn);
+ _Age = GetFieldString(dbDataReader, "Age", _Age);
+ _AgeOn = GetFieldDateTime(dbDataReader, "AgeOn", _AgeOn);
+ _PhoneMobile = GetFieldString(dbDataReader, "PhoneMobile", _PhoneMobile);
+ _Email = GetFieldString(dbDataReader, "Email", _Email);
+ _ContactFlags = GetFieldInt16(dbDataReader, "ContactFlags", _ContactFlags);
+ _SystemRef = GetFieldString(dbDataReader, "SystemRef", _SystemRef);
+ _AttendanceType = GetFieldInt16(dbDataReader, "AttendanceType", _AttendanceType);
+ _AttendanceStatus = GetFieldString(dbDataReader, "AttendanceStatus", _AttendanceStatus);
+ _FacilityIdWard = GetFieldInt32(dbDataReader, "FacilityIdWard", _FacilityIdWard);
+ _Ward = GetFieldString(dbDataReader, "Ward", _Ward);
+ _SpecialityCode = GetFieldString(dbDataReader, "SpecialityCode", _SpecialityCode);
+ _ProcedureId = GetFieldInt32(dbDataReader, "ProcedureId", _ProcedureId);
+ _ProcedureCode = GetFieldString(dbDataReader, "ProcedureCode", _ProcedureCode);
+ _ProcedureDesc = GetFieldString(dbDataReader, "ProcedureDesc", _ProcedureDesc);
+ _ComplexityCode = GetFieldString(dbDataReader, "ComplexityCode", _ComplexityCode);
+ _ProcedureIndication = GetFieldString(dbDataReader, "ProcedureIndication", _ProcedureIndication);
+ _PatientHistory = GetFieldString(dbDataReader, "PatientHistory", _PatientHistory);
+ _GestationPeriod = GetFieldString(dbDataReader, "GestationPeriod", _GestationPeriod);
+ _DurationExp = GetFieldInt16(dbDataReader, "DurationExp", _DurationExp);
+ _DurationAct = GetFieldInt16(dbDataReader, "DurationAct", _DurationAct);
+ _UnitsExp = GetFieldSingle(dbDataReader, "UnitsExp", _UnitsExp);
+ _UnitsAct = GetFieldSingle(dbDataReader, "UnitsAct", _UnitsAct);
+ _Anaesthetic = GetFieldString(dbDataReader, "Anaesthetic", _Anaesthetic);
+ _Position = GetFieldString(dbDataReader, "Position", _Position);
+ _SpecialEquipment = GetFieldString(dbDataReader, "SpecialEquipment", _SpecialEquipment);
+ _ComfortScore = GetFieldString(dbDataReader, "ComfortScore", _ComfortScore);
+ _TimeCalled = GetFieldDateTime(dbDataReader, "TimeCalled", _TimeCalled);
+ _TimeArrived = GetFieldDateTime(dbDataReader, "TimeArrived", _TimeArrived);
+ _TimeAnaesStart = GetFieldDateTime(dbDataReader, "TimeAnaesStart", _TimeAnaesStart);
+ _TimeProcStart = GetFieldDateTime(dbDataReader, "TimeProcStart", _TimeProcStart);
+ _TimeProcEnd = GetFieldDateTime(dbDataReader, "TimeProcEnd", _TimeProcEnd);
+ _TimeInRecovery = GetFieldDateTime(dbDataReader, "TimeInRecovery", _TimeInRecovery);
+ _TimeInformDest = GetFieldDateTime(dbDataReader, "TimeInformDest", _TimeInformDest);
+ _TimeLeave = GetFieldDateTime(dbDataReader, "TimeLeave", _TimeLeave);
+ _CancelType = GetFieldInt16(dbDataReader, "CancelType", _CancelType);
+ _CancelDate = GetFieldDateTime(dbDataReader, "CancelDate", _CancelDate);
+ _CancelCount = GetFieldInt16(dbDataReader, "CancelCount", _CancelCount);
+ _CancelCode = GetFieldString(dbDataReader, "CancelCode", _CancelCode);
+ _CancelReason = GetFieldString(dbDataReader, "CancelReason", _CancelReason);
+ _Notes = GetFieldString(dbDataReader, "Notes", _Notes);
+ _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
+ _Status = GetFieldString(dbDataReader, "Status", _Status);
+ _CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
+ _CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
+ _CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
+ _UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
+ _UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
+ _UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
+ _DecisionToRefer = GetFieldDateTime(dbDataReader, "DecisionToRefer", _DecisionToRefer);
+ _Referred = GetFieldDateTime(dbDataReader, "Referred", _Referred);
+ }
+
+ //-------------------------------------------------------------------
+ // Insert command.
+ public override bool ExecuteInsertCommand (DbCommand dbCommand)
+ {
+ List columnNames = ExistingColumnNamesNonId;
+ // Construct query.
+ String query =
+ "INSERT INTO " + TableNameFmt + " " +
+ "("+columnNames.Concat(",","[","]")+") ";
+ if (dbCommand is SqlCommand)
+ query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
+ else query += "VALUES (" + StringList.CreateList("?", columnNames.Count).Concat(",") + ") ";
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("Id")) AddCommandParameter(dbCommand, "@Id", _Id);
+ if (columnNames.ContainsCI("FacilityId")) AddCommandParameter(dbCommand, "@FacilityId", _FacilityId);
+ if (columnNames.ContainsCI("FacilityTemplateId")) AddCommandParameter(dbCommand, "@FacilityTemplateId", _FacilityTemplateId);
+ if (columnNames.ContainsCI("AdmissionFrom")) AddCommandParameter(dbCommand, "@AdmissionFrom", _AdmissionFrom);
+ if (columnNames.ContainsCI("AdmissionTo")) AddCommandParameter(dbCommand, "@AdmissionTo", _AdmissionTo);
+ if (columnNames.ContainsCI("DecisionToReferOn")) AddCommandParameter(dbCommand, "@DecisionToReferOn", _DecisionToReferOn);
+ if (columnNames.ContainsCI("ReferredOn")) AddCommandParameter(dbCommand, "@ReferredOn", _ReferredOn);
+ if (columnNames.ContainsCI("BreechOn")) AddCommandParameter(dbCommand, "@BreechOn", _BreechOn);
+ if (columnNames.ContainsCI("DecisionToAdmitOn")) AddCommandParameter(dbCommand, "@DecisionToAdmitOn", _DecisionToAdmitOn);
+ if (columnNames.ContainsCI("PreAssessment")) AddCommandParameter(dbCommand, "@PreAssessment", _PreAssessment);
+ if (columnNames.ContainsCI("ToComeIn")) AddCommandParameter(dbCommand, "@ToComeIn", _ToComeIn);
+ if (columnNames.ContainsCI("Seq")) AddCommandParameter(dbCommand, "@Seq", _Seq);
+ if (columnNames.ContainsCI("Type")) AddCommandParameter(dbCommand, "@Type", _Type);
+ if (columnNames.ContainsCI("Occupancy")) AddCommandParameter(dbCommand, "@Occupancy", _Occupancy);
+ if (columnNames.ContainsCI("PatientId")) AddCommandParameter(dbCommand, "@PatientId", _PatientId);
+ if (columnNames.ContainsCI("PatientNo")) AddCommandParameter(dbCommand, "@PatientNo", _PatientNo);
+ if (columnNames.ContainsCI("NhsNumber")) AddCommandParameter(dbCommand, "@NhsNumber", _NhsNumber);
+ if (columnNames.ContainsCI("Title")) AddCommandParameter(dbCommand, "@Title", _Title);
+ if (columnNames.ContainsCI("Surname")) AddCommandParameter(dbCommand, "@Surname", _Surname);
+ if (columnNames.ContainsCI("Forename")) AddCommandParameter(dbCommand, "@Forename", _Forename);
+ if (columnNames.ContainsCI("Gender")) AddCommandParameter(dbCommand, "@Gender", _Gender);
+ if (columnNames.ContainsCI("BirthOn")) AddCommandParameter(dbCommand, "@BirthOn", _BirthOn);
+ if (columnNames.ContainsCI("Age")) AddCommandParameter(dbCommand, "@Age", _Age);
+ if (columnNames.ContainsCI("AgeOn")) AddCommandParameter(dbCommand, "@AgeOn", _AgeOn);
+ if (columnNames.ContainsCI("PhoneMobile")) AddCommandParameter(dbCommand, "@PhoneMobile", _PhoneMobile);
+ if (columnNames.ContainsCI("Email")) AddCommandParameter(dbCommand, "@Email", _Email);
+ if (columnNames.ContainsCI("ContactFlags")) AddCommandParameter(dbCommand, "@ContactFlags", _ContactFlags);
+ if (columnNames.ContainsCI("SystemRef")) AddCommandParameter(dbCommand, "@SystemRef", _SystemRef);
+ if (columnNames.ContainsCI("AttendanceType")) AddCommandParameter(dbCommand, "@AttendanceType", _AttendanceType);
+ if (columnNames.ContainsCI("AttendanceStatus")) AddCommandParameter(dbCommand, "@AttendanceStatus", _AttendanceStatus);
+ if (columnNames.ContainsCI("FacilityIdWard")) AddCommandParameter(dbCommand, "@FacilityIdWard", _FacilityIdWard);
+ if (columnNames.ContainsCI("Ward")) AddCommandParameter(dbCommand, "@Ward", _Ward);
+ if (columnNames.ContainsCI("SpecialityCode")) AddCommandParameter(dbCommand, "@SpecialityCode", _SpecialityCode);
+ if (columnNames.ContainsCI("ProcedureId")) AddCommandParameter(dbCommand, "@ProcedureId", _ProcedureId);
+ if (columnNames.ContainsCI("ProcedureCode")) AddCommandParameter(dbCommand, "@ProcedureCode", _ProcedureCode);
+ if (columnNames.ContainsCI("ProcedureDesc")) AddCommandParameter(dbCommand, "@ProcedureDesc", _ProcedureDesc);
+ if (columnNames.ContainsCI("ComplexityCode")) AddCommandParameter(dbCommand, "@ComplexityCode", _ComplexityCode);
+ if (columnNames.ContainsCI("ProcedureIndication")) AddCommandParameter(dbCommand, "@ProcedureIndication", _ProcedureIndication);
+ if (columnNames.ContainsCI("PatientHistory")) AddCommandParameter(dbCommand, "@PatientHistory", _PatientHistory);
+ if (columnNames.ContainsCI("GestationPeriod")) AddCommandParameter(dbCommand, "@GestationPeriod", _GestationPeriod);
+ if (columnNames.ContainsCI("DurationExp")) AddCommandParameter(dbCommand, "@DurationExp", _DurationExp);
+ if (columnNames.ContainsCI("DurationAct")) AddCommandParameter(dbCommand, "@DurationAct", _DurationAct);
+ if (columnNames.ContainsCI("UnitsExp")) AddCommandParameter(dbCommand, "@UnitsExp", _UnitsExp);
+ if (columnNames.ContainsCI("UnitsAct")) AddCommandParameter(dbCommand, "@UnitsAct", _UnitsAct);
+ if (columnNames.ContainsCI("Anaesthetic")) AddCommandParameter(dbCommand, "@Anaesthetic", _Anaesthetic);
+ if (columnNames.ContainsCI("Position")) AddCommandParameter(dbCommand, "@Position", _Position);
+ if (columnNames.ContainsCI("SpecialEquipment")) AddCommandParameter(dbCommand, "@SpecialEquipment", _SpecialEquipment);
+ if (columnNames.ContainsCI("ComfortScore")) AddCommandParameter(dbCommand, "@ComfortScore", _ComfortScore);
+ if (columnNames.ContainsCI("TimeCalled")) AddCommandParameter(dbCommand, "@TimeCalled", _TimeCalled);
+ if (columnNames.ContainsCI("TimeArrived")) AddCommandParameter(dbCommand, "@TimeArrived", _TimeArrived);
+ if (columnNames.ContainsCI("TimeAnaesStart")) AddCommandParameter(dbCommand, "@TimeAnaesStart", _TimeAnaesStart);
+ if (columnNames.ContainsCI("TimeProcStart")) AddCommandParameter(dbCommand, "@TimeProcStart", _TimeProcStart);
+ if (columnNames.ContainsCI("TimeProcEnd")) AddCommandParameter(dbCommand, "@TimeProcEnd", _TimeProcEnd);
+ if (columnNames.ContainsCI("TimeInRecovery")) AddCommandParameter(dbCommand, "@TimeInRecovery", _TimeInRecovery);
+ if (columnNames.ContainsCI("TimeInformDest")) AddCommandParameter(dbCommand, "@TimeInformDest", _TimeInformDest);
+ if (columnNames.ContainsCI("TimeLeave")) AddCommandParameter(dbCommand, "@TimeLeave", _TimeLeave);
+ if (columnNames.ContainsCI("CancelType")) AddCommandParameter(dbCommand, "@CancelType", _CancelType);
+ if (columnNames.ContainsCI("CancelDate")) AddCommandParameter(dbCommand, "@CancelDate", _CancelDate);
+ if (columnNames.ContainsCI("CancelCount")) AddCommandParameter(dbCommand, "@CancelCount", _CancelCount);
+ if (columnNames.ContainsCI("CancelCode")) AddCommandParameter(dbCommand, "@CancelCode", _CancelCode);
+ if (columnNames.ContainsCI("CancelReason")) AddCommandParameter(dbCommand, "@CancelReason", _CancelReason);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
+ if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
+ if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ if (columnNames.ContainsCI("DecisionToRefer")) AddCommandParameter(dbCommand, "@DecisionToRefer", _DecisionToRefer);
+ if (columnNames.ContainsCI("Referred")) AddCommandParameter(dbCommand, "@Referred", _Referred);
+ // Execute insert command.
+ bool commandSuccess = false;
+ int executeNonQuery = dbCommand.ExecuteNonQuery();
+ if (executeNonQuery == 1)
+ {
+ commandSuccess = true;
+ }
+ return commandSuccess;
+ }
+
+ //-------------------------------------------------------------------
+ // Update command.
+ public override bool ExecuteUpdateCommand (DbCommand dbCommand)
+ {
+ // Columns to update.
+ List columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
+ // Construct query.
+ String query = "UPDATE " + TableNameFmt + " SET ";
+ if (dbCommand is SqlCommand)
+ {
+ query += StringPairList.CreateFrom(columnNames,true).Concat("=@").Concat(", ") + " ";
+ query += "WHERE Id=@Id;";
+ }
+ else
+ {
+ query += columnNames.Concat(", ", "", "=?") + " ";
+ query += "WHERE Id=?;";
+ }
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("FacilityId")) AddCommandParameter(dbCommand, "@FacilityId", _FacilityId);
+ if (columnNames.ContainsCI("FacilityTemplateId")) AddCommandParameter(dbCommand, "@FacilityTemplateId", _FacilityTemplateId);
+ if (columnNames.ContainsCI("AdmissionFrom")) AddCommandParameter(dbCommand, "@AdmissionFrom", _AdmissionFrom);
+ if (columnNames.ContainsCI("AdmissionTo")) AddCommandParameter(dbCommand, "@AdmissionTo", _AdmissionTo);
+ if (columnNames.ContainsCI("DecisionToReferOn")) AddCommandParameter(dbCommand, "@DecisionToReferOn", _DecisionToReferOn);
+ if (columnNames.ContainsCI("ReferredOn")) AddCommandParameter(dbCommand, "@ReferredOn", _ReferredOn);
+ if (columnNames.ContainsCI("BreechOn")) AddCommandParameter(dbCommand, "@BreechOn", _BreechOn);
+ if (columnNames.ContainsCI("DecisionToAdmitOn")) AddCommandParameter(dbCommand, "@DecisionToAdmitOn", _DecisionToAdmitOn);
+ if (columnNames.ContainsCI("PreAssessment")) AddCommandParameter(dbCommand, "@PreAssessment", _PreAssessment);
+ if (columnNames.ContainsCI("ToComeIn")) AddCommandParameter(dbCommand, "@ToComeIn", _ToComeIn);
+ if (columnNames.ContainsCI("Seq")) AddCommandParameter(dbCommand, "@Seq", _Seq);
+ if (columnNames.ContainsCI("Type")) AddCommandParameter(dbCommand, "@Type", _Type);
+ if (columnNames.ContainsCI("Occupancy")) AddCommandParameter(dbCommand, "@Occupancy", _Occupancy);
+ if (columnNames.ContainsCI("PatientId")) AddCommandParameter(dbCommand, "@PatientId", _PatientId);
+ if (columnNames.ContainsCI("PatientNo")) AddCommandParameter(dbCommand, "@PatientNo", _PatientNo);
+ if (columnNames.ContainsCI("NhsNumber")) AddCommandParameter(dbCommand, "@NhsNumber", _NhsNumber);
+ if (columnNames.ContainsCI("Title")) AddCommandParameter(dbCommand, "@Title", _Title);
+ if (columnNames.ContainsCI("Surname")) AddCommandParameter(dbCommand, "@Surname", _Surname);
+ if (columnNames.ContainsCI("Forename")) AddCommandParameter(dbCommand, "@Forename", _Forename);
+ if (columnNames.ContainsCI("Gender")) AddCommandParameter(dbCommand, "@Gender", _Gender);
+ if (columnNames.ContainsCI("BirthOn")) AddCommandParameter(dbCommand, "@BirthOn", _BirthOn);
+ if (columnNames.ContainsCI("Age")) AddCommandParameter(dbCommand, "@Age", _Age);
+ if (columnNames.ContainsCI("AgeOn")) AddCommandParameter(dbCommand, "@AgeOn", _AgeOn);
+ if (columnNames.ContainsCI("PhoneMobile")) AddCommandParameter(dbCommand, "@PhoneMobile", _PhoneMobile);
+ if (columnNames.ContainsCI("Email")) AddCommandParameter(dbCommand, "@Email", _Email);
+ if (columnNames.ContainsCI("ContactFlags")) AddCommandParameter(dbCommand, "@ContactFlags", _ContactFlags);
+ if (columnNames.ContainsCI("SystemRef")) AddCommandParameter(dbCommand, "@SystemRef", _SystemRef);
+ if (columnNames.ContainsCI("AttendanceType")) AddCommandParameter(dbCommand, "@AttendanceType", _AttendanceType);
+ if (columnNames.ContainsCI("AttendanceStatus")) AddCommandParameter(dbCommand, "@AttendanceStatus", _AttendanceStatus);
+ if (columnNames.ContainsCI("FacilityIdWard")) AddCommandParameter(dbCommand, "@FacilityIdWard", _FacilityIdWard);
+ if (columnNames.ContainsCI("Ward")) AddCommandParameter(dbCommand, "@Ward", _Ward);
+ if (columnNames.ContainsCI("SpecialityCode")) AddCommandParameter(dbCommand, "@SpecialityCode", _SpecialityCode);
+ if (columnNames.ContainsCI("ProcedureId")) AddCommandParameter(dbCommand, "@ProcedureId", _ProcedureId);
+ if (columnNames.ContainsCI("ProcedureCode")) AddCommandParameter(dbCommand, "@ProcedureCode", _ProcedureCode);
+ if (columnNames.ContainsCI("ProcedureDesc")) AddCommandParameter(dbCommand, "@ProcedureDesc", _ProcedureDesc);
+ if (columnNames.ContainsCI("ComplexityCode")) AddCommandParameter(dbCommand, "@ComplexityCode", _ComplexityCode);
+ if (columnNames.ContainsCI("ProcedureIndication")) AddCommandParameter(dbCommand, "@ProcedureIndication", _ProcedureIndication);
+ if (columnNames.ContainsCI("PatientHistory")) AddCommandParameter(dbCommand, "@PatientHistory", _PatientHistory);
+ if (columnNames.ContainsCI("GestationPeriod")) AddCommandParameter(dbCommand, "@GestationPeriod", _GestationPeriod);
+ if (columnNames.ContainsCI("DurationExp")) AddCommandParameter(dbCommand, "@DurationExp", _DurationExp);
+ if (columnNames.ContainsCI("DurationAct")) AddCommandParameter(dbCommand, "@DurationAct", _DurationAct);
+ if (columnNames.ContainsCI("UnitsExp")) AddCommandParameter(dbCommand, "@UnitsExp", _UnitsExp);
+ if (columnNames.ContainsCI("UnitsAct")) AddCommandParameter(dbCommand, "@UnitsAct", _UnitsAct);
+ if (columnNames.ContainsCI("Anaesthetic")) AddCommandParameter(dbCommand, "@Anaesthetic", _Anaesthetic);
+ if (columnNames.ContainsCI("Position")) AddCommandParameter(dbCommand, "@Position", _Position);
+ if (columnNames.ContainsCI("SpecialEquipment")) AddCommandParameter(dbCommand, "@SpecialEquipment", _SpecialEquipment);
+ if (columnNames.ContainsCI("ComfortScore")) AddCommandParameter(dbCommand, "@ComfortScore", _ComfortScore);
+ if (columnNames.ContainsCI("TimeCalled")) AddCommandParameter(dbCommand, "@TimeCalled", _TimeCalled);
+ if (columnNames.ContainsCI("TimeArrived")) AddCommandParameter(dbCommand, "@TimeArrived", _TimeArrived);
+ if (columnNames.ContainsCI("TimeAnaesStart")) AddCommandParameter(dbCommand, "@TimeAnaesStart", _TimeAnaesStart);
+ if (columnNames.ContainsCI("TimeProcStart")) AddCommandParameter(dbCommand, "@TimeProcStart", _TimeProcStart);
+ if (columnNames.ContainsCI("TimeProcEnd")) AddCommandParameter(dbCommand, "@TimeProcEnd", _TimeProcEnd);
+ if (columnNames.ContainsCI("TimeInRecovery")) AddCommandParameter(dbCommand, "@TimeInRecovery", _TimeInRecovery);
+ if (columnNames.ContainsCI("TimeInformDest")) AddCommandParameter(dbCommand, "@TimeInformDest", _TimeInformDest);
+ if (columnNames.ContainsCI("TimeLeave")) AddCommandParameter(dbCommand, "@TimeLeave", _TimeLeave);
+ if (columnNames.ContainsCI("CancelType")) AddCommandParameter(dbCommand, "@CancelType", _CancelType);
+ if (columnNames.ContainsCI("CancelDate")) AddCommandParameter(dbCommand, "@CancelDate", _CancelDate);
+ if (columnNames.ContainsCI("CancelCount")) AddCommandParameter(dbCommand, "@CancelCount", _CancelCount);
+ if (columnNames.ContainsCI("CancelCode")) AddCommandParameter(dbCommand, "@CancelCode", _CancelCode);
+ if (columnNames.ContainsCI("CancelReason")) AddCommandParameter(dbCommand, "@CancelReason", _CancelReason);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ if (columnNames.ContainsCI("DecisionToRefer")) AddCommandParameter(dbCommand, "@DecisionToRefer", _DecisionToRefer);
+ if (columnNames.ContainsCI("Referred")) AddCommandParameter(dbCommand, "@Referred", _Referred);
+ AddCommandParameter(dbCommand, "@Id", _Id);
+ int executeNonQueryResult = dbCommand.ExecuteNonQuery();
+ return (executeNonQueryResult == 1);
+ }
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SwmDepartmentCode_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmDepartmentCode_Db.cs
new file mode 100644
index 0000000..538be88
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmDepartmentCode_Db.cs
@@ -0,0 +1,213 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class SwmDepartmentCode_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id");
+ public ColumnDataInt32 _DepartmentId { get; } = new ColumnDataInt32("DepartmentId");
+ public ColumnDataInt16 _CodeType { get; } = new ColumnDataInt16("CodeType");
+ public ColumnDataString _Code { get; } = new ColumnDataString("Code");
+ public ColumnDataString _Description { get; } = new ColumnDataString("Description");
+ public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
+ public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
+ public ColumnDataString _Status { get; } = new ColumnDataString("Status");
+ public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
+ public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
+ public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
+ public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
+ public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
+ public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "Id",
+ "DepartmentId",
+ "CodeType",
+ "Code",
+ "Description",
+ "Notes",
+ "Flags",
+ "Status",
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ "UpdateOn",
+ "UpdateBy",
+ "UpdateHost",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "Id",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List()
+ {
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ };
+
+ //-------------------------------------------------------------------
+ // Construction.
+ internal SwmDepartmentCode_Db (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public override String SchemaName { get; } = "dbo";
+ public override String TableName { get; } = "SwmDepartmentCode";
+ public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
+ public static List Fields { get { return new List(fields); } }
+ public static List FieldsId { get { return new List(fieldsId); } }
+ public static List FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
+ // Columns.
+ public ColumnsData Cols { get; } = new ColumnsData();
+ public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
+ public Int32 _DepartmentId { get { return Cols._DepartmentId.Value; } set { Cols._DepartmentId.Value = value; } }
+ public Int16 _CodeType { get { return Cols._CodeType.Value; } set { Cols._CodeType.Value = value; } }
+ public String _Code { get { return Cols._Code.Value; } set { Cols._Code.Value = value; } }
+ public String _Description { get { return Cols._Description.Value; } set { Cols._Description.Value = value; } }
+ public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
+ public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
+ public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
+ public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
+ public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
+ public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
+ public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
+ public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
+ public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
+ // Existing columns - confirmed on database if table exists.
+ public List ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
+ public List ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
+
+ //-------------------------------------------------------------------
+ // Population.
+ public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
+ {
+ dbCommand.CommandText =
+ "SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
+ "FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
+ (!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
+ using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
+ {
+ dbDataReader.Read();
+ PopulateFrom(dbDataReader);
+ }
+ }
+ public override void PopulateFrom (DbDataReader dbDataReader)
+ {
+ _Id = GetFieldInt32(dbDataReader, "Id", _Id);
+ _DepartmentId = GetFieldInt32(dbDataReader, "DepartmentId", _DepartmentId);
+ _CodeType = GetFieldInt16(dbDataReader, "CodeType", _CodeType);
+ _Code = GetFieldString(dbDataReader, "Code", _Code);
+ _Description = GetFieldString(dbDataReader, "Description", _Description);
+ _Notes = GetFieldString(dbDataReader, "Notes", _Notes);
+ _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
+ _Status = GetFieldString(dbDataReader, "Status", _Status);
+ _CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
+ _CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
+ _CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
+ _UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
+ _UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
+ _UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
+ }
+
+ //-------------------------------------------------------------------
+ // Insert command.
+ public override bool ExecuteInsertCommand (DbCommand dbCommand)
+ {
+ List columnNames = ExistingColumnNamesNonId;
+ // Construct query.
+ String query =
+ "INSERT INTO " + TableNameFmt + " " +
+ "("+columnNames.Concat(",","[","]")+") ";
+ if (dbCommand is SqlCommand)
+ query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
+ else query += "VALUES (" + StringList.CreateList("?", columnNames.Count).Concat(",") + ") ";
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("Id")) AddCommandParameter(dbCommand, "@Id", _Id);
+ if (columnNames.ContainsCI("DepartmentId")) AddCommandParameter(dbCommand, "@DepartmentId", _DepartmentId);
+ if (columnNames.ContainsCI("CodeType")) AddCommandParameter(dbCommand, "@CodeType", _CodeType);
+ if (columnNames.ContainsCI("Code")) AddCommandParameter(dbCommand, "@Code", _Code);
+ if (columnNames.ContainsCI("Description")) AddCommandParameter(dbCommand, "@Description", _Description);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
+ if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
+ if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ // Execute insert command.
+ bool commandSuccess = false;
+ int executeNonQuery = dbCommand.ExecuteNonQuery();
+ if (executeNonQuery == 1)
+ {
+ commandSuccess = true;
+ }
+ return commandSuccess;
+ }
+
+ //-------------------------------------------------------------------
+ // Update command.
+ public override bool ExecuteUpdateCommand (DbCommand dbCommand)
+ {
+ // Columns to update.
+ List columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
+ // Construct query.
+ String query = "UPDATE " + TableNameFmt + " SET ";
+ if (dbCommand is SqlCommand)
+ {
+ query += StringPairList.CreateFrom(columnNames,true).Concat("=@").Concat(", ") + " ";
+ query += "WHERE Id=@Id;";
+ }
+ else
+ {
+ query += columnNames.Concat(", ", "", "=?") + " ";
+ query += "WHERE Id=?;";
+ }
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("DepartmentId")) AddCommandParameter(dbCommand, "@DepartmentId", _DepartmentId);
+ if (columnNames.ContainsCI("CodeType")) AddCommandParameter(dbCommand, "@CodeType", _CodeType);
+ if (columnNames.ContainsCI("Code")) AddCommandParameter(dbCommand, "@Code", _Code);
+ if (columnNames.ContainsCI("Description")) AddCommandParameter(dbCommand, "@Description", _Description);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ AddCommandParameter(dbCommand, "@Id", _Id);
+ int executeNonQueryResult = dbCommand.ExecuteNonQuery();
+ return (executeNonQueryResult == 1);
+ }
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SwmDepartment_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmDepartment_Db.cs
new file mode 100644
index 0000000..343fff4
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmDepartment_Db.cs
@@ -0,0 +1,231 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class SwmDepartment_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id");
+ public ColumnDataInt32 _InstitutionId { get; } = new ColumnDataInt32("InstitutionId");
+ public ColumnDataString _Name { get; } = new ColumnDataString("Name");
+ public ColumnDataInt32 _FacilityTypes { get; } = new ColumnDataInt32("FacilityTypes");
+ public ColumnDataInt32 _AllowAnyFacility { get; } = new ColumnDataInt32("AllowAnyFacility");
+ public ColumnDataString _CancellReBookLimit { get; } = new ColumnDataString("CancellReBookLimit");
+ public ColumnDataDateTime _ApplicFrom { get; } = new ColumnDataDateTime("ApplicFrom");
+ public ColumnDataDateTime _ApplicTo { get; } = new ColumnDataDateTime("ApplicTo");
+ public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
+ public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
+ public ColumnDataString _Status { get; } = new ColumnDataString("Status");
+ public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
+ public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
+ public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
+ public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
+ public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
+ public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "Id",
+ "InstitutionId",
+ "Name",
+ "FacilityTypes",
+ "AllowAnyFacility",
+ "CancellReBookLimit",
+ "ApplicFrom",
+ "ApplicTo",
+ "Notes",
+ "Flags",
+ "Status",
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ "UpdateOn",
+ "UpdateBy",
+ "UpdateHost",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "Id",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List()
+ {
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ };
+
+ //-------------------------------------------------------------------
+ // Construction.
+ internal SwmDepartment_Db (IDatabaseInfo dbInfo) : base(dbInfo)
+ {
+ }
+
+ //-------------------------------------------------------------------
+ // Properties.
+ public override String SchemaName { get; } = "dbo";
+ public override String TableName { get; } = "SwmDepartment";
+ public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
+ public static List Fields { get { return new List(fields); } }
+ public static List FieldsId { get { return new List(fieldsId); } }
+ public static List FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
+ // Columns.
+ public ColumnsData Cols { get; } = new ColumnsData();
+ public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
+ public Int32 _InstitutionId { get { return Cols._InstitutionId.Value; } set { Cols._InstitutionId.Value = value; } }
+ public String _Name { get { return Cols._Name.Value; } set { Cols._Name.Value = value; } }
+ public Int32 _FacilityTypes { get { return Cols._FacilityTypes.Value; } set { Cols._FacilityTypes.Value = value; } }
+ public Int32 _AllowAnyFacility { get { return Cols._AllowAnyFacility.Value; } set { Cols._AllowAnyFacility.Value = value; } }
+ public String _CancellReBookLimit { get { return Cols._CancellReBookLimit.Value; } set { Cols._CancellReBookLimit.Value = value; } }
+ public DateTime _ApplicFrom { get { return Cols._ApplicFrom.Value; } set { Cols._ApplicFrom.Value = value; } }
+ public DateTime _ApplicTo { get { return Cols._ApplicTo.Value; } set { Cols._ApplicTo.Value = value; } }
+ public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
+ public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
+ public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
+ public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
+ public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
+ public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
+ public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
+ public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
+ public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
+ // Existing columns - confirmed on database if table exists.
+ public List ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
+ public List ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
+
+ //-------------------------------------------------------------------
+ // Population.
+ public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
+ {
+ dbCommand.CommandText =
+ "SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
+ "FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
+ (!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
+ using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
+ {
+ dbDataReader.Read();
+ PopulateFrom(dbDataReader);
+ }
+ }
+ public override void PopulateFrom (DbDataReader dbDataReader)
+ {
+ _Id = GetFieldInt32(dbDataReader, "Id", _Id);
+ _InstitutionId = GetFieldInt32(dbDataReader, "InstitutionId", _InstitutionId);
+ _Name = GetFieldString(dbDataReader, "Name", _Name);
+ _FacilityTypes = GetFieldInt32(dbDataReader, "FacilityTypes", _FacilityTypes);
+ _AllowAnyFacility = GetFieldInt32(dbDataReader, "AllowAnyFacility", _AllowAnyFacility);
+ _CancellReBookLimit = GetFieldString(dbDataReader, "CancellReBookLimit", _CancellReBookLimit);
+ _ApplicFrom = GetFieldDateTime(dbDataReader, "ApplicFrom", _ApplicFrom);
+ _ApplicTo = GetFieldDateTime(dbDataReader, "ApplicTo", _ApplicTo);
+ _Notes = GetFieldString(dbDataReader, "Notes", _Notes);
+ _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
+ _Status = GetFieldString(dbDataReader, "Status", _Status);
+ _CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
+ _CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
+ _CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
+ _UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
+ _UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
+ _UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
+ }
+
+ //-------------------------------------------------------------------
+ // Insert command.
+ public override bool ExecuteInsertCommand (DbCommand dbCommand)
+ {
+ List columnNames = ExistingColumnNamesNonId;
+ // Construct query.
+ String query =
+ "INSERT INTO " + TableNameFmt + " " +
+ "("+columnNames.Concat(",","[","]")+") ";
+ if (dbCommand is SqlCommand)
+ query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
+ else query += "VALUES (" + StringList.CreateList("?", columnNames.Count).Concat(",") + ") ";
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("Id")) AddCommandParameter(dbCommand, "@Id", _Id);
+ if (columnNames.ContainsCI("InstitutionId")) AddCommandParameter(dbCommand, "@InstitutionId", _InstitutionId);
+ if (columnNames.ContainsCI("Name")) AddCommandParameter(dbCommand, "@Name", _Name);
+ if (columnNames.ContainsCI("FacilityTypes")) AddCommandParameter(dbCommand, "@FacilityTypes", _FacilityTypes);
+ if (columnNames.ContainsCI("AllowAnyFacility")) AddCommandParameter(dbCommand, "@AllowAnyFacility", _AllowAnyFacility);
+ if (columnNames.ContainsCI("CancellReBookLimit")) AddCommandParameter(dbCommand, "@CancellReBookLimit", _CancellReBookLimit);
+ if (columnNames.ContainsCI("ApplicFrom")) AddCommandParameter(dbCommand, "@ApplicFrom", _ApplicFrom);
+ if (columnNames.ContainsCI("ApplicTo")) AddCommandParameter(dbCommand, "@ApplicTo", _ApplicTo);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
+ if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
+ if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ // Execute insert command.
+ bool commandSuccess = false;
+ int executeNonQuery = dbCommand.ExecuteNonQuery();
+ if (executeNonQuery == 1)
+ {
+ commandSuccess = true;
+ }
+ return commandSuccess;
+ }
+
+ //-------------------------------------------------------------------
+ // Update command.
+ public override bool ExecuteUpdateCommand (DbCommand dbCommand)
+ {
+ // Columns to update.
+ List columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
+ // Construct query.
+ String query = "UPDATE " + TableNameFmt + " SET ";
+ if (dbCommand is SqlCommand)
+ {
+ query += StringPairList.CreateFrom(columnNames,true).Concat("=@").Concat(", ") + " ";
+ query += "WHERE Id=@Id;";
+ }
+ else
+ {
+ query += columnNames.Concat(", ", "", "=?") + " ";
+ query += "WHERE Id=?;";
+ }
+ dbCommand.CommandText = query;
+ // Populate parameters.
+ dbCommand.Parameters.Clear();
+ if (columnNames.ContainsCI("InstitutionId")) AddCommandParameter(dbCommand, "@InstitutionId", _InstitutionId);
+ if (columnNames.ContainsCI("Name")) AddCommandParameter(dbCommand, "@Name", _Name);
+ if (columnNames.ContainsCI("FacilityTypes")) AddCommandParameter(dbCommand, "@FacilityTypes", _FacilityTypes);
+ if (columnNames.ContainsCI("AllowAnyFacility")) AddCommandParameter(dbCommand, "@AllowAnyFacility", _AllowAnyFacility);
+ if (columnNames.ContainsCI("CancellReBookLimit")) AddCommandParameter(dbCommand, "@CancellReBookLimit", _CancellReBookLimit);
+ if (columnNames.ContainsCI("ApplicFrom")) AddCommandParameter(dbCommand, "@ApplicFrom", _ApplicFrom);
+ if (columnNames.ContainsCI("ApplicTo")) AddCommandParameter(dbCommand, "@ApplicTo", _ApplicTo);
+ if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
+ if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
+ if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
+ if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
+ if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
+ if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
+ AddCommandParameter(dbCommand, "@Id", _Id);
+ int executeNonQueryResult = dbCommand.ExecuteNonQuery();
+ return (executeNonQueryResult == 1);
+ }
+
+ //-------------------------------------------------------------------
+ }
+}
diff --git a/SaPatMgrWinDbas/Win/Dbas/Internal/SwmEmployeeRole_Db.cs b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmEmployeeRole_Db.cs
new file mode 100644
index 0000000..71f69f5
--- /dev/null
+++ b/SaPatMgrWinDbas/Win/Dbas/Internal/SwmEmployeeRole_Db.cs
@@ -0,0 +1,219 @@
+using Sarand.Core.Base;
+using Sarand.PatientMgr.Win.Dbas.Data;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data.Odbc;
+using System.Data.SqlClient;
+using System.Linq;
+
+//---------------------------------------------------------------------------
+// Code generated by Sarand Database Utilities Tue 9-Apr-2019 17:58:35
+//---------------------------------------------------------------------------
+namespace Sarand.PatientMgr.Win.Dbas.Internal
+{
+ internal class SwmEmployeeRole_Db : SpmDbDataItem
+ {
+ //-------------------------------------------------------------------
+ // Column definitions.
+ public class ColumnsData
+ {
+ public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id");
+ public ColumnDataInt32 _DepartmentId { get; } = new ColumnDataInt32("DepartmentId");
+ public ColumnDataInt32 _EmployeeId { get; } = new ColumnDataInt32("EmployeeId");
+ public ColumnDataInt16 _Role { get; } = new ColumnDataInt16("Role");
+ public ColumnDataDateTime _ApplicFrom { get; } = new ColumnDataDateTime("ApplicFrom");
+ public ColumnDataDateTime _ApplicTo { get; } = new ColumnDataDateTime("ApplicTo");
+ public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
+ public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
+ public ColumnDataString _Status { get; } = new ColumnDataString("Status");
+ public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
+ public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
+ public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
+ public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
+ public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
+ public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
+ }
+
+ //-------------------------------------------------------------------
+ // Data members.
+ private static List fields { get; } = new List()
+ {
+ "Id",
+ "DepartmentId",
+ "EmployeeId",
+ "Role",
+ "ApplicFrom",
+ "ApplicTo",
+ "Notes",
+ "Flags",
+ "Status",
+ "CreateOn",
+ "CreateBy",
+ "CreateHost",
+ "UpdateOn",
+ "UpdateBy",
+ "UpdateHost",
+ };
+ private static List fieldsId { get; } = new List()
+ {
+ };
+ private static List fieldsPrimary { get; } = new List()
+ {
+ "Id",
+ };
+ private static List fieldsIgnoreOnUpdate { get; } = new List