Changeset 1051 for Scheduling/trunk/cs
- Timestamp:
- Jan 6, 2011, 4:25:38 AM (14 years ago)
- Location:
- Scheduling/trunk/cs/bsdx0200GUISourceCode
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs
r1050 r1051 188 188 189 189 190 _current.InitializeApp(); 190 bool isEverythingOkay = _current.InitializeApp(); 191 192 if (!isEverythingOkay) return; 191 193 192 194 //Create the first empty document … … 251 253 /// See InitializeApp(bool) below 252 254 /// </summary> 253 private voidInitializeApp()254 { 255 InitializeApp(false);255 private bool InitializeApp() 256 { 257 return InitializeApp(false); 256 258 } 257 259 … … 264 266 /// <param name="bReLogin">Is the User logging in again from a currently running instance? 265 267 /// If so, display a dialog to collect access and verify codes.</param> 266 private voidInitializeApp(bool bReLogin)268 private bool InitializeApp(bool bReLogin) 267 269 { 268 270 //Set M connection info … … 278 280 m_ConnectInfo.EventPollingEnabled = false; 279 281 280 //Show a splash screen while initializing 282 //Show a splash screen while initializing; define delegates to remote thread 281 283 DSplash m_ds = new DSplash(); 282 284 DSplash.dSetStatus setStatusDelegate = new DSplash.dSetStatus(m_ds.SetStatus); 283 285 DSplash.dAny closeSplashDelegate = new DSplash.dAny(m_ds.RemoteClose); 284 DSplash.dAny hideSplashDelegate = new DSplash.dAny(m_ds.RemoteHide); 285 286 DSplash.dProgressBarSet setMaxProgressDelegate = new DSplash.dProgressBarSet(m_ds.RemoteProgressBarMaxSet); 287 DSplash.dProgressBarSet setProgressDelegate = new DSplash.dProgressBarSet(m_ds.RemoteProgressBarValueSet); 288 289 //Start new thread for the Splash screen. 286 290 Thread threadSplash = new Thread(new ParameterizedThreadStart(StartSplash)); 287 threadSplash.IsBackground = true; //expendable -- exit even if still running. 288 threadSplash.Start(m_ds); 289 291 threadSplash.IsBackground = true; //expendable thread -- exit even if still running. 292 threadSplash.Name = "Splash Thread"; 293 threadSplash.Start(m_ds); // pass form as parameter. 294 295 //There are 20 steps to load the application. That's max for the progress bar. 296 setMaxProgressDelegate(20); 290 297 291 //m_ds.SetStatus("Loading Configuration Settings..."); 292 //m_ds.Refresh(); 293 //this.Activate(); 294 // smh--not used System.Configuration.ConfigurationManager.GetSection("appSettings"); 298 // smh--not used: System.Configuration.ConfigurationManager.GetSection("appSettings"); 299 295 300 setStatusDelegate("Connecting to VISTA"); 296 //m_ds.Refresh();301 297 302 bool bRetry = true; 298 303 … … 301 306 //whether you can connect or not. Not good. So I test first whether 302 307 //we can connect at all by doing a simple connection and disconnect. 303 //TODO: Make this more robust by sending a TCPConnect message and seeing if you get a response. 304 305 //m_ds.Refresh(); 306 308 //TODO: Make this more robust by sending a TCPConnect message and seeing if you get a response 307 309 if (m_Server != "" && m_Port != 0) 308 310 { … … 313 315 tcpClient.Close(); // then close it 314 316 } 315 catch (System.Net.Sockets.SocketException ex)317 catch (System.Net.Sockets.SocketException) 316 318 { 317 throw ex; 319 MessageBox.Show("Cannot connect to VistA. Network Error"); 320 return false; 318 321 } 319 322 } 320 323 321 do 324 325 // Do block is Log-in logic 326 do 322 327 { 323 328 // login crap … … 347 352 catch (System.Net.Sockets.SocketException) 348 353 { 349 MessageBox.Show("Cannot connect to VistA. ");354 MessageBox.Show("Cannot connect to VistA. Network Error"); 350 355 } 351 catch ( Exception ex)356 catch (BMXNetException ex) 352 357 { 353 //m_ds.Close();354 358 if (MessageBox.Show("Unable to connect to VistA. " + ex.Message, "Clinical Scheduling", MessageBoxButtons.RetryCancel) == DialogResult.Retry) 355 359 { … … 361 365 closeSplashDelegate(); 362 366 bRetry = false; 363 throw ex;367 return false; //tell main that it's a no go. 364 368 } 365 369 } … … 370 374 371 375 //Version info 372 //m_ds.Activate(); 376 // Table #1 377 setProgressDelegate(1); 373 378 setStatusDelegate("Getting Version Info from Server..."); 374 379 … … 406 411 407 412 //Change encoding 413 // Call #2 414 setProgressDelegate(2); 408 415 setStatusDelegate("Setting encoding..."); 409 416 … … 414 421 m_ConnectInfo.bmxNetLib.Encoder = System.Text.UTF8Encoding.UTF8; 415 422 } 416 //Set application context 423 424 //Set application context 425 // Call #3 426 setProgressDelegate(3); 417 427 setStatusDelegate("Setting Application Context to BSDXRPC..."); 418 428 m_ConnectInfo.AppContext = "BSDXRPC"; … … 424 434 string sCommandText; 425 435 436 //Schedule User Info 437 // Table #4 438 setProgressDelegate(4); 426 439 setStatusDelegate(statusConst + " Schedule User"); 427 //Schedule User Info428 440 DataTable dtUser = _dal.GetUserInfo(m_ConnectInfo.DUZ); 429 441 dtUser.TableName = "SchedulingUser"; … … 437 449 m_bSchedManager = (sUser == "YES") ? true : false; 438 450 451 //Get Access Types 452 // Table #5 453 setProgressDelegate(5); 439 454 setStatusDelegate(statusConst + " Access Types"); 440 //Get Access Types441 455 DataTable dtAccessTypes = _dal.GetAccessTypes(); 442 456 dtAccessTypes.TableName = "AccessTypes"; 443 457 m_dsGlobal.Tables.Add(dtAccessTypes); 444 458 459 //Get Access Groups 460 // Table #6 461 setProgressDelegate(6); 445 462 setStatusDelegate(statusConst + " Access Groups"); 446 //AccessGroups447 463 LoadAccessGroupsTable(); 448 464 … … 454 470 dtGroups.PrimaryKey = dcKeys; 455 471 472 //Get Access Group Types (??) 473 // Table #7 474 setProgressDelegate(7); 456 475 setStatusDelegate(statusConst + " Access Group Types"); 457 //AccessGroupType458 476 LoadAccessGroupTypesTable(); 459 477 … … 471 489 m_dsGlobal.Relations.Add(dr); 472 490 491 //ResourceGroup Table (Resource Groups by User) 492 // Table #8 493 setProgressDelegate(8); 473 494 setStatusDelegate(statusConst + " Resource Groups By User"); 474 //ResourceGroup Table (Resource Groups by User)475 495 LoadResourceGroupTable(); 476 496 497 //Resources by user 498 // Table #9 499 setProgressDelegate(9); 477 500 setStatusDelegate(statusConst + " Resources By User"); 478 //Resources by user479 501 LoadBSDXResourcesTable(); 480 502 … … 484 506 m_dsGlobal.Tables["Resources"].PrimaryKey = dc; 485 507 508 //GroupResources table 509 // Table #10 510 setProgressDelegate(10); 486 511 setStatusDelegate(statusConst + " Group Resources"); 487 //GroupResources table488 512 LoadGroupResourcesTable(); 489 513 … … 500 524 m_dsGlobal.Relations.Add(dr); 501 525 526 //HospitalLocation table 527 //Table #11 528 setProgressDelegate(11); 502 529 setStatusDelegate(statusConst + " Clinics"); 503 //HospitalLocation table504 530 //cmd.CommandText = "SELECT BMXIEN 'HOSPITAL_LOCATION_ID', NAME 'HOSPITAL_LOCATION', DEFAULT_PROVIDER, STOP_CODE_NUMBER, INACTIVATE_DATE, REACTIVATE_DATE FROM HOSPITAL_LOCATION"; 505 531 sCommandText = "BSDX HOSPITAL LOCATION"; … … 519 545 m_dsGlobal.Relations.Add(dr); 520 546 547 //Build ScheduleUser table 548 //Table #12 549 setProgressDelegate(12); 521 550 setStatusDelegate(statusConst + " Schedule User"); 522 //Build ScheduleUser table523 551 this.LoadScheduleUserTable(); 524 552 … … 529 557 m_dsGlobal.Tables["ScheduleUser"].PrimaryKey = dc; 530 558 559 //Build ResourceUser table 560 //Table #13 561 setProgressDelegate(13); 531 562 setStatusDelegate(statusConst + " Resource User"); 532 //Build ResourceUser table533 563 this.LoadResourceUserTable(); 534 564 … … 545 575 m_dsGlobal.Relations.Add(dr); 546 576 577 //Build active provider table 578 //Table #14 579 setProgressDelegate(14); 547 580 setStatusDelegate(statusConst + " Providers"); 548 //Build active provider table549 581 sCommandText = "SELECT BMXIEN, NAME FROM NEW_PERSON WHERE INACTIVE_DATE = '' AND BMXIEN > 1"; 550 582 ConnectInfo.RPMSDataTable(sCommandText, "Provider", m_dsGlobal); 551 583 Debug.Write("LoadGlobalRecordsets -- Provider loaded\n"); 552 584 585 //Build the CLINIC_STOP table 586 //Table #15 587 setProgressDelegate(15); 553 588 setStatusDelegate(statusConst + " Clinic Stops"); 554 //Build the CLINIC_STOP table555 589 // sCommandText = "SELECT BMXIEN, CODE, NAME FROM CLINIC_STOP"; //SMH 556 590 sCommandText = "SELECT BMXIEN, AMIS_REPORTING_STOP_CODE, NAME FROM CLINIC_STOP"; … … 558 592 Debug.Write("LoadGlobalRecordsets -- ClinicStop loaded\n"); 559 593 594 //Build the HOLIDAY table 595 //Table #16 596 setProgressDelegate(16); 560 597 setStatusDelegate(statusConst + " Holiday"); 561 //Build the HOLIDAY table562 598 sCommandText = "SELECT NAME, DATE FROM HOLIDAY WHERE DATE > '" + DateTime.Today.ToShortDateString() + "'"; 563 599 ConnectInfo.RPMSDataTable(sCommandText, "HOLIDAY", m_dsGlobal); … … 568 604 //m_dsGlobal.WriteXmlSchema(@"..\..\csSchema20060526.xsd"); 569 605 //---------------------------------------------- 570 571 606 607 setStatusDelegate("Setting Receive Timeout"); 572 608 _current.m_ConnectInfo.ReceiveTimeout = 30000; //30-second timeout 573 609 … … 575 611 _current.m_ConnectInfo.ReceiveTimeout = 600000; //longer timeout for debugging 576 612 #endif 577 _current.m_ConnectInfo.SubscribeEvent("BSDX SCHEDULE"); 578 _current.m_ConnectInfo.SubscribeEvent("BSDX CALL WORKSTATIONS"); 579 _current.m_ConnectInfo.SubscribeEvent("BSDX ADMIN MESSAGE"); 580 _current.m_ConnectInfo.SubscribeEvent("BSDX ADMIN SHUTDOWN"); 613 // Event Subsriptions 614 setStatusDelegate("Subscribing to Server Events"); 615 //Table #17 616 setProgressDelegate(17); 617 _current.m_ConnectInfo.SubscribeEvent("BSDX SCHEDULE"); 618 //Table #18 619 setProgressDelegate(18); 620 _current.m_ConnectInfo.SubscribeEvent("BSDX CALL WORKSTATIONS"); 621 //Table #19 622 setProgressDelegate(19); 623 _current.m_ConnectInfo.SubscribeEvent("BSDX ADMIN MESSAGE"); 624 //Table #20 625 setProgressDelegate(20); 626 _current.m_ConnectInfo.SubscribeEvent("BSDX ADMIN SHUTDOWN"); 581 627 582 628 _current.m_ConnectInfo.EventPollingInterval = 5000; //in milliseconds … … 586 632 //Close Splash Screen 587 633 closeSplashDelegate(); 634 635 return true; 588 636 589 637 } -
Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user
r1050 r1051 37 37 </RemoteDebugMachine> 38 38 <StartAction>Project</StartAction> 39 <StartArguments>/s=1 0.161.20.25 /p=9280 /a=s.habiel /v=catdog.55</StartArguments>39 <StartArguments>/s=192.168.56.101 /p=9260 /a=shabiel12 /v=catdog.66</StartArguments> 40 40 <StartPage> 41 41 </StartPage> -
Scheduling/trunk/cs/bsdx0200GUISourceCode/DSplash.cs
r1050 r1051 17 17 private Label lblVersion; 18 18 private Label label2; 19 private ProgressBar progressBar1; 19 20 /// <summary> 20 21 /// Required designer variable. … … 62 63 this.lblVersion = new System.Windows.Forms.Label(); 63 64 this.label2 = new System.Windows.Forms.Label(); 65 this.progressBar1 = new System.Windows.Forms.ProgressBar(); 64 66 this.SuspendLayout(); 65 67 // … … 110 112 this.label2.Text = "VISTA"; 111 113 // 114 // progressBar1 115 // 116 this.progressBar1.Location = new System.Drawing.Point(18, 207); 117 this.progressBar1.Name = "progressBar1"; 118 this.progressBar1.Size = new System.Drawing.Size(458, 14); 119 this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous; 120 this.progressBar1.TabIndex = 7; 121 // 112 122 // DSplash 113 123 // … … 116 126 this.ClientSize = new System.Drawing.Size(488, 252); 117 127 this.ControlBox = false; 128 this.Controls.Add(this.progressBar1); 118 129 this.Controls.Add(this.label2); 119 130 this.Controls.Add(this.lblVersion); … … 135 146 public delegate void dSetStatus(string sStatus); 136 147 public delegate void dAny(); 148 public delegate void dProgressBarSet(int number); 137 149 138 150 public void SetStatus(string sStatus) … … 145 157 } 146 158 147 System.Diagnostics.Debug.Assert(this.InvokeRequired == false);148 159 this.lblStatus.Text = sStatus; 149 this.Refresh();150 160 } 151 161 … … 166 176 this.Invoke(d); 167 177 } 178 179 public void RemoteProgressBarMaxSet(int max) 180 { 181 if (this.InvokeRequired == true) 182 { 183 dProgressBarSet d = new dProgressBarSet(RemoteProgressBarMaxSet); 184 this.Invoke(d, new object[] { max }); 185 return; 186 } 187 188 this.progressBar1.Maximum = max; 189 } 190 191 public void RemoteProgressBarValueSet(int val) 192 { 193 if (this.InvokeRequired == true) 194 { 195 dProgressBarSet d = new dProgressBarSet(RemoteProgressBarValueSet); 196 this.Invoke(d, new object[] { val }); 197 return; 198 } 199 200 this.progressBar1.Value = val; 201 } 202 168 203 } 169 204
Note:
See TracChangeset
for help on using the changeset viewer.