Ignore:
Timestamp:
Jul 8, 2010, 8:46:18 AM (14 years ago)
Author:
Sam Habiel
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs

    r824 r843  
    3434        private string                      m_Encoding="";
    3535
     36        //Data Access Layer
     37        private DAL                         _dal = null;
     38
    3639                //M Connection member variables
    3740                private DataSet                                                                 m_dsGlobal = null;
     
    177180                }
    178181
     182        public DAL DAL
     183        {
     184            get { return this._dal; }
     185        }
     186
    179187
    180188                #endregion
     
    206214                private void InitializeComponent()
    207215                {
    208                         //
    209                         // CGDocumentManager
    210                         //
    211                         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    212                         this.ClientSize = new System.Drawing.Size(292, 266);
    213                         this.Name = "CGDocumentManager";
    214 
    215216                }
    216217
     
    231232                {
    232233            m_ConnectInfo = new BMXNetConnectInfo(m_Encoding); // Encoding is "" unless passed in command line
     234            _dal = new DAL(m_ConnectInfo);   // Data access layer
    233235            //m_ConnectInfo.bmxNetLib.StartLog();    //This line turns on logging of messages
    234236            CDocMgrEventDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(CDocMgrEventHandler);
     
    321323                                m_ds.SetStatus("Getting Version Info...");
    322324                m_ds.Refresh();
    323                 String sCmd = "BMX VERSION INFO^BSDX^";
    324                 this.m_ConnectInfo.RPMSDataTable(sCmd, "VersionInfo", m_dsGlobal);
    325 
    326                                 //Keep the following commented code for future use:
     325
     326                DataTable ver = _dal.GetVersion("BSDX"); //sCmd, "VersionInfo", m_dsGlobal);
     327                ver.TableName = "VersionInfo";
     328                m_dsGlobal.Tables.Add(ver);
     329
     330                //Keep the following commented code for future use:
    327331                                //How to extract the version numbers:
    328332                //DataTable dtVersion = m_dsGlobal.Tables["VersionInfo"];
     
    435439                }
    436440
    437                 public void LoadAccessTypesTable()
    438                 {
    439                         string sCommandText = "SELECT * FROM BSDX_ACCESS_TYPE";
    440                         ConnectInfo.RPMSDataTable(sCommandText, "AccessTypes", m_dsGlobal);
    441                         Debug.Write("LoadGlobalRecordsets -- AccessTypes loaded\n");
    442                 }
    443441
    444442                public void LoadAccessGroupsTable()
     
    455453                        Debug.Write("LoadGlobalRecordsets -- AccessGroupTypes loaded\n");
    456454                }
    457 
    458         //TODO:REMOVE THIS
    459                 /*public void LoadClinicSetupTable()
    460                 {
    461                         string sCommandText = "BSDX CLINIC SETUP";
    462                         ConnectInfo.RPMSDataTable(sCommandText, "ClinicSetupParameters", m_dsGlobal);
    463                         Debug.Write("LoadGlobalRecordsets -- ClinicSetupParameters loaded\n");
    464                 }*/
    465455
    466456                public void LoadBSDXResourcesTable()
     
    521511                private bool LoadGlobalRecordsets()
    522512                {
    523                         //Schedule User Info
    524                         string sCommandText = "BSDX SCHEDULING USER INFO^" + m_ConnectInfo.DUZ;
    525                         DataTable dtUser = ConnectInfo.RPMSDataTable(sCommandText, "SchedulingUser", m_dsGlobal);
    526 
     513                       
     514            string sCommandText;
     515
     516            //Schedule User Info
     517                        DataTable dtUser = _dal.GetUserInfo(m_ConnectInfo.DUZ);
     518            dtUser.TableName = "SchedulingUser";
     519            m_dsGlobal.Tables.Add(dtUser);
    527520                        Debug.Assert(dtUser.Rows.Count == 1);
     521
     522            // Only one row and one column named "MANAGER". Set local var m_bSchedManager to true if Manager.
    528523                        DataRow rUser = dtUser.Rows[0];
    529524                        Object oUser = rUser["MANAGER"];
     
    531526                        m_bSchedManager = (sUser == "YES")?true:false;
    532527
    533                         //AccessTypes
    534                         LoadAccessTypesTable();
    535 
    536                         //Build Primary Key for AccessTypes table
    537                         DataTable dtTypes = m_dsGlobal.Tables["AccessTypes"];
    538                         DataColumn dcKey = dtTypes.Columns["BMXIEN"];
    539                         DataColumn[] dcKeys = new DataColumn[1];
    540                         dcKeys[0] = dcKey;
    541                         dtTypes.PrimaryKey = dcKeys;
     528            //Get Access Types
     529            DataTable dtAccessTypes = _dal.GetAccessTypes();
     530            dtAccessTypes.TableName = "AccessTypes";
     531            m_dsGlobal.Tables.Add(dtAccessTypes);
    542532
    543533                        //AccessGroups
     
    546536                        //Build Primary Key for AccessGroup table
    547537                        DataTable dtGroups = m_dsGlobal.Tables["AccessGroup"];
    548                         dcKey = dtGroups.Columns["ACCESS_GROUP"];
    549                         dcKeys = new DataColumn[1];
     538            DataColumn dcKey = dtGroups.Columns["ACCESS_GROUP"];
     539            DataColumn[] dcKeys = new DataColumn[1];
    550540                        dcKeys[0] = dcKey;
    551541                        dtGroups.PrimaryKey = dcKeys;
     
    10441034                        //Retrieves a recordset from RPMS
    10451035                        string                  sErrorMessage = "";
     1036            DataTable dtOut;
     1037
     1038#if TRACE
     1039            DateTime sendTime = DateTime.Now;
     1040#endif
    10461041                        try
    10471042                        {
    10481043                                System.IntPtr pHandle = this.Handle;
    1049                                 DataTable dtOut;
    10501044                                RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(ConnectInfo.RPMSDataTable);
    1051                                 //dtOut = (DataTable) this.Invoke(rdtd, new object[] {sSQL, sTableName});
    1052                 dtOut = ConnectInfo.RPMSDataTable(sSQL, sTableName);
    1053                                 return dtOut;
    1054                         }
     1045                                dtOut = (DataTable) this.Invoke(rdtd, new object[] {sSQL, sTableName});
     1046                        }
     1047
    10551048                        catch (Exception ex)
    10561049                        {
     
    10581051                                throw ex;
    10591052                        }
     1053
     1054#if TRACE
     1055            DateTime receiveTime = DateTime.Now;
     1056            TimeSpan executionTime = receiveTime - sendTime;
     1057            Debug.Write("CGDocumentManager::RPMSDataTable Execution Time: " + executionTime.Milliseconds + " ms.\n");
     1058#endif
     1059
     1060            return dtOut;
     1061
    10601062                }
    10611063
Note: See TracChangeset for help on using the changeset viewer.