diff --git a/cs/bsdx0200GUISourceCode/AssemblyInfo.cs b/cs/bsdx0200GUISourceCode/AssemblyInfo.cs index c69dfb6..40fd1dc 100644 --- a/cs/bsdx0200GUISourceCode/AssemblyInfo.cs +++ b/cs/bsdx0200GUISourceCode/AssemblyInfo.cs @@ -27,7 +27,7 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.6.1.*")] +[assembly: AssemblyVersion("1.7.0.*")] // // In order to sign your assembly you must specify a key to use. Refer to the @@ -57,5 +57,5 @@ using System.Runtime.InteropServices; [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] -[assembly: AssemblyFileVersionAttribute("1.6.1.0")] +[assembly: AssemblyFileVersionAttribute("1.7.0.0")] [assembly: ComVisibleAttribute(false)] diff --git a/cs/bsdx0200GUISourceCode/CGAVView.cs b/cs/bsdx0200GUISourceCode/CGAVView.cs index 7ac2906..6d8ddb4 100644 --- a/cs/bsdx0200GUISourceCode/CGAVView.cs +++ b/cs/bsdx0200GUISourceCode/CGAVView.cs @@ -653,7 +653,7 @@ namespace IndianHealthService.ClinicalScheduling // string sSql; // sSql = "BSDX RAISE EVENT^" + sEvent + "^" + sParams + "^^"; // DataTable dtAppt =m_DocManager.RPMSDataTable(sSql, "RaiseEvent"); - this.m_DocManager.ConnectInfo.RaiseEvent(sEvent, sParams, true); + CGDocumentManager.Current.RemoteSession.EventServices.TriggerEvent(sEvent, sParams, true); } catch (Exception ex) { @@ -808,7 +808,7 @@ namespace IndianHealthService.ClinicalScheduling private void AppointmentDelete() { calendarGrid1.CGToolTip.Active = false; - string sMsg = " this access block?"; + string sMsg; if (calendarGrid1.SelectedAppointments.AppointmentTable.Count > 1) sMsg = " these access blocks?"; @@ -858,7 +858,7 @@ namespace IndianHealthService.ClinicalScheduling { try { - bool bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXMGR", "+"); + bool bLock = CGDocumentManager.Current.RemoteSession.Lock("^BSDXMGR", "+"); if (bLock == false) { throw new Exception("Another user is currently in Scheduling Management. Try later."); @@ -871,7 +871,7 @@ namespace IndianHealthService.ClinicalScheduling { return; } - bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXMGR", "-"); + bLock = CGDocumentManager.Current.RemoteSession.Lock("^BSDXMGR", "-"); } catch (Exception ex) { @@ -946,7 +946,7 @@ namespace IndianHealthService.ClinicalScheduling private void CGAVView_Closing(object sender, System.ComponentModel.CancelEventArgs e) { this.calendarGrid1.CloseGrid(); - DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXRES(" + Document.ResourceID.ToString() + ")", "-"); + CGDocumentManager.Current.RemoteSession.Lock("^BSDXRES(" + Document.ResourceID.ToString() + ")", "-"); } private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e) diff --git a/cs/bsdx0200GUISourceCode/CGDocumentManager.cs b/cs/bsdx0200GUISourceCode/CGDocumentManager.cs index c886552..c58b4cd 100644 --- a/cs/bsdx0200GUISourceCode/CGDocumentManager.cs +++ b/cs/bsdx0200GUISourceCode/CGDocumentManager.cs @@ -1,3 +1,9 @@ +/* Main Class...: + * Original Author: Horace Whitt + * Current Author and Maintainer: Sam Habiel + * License: LGPL. http://www.gnu.org/licenses/lgpl-2.1.html +*/ + using System; using System.Windows.Forms; using System.Collections; @@ -5,6 +11,8 @@ using System.Data; using System.Diagnostics; using System.Threading; using IndianHealthService.BMXNet; +using IndianHealthService.BMXNet.WinForm; +using IndianHealthService.BMXNet.WinForm.Configuration; //grrrr... too many namespaces here... using Mono.Options; using System.Runtime.InteropServices; using System.Globalization; @@ -41,8 +49,6 @@ namespace IndianHealthService.ClinicalScheduling //M Connection member variables private DataSet m_dsGlobal = null; // Holds all user data - private BMXNetConnectInfo m_ConnectInfo = null; // Connection to VISTA object - private BMXNetConnectInfo.BMXNetEventDelegate CDocMgrEventDelegate; // Delegate to respond to messages from VISTA. Responds to event: BMXNetConnectInfo.BMXNetEvent //Custom Printing private Printing m_PrintingObject = null; @@ -50,16 +56,9 @@ namespace IndianHealthService.ClinicalScheduling #region Properties - /// - /// Returns the document manager's BMXNetConnectInfo member - /// - public BMXNetConnectInfo ConnectInfo - { - get - { - return m_ConnectInfo; - } - } + public WinFramework WinFramework { get; private set; } // Login Manager + public RemoteSession RemoteSession { get; private set; } // Data Sesssion against the RPMS/VISTA server + public RPCLogger RPCLogger { get; private set; } // Logger for RPCs /// /// True if the current user holds the BSDXZMGR or XUPROGMODE keys in RPMS @@ -152,9 +151,9 @@ namespace IndianHealthService.ClinicalScheduling #endregion /// - /// Constructor. Does absolutely nothing at this point. + /// Private constructor for singleton instance. /// - public CGDocumentManager() + private CGDocumentManager() { } @@ -217,10 +216,21 @@ namespace IndianHealthService.ClinicalScheduling opset.Parse(args); - //Init app - bool isEverythingOkay = _current.InitializeApp(); + //Init app. Catch Login Exceptions if they happen. + bool isEverythingOkay = false; + try + { + isEverythingOkay = _current.InitializeApp(); + } + catch (Exception ex) + { - //if an error occurred, break out. + MessageBox.Show("Booboo: An Error Happened: " + ex.Message); + return; // exit application + } + + + //if something yucky happened, break out. if (!isEverythingOkay) return; //Create the first empty document @@ -234,7 +244,7 @@ namespace IndianHealthService.ClinicalScheduling CGView view = new CGView(); view.InitializeDocView(doc, _current, doc.StartDate, _current.WindowText); - //Handle BMX Event + //Handle Message Queue Application.DoEvents(); //test @@ -294,30 +304,28 @@ namespace IndianHealthService.ClinicalScheduling }// here application terminates #region BMXNet Event Handler - private void CDocMgrEventHandler(Object obj, BMXNet.BMXNetEventArgs e) + private void CDocMgrEventHandler(Object obj, RemoteEventArgs e) { - if (e.BMXEvent == "BSDX CALL WORKSTATIONS") + if (e.EventType == "BSDX CALL WORKSTATIONS") { string sParam = ""; string sDelim="~"; - sParam += this.m_ConnectInfo.UserName + sDelim; + sParam += this.RemoteSession.User.Name + sDelim; sParam += this.m_sHandle + sDelim; sParam += Application.ProductVersion + sDelim; sParam += this._views.Count.ToString(); - _current.m_ConnectInfo.RaiseEvent("BSDX WORKSTATION REPORT", sParam, true); + _current.RemoteSession.EventServices.TriggerEvent("BSDX WORKSTATION REPORT", sParam, true); } - if (e.BMXEvent == "BSDX ADMIN MESSAGE") + if (e.EventType == "BSDX ADMIN MESSAGE") { - string sMsg = e.BMXParam; + string sMsg = e.EventType; ShowAdminMsgDelegate samd = new ShowAdminMsgDelegate(ShowAdminMsg); - //this.Invoke(samd, new object [] {sMsg}); samd.Invoke(sMsg); } - if (e.BMXEvent == "BSDX ADMIN SHUTDOWN") + if (e.EventType == "BSDX ADMIN SHUTDOWN") { - string sMsg = e.BMXParam; + string sMsg = e.Details; CloseAllDelegate cad = new CloseAllDelegate(CloseAll); - //this.Invoke(cad, new object [] {sMsg}); cad.Invoke(sMsg); } } @@ -352,38 +360,132 @@ namespace IndianHealthService.ClinicalScheduling /// If so, display a dialog to collect access and verify codes. private bool InitializeApp(bool bReLogin) { - //Set M connection info - 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 - - //Create a delegate to process events raised by BMX. - CDocMgrEventDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(CDocMgrEventHandler); - //Tie delegate to Events generated by BMX. - m_ConnectInfo.BMXNetEvent += CDocMgrEventDelegate; - //Disable polling (But does this really work???? I don't see how it gets disabled) - m_ConnectInfo.EventPollingEnabled = false; + //Note: There are 2 splashes -- one for being the parent of the log in forms + // the next is invoked async and updated async while the GUI is loading + // The reason is b/c an async form cannot be the parent of another that lies on the main thread + RPCLogger = new RPCLogger(); + + DSplash firstSplash = new DSplash(); + + firstSplash.Show(); + + /* IMPORTANT NOTE + * LOGIN CODE IS COPIED ALMOST VERBATIM FROM THE SCHEMABUILDER APPLICAITON; + * THE ONLY ONE I CAN FIND WHICH RELIES ON BMX 4 NEW WAYS WHICH I CAN'T FIGURE OUT + */ + LoginProcess login; + this.WinFramework = WinFramework.CreateWithNetworkBroker(true, RPCLogger); + + if (bReLogin) // if logging in again... + { + this.WinFramework.LoadConnectionSpecs(LocalPersistentStore.CreateDefaultStorage(true), "BSDX"); + login = this.WinFramework.CreateLoginProcess(); + login.AttemptUserInputLogin("Clincal Scheduling Log-in", 3, true, firstSplash); + goto DoneTrying; + } + + // If server,port,ac,vc are supplied on command line, then try to connect... + else if (!String.IsNullOrEmpty(m_Server) && m_Port != 0 && !String.IsNullOrEmpty(m_AccessCode) && !String.IsNullOrEmpty(m_VerifyCode)) + { + RpmsConnectionSpec spec = new RpmsConnectionSpec(); + spec.IsDefault = true; + spec.Name = "Command Line Server"; + spec.Port = m_Port; + spec.Server = m_Server; + spec.UseWindowsAuthentication = false; //for now + spec.UseDefaultNamespace = true; //for now + login = this.WinFramework.CreateLoginProcess(); + login.AutoSetDivisionToLastLookup = false; + login.AttemptAccessVerifyLogin(spec, m_AccessCode, m_VerifyCode); + goto DoneTrying; + } + + // if only server, port is supplied, then use these instead + else if (!String.IsNullOrEmpty(m_Server) && m_Port != 0) + { + RpmsConnectionSpec spec = new RpmsConnectionSpec(); + spec.IsDefault = true; + spec.Name = "Command Line Server"; + spec.Port = m_Port; + spec.Server = m_Server; + spec.UseWindowsAuthentication = false; //for now + spec.UseDefaultNamespace = true; //for now + + RpmsConnectionSettings cxnSettings = new RpmsConnectionSettings + { + CommandLineConnectionSpec = spec + }; + + this.WinFramework.ConnectionSettings = cxnSettings; + + login = this.WinFramework.CreateLoginProcess(); + login.AutoSetDivisionToLastLookup = false; + //test + //spec.UseWindowsAuthentication = true; + login.AttemptUserInputLogin("Clinical Scheduling Log-in", 3, false, firstSplash); + //login.AttemptWindowsAuthLogin(); + //test + goto DoneTrying; + } + + // if nothing is supplied, fall back on the original dialog + else + { + this.WinFramework.LoadConnectionSpecs(LocalPersistentStore.CreateDefaultStorage(true), "BSDX"); + login = this.WinFramework.CreateLoginProcess(); + login.AutoSetDivisionToLastLookup = false; + login.AttemptUserInputLogin("Clincal Scheduling Log-in", 3, true, firstSplash); + + goto DoneTrying; + } + +DoneTrying: + if (!login.WasSuccessful) + { + return false; + } + + LocalSession local = this.WinFramework.LocalSession; + + if ((this.WinFramework.Context.User.Division == null) && !this.WinFramework.AttemptUserInputSetDivision("Set Initial Division", firstSplash)) + { + return false; + } + + + + this.RemoteSession = this.WinFramework.PrimaryRemoteSession; + + //Tie delegate to Events generated by BMX. + this.RemoteSession.EventServices.RpmsEvent += this.CDocMgrEventHandler; + //Disable polling + this.RemoteSession.EventServices.IsEventPollingEnabled = false; + + //Second splash screens //Show a splash screen while initializing; define delegates to remote thread - DSplash m_ds = new DSplash(); - DSplash.dSetStatus setStatusDelegate = new DSplash.dSetStatus(m_ds.SetStatus); - DSplash.dAny closeSplashDelegate = new DSplash.dAny(m_ds.RemoteClose); - DSplash.dProgressBarSet setMaxProgressDelegate = new DSplash.dProgressBarSet(m_ds.RemoteProgressBarMaxSet); - DSplash.dProgressBarSet setProgressDelegate = new DSplash.dProgressBarSet(m_ds.RemoteProgressBarValueSet); + DSplash secondSplash = new DSplash(); + DSplash.dSetStatus setStatusDelegate = new DSplash.dSetStatus(secondSplash.SetStatus); + DSplash.dAny closeSplashDelegate = new DSplash.dAny(secondSplash.RemoteClose); + DSplash.dProgressBarSet setMaxProgressDelegate = new DSplash.dProgressBarSet(secondSplash.RemoteProgressBarMaxSet); + DSplash.dProgressBarSet setProgressDelegate = new DSplash.dProgressBarSet(secondSplash.RemoteProgressBarValueSet); //Start new thread for the Splash screen. Thread threadSplash = new Thread(new ParameterizedThreadStart(frm => ((DSplash)frm).ShowDialog())); threadSplash.IsBackground = true; //expendable thread -- exit even if still running. threadSplash.Name = "Splash Thread"; - threadSplash.Start(m_ds); // pass form as parameter. + threadSplash.Start(secondSplash); + + firstSplash.Close(); // close temporary splash now that the new one is up and running //There are 21 steps to load the application. That's max for the progress bar. setMaxProgressDelegate(21); - + // smh--not used: System.Configuration.ConfigurationManager.GetSection("appSettings"); - setStatusDelegate("Connecting to VISTA"); + + /* //Try to connect using supplied values for Server and Port //Why am I doing this? The library BMX net uses prompts for access and verify code //whether you can connect or not. Not good. So I test first whether @@ -461,9 +563,10 @@ namespace IndianHealthService.ClinicalScheduling } } }while (bRetry == true); - - //Printing + */ + //Printing Custom DLL. Perfect place for code injection!!! + //************************************************* string DllLocation = string.Empty; System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(Application.StartupPath + @"\Printing\"); if (di.Exists) @@ -494,7 +597,7 @@ namespace IndianHealthService.ClinicalScheduling } this.m_PrintingObject = Creator.PrintFactory(); } - + //************************************************ //User Interface Culture (m_CultureName is set from the command line flag /culture) // @@ -511,6 +614,8 @@ namespace IndianHealthService.ClinicalScheduling Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; } + _dal = new DAL(RemoteSession); // Data access layer + //Create global dataset _current.m_dsGlobal = new DataSet("GlobalDataSet"); @@ -552,25 +657,27 @@ namespace IndianHealthService.ClinicalScheduling // Call #2 setProgressDelegate(2); setStatusDelegate("Setting encoding..."); - + //PORT TODO: Set encoding if (m_Encoding == String.Empty) { - string utf8_server_support = m_ConnectInfo.bmxNetLib.TransmitRPC("BMX UTF-8", ""); + string utf8_server_support = RemoteSession.TransmitRPC("BMX UTF-8", ""); + if (utf8_server_support == "1") - m_ConnectInfo.bmxNetLib.Encoder = System.Text.UTF8Encoding.UTF8; + RemoteSession.ConnectionEncoding = System.Text.UTF8Encoding.UTF8; + } //Set application context // Call #3 setProgressDelegate(3); setStatusDelegate("Setting Application Context to BSDXRPC..."); - m_ConnectInfo.AppContext = "BSDXRPC"; + RemoteSession.AppContext = "BSDXRPC"; //User Preferences Object setProgressDelegate(4); //next number is 6 b/c two calls setStatusDelegate("Getting User Preferences from the Server..."); - _current.UserPreferences = new UserPreferences(); // Does the calling to do that... + _current.UserPreferences = new UserPreferences(); // Constructor Does the calling to do that... //Load global recordsets string statusConst = "Loading VistA data tables..."; @@ -582,7 +689,7 @@ namespace IndianHealthService.ClinicalScheduling // Table #4 setProgressDelegate(6); setStatusDelegate(statusConst + " Schedule User"); - DataTable dtUser = _dal.GetUserInfo(m_ConnectInfo.DUZ); + DataTable dtUser = _dal.GetUserInfo(RemoteSession.User.Duz); dtUser.TableName = "SchedulingUser"; m_dsGlobal.Tables.Add(dtUser); Debug.Assert(dtUser.Rows.Count == 1); @@ -597,9 +704,7 @@ namespace IndianHealthService.ClinicalScheduling // Table #5 setProgressDelegate(7); setStatusDelegate(statusConst + " Access Types"); - DataTable dtAccessTypes = _dal.GetAccessTypes(); - dtAccessTypes.TableName = "AccessTypes"; - m_dsGlobal.Tables.Add(dtAccessTypes); + DataTable dtAccessTypes = _dal.GetAccessTypes(m_dsGlobal, "AccessTypes"); //Get Access Groups // Table #6 @@ -679,7 +784,7 @@ namespace IndianHealthService.ClinicalScheduling setStatusDelegate(statusConst + " Clinics"); //cmd.CommandText = "SELECT BMXIEN 'HOSPITAL_LOCATION_ID', NAME 'HOSPITAL_LOCATION', DEFAULT_PROVIDER, STOP_CODE_NUMBER, INACTIVATE_DATE, REACTIVATE_DATE FROM HOSPITAL_LOCATION"; sCommandText = "BSDX HOSPITAL LOCATION"; - ConnectInfo.RPMSDataTable(sCommandText, "HospitalLocation", m_dsGlobal); + RemoteSession.TableFromCommand(sCommandText, m_dsGlobal, "HospitalLocation"); Debug.Write("LoadGlobalRecordsets -- HospitalLocation loaded\n"); //Build Primary Key for HospitalLocation table @@ -731,7 +836,7 @@ namespace IndianHealthService.ClinicalScheduling setProgressDelegate(16); setStatusDelegate(statusConst + " Providers"); sCommandText = "SELECT BMXIEN, NAME FROM NEW_PERSON WHERE INACTIVE_DATE = '' AND BMXIEN > 1"; - ConnectInfo.RPMSDataTable(sCommandText, "Provider", m_dsGlobal); + RemoteSession.TableFromSQL(sCommandText, m_dsGlobal, "Provider"); Debug.Write("LoadGlobalRecordsets -- Provider loaded\n"); //Build the HOLIDAY table @@ -739,7 +844,7 @@ namespace IndianHealthService.ClinicalScheduling setProgressDelegate(17); setStatusDelegate(statusConst + " Holiday"); sCommandText = "SELECT NAME, DATE FROM HOLIDAY WHERE INTERNAL[DATE] > '" + FMDateTime.Create(DateTime.Today).DateOnly.FMDateString + "'"; - ConnectInfo.RPMSDataTable(sCommandText, "HOLIDAY", m_dsGlobal); + RemoteSession.TableFromSQL(sCommandText, m_dsGlobal, "HOLIDAY"); Debug.Write("LoadingGlobalRecordsets -- Holidays loaded\n"); @@ -748,29 +853,31 @@ namespace IndianHealthService.ClinicalScheduling //---------------------------------------------- setStatusDelegate("Setting Receive Timeout"); - _current.m_ConnectInfo.ReceiveTimeout = 30000; //30-second timeout + _current.RemoteSession.ReceiveTimeout = 30000; //30-second timeout #if DEBUG - _current.m_ConnectInfo.ReceiveTimeout = 600000; //longer timeout for debugging + _current.RemoteSession.ReceiveTimeout = 600000; //longer timeout for debugging #endif // Event Subsriptions setStatusDelegate("Subscribing to Server Events"); //Table #16 setProgressDelegate(18); - _current.m_ConnectInfo.SubscribeEvent("BSDX SCHEDULE"); + _current.RemoteSession.EventServices.Subscribe("BSDX SCHEDULE"); //Table #17 setProgressDelegate(19); - _current.m_ConnectInfo.SubscribeEvent("BSDX CALL WORKSTATIONS"); + _current.RemoteSession.EventServices.Subscribe("BSDX CALL WORKSTATIONS"); //Table #18 setProgressDelegate(20); - _current.m_ConnectInfo.SubscribeEvent("BSDX ADMIN MESSAGE"); + _current.RemoteSession.EventServices.Subscribe("BSDX ADMIN MESSAGE"); //Table #19 setProgressDelegate(21); - _current.m_ConnectInfo.SubscribeEvent("BSDX ADMIN SHUTDOWN"); + _current.RemoteSession.EventServices.Subscribe("BSDX ADMIN SHUTDOWN"); - _current.m_ConnectInfo.EventPollingInterval = 5000; //in milliseconds - _current.m_ConnectInfo.EventPollingEnabled = true; - _current.m_ConnectInfo.AutoFire = 12; //AutoFire every 12*5 seconds + _current.RemoteSession.EventServices.EventPollingInterval = 5000; //in milliseconds + _current.RemoteSession.EventServices.IsEventPollingEnabled = true; + + //PORT TODO: No Autofire in BMX 4.0 + //_current.RemoteSession.EventServices. = 12; //AutoFire every 12*5 seconds //Close Splash Screen closeSplashDelegate(); @@ -784,21 +891,21 @@ namespace IndianHealthService.ClinicalScheduling public void LoadAccessGroupsTable() { string sCommandText = "SELECT * FROM BSDX_ACCESS_GROUP"; - ConnectInfo.RPMSDataTable(sCommandText, "AccessGroup", m_dsGlobal); + RemoteSession.TableFromSQL(sCommandText, m_dsGlobal, "AccessGroup"); Debug.Write("LoadGlobalRecordsets -- AccessGroups loaded\n"); } public void LoadAccessGroupTypesTable() { string sCommandText = "BSDX GET ACCESS GROUP TYPES"; - ConnectInfo.RPMSDataTable(sCommandText, "AccessGroupType", m_dsGlobal); + RemoteSession.TableFromCommand(sCommandText, m_dsGlobal, "AccessGroupType"); Debug.Write("LoadGlobalRecordsets -- AccessGroupTypes loaded\n"); } public void LoadBSDXResourcesTable() { - string sCommandText = "BSDX RESOURCES^" + m_ConnectInfo.DUZ; - ConnectInfo.RPMSDataTable(sCommandText, "Resources", m_dsGlobal); + string sCommandText = "BSDX RESOURCES^" + RemoteSession.User.Duz; + RemoteSession.TableFromCommand(sCommandText, m_dsGlobal, "Resources"); Debug.Write("LoadGlobalRecordsets -- Resources loaded\n"); } @@ -808,8 +915,8 @@ namespace IndianHealthService.ClinicalScheduling //Table "ResourceGroup" contains all resource group names //to which user has access //Fields are: RESOURCE_GROUPID, RESOURCE_GROUP - string sCommandText = "BSDX RESOURCE GROUPS BY USER^" + m_ConnectInfo.DUZ; - ConnectInfo.RPMSDataTable(sCommandText, "ResourceGroup", m_dsGlobal); + string sCommandText = "BSDX RESOURCE GROUPS BY USER^" + RemoteSession.User.Duz; + RemoteSession.TableFromCommand(sCommandText, m_dsGlobal, "ResourceGroup"); Debug.Write("LoadGlobalRecordsets -- ResourceGroup loaded\n"); } @@ -820,8 +927,8 @@ namespace IndianHealthService.ClinicalScheduling //If user has BSDXZMGR or XUPROGMODE keys, then ALL Group/Resource combinstions //are returned. //Fields are: RESOURCE_GROUPID, RESOURCE_GROUP, RESOURCE_GROUP_ITEMID, RESOURCE_NAME, RESOURCE_ID - string sCommandText = "BSDX GROUP RESOURCE^" + m_ConnectInfo.DUZ; - ConnectInfo.RPMSDataTable(sCommandText, "GroupResources", m_dsGlobal); + string sCommandText = "BSDX GROUP RESOURCE^" + RemoteSession.User.Duz; + RemoteSession.TableFromCommand(sCommandText, m_dsGlobal, "GroupResources"); Debug.Write("LoadGlobalRecordsets -- GroupResources loaded\n"); } @@ -830,7 +937,7 @@ namespace IndianHealthService.ClinicalScheduling //Table "ScheduleUser" contains an entry for each user in File 200 (NEW PERSON) //who possesses the BSDXZMENU security key. string sCommandText = "BSDX SCHEDULE USER"; - ConnectInfo.RPMSDataTable(sCommandText, "ScheduleUser", m_dsGlobal); + RemoteSession.TableFromCommand(sCommandText, m_dsGlobal, "ScheduleUser"); Debug.Write("LoadGlobalRecordsets -- ScheduleUser loaded\n"); } @@ -849,10 +956,10 @@ namespace IndianHealthService.ClinicalScheduling if (!bAllUsers) { - sCommandText += String.Format(" WHERE INTERNAL[USERNAME] = {0}", m_ConnectInfo.DUZ); + sCommandText += String.Format(" WHERE INTERNAL[USERNAME] = {0}", RemoteSession.User.Duz); } - ConnectInfo.RPMSDataTable(sCommandText, "ResourceUser", m_dsGlobal); + RemoteSession.TableFromSQL(sCommandText, m_dsGlobal, "ResourceUser"); Debug.Write("LoadGlobalRecordsets -- ResourceUser loaded\n"); } @@ -967,9 +1074,9 @@ namespace IndianHealthService.ClinicalScheduling //If no documents left, then close RPMS connection & exit the application if ((Views.Count == 0)&&(this.AvailabilityViews.Count == 0)&&(m_bExitOK == true)) { - m_ConnectInfo.EventPollingEnabled = false; - m_ConnectInfo.UnSubscribeEvent("BSDX SCHEDULE"); - m_ConnectInfo.CloseConnection(); + RemoteSession.EventServices.IsEventPollingEnabled = false; + RemoteSession.EventServices.Unsubscribe("BSDX SCHEDULE"); + RemoteSession.Close(); Application.Exit(); } } @@ -982,7 +1089,7 @@ namespace IndianHealthService.ClinicalScheduling //If no documents left, then close RPMS connection & exit the application if ((Views.Count == 0)&&(this.AvailabilityViews.Count == 0)&&(m_bExitOK == true)) { - m_ConnectInfo.bmxNetLib.CloseConnection(); + RemoteSession.Close(); Application.Exit(); } } @@ -1122,9 +1229,9 @@ namespace IndianHealthService.ClinicalScheduling m_bExitOK = true; //Used in Do loop - bool bRetry = true; + //bool bRetry = true; - // Do Loop to deal with changing the server and the vagaries of user choices. + /*// Do Loop to deal with changing the server and the vagaries of user choices. do { try @@ -1133,7 +1240,8 @@ namespace IndianHealthService.ClinicalScheduling //It only changes the saved server information in the %APPDATA% folder //so it can be re-used when BMX tries to log in again. //Access and Verify code are prompted for in InitializeApp - m_ConnectInfo.ChangeServerInfo(); + LoginProcess login = this.WinFramework.CreateLoginProcess(); + login.AttemptUserInputLogin("ReLog-in", 3, true, null); bRetry = false; } catch (Exception ex) @@ -1156,7 +1264,8 @@ namespace IndianHealthService.ClinicalScheduling } } } while (bRetry == true); - + */ + //Parameter for initialize app tells it that this is a re-login and forces a new access and verify code. bool isEverythingOkay = this.InitializeApp(true); @@ -1193,7 +1302,10 @@ namespace IndianHealthService.ClinicalScheduling /// not used private void mnuRPMSLogin_Click(object sender, EventArgs e) { - //Warn that changing login will close all schedules + mnuRPMSServer_Click(sender, e); + + /* v 1.7 to support BMX 4 -- commented out -- smh + //Warn that changing login will close all schedules if (MessageBox.Show("Are you sure you want to close all schedules and login to VistA?", "Clinical Scheduling", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) return; @@ -1206,6 +1318,24 @@ namespace IndianHealthService.ClinicalScheduling CloseAll(); m_bExitOK = true; + LoginProcess login = this.WinFramework.CreateLoginProcess(); + login.AttemptUserInputLogin("Clincal Scheduling", 3, true, null); + //m_ConnectInfo.bmxNetLib.StartLog(); //This line turns on logging of messages + + if (!login.WasSuccessful) + { + return; + } + + LocalSession local = this.WinFramework.LocalSession; + + if ((this.WinFramework.Context.User.Division == null) && !this.WinFramework.AttemptUserInputSetDivision("Set Initial Division", null)) + { + return; + } + + this.RemoteSession = this.WinFramework.PrimaryRemoteSession; + //Parameter for initialize app tells it that this is a re-login and forces a new access and verify code. bool isEverythingOkay = this.InitializeApp(true); @@ -1232,7 +1362,7 @@ namespace IndianHealthService.ClinicalScheduling { throw ex; } - + */ } delegate void CloseAllDelegate(string sMsg); @@ -1289,9 +1419,11 @@ namespace IndianHealthService.ClinicalScheduling try { //System.IntPtr pHandle = this.Handle; - RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(ConnectInfo.RPMSDataTable); + RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(RemoteSession.TableFromCommand); //dtOut = (DataTable) this.Invoke(rdtd, new object[] {sSQL, sTableName}); - dtOut = rdtd.Invoke(sSQL, sTableName); + dtOut = RemoteSession.TableFromCommand(sSQL); + dtOut.TableName = sTableName; + } catch (Exception ex) @@ -1306,7 +1438,10 @@ namespace IndianHealthService.ClinicalScheduling public void ChangeDivision(System.Windows.Forms.Form frmCaller) { - this.ConnectInfo.ChangeDivision(frmCaller); + WinFramework.AttemptUserInputSetDivision("Change Division", frmCaller); + + RemoteSession = WinFramework.PrimaryRemoteSession; + foreach (CGView v in _views.Keys) { v.InitializeDocView(v.Document.DocName); diff --git a/cs/bsdx0200GUISourceCode/CGView.cs b/cs/bsdx0200GUISourceCode/CGView.cs index c74f75f..342b8b0 100644 --- a/cs/bsdx0200GUISourceCode/CGView.cs +++ b/cs/bsdx0200GUISourceCode/CGView.cs @@ -113,6 +113,7 @@ namespace IndianHealthService.ClinicalScheduling private MenuItem mnuUndoCheckin; private MenuItem sepApptMenu3; private MenuItem mnuReprintApptSlip; + private MenuItem mnuViewBrokerLog; private IContainer components; #region Initialization @@ -131,11 +132,11 @@ namespace IndianHealthService.ClinicalScheduling public void InitializeDocView(string sText) { - this.Text = this.DocManager.ConnectInfo.UserName; + this.Text = CGDocumentManager.Current.RemoteSession.User.Name; if (sText != null) this.Text += " - " + sText; - if (DocManager.ConnectInfo.DivisionName != null) - this.Text += " - " + DocManager.ConnectInfo.DivisionName; + if (CGDocumentManager.Current.RemoteSession.User.Division.Name != null) + this.Text += " - " + CGDocumentManager.Current.RemoteSession.User.Division.Name; } public void InitializeDocView(CGDocument doc, @@ -156,18 +157,14 @@ namespace IndianHealthService.ClinicalScheduling // Set username and division up top - this.Text = this.DocManager.ConnectInfo.UserName; + this.Text = CGDocumentManager.Current.RemoteSession.User.Name; if (sText != null) this.Text += " - " + sText; - if (DocManager.ConnectInfo.DivisionName != null) - this.Text += " - " + DocManager.ConnectInfo.DivisionName; + if (CGDocumentManager.Current.RemoteSession.User.Division.Name != null) + this.Text += " - " + CGDocumentManager.Current.RemoteSession.User.Division.Name; - this.m_ConnectInfo = m_DocManager.ConnectInfo; - m_bmxDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(BMXNetEventHandler); - m_ConnectInfo.BMXNetEvent += m_bmxDelegate; + CGDocumentManager.Current.RemoteSession.EventServices.RpmsEvent += BMXNetEventHandler; } - - private BMXNetConnectInfo.BMXNetEventDelegate m_bmxDelegate; #endregion initialization @@ -234,6 +231,7 @@ namespace IndianHealthService.ClinicalScheduling this.mnuRefresh = new System.Windows.Forms.MenuItem(); this.mnuHelp = new System.Windows.Forms.MenuItem(); this.mnuHelpAbout = new System.Windows.Forms.MenuItem(); + this.mnuViewBrokerLog = new System.Windows.Forms.MenuItem(); this.mnuTest = new System.Windows.Forms.MenuItem(); this.mnuTest1 = new System.Windows.Forms.MenuItem(); this.tvSchedules = new System.Windows.Forms.TreeView(); @@ -679,7 +677,8 @@ namespace IndianHealthService.ClinicalScheduling // this.mnuHelp.Index = 3; this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.mnuHelpAbout}); + this.mnuHelpAbout, + this.mnuViewBrokerLog}); this.mnuHelp.Text = "&Help"; // // mnuHelpAbout @@ -688,6 +687,12 @@ namespace IndianHealthService.ClinicalScheduling this.mnuHelpAbout.Text = "&About"; this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click); // + // mnuViewBrokerLog + // + this.mnuViewBrokerLog.Index = 1; + this.mnuViewBrokerLog.Text = "&View Broker Log"; + this.mnuViewBrokerLog.Click += new System.EventHandler(this.mnuViewBrokerLog_Click); + // // mnuTest // this.mnuTest.Enabled = false; @@ -701,7 +706,6 @@ namespace IndianHealthService.ClinicalScheduling // this.mnuTest1.Index = 0; this.mnuTest1.Text = "Test1"; - this.mnuTest1.Click += new System.EventHandler(this.mnuTest1_Click); // // tvSchedules // @@ -711,7 +715,7 @@ namespace IndianHealthService.ClinicalScheduling this.tvSchedules.HotTracking = true; this.tvSchedules.Location = new System.Drawing.Point(0, 0); this.tvSchedules.Name = "tvSchedules"; - this.tvSchedules.Size = new System.Drawing.Size(128, 392); + this.tvSchedules.Size = new System.Drawing.Size(128, 389); this.tvSchedules.Sorted = true; this.tvSchedules.TabIndex = 1; this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect); @@ -780,7 +784,7 @@ namespace IndianHealthService.ClinicalScheduling this.panelRight.Dock = System.Windows.Forms.DockStyle.Right; this.panelRight.Location = new System.Drawing.Point(996, 0); this.panelRight.Name = "panelRight"; - this.panelRight.Size = new System.Drawing.Size(128, 392); + this.panelRight.Size = new System.Drawing.Size(128, 389); this.panelRight.TabIndex = 3; this.panelRight.Visible = false; // @@ -876,38 +880,9 @@ namespace IndianHealthService.ClinicalScheduling this.panelCenter.Dock = System.Windows.Forms.DockStyle.Fill; this.panelCenter.Location = new System.Drawing.Point(136, 24); this.panelCenter.Name = "panelCenter"; - this.panelCenter.Size = new System.Drawing.Size(857, 344); + this.panelCenter.Size = new System.Drawing.Size(857, 341); this.panelCenter.TabIndex = 7; // - // calendarGrid1 - // - this.calendarGrid1.AllowDrop = true; - this.calendarGrid1.Appointments = null; - this.calendarGrid1.ApptDragSource = null; - this.calendarGrid1.AutoScroll = true; - this.calendarGrid1.AutoScrollMinSize = new System.Drawing.Size(600, 1898); - this.calendarGrid1.AvailabilityArray = null; - this.calendarGrid1.BackColor = System.Drawing.SystemColors.Window; - this.calendarGrid1.Columns = 5; - this.calendarGrid1.ContextMenu = this.ctxCalendarGrid; - this.calendarGrid1.Dock = System.Windows.Forms.DockStyle.Fill; - this.calendarGrid1.DrawWalkIns = true; - this.calendarGrid1.GridBackColor = null; - this.calendarGrid1.GridEnter = false; - this.calendarGrid1.Location = new System.Drawing.Point(0, 0); - this.calendarGrid1.Name = "calendarGrid1"; - this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources"))); - this.calendarGrid1.SelectedAppointment = 0; - this.calendarGrid1.Size = new System.Drawing.Size(857, 344); - this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); - this.calendarGrid1.TabIndex = 0; - this.calendarGrid1.TimeScale = 20; - this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); - this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); - this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); - this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick); - this.calendarGrid1.MouseEnter += new System.EventHandler(this.calendarGrid1_MouseEnter); - // // ctxCalendarGrid // this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { @@ -1012,7 +987,7 @@ namespace IndianHealthService.ClinicalScheduling // this.panelBottom.Controls.Add(this.statusBar1); this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panelBottom.Location = new System.Drawing.Point(136, 368); + this.panelBottom.Location = new System.Drawing.Point(136, 365); this.panelBottom.Name = "panelBottom"; this.panelBottom.Size = new System.Drawing.Size(857, 24); this.panelBottom.TabIndex = 8; @@ -1030,7 +1005,7 @@ namespace IndianHealthService.ClinicalScheduling // this.splitter1.Location = new System.Drawing.Point(128, 24); this.splitter1.Name = "splitter1"; - this.splitter1.Size = new System.Drawing.Size(8, 368); + this.splitter1.Size = new System.Drawing.Size(8, 365); this.splitter1.TabIndex = 9; this.splitter1.TabStop = false; // @@ -1039,14 +1014,43 @@ namespace IndianHealthService.ClinicalScheduling this.splitter2.Dock = System.Windows.Forms.DockStyle.Right; this.splitter2.Location = new System.Drawing.Point(993, 24); this.splitter2.Name = "splitter2"; - this.splitter2.Size = new System.Drawing.Size(3, 368); + this.splitter2.Size = new System.Drawing.Size(3, 365); this.splitter2.TabIndex = 10; this.splitter2.TabStop = false; // + // calendarGrid1 + // + this.calendarGrid1.AllowDrop = true; + this.calendarGrid1.Appointments = null; + this.calendarGrid1.ApptDragSource = null; + this.calendarGrid1.AutoScroll = true; + this.calendarGrid1.AutoScrollMinSize = new System.Drawing.Size(600, 1898); + this.calendarGrid1.AvailabilityArray = null; + this.calendarGrid1.BackColor = System.Drawing.SystemColors.Window; + this.calendarGrid1.Columns = 5; + this.calendarGrid1.ContextMenu = this.ctxCalendarGrid; + this.calendarGrid1.Dock = System.Windows.Forms.DockStyle.Fill; + this.calendarGrid1.DrawWalkIns = true; + this.calendarGrid1.GridBackColor = null; + this.calendarGrid1.GridEnter = false; + this.calendarGrid1.Location = new System.Drawing.Point(0, 0); + this.calendarGrid1.Name = "calendarGrid1"; + this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources"))); + this.calendarGrid1.SelectedAppointment = 0; + this.calendarGrid1.Size = new System.Drawing.Size(857, 341); + this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); + this.calendarGrid1.TabIndex = 0; + this.calendarGrid1.TimeScale = 20; + this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); + this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); + this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); + this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick); + this.calendarGrid1.MouseEnter += new System.EventHandler(this.calendarGrid1_MouseEnter); + // // CGView // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(1124, 392); + this.ClientSize = new System.Drawing.Size(1124, 389); this.Controls.Add(this.panelCenter); this.Controls.Add(this.panelBottom); this.Controls.Add(this.splitter2); @@ -1085,8 +1089,6 @@ namespace IndianHealthService.ClinicalScheduling private Hashtable m_htOverbook; private Hashtable m_htModifySchedule; private Hashtable m_htChangeAppts; - private BMXNetConnectInfo m_ConnectInfo = null; - public BMXNetConnectInfo.BMXNetEventDelegate BMXNetEvent; #endregion Fields @@ -1307,7 +1309,7 @@ namespace IndianHealthService.ClinicalScheduling string sResource = (string) m_alSelectedTreeResourceArray[0]; DataTable dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"]; DataView dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows); - string sDuz = this.DocManager.ConnectInfo.DUZ; + string sDuz = CGDocumentManager.Current.RemoteSession.User.Duz; bool bModSchedule = false; DataRowView[] drvA = dv.FindRows(sResource); if (drvA.Length == 0) @@ -1568,13 +1570,19 @@ namespace IndianHealthService.ClinicalScheduling private bool IsThisARadiologyResource(string sResource) { + //smh - change in v 1.7... if the resource is not linked to a PIMS clinic, this method fails. + //This happens if there is just one resource that is not linked, which makes it impossible to + //make any appointments, because this method gets called at any time a menu is opened. + //So we change res.Field to res.Field + // see if resource is mapped to a Radiology Hospital Location. return ( //select all Hospital Locations which are radiology locations from hl in CGDocumentManager.Current.GlobalDataSet.Tables["HospitalLocation"].AsEnumerable() where hl.Field("IS_RADIOLOGY_LOCATION") == "1" //join this to the resources table using the foreign ID (plain jane relational join) join res in CGDocumentManager.Current.GlobalDataSet.Tables["Resources"].AsEnumerable() - on hl.Field("HOSPITAL_LOCATION_ID") equals res.Field("HOSPITAL_LOCATION_ID") + //on hl.Field("HOSPITAL_LOCATION_ID") equals res.Field("HOSPITAL_LOCATION_ID") //change in 1.7 + on hl.Field("HOSPITAL_LOCATION_ID") equals res.Field("HOSPITAL_LOCATION_ID") //then filter this down to the resource that we have where res.Field("RESOURCE_NAME") == sResource //if we have any row left, then it is true. @@ -1765,7 +1773,7 @@ namespace IndianHealthService.ClinicalScheduling doc.ResourceID = Convert.ToInt32(sResourceID); - bool bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXRES(" + sResourceID + ")", "+"); + bool bLock = CGDocumentManager.Current.RemoteSession.Lock("^BSDXRES(" + sResourceID + ")", "+"); if (bLock == false) { throw new BMXNetException("Another user is currently editing availability for this resource. Try later."); @@ -1938,9 +1946,7 @@ namespace IndianHealthService.ClinicalScheduling v.m_htChangeAppts = new Hashtable(sSelectedTreeResourceArray.Count); dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"]; dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows); - - //dv.RowFilter = "USERNAME = '" + filte_name + "'"; - dv.RowFilter = String.Format("USERNAME = '{0}'", this.DocManager.ConnectInfo.UserName.Replace("'", "''")); + dv.RowFilter = String.Format("USERNAME = '{0}'", CGDocumentManager.Current.RemoteSession.User.Name.Replace("'", "''")); for (int j=0; j < dv.Count; j++) { @@ -2528,8 +2534,8 @@ namespace IndianHealthService.ClinicalScheduling catch (Exception ex) { string msg; - if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error. - msg = BMXNetLib.Piece(ex.Message, "~", 4); + if (M.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error. + msg = M.Piece(ex.Message, "~", 4); else msg = ex.Message; @@ -2639,8 +2645,8 @@ namespace IndianHealthService.ClinicalScheduling catch (Exception ex) { string msg; - if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error. - msg = BMXNetLib.Piece(ex.Message, "~", 4); + if (M.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error. + msg = M.Piece(ex.Message, "~", 4); else msg = ex.Message; @@ -2747,8 +2753,8 @@ namespace IndianHealthService.ClinicalScheduling catch (Exception ex) { string msg; - if (BMXNetLib.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error. - msg = BMXNetLib.Piece(ex.Message, "~", 4); + if (M.Piece(ex.Message, "~", 1) == "-10") // -10 means that BSDXAPI reported an error. + msg = M.Piece(ex.Message, "~", 4); else msg = ex.Message; @@ -2770,7 +2776,7 @@ namespace IndianHealthService.ClinicalScheduling /// Not used /// BMXEvent Args: /// e.BMXEvent is free text for Event Type; e.BMXParam is free text for Event Arguments - private void BMXNetEventHandler(Object obj, BMXNet.BMXNetEventArgs e) + private void BMXNetEventHandler(Object obj, RemoteEventArgs e) { try { @@ -2778,7 +2784,7 @@ namespace IndianHealthService.ClinicalScheduling if (this == null) return; // if event is Autofire event - if (e.BMXEvent == "BMXNet AutoFire") + if (e.EventType == "BMXNet AutoFire") { Debug.Write("CGView caught AutoFire event.\n"); @@ -2791,7 +2797,7 @@ namespace IndianHealthService.ClinicalScheduling } // if event is BSDX SCHEDULE - else if (e.BMXEvent == "BSDX SCHEDULE") + else if (e.EventType == "BSDX SCHEDULE") { //See if any of the resources in the event argument matches BSDX Schedule. //If yes, fire off the delegate @@ -2799,7 +2805,7 @@ namespace IndianHealthService.ClinicalScheduling for (int j = 0; j < m_Document.m_sResourcesArray.Count; j++) { sResourceName = m_Document.m_sResourcesArray[j].ToString(); - if (e.BMXParam == sResourceName) + if (e.Details == sResourceName) { Debug.Write("CGView caught BSDX SCHEDULE event.\n"); @@ -2867,7 +2873,7 @@ namespace IndianHealthService.ClinicalScheduling try { //Signal RPMS to raise an event - m_ConnectInfo.RaiseEvent(sEvent, sParams, false); + CGDocumentManager.Current.RemoteSession.EventServices.TriggerEvent(sEvent, sParams, false); } catch (Exception ex) { @@ -2913,7 +2919,7 @@ namespace IndianHealthService.ClinicalScheduling { try { - bool bLock = DocManager.ConnectInfo.Lock("^BSDXMGR", "+", ""); + bool bLock = CGDocumentManager.Current.RemoteSession.Lock("^BSDXMGR", "+"); if (bLock == false) { throw new Exception("Another user is currently in Scheduling Management. Try later."); @@ -2928,7 +2934,7 @@ namespace IndianHealthService.ClinicalScheduling m_DocManager.GlobalDataSet.Tables["ResourceUser"].Clear(); m_DocManager.LoadResourceUserTable(false); - bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXMGR", "-"); + bLock = CGDocumentManager.Current.RemoteSession.Lock("^BSDXMGR", "-"); } catch (ApplicationException aex) { @@ -3194,49 +3200,11 @@ namespace IndianHealthService.ClinicalScheduling e.Node.TreeView.SelectedNode = e.Node; } - /// - /// Useless code now... Good place to test something. - /// - /// - /// - private void mnuTest1_Click(object sender, System.EventArgs e) - { - ReaderWriterLock m_rwl = this.DocManager.ConnectInfo.bmxNetLib.BMXRWL; - try - { - m_rwl.AcquireWriterLock(50); - Debug.Write("\nTest Button 1 Acquired first lock\n"); - m_rwl.AcquireWriterLock(50); - Debug.Write("Test Button 1 Acquired second lock\n"); - this.DocManager.ViewRefresh(); - Thread.Sleep(5000); - try - { - } - catch - { - } - finally - { - m_rwl.ReleaseWriterLock(); - Debug.Write ("Test Button 1 released first lock.\n"); - m_rwl.ReleaseWriterLock(); - Debug.Write ("Test Button 1 released second lock.\n"); - } - - return; - } - catch (Exception ex) - { - Debug.Write("Test Button 1 exception: " + ex.Message + "\n"); - } - } - private void CGView_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { - m_ConnectInfo.BMXNetEvent -= m_bmxDelegate; + CGDocumentManager.Current.RemoteSession.EventServices.RpmsEvent -= BMXNetEventHandler; this.calendarGrid1.CloseGrid(); } catch (Exception ex) @@ -3965,6 +3933,12 @@ namespace IndianHealthService.ClinicalScheduling dpl.ShowDialog(this); } + private void mnuViewBrokerLog_Click(object sender, EventArgs e) + { + var view = new RPCLoggerView(); + view.Show(); + } + }//End class } diff --git a/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj b/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj index bbf1600..189c776 100644 --- a/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj +++ b/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj @@ -109,6 +109,18 @@ false + + False + bin\Release\BMXNET40.dll + + + False + bin\Release\BMXWIN40.dll + + + False + bin\Release\PrintPreview.dll + System @@ -147,6 +159,13 @@ + + + Form + + + RPCLoggerView.cs + True True @@ -431,6 +450,9 @@ LoadingSplash.cs + + RPCLoggerView.cs + ResXFileCodeGenerator strings.ar.Designer.cs @@ -477,16 +499,6 @@ - - - {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45} - BMXNet - - - {9E8D433B-EFD1-4253-BD2C-C4E0DB0BFD0E} - PrintPreview - - diff --git a/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user b/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user index 50a069c..7c354d7 100644 --- a/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user +++ b/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user @@ -36,7 +36,7 @@ Project - /s=10.0.1.13 /p=9261 /a=shabiel12 /v=catdog.22 + /s=10.0.1.13 /p=9431 /a=shabiel12 /v=catdog.22 C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\IEExec.exe diff --git a/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln b/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln index 6396fc3..06fdc8f 100644 --- a/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln +++ b/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln @@ -6,9 +6,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClinicalScheduling", "Clini {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45} = {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintPreview", "..\EnhancedPrintPreview\PrintPreview\PrintPreview.csproj", "{9E8D433B-EFD1-4253-BD2C-C4E0DB0BFD0E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IndianHealthService.BMXNet", "..\BMX4\IndianHealthService.BMXNet\IndianHealthService.BMXNet.csproj", "{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMXNet", "..\..\BMX2\BMXNet\BMXNet.csproj", "{DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IndianHealthService.BMXNet.WinForm", "..\BMX4\IndianHealthService.BMXNet.WinForm\IndianHealthService.BMXNet.WinForm.csproj", "{3B9011B5-59F4-4F6B-ADC7-54ADC6948F4D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -28,6 +28,10 @@ Global {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.ActiveCfg = Release|Any CPU {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.Build.0 = Release|Any CPU + {3B9011B5-59F4-4F6B-ADC7-54ADC6948F4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B9011B5-59F4-4F6B-ADC7-54ADC6948F4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3B9011B5-59F4-4F6B-ADC7-54ADC6948F4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B9011B5-59F4-4F6B-ADC7-54ADC6948F4D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/cs/bsdx0200GUISourceCode/ClinicalScheduling.suo b/cs/bsdx0200GUISourceCode/ClinicalScheduling.suo index a13d89e..8494407 100644 Binary files a/cs/bsdx0200GUISourceCode/ClinicalScheduling.suo and b/cs/bsdx0200GUISourceCode/ClinicalScheduling.suo differ diff --git a/cs/bsdx0200GUISourceCode/DAL.cs b/cs/bsdx0200GUISourceCode/DAL.cs index fce1631..49ec6ce 100644 --- a/cs/bsdx0200GUISourceCode/DAL.cs +++ b/cs/bsdx0200GUISourceCode/DAL.cs @@ -15,7 +15,7 @@ namespace IndianHealthService.ClinicalScheduling /// public class DAL { - private BMXNetConnectInfo _thisConnection; // set in constructor + private RemoteSession _thisConnection; // set in constructor delegate DataTable RPMSDataTableDelegate(string CommandString, string TableName); // for use in calling (Sync and Async) delegate string TransmitRPCAsync(string RPCName, string Params); //same idea @@ -24,7 +24,7 @@ namespace IndianHealthService.ClinicalScheduling /// Constructor /// /// The current connection to use - public DAL(BMXNetConnectInfo conn) + public DAL(RemoteSession conn) { this._thisConnection = conn; } @@ -38,7 +38,7 @@ namespace IndianHealthService.ClinicalScheduling public DataTable GetVersion(string nmsp) { string cmd = String.Format("BMX VERSION INFO^{0}", nmsp); - return RPMSDataTable(cmd, ""); + return _thisConnection.TableFromCommand(cmd); } /// @@ -49,7 +49,7 @@ namespace IndianHealthService.ClinicalScheduling public DataTable GetUserInfo(string DUZ) { string cmd = String.Format("BSDX SCHEDULING USER INFO^{0}", DUZ); - return RPMSDataTable(cmd, ""); + return _thisConnection.TableFromCommand(cmd); } /// @@ -64,10 +64,10 @@ namespace IndianHealthService.ClinicalScheduling /// GREEN (NJ3,0), [0;6] /// BLUE (NJ3,0), [0;7] /// - public DataTable GetAccessTypes() + public DataTable GetAccessTypes(DataSet dataSetToTakeTable, string tablename) { string sCommandText = "SELECT * FROM BSDX_ACCESS_TYPE"; - DataTable table = RPMSDataTable(sCommandText, ""); + DataTable table = _thisConnection.TableFromSQL(sCommandText, dataSetToTakeTable, tablename); DataColumn dcKey = table.Columns["BMXIEN"]; DataColumn[] dcKeys = new DataColumn[1]; dcKeys[0] = dcKey; @@ -92,7 +92,7 @@ namespace IndianHealthService.ClinicalScheduling string sBegin = FMDateTime.Create(BeginDate).DateOnly.FMDateString; string sEnd = FMDateTime.Create(EndDate).DateOnly.FMDateString; string cmd = String.Format("BSDX CLINIC LETTERS^{0}^{1}^{2}", sClinicList, sBegin, sEnd); - return RPMSDataTable(cmd, ""); + return _thisConnection.TableFromCommand(cmd); } /// @@ -106,7 +106,7 @@ namespace IndianHealthService.ClinicalScheduling public DataTable GetResourceLetters(string sClinicList) { string cmd = String.Format("BSDX RESOURCE LETTERS^{0}", sClinicList); - return RPMSDataTable(cmd, ""); + return _thisConnection.TableFromCommand(cmd); } /// @@ -125,7 +125,7 @@ namespace IndianHealthService.ClinicalScheduling string sBegin = FMDateTime.Create(BeginDate).DateOnly.FMDateString; string sEnd = FMDateTime.Create(EndDate).DateOnly.FMDateString; string cmd = String.Format("BSDX REBOOK CLINIC LIST^{0}^{1}^{2}", sClinicList, sBegin, sEnd); - return RPMSDataTable(cmd, ""); + return _thisConnection.TableFromCommand(cmd); } /// @@ -138,7 +138,7 @@ namespace IndianHealthService.ClinicalScheduling public DataTable GetRebookedAppointments(string sApptList) { string cmd = String.Format("BSDX REBOOK LIST^{0}", sApptList); - return RPMSDataTable(cmd, ""); + return _thisConnection.TableFromCommand(cmd); } /// @@ -156,7 +156,7 @@ namespace IndianHealthService.ClinicalScheduling string sBegin = FMDateTime.Create(BeginDate).DateOnly.FMDateString; string sEnd = FMDateTime.Create(EndDate).DateOnly.FMDateString; string cmd = String.Format("BSDX CANCEL CLINIC LIST^{0}^{1}^{2}", sClinicList, sBegin, sEnd); - return RPMSDataTable(cmd, ""); + return _thisConnection.TableFromCommand(cmd); } /// @@ -172,7 +172,7 @@ namespace IndianHealthService.ClinicalScheduling string sBegin = FMDateTime.Create(BeginDate).DateOnly.FMDateString; string sEnd = FMDateTime.Create(EndDate).DateOnly.FMDateString; string cmd = String.Format("BSDX CANCEL AV BY DATE^{0}^{1}^{2}", sResourceID, sBegin, sEnd); - return RPMSDataTable(cmd, "Cancelled"); + return _thisConnection.TableFromCommand(cmd); } /// @@ -184,7 +184,7 @@ namespace IndianHealthService.ClinicalScheduling public DataTable RemoveCheckIn(int ApptID) { string cmd = string.Format("BSDX REMOVE CHECK-IN^{0}", ApptID); - return RPMSDataTable(cmd, ""); + return _thisConnection.TableFromCommand(cmd); } /// @@ -196,7 +196,7 @@ namespace IndianHealthService.ClinicalScheduling public List GetRadiologyExamsForPatientinHL(int DFN, int SCIEN) { string cmd = string.Format("BSDX GET RAD EXAM FOR PT^{0}^{1}", DFN, SCIEN); - DataTable tbl = RPMSDataTable(cmd, ""); + DataTable tbl = _thisConnection.TableFromCommand(cmd); return (from row in tbl.AsEnumerable() select new RadiologyExam { @@ -217,7 +217,7 @@ namespace IndianHealthService.ClinicalScheduling public bool ScheduleRadiologyExam(int DFN, int examIEN, DateTime dStart) { string fmStartDate = FMDateTime.Create(dStart).FMDateString; - string result = _thisConnection.bmxNetLib.TransmitRPC("BSDX SCHEDULE RAD EXAM", string.Format("{0}^{1}^{2}", DFN, examIEN, fmStartDate)); + string result = _thisConnection.TransmitRPC("BSDX SCHEDULE RAD EXAM", string.Format("{0}^{1}^{2}", DFN, examIEN, fmStartDate)); return result == "1" ? true : false; } @@ -229,7 +229,7 @@ namespace IndianHealthService.ClinicalScheduling /// should always return true public bool CancelRadiologyExam(int DFN, int examIEN) { - string result = _thisConnection.bmxNetLib.TransmitRPC("BSDX HOLD RAD EXAM", string.Format("{0}^{1}", DFN, examIEN)); + string result = _thisConnection.TransmitRPC("BSDX HOLD RAD EXAM", string.Format("{0}^{1}", DFN, examIEN)); return result == "1" ? true : false; } @@ -240,7 +240,7 @@ namespace IndianHealthService.ClinicalScheduling /// true or false public bool CanCancelRadExam(int examIEN) { - string result = _thisConnection.bmxNetLib.TransmitRPC("BSDX CAN HOLD RAD EXAM", examIEN.ToString()); + string result = _thisConnection.TransmitRPC("BSDX CAN HOLD RAD EXAM", examIEN.ToString()); return result == "1" ? true : false; } @@ -255,12 +255,12 @@ namespace IndianHealthService.ClinicalScheduling { get { - string val = _thisConnection.bmxNetLib.TransmitRPC("BSDX GET PARAM", "BSDX AUTO PRINT RS"); //1 = true; 0 = false; "" = not set + string val = _thisConnection.TransmitRPC("BSDX GET PARAM", "BSDX AUTO PRINT RS"); //1 = true; 0 = false; "" = not set return val == "1" ? true : false; } set { - TransmitRPCAsync _asyncTransmitter = new TransmitRPCAsync(_thisConnection.bmxNetLib.TransmitRPC); + TransmitRPCAsync _asyncTransmitter = new TransmitRPCAsync(_thisConnection.TransmitRPC); // 0 = success; anything else is wrong. Not being tested here as its success is not critical to application use. _asyncTransmitter.BeginInvoke("BSDX SET PARAM", String.Format("{0}^{1}", "BSDX AUTO PRINT RS", value ? "1" : "0"), null, null); } @@ -277,12 +277,12 @@ namespace IndianHealthService.ClinicalScheduling { get { - string val = _thisConnection.bmxNetLib.TransmitRPC("BSDX GET PARAM", "BSDX AUTO PRINT AS"); //1 = true; 0 = false; "" = not set + string val = _thisConnection.TransmitRPC("BSDX GET PARAM", "BSDX AUTO PRINT AS"); //1 = true; 0 = false; "" = not set return val == "1" ? true : false; } set { - TransmitRPCAsync _asyncTransmitter = new TransmitRPCAsync(_thisConnection.bmxNetLib.TransmitRPC); + TransmitRPCAsync _asyncTransmitter = new TransmitRPCAsync(_thisConnection.TransmitRPC); // 0 = success; anything else is wrong. Not being tested here as its success is not critical to application use. _asyncTransmitter.BeginInvoke("BSDX SET PARAM", String.Format("{0}^{1}", "BSDX AUTO PRINT AS", value ? "1" : "0"), null, null); } @@ -302,12 +302,9 @@ namespace IndianHealthService.ClinicalScheduling string sErrorMessage = ""; DataTable dtOut; -#if TRACE - DateTime sendTime = DateTime.Now; -#endif try { - RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(_thisConnection.RPMSDataTable); + RPMSDataTableDelegate rdtd = new RPMSDataTableDelegate(_thisConnection.TableFromSQL); dtOut = (DataTable)rdtd.Invoke(sSQL, sTableName); } @@ -317,12 +314,6 @@ namespace IndianHealthService.ClinicalScheduling throw ex; } -#if TRACE - DateTime receiveTime = DateTime.Now; - TimeSpan executionTime = receiveTime - sendTime; - Debug.Write("RPMSDataTable Execution Time: " + executionTime.Milliseconds + " ms.\n"); -#endif - return dtOut; } diff --git a/cs/bsdx0200GUISourceCode/DManagement.cs b/cs/bsdx0200GUISourceCode/DManagement.cs index e9d89e1..47f3928 100644 --- a/cs/bsdx0200GUISourceCode/DManagement.cs +++ b/cs/bsdx0200GUISourceCode/DManagement.cs @@ -139,9 +139,8 @@ namespace IndianHealthService.ClinicalScheduling this.m_DocManager = docManager; this.m_dsGlobal = m_DocManager.GlobalDataSet; - MgrEventDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(MgrEventHandler); - m_DocManager.ConnectInfo.BMXNetEvent += MgrEventDelegate; - m_DocManager.ConnectInfo.SubscribeEvent("BSDX WORKSTATION REPORT"); + m_DocManager.RemoteSession.EventServices.RpmsEvent += MgrEventHandler; + m_DocManager.RemoteSession.EventServices.Subscribe("BSDX WORKSTATION REPORT"); m_dtWSGrid = new DataTable("WSGrid"); m_dtWSGrid.Columns.Add("UserName", typeof(System.String)); m_dtWSGrid.Columns.Add("Handle", typeof(System.String)); @@ -1898,9 +1897,10 @@ namespace IndianHealthService.ClinicalScheduling { 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); + //PORT TODO: This may fail. + DataTable dt1 = m_DocManager.DAL.GetAccessTypes(m_dsGlobal, "AccessTypes"); + //m_dsGlobal.Tables["AccessTypes"].Merge(dt1); //smh -commented out for BMX4 + //m_dsGlobal.Tables.Add(dt1); //smh -commented out for BMX4 //Fix Groups //m_DocManager.LoadAccessTypesTable(); m_DocManager.LoadAccessGroupTypesTable(); @@ -2328,27 +2328,26 @@ namespace IndianHealthService.ClinicalScheduling private void cmdWorkStationsRefresh_Click(object sender, System.EventArgs e) { this.m_dtWSGrid.Clear(); - this.m_DocManager.ConnectInfo.RaiseEvent("BSDX CALL WORKSTATIONS", "A", true); + this.m_DocManager.RemoteSession.EventServices.TriggerEvent("BSDX CALL WORKSTATIONS", "A", true); } - private BMXNetConnectInfo.BMXNetEventDelegate MgrEventDelegate; delegate void UpdateWorkstationGridDelegate(string sParam); - private void MgrEventHandler(Object obj, BMXNet.BMXNetEventArgs e) + private void MgrEventHandler(Object obj, RemoteEventArgs e) { try { - if (e.BMXEvent == "BSDX WORKSTATION REPORT") + if (e.EventType == "BSDX WORKSTATION REPORT") { Debug.Write("DManagement Got Workstation Report\n"); UpdateWorkstationGridDelegate uWSGd = new UpdateWorkstationGridDelegate(UpdateWorkstationGrid); if (this.InvokeRequired == true) //ensures that handle is created { - this.Invoke(uWSGd, new object[] { e.BMXParam }); + this.Invoke(uWSGd, new object[] { e.Details }); } else { - UpdateWorkstationGrid(e.BMXParam); + UpdateWorkstationGrid(e.Details); } } } @@ -2362,16 +2361,16 @@ namespace IndianHealthService.ClinicalScheduling { string sDelim = "~"; DataRow dr = this.m_dtWSGrid.NewRow(); - dr["UserName"] = BMXNetLib.Piece(sParam,sDelim,1); - dr["Handle"] = BMXNetLib.Piece(sParam,sDelim,2); - dr["Version"] = BMXNetLib.Piece(sParam,sDelim,3); - dr["Views"] = BMXNetLib.Piece(sParam,sDelim,4); + dr["UserName"] = M.Piece(sParam,sDelim,1); + dr["Handle"] = M.Piece(sParam,sDelim,2); + dr["Version"] = M.Piece(sParam,sDelim,3); + dr["Views"] = M.Piece(sParam,sDelim,4); m_dtWSGrid.Rows.Add(dr); } private void DManagement_Closing(object sender, System.ComponentModel.CancelEventArgs e) { - m_DocManager.ConnectInfo.UnSubscribeEvent("BSDX WORKSTATION REPORT"); + CGDocumentManager.Current.RemoteSession.EventServices.Unsubscribe("BSDX WORKSTATION REPORT"); } private void cmdWorkStationsMessage_Click(object sender, System.EventArgs e) @@ -2388,7 +2387,7 @@ namespace IndianHealthService.ClinicalScheduling if (sMessage == "") return; - this.m_DocManager.ConnectInfo.RaiseEvent("BSDX ADMIN MESSAGE", sMessage, false); + this.m_DocManager.RemoteSession.EventServices.TriggerEvent("BSDX ADMIN MESSAGE", sMessage, false); } private void cmdWorkStationsShutdown_Click(object sender, System.EventArgs e) @@ -2397,7 +2396,7 @@ namespace IndianHealthService.ClinicalScheduling { return; } - this.m_DocManager.ConnectInfo.RaiseEvent("BSDX ADMIN SHUTDOWN", txtSendMessage.Text, false); + this.m_DocManager.RemoteSession.EventServices.TriggerEvent("BSDX ADMIN SHUTDOWN", txtSendMessage.Text, false); } #endregion Workstations diff --git a/cs/bsdx0200GUISourceCode/Printing.cs b/cs/bsdx0200GUISourceCode/Printing.cs index 278acec..d49bd65 100644 --- a/cs/bsdx0200GUISourceCode/Printing.cs +++ b/cs/bsdx0200GUISourceCode/Printing.cs @@ -216,7 +216,7 @@ namespace IndianHealthService.ClinicalScheduling // Draw Header - string division = CGDocumentManager.Current.ConnectInfo.DivisionName; + string division = CGDocumentManager.Current.RemoteSession.User.Division.Name; int divisionStringHeight = (int)g.MeasureString(division.ToString(), fontBody, e.PageBounds.Width - (int)(10 * widthRatio) - HardMarginX).Height; Rectangle headerArea = new Rectangle() @@ -690,7 +690,7 @@ namespace IndianHealthService.ClinicalScheduling } // Draw Header - string division = CGDocumentManager.Current.ConnectInfo.DivisionName; + string division = CGDocumentManager.Current.RemoteSession.User.Division.Name; int divisionStringHeight = (int)g.MeasureString(division.ToString(), fontBody, e.MarginBounds.Width).Height; Rectangle headerArea = new Rectangle() { diff --git a/cs/bsdx0200GUISourceCode/RPCLogger.cs b/cs/bsdx0200GUISourceCode/RPCLogger.cs new file mode 100644 index 0000000..32ed662 --- /dev/null +++ b/cs/bsdx0200GUISourceCode/RPCLogger.cs @@ -0,0 +1,102 @@ +/* Written by Sam Habiel in May 2011 + * Licensed under LGPL */ + +using System; +using System.Collections.Generic; +using System.Text; +using IndianHealthService.BMXNet; +using System.Diagnostics; + +namespace IndianHealthService.ClinicalScheduling +{ + /// + /// Class to Log Calls to RPMS/VISTA back and forth. Implements BMXNet.[I]Log interaface. + /// Logger is implemented as a Queue Collection of class EventToLog + /// + public class RPCLogger: Log + { + /// + /// Max size of Log + /// + const int maxsize = 1000; + + /// + /// Stop Watch to keep track of time between calls. + /// + Stopwatch _watch; + + /// + /// ctor + /// + public RPCLogger() + { + _logger = new List(maxsize); + _watch = new Stopwatch(); + _watch.Start(); + } + + public bool IsLogging { get; set; } + + //Event to notify interested controls that we have more data + public event EventHandler HaveMoreData; + + private List _logger; + + public List Logger + { + get { return _logger; } + } + + /// + /// Data Structure to Log + /// + public class EventToLog: EventArgs + { + public DateTime EventTime { get; set; } + public long ElapasedTime { get; set; } + public string Class { get; set; } + public string Category { get; set; } + public string Lines { get; set; } + public Exception Exception { get; set; } + + public override string ToString() + { + return EventTime.TimeOfDay + "\t" + Category + "\t" + Class + "\t" + ElapasedTime + " ms"; + } + } + + /// + /// Chained to Below + /// + public void Log(string aClass, string aCategory, params string[] lines) + { + Log(aClass, aCategory, null, lines); + } + + /// + /// Adds Log entry to queue object + /// + public void Log(string aClass, string aCategory, Exception anException, params string[] lines) + { + if (_logger.Count >= maxsize - 1) _logger.RemoveAt(_logger.Count - 1); + + EventToLog _e = new EventToLog + { + EventTime = DateTime.Now, + Class = aClass, + Category = aCategory, + Lines = String.Join("\r\n", lines), + Exception = anException, + ElapasedTime = _watch.ElapsedMilliseconds + }; + + _logger.Add(_e); + + _watch.Reset(); + _watch.Start(); + + //Tell subscribers to this event that we want attention!!!! + if (HaveMoreData != null) HaveMoreData(this, _e); + } + } +} diff --git a/cs/bsdx0200GUISourceCode/RPCLoggerView.Designer.cs b/cs/bsdx0200GUISourceCode/RPCLoggerView.Designer.cs new file mode 100644 index 0000000..e253da2 --- /dev/null +++ b/cs/bsdx0200GUISourceCode/RPCLoggerView.Designer.cs @@ -0,0 +1,99 @@ +namespace IndianHealthService.ClinicalScheduling +{ + partial class RPCLoggerView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.lstRPCEvents = new System.Windows.Forms.ListBox(); + this.txtRPCEvent = new System.Windows.Forms.TextBox(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.lstRPCEvents); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.txtRPCEvent); + this.splitContainer1.Size = new System.Drawing.Size(894, 262); + this.splitContainer1.SplitterDistance = 342; + this.splitContainer1.TabIndex = 0; + // + // lstRPCEvents + // + this.lstRPCEvents.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstRPCEvents.FormattingEnabled = true; + this.lstRPCEvents.Location = new System.Drawing.Point(0, 0); + this.lstRPCEvents.Name = "lstRPCEvents"; + this.lstRPCEvents.Size = new System.Drawing.Size(342, 262); + this.lstRPCEvents.TabIndex = 0; + this.lstRPCEvents.SelectedIndexChanged += new System.EventHandler(this.lstRPCEvents_SelectedIndexChanged); + // + // txtRPCEvent + // + this.txtRPCEvent.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtRPCEvent.Location = new System.Drawing.Point(0, 0); + this.txtRPCEvent.Multiline = true; + this.txtRPCEvent.Name = "txtRPCEvent"; + this.txtRPCEvent.Size = new System.Drawing.Size(548, 262); + this.txtRPCEvent.TabIndex = 0; + // + // RPCLoggerView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(894, 262); + this.Controls.Add(this.splitContainer1); + this.Name = "RPCLoggerView"; + this.Text = "BMX RPC Log View"; + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.Panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.TextBox txtRPCEvent; + private System.Windows.Forms.ListBox lstRPCEvents; + } +} \ No newline at end of file diff --git a/cs/bsdx0200GUISourceCode/RPCLoggerView.cs b/cs/bsdx0200GUISourceCode/RPCLoggerView.cs new file mode 100644 index 0000000..7587c05 --- /dev/null +++ b/cs/bsdx0200GUISourceCode/RPCLoggerView.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace IndianHealthService.ClinicalScheduling +{ + /// + /// This form displays the RPC Events found in RPCLogger + /// + public partial class RPCLoggerView : Form + { + public RPCLoggerView() + { + InitializeComponent(); + lstRPCEvents.BeginUpdate(); // Stop redrawing + foreach (var eventItem in CGDocumentManager.Current.RPCLogger.Logger) lstRPCEvents.Items.Add(eventItem); // Add the stuff + lstRPCEvents.EndUpdate(); // Draw Again + + //We are interested in event HaveMoreData. Each time it happens, it means we have an extra item we need to add. + CGDocumentManager.Current.RPCLogger.HaveMoreData += new EventHandler(RPCLogger_HaveMoreData); + } + + // Dummmy delegate for the method below to use in this.Invoke + delegate void dAny(object s, RPCLogger.EventToLog e); + + /// + /// Adds the new RPC event to Listbox + /// + /// this is the RPCLogger Object. It's not used + /// That's the custom logged event. + void RPCLogger_HaveMoreData(object sender, RPCLogger.EventToLog e) + { + if (this.InvokeRequired) + { + dAny d = new dAny(this.RPCLogger_HaveMoreData); + this.Invoke(d, new object[] { sender, e }); + return; + } + + lstRPCEvents.Items.Add(e); + } + + /// + /// Puts the text of the event in the text box + /// + /// useless + /// useless + private void lstRPCEvents_SelectedIndexChanged(object sender, EventArgs e) + { + RPCLogger.EventToLog l = lstRPCEvents.SelectedItem as RPCLogger.EventToLog; + if (l == null) return; + txtRPCEvent.Text = l.Lines + "\r\n" + l.Exception ?? ""; + } + } +} diff --git a/cs/bsdx0200GUISourceCode/RPCLoggerView.resx b/cs/bsdx0200GUISourceCode/RPCLoggerView.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/cs/bsdx0200GUISourceCode/RPCLoggerView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/cs/bsdx0200GUISourceCode/bin/Release/BMXNET40.dll b/cs/bsdx0200GUISourceCode/bin/Release/BMXNET40.dll new file mode 100644 index 0000000..1177780 Binary files /dev/null and b/cs/bsdx0200GUISourceCode/bin/Release/BMXNET40.dll differ diff --git a/cs/bsdx0200GUISourceCode/bin/Release/BMXNet23.dll b/cs/bsdx0200GUISourceCode/bin/Release/BMXNet23.dll deleted file mode 100644 index 46fd448..0000000 Binary files a/cs/bsdx0200GUISourceCode/bin/Release/BMXNet23.dll and /dev/null differ diff --git a/cs/bsdx0200GUISourceCode/bin/Release/BMXWIN40.dll b/cs/bsdx0200GUISourceCode/bin/Release/BMXWIN40.dll new file mode 100644 index 0000000..a3559b1 Binary files /dev/null and b/cs/bsdx0200GUISourceCode/bin/Release/BMXWIN40.dll differ diff --git a/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.exe b/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.exe index 0df9adf..89bbcb3 100644 Binary files a/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.exe and b/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.exe differ diff --git a/cs/bsdx0200GUISourceCode/bin/Release/ar/ClinicalScheduling.resources.dll b/cs/bsdx0200GUISourceCode/bin/Release/ar/ClinicalScheduling.resources.dll index aa8acd0..c87f150 100644 Binary files a/cs/bsdx0200GUISourceCode/bin/Release/ar/ClinicalScheduling.resources.dll and b/cs/bsdx0200GUISourceCode/bin/Release/ar/ClinicalScheduling.resources.dll differ