Some refactoring of code into DAL.cs for Data Access.
Addition of Fileman date code (not used yet). Removal of .config and .xml file from bin/Release/ Removal of BMXNet20.dll to replace with BMXNet21.dll
This commit is contained in:
parent
cffda38818
commit
e9aee9c88d
|
@ -33,6 +33,9 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
//Encoding string (empty by default)
|
||||
private string m_Encoding="";
|
||||
|
||||
//Data Access Layer
|
||||
private DAL _dal = null;
|
||||
|
||||
//M Connection member variables
|
||||
private DataSet m_dsGlobal = null;
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
@ -176,6 +179,11 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
}
|
||||
}
|
||||
|
||||
public DAL DAL
|
||||
{
|
||||
get { return this._dal; }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -205,13 +213,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
//
|
||||
// CGDocumentManager
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(292, 266);
|
||||
this.Name = "CGDocumentManager";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,6 +231,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
private void InitializeApp(bool bReLogin)
|
||||
{
|
||||
m_ConnectInfo = new BMXNetConnectInfo(m_Encoding); // Encoding is "" unless passed in command line
|
||||
_dal = new DAL(m_ConnectInfo); // Data access layer
|
||||
//m_ConnectInfo.bmxNetLib.StartLog(); //This line turns on logging of messages
|
||||
CDocMgrEventDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(CDocMgrEventHandler);
|
||||
m_ConnectInfo.BMXNetEvent += CDocMgrEventDelegate;
|
||||
|
@ -320,10 +322,12 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
//Version info
|
||||
m_ds.SetStatus("Getting Version Info...");
|
||||
m_ds.Refresh();
|
||||
String sCmd = "BMX VERSION INFO^BSDX^";
|
||||
this.m_ConnectInfo.RPMSDataTable(sCmd, "VersionInfo", m_dsGlobal);
|
||||
|
||||
//Keep the following commented code for future use:
|
||||
DataTable ver = _dal.GetVersion("BSDX"); //sCmd, "VersionInfo", m_dsGlobal);
|
||||
ver.TableName = "VersionInfo";
|
||||
m_dsGlobal.Tables.Add(ver);
|
||||
|
||||
//Keep the following commented code for future use:
|
||||
//How to extract the version numbers:
|
||||
//DataTable dtVersion = m_dsGlobal.Tables["VersionInfo"];
|
||||
//Debug.Assert(dtVersion.Rows.Count == 1);
|
||||
|
@ -434,12 +438,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadAccessTypesTable()
|
||||
{
|
||||
string sCommandText = "SELECT * FROM BSDX_ACCESS_TYPE";
|
||||
ConnectInfo.RPMSDataTable(sCommandText, "AccessTypes", m_dsGlobal);
|
||||
Debug.Write("LoadGlobalRecordsets -- AccessTypes loaded\n");
|
||||
}
|
||||
|
||||
public void LoadAccessGroupsTable()
|
||||
{
|
||||
|
@ -455,14 +453,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
Debug.Write("LoadGlobalRecordsets -- AccessGroupTypes loaded\n");
|
||||
}
|
||||
|
||||
//TODO:REMOVE THIS
|
||||
/*public void LoadClinicSetupTable()
|
||||
{
|
||||
string sCommandText = "BSDX CLINIC SETUP";
|
||||
ConnectInfo.RPMSDataTable(sCommandText, "ClinicSetupParameters", m_dsGlobal);
|
||||
Debug.Write("LoadGlobalRecordsets -- ClinicSetupParameters loaded\n");
|
||||
}*/
|
||||
|
||||
public void LoadBSDXResourcesTable()
|
||||
{
|
||||
string sCommandText = "BSDX RESOURCES^" + m_ConnectInfo.DUZ;
|
||||
|
@ -520,33 +510,33 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
private bool LoadGlobalRecordsets()
|
||||
{
|
||||
//Schedule User Info
|
||||
string sCommandText = "BSDX SCHEDULING USER INFO^" + m_ConnectInfo.DUZ;
|
||||
DataTable dtUser = ConnectInfo.RPMSDataTable(sCommandText, "SchedulingUser", m_dsGlobal);
|
||||
|
||||
string sCommandText;
|
||||
|
||||
//Schedule User Info
|
||||
DataTable dtUser = _dal.GetUserInfo(m_ConnectInfo.DUZ);
|
||||
dtUser.TableName = "SchedulingUser";
|
||||
m_dsGlobal.Tables.Add(dtUser);
|
||||
Debug.Assert(dtUser.Rows.Count == 1);
|
||||
|
||||
// Only one row and one column named "MANAGER". Set local var m_bSchedManager to true if Manager.
|
||||
DataRow rUser = dtUser.Rows[0];
|
||||
Object oUser = rUser["MANAGER"];
|
||||
string sUser = oUser.ToString();
|
||||
m_bSchedManager = (sUser == "YES")?true:false;
|
||||
|
||||
//AccessTypes
|
||||
LoadAccessTypesTable();
|
||||
|
||||
//Build Primary Key for AccessTypes table
|
||||
DataTable dtTypes = m_dsGlobal.Tables["AccessTypes"];
|
||||
DataColumn dcKey = dtTypes.Columns["BMXIEN"];
|
||||
DataColumn[] dcKeys = new DataColumn[1];
|
||||
dcKeys[0] = dcKey;
|
||||
dtTypes.PrimaryKey = dcKeys;
|
||||
//Get Access Types
|
||||
DataTable dtAccessTypes = _dal.GetAccessTypes();
|
||||
dtAccessTypes.TableName = "AccessTypes";
|
||||
m_dsGlobal.Tables.Add(dtAccessTypes);
|
||||
|
||||
//AccessGroups
|
||||
LoadAccessGroupsTable();
|
||||
|
||||
//Build Primary Key for AccessGroup table
|
||||
DataTable dtGroups = m_dsGlobal.Tables["AccessGroup"];
|
||||
dcKey = dtGroups.Columns["ACCESS_GROUP"];
|
||||
dcKeys = new DataColumn[1];
|
||||
DataColumn dcKey = dtGroups.Columns["ACCESS_GROUP"];
|
||||
DataColumn[] dcKeys = new DataColumn[1];
|
||||
dcKeys[0] = dcKey;
|
||||
dtGroups.PrimaryKey = dcKeys;
|
||||
|
||||
|
@ -1043,20 +1033,32 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
{
|
||||
//Retrieves a recordset from RPMS
|
||||
string sErrorMessage = "";
|
||||
DataTable dtOut;
|
||||
|
||||
#if TRACE
|
||||
DateTime sendTime = DateTime.Now;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
System.IntPtr pHandle = this.Handle;
|
||||
DataTable dtOut;
|
||||
RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(ConnectInfo.RPMSDataTable);
|
||||
//dtOut = (DataTable) this.Invoke(rdtd, new object[] {sSQL, sTableName});
|
||||
dtOut = ConnectInfo.RPMSDataTable(sSQL, sTableName);
|
||||
return dtOut;
|
||||
dtOut = (DataTable) this.Invoke(rdtd, new object[] {sSQL, sTableName});
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
sErrorMessage = "CGDocumentManager.RPMSDataTable error: " + ex.Message;
|
||||
throw ex;
|
||||
}
|
||||
|
||||
#if TRACE
|
||||
DateTime receiveTime = DateTime.Now;
|
||||
TimeSpan executionTime = receiveTime - sendTime;
|
||||
Debug.Write("CGDocumentManager::RPMSDataTable Execution Time: " + executionTime.Milliseconds + " ms.\n");
|
||||
#endif
|
||||
|
||||
return dtOut;
|
||||
|
||||
}
|
||||
|
||||
public void ChangeDivision(System.Windows.Forms.Form frmCaller)
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile>bin\Release\ClinicalScheduling.XML</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
|
@ -89,8 +89,7 @@
|
|||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile>bin\Release\ClinicalScheduling.XML</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
|
@ -107,10 +106,6 @@
|
|||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BMXNet21, Version=2.0.3839.7911, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BMX\bmx_0200scr\BMX2\BMXNet\bin\Release\BMXNet21.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
|
@ -145,7 +140,6 @@
|
|||
<None Include="CGView.cd" />
|
||||
<None Include="ClassDiagram1.cd" />
|
||||
<None Include="ClassDiagram2.cd" />
|
||||
<None Include="ClinicalScheduling_TemporaryKey.pfx" />
|
||||
<None Include="dsPatientApptDisplay2.xsc">
|
||||
<DependentUpon>dsPatientApptDisplay2.xsd</DependentUpon>
|
||||
</None>
|
||||
|
@ -226,6 +220,7 @@
|
|||
<Compile Include="DAccessType.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DAL.cs" />
|
||||
<Compile Include="DAppointPage.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -294,6 +289,9 @@
|
|||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>dsRebookAppts.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FMDateTime.cs">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Include="Options.cs" />
|
||||
<Compile Include="Printing.cs" />
|
||||
<Compile Include="UCPatientAppts.cs">
|
||||
|
@ -433,6 +431,12 @@
|
|||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\BMX\bmx_0200scr\BMX2\BMXNet\BMXNet.csproj">
|
||||
<Project>{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}</Project>
|
||||
<Name>BMXNet</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using IndianHealthService.BMXNet;
|
||||
|
||||
namespace IndianHealthService.ClinicalScheduling
|
||||
{
|
||||
/// <summary>
|
||||
/// Data Access Layer
|
||||
/// </summary>
|
||||
public class DAL
|
||||
{
|
||||
private BMXNetConnectInfo _thisConnection; // set in constructor
|
||||
delegate DataTable RPMSDataTableDelegate(string CommandString, string TableName); // for use in calling (Sync and Async)
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="conn">The current connection to use</param>
|
||||
public DAL(BMXNetConnectInfo conn)
|
||||
{
|
||||
this._thisConnection = conn;
|
||||
}
|
||||
|
||||
public DataTable GetVersion(string nmsp)
|
||||
{
|
||||
string cmd = String.Format("BMX VERSION INFO^{0}", nmsp);
|
||||
return RPMSDataTable(cmd, "");
|
||||
}
|
||||
|
||||
public DataTable GetUserInfo(string DUZ)
|
||||
{
|
||||
string cmd = String.Format("BSDX SCHEDULING USER INFO^{0}", DUZ);
|
||||
return RPMSDataTable(cmd, "");
|
||||
}
|
||||
|
||||
public DataTable GetAccessTypes()
|
||||
{
|
||||
string sCommandText = "SELECT * FROM BSDX_ACCESS_TYPE";
|
||||
DataTable table = RPMSDataTable(sCommandText, "");
|
||||
DataColumn dcKey = table.Columns["BMXIEN"];
|
||||
DataColumn[] dcKeys = new DataColumn[1];
|
||||
dcKeys[0] = dcKey;
|
||||
table.PrimaryKey = dcKeys;
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Workhorse
|
||||
/// </summary>
|
||||
/// <param name="sSQL"></param>
|
||||
/// <param name="sTableName"></param>
|
||||
/// <param name="ds"></param>
|
||||
/// <returns></returns>
|
||||
private DataTable RPMSDataTable(string sSQL, string sTableName)
|
||||
{
|
||||
//Retrieves a recordset from RPMS
|
||||
string sErrorMessage = "";
|
||||
DataTable dtOut;
|
||||
|
||||
#if TRACE
|
||||
DateTime sendTime = DateTime.Now;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(_thisConnection.RPMSDataTable);
|
||||
dtOut = (DataTable)rdtd.Invoke(sSQL, sTableName);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
sErrorMessage = "CGDocumentManager.RPMSDataTable error: " + ex.Message;
|
||||
throw ex;
|
||||
}
|
||||
|
||||
#if TRACE
|
||||
DateTime receiveTime = DateTime.Now;
|
||||
TimeSpan executionTime = receiveTime - sendTime;
|
||||
Debug.Write("RPMSDataTable Execution Time: " + executionTime.Milliseconds + " ms.\n");
|
||||
#endif
|
||||
|
||||
return dtOut;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1883,8 +1883,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
throw new Exception((string) dr["ERRORTEXT"]);
|
||||
}
|
||||
|
||||
m_DocManager.LoadAccessTypesTable();
|
||||
m_DocManager.UpdateViews();
|
||||
RefreshAccessTypesTables();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -1892,6 +1891,19 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
}
|
||||
}
|
||||
|
||||
private void RefreshAccessTypesTables()
|
||||
{
|
||||
m_dsGlobal.Tables["AccessTypes"].Clear();
|
||||
m_dsGlobal.Tables["AccessGroupType"].Clear();
|
||||
DataTable dt1 = m_DocManager.DAL.GetAccessTypes();
|
||||
m_dsGlobal.Tables["AccessTypes"].Merge(dt1);
|
||||
m_dsGlobal.Tables.Add(dt1);
|
||||
//Fix Groups
|
||||
//m_DocManager.LoadAccessTypesTable();
|
||||
m_DocManager.LoadAccessGroupTypesTable();
|
||||
m_DocManager.UpdateViews();
|
||||
}
|
||||
|
||||
private void cmdAddAT_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
try
|
||||
|
@ -1927,8 +1939,8 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
throw new Exception((string) dr["ERRORTEXT"]);
|
||||
}
|
||||
|
||||
m_DocManager.LoadAccessTypesTable();
|
||||
m_DocManager.UpdateViews();
|
||||
RefreshAccessTypesTables();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -2186,12 +2198,8 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
this.cmdRemoveAccessGroup.Enabled = true;
|
||||
|
||||
m_dsGlobal.Tables["AccessTypes"].Clear();
|
||||
m_dsGlobal.Tables["AccessGroupType"].Clear();
|
||||
m_DocManager.LoadAccessTypesTable();
|
||||
m_DocManager.LoadAccessGroupTypesTable();
|
||||
|
||||
m_DocManager.UpdateViews();
|
||||
RefreshAccessTypesTables();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<!-- User application and configured property settings go here.-->
|
||||
<!-- Example: <add key="settingName" value="settingValue"/> -->
|
||||
<add key="mnuNewAppointment.Enabled" value="True" />
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v2.0.50727" />
|
||||
</startup>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
<providers>
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
|
||||
</providers>
|
||||
</membership>
|
||||
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
|
||||
<providers>
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
</configuration>
|
Loading…
Reference in New Issue