source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DAL.cs@ 843

Last change on this file since 843 was 843, checked in by Sam Habiel, 14 years ago

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

File size: 2.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Data;
5using System.Text;
6using System.Diagnostics;
7using IndianHealthService.BMXNet;
8
9namespace IndianHealthService.ClinicalScheduling
10{
11 /// <summary>
12 /// Data Access Layer
13 /// </summary>
14 public class DAL
15 {
16 private BMXNetConnectInfo _thisConnection; // set in constructor
17 delegate DataTable RPMSDataTableDelegate(string CommandString, string TableName); // for use in calling (Sync and Async)
18
19 /// <summary>
20 /// Constructor
21 /// </summary>
22 /// <param name="conn">The current connection to use</param>
23 public DAL(BMXNetConnectInfo conn)
24 {
25 this._thisConnection = conn;
26 }
27
28 public DataTable GetVersion(string nmsp)
29 {
30 string cmd = String.Format("BMX VERSION INFO^{0}", nmsp);
31 return RPMSDataTable(cmd, "");
32 }
33
34 public DataTable GetUserInfo(string DUZ)
35 {
36 string cmd = String.Format("BSDX SCHEDULING USER INFO^{0}", DUZ);
37 return RPMSDataTable(cmd, "");
38 }
39
40 public DataTable GetAccessTypes()
41 {
42 string sCommandText = "SELECT * FROM BSDX_ACCESS_TYPE";
43 DataTable table = RPMSDataTable(sCommandText, "");
44 DataColumn dcKey = table.Columns["BMXIEN"];
45 DataColumn[] dcKeys = new DataColumn[1];
46 dcKeys[0] = dcKey;
47 table.PrimaryKey = dcKeys;
48 return table;
49 }
50
51
52
53 /// <summary>
54 /// Workhorse
55 /// </summary>
56 /// <param name="sSQL"></param>
57 /// <param name="sTableName"></param>
58 /// <param name="ds"></param>
59 /// <returns></returns>
60 private DataTable RPMSDataTable(string sSQL, string sTableName)
61 {
62 //Retrieves a recordset from RPMS
63 string sErrorMessage = "";
64 DataTable dtOut;
65
66#if TRACE
67 DateTime sendTime = DateTime.Now;
68#endif
69 try
70 {
71 RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(_thisConnection.RPMSDataTable);
72 dtOut = (DataTable)rdtd.Invoke(sSQL, sTableName);
73 }
74
75 catch (Exception ex)
76 {
77 sErrorMessage = "CGDocumentManager.RPMSDataTable error: " + ex.Message;
78 throw ex;
79 }
80
81#if TRACE
82 DateTime receiveTime = DateTime.Now;
83 TimeSpan executionTime = receiveTime - sendTime;
84 Debug.Write("RPMSDataTable Execution Time: " + executionTime.Milliseconds + " ms.\n");
85#endif
86
87 return dtOut;
88
89 }
90
91
92 }
93}
94
95
Note: See TracBrowser for help on using the repository browser.