Changeset 1011 for Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAVView.cs
- Timestamp:
- Nov 18, 2010, 7:47:04 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAVView.cs
r917 r1011 68 68 this.mnuLoadTemplate = new System.Windows.Forms.MenuItem(); 69 69 this.mnuSaveTemplate = new System.Windows.Forms.MenuItem(); 70 this.mnuDeleteAllAppointments = new System.Windows.Forms.MenuItem(); 70 71 this.menuItem6 = new System.Windows.Forms.MenuItem(); 71 72 this.mnuSchedulingManagment = new System.Windows.Forms.MenuItem(); … … 90 91 this.mnuHelpAbout = new System.Windows.Forms.MenuItem(); 91 92 this.splitter1 = new System.Windows.Forms.Splitter(); 93 this.saveAccessBlocksWorker = new System.ComponentModel.BackgroundWorker(); 92 94 this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid(); 93 95 this.panelRight.SuspendLayout(); … … 104 106 this.panelRight.Location = new System.Drawing.Point(728, 0); 105 107 this.panelRight.Name = "panelRight"; 106 this.panelRight.Size = new System.Drawing.Size(120, 412);108 this.panelRight.Size = new System.Drawing.Size(120, 393); 107 109 this.panelRight.TabIndex = 1; 108 110 // … … 125 127 this.lstClip.Location = new System.Drawing.Point(0, 32); 126 128 this.lstClip.Name = "lstClip"; 127 this.lstClip.Size = new System.Drawing.Size(120, 4 07);129 this.lstClip.Size = new System.Drawing.Size(120, 416); 128 130 this.lstClip.TabIndex = 0; 129 131 this.lstClip.DragDrop += new System.Windows.Forms.DragEventHandler(this.lstClip_DragDrop); 132 this.lstClip.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstClip_DragEnter); 133 this.lstClip.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseDown); 130 134 this.lstClip.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseMove); 131 this.lstClip.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseDown);132 this.lstClip.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstClip_DragEnter);133 135 // 134 136 // ctxApptClipMenu … … 165 167 this.panelBottom.Controls.Add(this.statusBar1); 166 168 this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; 167 this.panelBottom.Location = new System.Drawing.Point(8, 3 88);169 this.panelBottom.Location = new System.Drawing.Point(8, 369); 168 170 this.panelBottom.Name = "panelBottom"; 169 171 this.panelBottom.Size = new System.Drawing.Size(720, 24); … … 217 219 this.panelCenter.Location = new System.Drawing.Point(8, 24); 218 220 this.panelCenter.Name = "panelCenter"; 219 this.panelCenter.Size = new System.Drawing.Size(712, 3 64);221 this.panelCenter.Size = new System.Drawing.Size(712, 345); 220 222 this.panelCenter.TabIndex = 4; 221 223 // … … 253 255 this.tvSchedules.Location = new System.Drawing.Point(0, 0); 254 256 this.tvSchedules.Name = "tvSchedules"; 255 this.tvSchedules.Size = new System.Drawing.Size(8, 412);257 this.tvSchedules.Size = new System.Drawing.Size(8, 393); 256 258 this.tvSchedules.Sorted = true; 257 259 this.tvSchedules.TabIndex = 5; … … 271 273 this.mnuLoadTemplate, 272 274 this.mnuSaveTemplate, 275 this.mnuDeleteAllAppointments, 273 276 this.menuItem6, 274 277 this.mnuSchedulingManagment, … … 291 294 this.mnuSaveTemplate.Click += new System.EventHandler(this.mnuSaveTemplate_Click); 292 295 // 296 // mnuDeleteAllAppointments 297 // 298 this.mnuDeleteAllAppointments.Enabled = false; 299 this.mnuDeleteAllAppointments.Index = 2; 300 this.mnuDeleteAllAppointments.Shortcut = System.Windows.Forms.Shortcut.CtrlD; 301 this.mnuDeleteAllAppointments.Text = "&Delete All Appointments"; 302 this.mnuDeleteAllAppointments.Click += new System.EventHandler(this.mnuDeleteAllAppointments_Click); 303 // 293 304 // menuItem6 294 305 // 295 this.menuItem6.Index = 2;306 this.menuItem6.Index = 3; 296 307 this.menuItem6.Text = "-"; 297 308 // 298 309 // mnuSchedulingManagment 299 310 // 300 this.mnuSchedulingManagment.Index = 3;311 this.mnuSchedulingManagment.Index = 4; 301 312 this.mnuSchedulingManagment.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftM; 302 313 this.mnuSchedulingManagment.Text = "Scheduling &Management"; … … 305 316 // menuItem5 306 317 // 307 this.menuItem5.Index = 4;318 this.menuItem5.Index = 5; 308 319 this.menuItem5.Text = "-"; 309 320 // 310 321 // mnuClose 311 322 // 312 this.mnuClose.Index = 5;323 this.mnuClose.Index = 6; 313 324 this.mnuClose.Shortcut = System.Windows.Forms.Shortcut.CtrlW; 314 325 this.mnuClose.Text = "&Close"; … … 446 457 this.splitter1.Location = new System.Drawing.Point(720, 24); 447 458 this.splitter1.Name = "splitter1"; 448 this.splitter1.Size = new System.Drawing.Size(8, 3 64);459 this.splitter1.Size = new System.Drawing.Size(8, 345); 449 460 this.splitter1.TabIndex = 6; 450 461 this.splitter1.TabStop = false; 462 // 463 // saveAccessBlocksWorker 464 // 465 this.saveAccessBlocksWorker.WorkerReportsProgress = true; 466 this.saveAccessBlocksWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.saveAccessBlocksWorker_DoWork); 467 this.saveAccessBlocksWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.saveAccessBlocksWorker_ProgressChanged); 468 this.saveAccessBlocksWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.saveAccessBlocksWorker_RunWorkerCompleted); 451 469 // 452 470 // calendarGrid1 … … 469 487 this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources"))); 470 488 this.calendarGrid1.SelectedAppointment = 0; 471 this.calendarGrid1.Size = new System.Drawing.Size(712, 3 64);489 this.calendarGrid1.Size = new System.Drawing.Size(712, 345); 472 490 this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); 473 491 this.calendarGrid1.TabIndex = 2; 474 492 this.calendarGrid1.TimeScale = 20; 493 this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); 494 this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); 495 this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); 475 496 this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick); 476 this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged);477 this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged);478 this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);479 497 // 480 498 // CGAVView 481 499 // 482 500 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 483 this.ClientSize = new System.Drawing.Size(848, 412);501 this.ClientSize = new System.Drawing.Size(848, 393); 484 502 this.Controls.Add(this.panelCenter); 485 503 this.Controls.Add(this.splitter1); … … 492 510 this.Name = "CGAVView"; 493 511 this.Text = "CGAVView"; 512 this.Closing += new System.ComponentModel.CancelEventHandler(this.CGAVView_Closing); 494 513 this.Load += new System.EventHandler(this.CGAVView_Load); 495 this.Closing += new System.ComponentModel.CancelEventHandler(this.CGAVView_Closing);496 514 this.panelRight.ResumeLayout(false); 497 515 this.panelClip.ResumeLayout(false); … … 556 574 private System.Windows.Forms.MenuItem ctxCalGridEdit; 557 575 private System.Windows.Forms.MenuItem ctxCalGridDelete; 576 private BackgroundWorker saveAccessBlocksWorker; 577 private MenuItem mnuDeleteAllAppointments; 558 578 private bool m_bDragDropStart = false; 559 579 … … 749 769 }//End AvailabilityAddNew 750 770 771 private void MassAppointmentDelete() 772 { 773 DialogResult msgResult = MessageBox.Show("Delete all Access Slots?", "Delete Slots?",MessageBoxButtons.YesNo); 774 if (msgResult != DialogResult.Yes) return; 775 776 CGAppointments appointments = new CGAppointments(); 777 appointments = this.Document.AVBlocks; 778 779 foreach (CGAppointment a in appointments.AppointmentTable.Values) 780 { 781 int nApptID = a.AppointmentKey; 782 Debug.Assert(nApptID != 0); 783 try 784 { 785 Document.DeleteAvailability(nApptID); 786 } 787 catch (Exception ex) 788 { 789 MessageBox.Show("Unable to delete access block" + ex.Message, "Clinical Scheduling"); 790 } 791 792 } 793 794 this.m_DocManager.UpdateViews((string)this.m_Document.Resources[0], ""); 795 RaiseRPMSEvent("BSDX SCHEDULE", m_Document.DocName); 796 this.calendarGrid1.Invalidate(); 797 } 798 751 799 private void AppointmentDelete() 752 800 { … … 756 804 sMsg = " these access blocks?"; 757 805 758 if (MessageBox.Show("Are you sure you want to delete" + sMsg, "Clinical Scheduling", MessageBoxButtons.YesNo) != DialogResult.Yes)759 {760 calendarGrid1.CGToolTip.Active = true;761 return;762 }763 806 calendarGrid1.CGToolTip.Active = true; 764 807 … … 907 950 { 908 951 // this.DocManager.EnableAutoRefresh(false); 909 910 if (MessageBox.Show("Are you sure you want to move this access block?", "Clinical Scheduling", MessageBoxButtons.YesNo) != DialogResult.Yes)911 return;912 952 913 953 m_Document.ChangeAppointmentTime(e.Appointment, e.StartTime, e.EndTime, e.Resource); … … 1010 1050 try 1011 1051 { 1012 OpenFileDialog openFileDialog1 = dlg.FileDialog; 1013 Stream streamFile; 1014 if((streamFile = openFileDialog1.OpenFile())== null) 1015 { 1016 MessageBox.Show("Unable to open template file."); 1017 return; 1018 } 1019 1020 BinaryFormatter formatter = new BinaryFormatter(); 1021 CGAppointments cgaTemp = (CGAppointments) formatter.Deserialize(streamFile); 1022 streamFile.Close(); 1023 1024 DateTime dtStart = dlg.StartDate; 1025 DateTime newStartDate, newEndDate; 1026 this.Document.WeekNeedsRefresh(1,dtStart, out newStartDate, out newEndDate); 1027 dtStart = newStartDate; 1028 int nWeeksToApply = dlg.WeeksToApply; 1029 DateTime dtEnd = dtStart.AddDays(6); // or 7? 1030 1031 string sResourceID = this.m_Document.ResourceID.ToString(); 1032 DataTable dt; 1033 1034 for (int j=1; j < nWeeksToApply + 1; j++) 1035 { 1036 //Convert start and end to string 1037 //string sStart = dtStart.ToString("M/d/yyyy"); 1038 //string sEnd = dtEnd.ToString("M/d/yyyy"); 1039 //i18n 1040 string sStart = FMDateTime.Create(dtStart).DateOnly.FMDateString; 1041 string sEnd = FMDateTime.Create(dtEnd).DateOnly.FMDateString; 1042 //Cancel all existing access blocks in the date range 1043 string sSql = "BSDX CANCEL AV BY DATE^" + sResourceID + "^" + sStart + "^" + sEnd; 1044 dt = this.m_DocManager.RPMSDataTable(sSql, "Cancelled"); 1045 1046 //for each CGAppointment in AVBlocks, call AddNew 1047 string sResource = ""; 1048 sResource = (string) this.Document.Resources[0]; 1049 foreach (CGAppointment a in cgaTemp.AppointmentTable.Values) 1050 { 1051 //Change the resource to the current one 1052 a.Resource = sResource; 1053 1054 //Change the date to correspond to the GridColumn member 1055 int col = a.GridColumn; 1056 col--; 1057 DateTime dBuildDate = dtStart.Date; 1058 dBuildDate = dBuildDate.AddDays(col); 1059 dBuildDate = dBuildDate.AddHours(a.StartTime.Hour); 1060 dBuildDate = dBuildDate.AddMinutes(a.StartTime.Minute); 1061 a.StartTime = dBuildDate; 1062 dBuildDate = dtStart.Date; 1063 dBuildDate = dBuildDate.AddDays(col); 1064 dBuildDate = dBuildDate.AddHours(a.EndTime.Hour); 1065 dBuildDate = dBuildDate.AddMinutes(a.EndTime.Minute); 1066 a.EndTime = dBuildDate; 1067 1068 //Call Document to add a new appointment 1069 this.Document.CreateAppointmentAuto(a); 1070 } 1071 1072 //Increment start and end 1073 dtStart = dtStart.AddDays(7); 1074 dtEnd = dtStart.AddDays(6); 1075 1076 }//end for 1052 this.saveAccessBlocksWorker.RunWorkerAsync(dlg); 1053 //OpenFileDialog openFileDialog1 = dlg.FileDialog; 1054 //openFileDialog1.RestoreDirectory = false; // go back to our dir 1055 //Stream streamFile; 1056 //if((streamFile = openFileDialog1.OpenFile())== null) 1057 //{ 1058 // MessageBox.Show("Unable to open template file."); 1059 // return; 1060 //} 1061 1062 //BinaryFormatter formatter = new BinaryFormatter(); 1063 //CGAppointments cgaTemp = (CGAppointments) formatter.Deserialize(streamFile); 1064 //streamFile.Close(); 1065 1066 //DateTime dtStart = dlg.StartDate; 1067 //DateTime newStartDate, newEndDate; 1068 //this.Document.WeekNeedsRefresh(1,dtStart, out newStartDate, out newEndDate); 1069 //dtStart = newStartDate; 1070 //int nWeeksToApply = dlg.WeeksToApply; 1071 //DateTime dtEnd = dtStart.AddDays(6); // or 7? 1072 1073 //string sResourceID = this.m_Document.ResourceID.ToString(); 1074 //DataTable dt; 1075 1076 //for (int j=1; j < nWeeksToApply + 1; j++) 1077 //{ 1078 // //Convert start and end to string 1079 // //string sStart = dtStart.ToString("M/d/yyyy"); 1080 // //string sEnd = dtEnd.ToString("M/d/yyyy"); 1081 // //i18n 1082 // string sStart = FMDateTime.Create(dtStart).DateOnly.FMDateString; 1083 // string sEnd = FMDateTime.Create(dtEnd).DateOnly.FMDateString; 1084 // //Cancel all existing access blocks in the date range 1085 // string sSql = "BSDX CANCEL AV BY DATE^" + sResourceID + "^" + sStart + "^" + sEnd; 1086 // dt = this.m_DocManager.RPMSDataTable(sSql, "Cancelled"); 1087 1088 // //for each CGAppointment in AVBlocks, call AddNew 1089 // string sResource = ""; 1090 // sResource = (string) this.Document.Resources[0]; 1091 // foreach (CGAppointment a in cgaTemp.AppointmentTable.Values) 1092 // { 1093 // //Change the resource to the current one 1094 // a.Resource = sResource; 1095 1096 // //Change the date to correspond to the GridColumn member 1097 // int col = a.GridColumn; 1098 // col--; 1099 // DateTime dBuildDate = dtStart.Date; 1100 // dBuildDate = dBuildDate.AddDays(col); 1101 // dBuildDate = dBuildDate.AddHours(a.StartTime.Hour); 1102 // dBuildDate = dBuildDate.AddMinutes(a.StartTime.Minute); 1103 // a.StartTime = dBuildDate; 1104 // dBuildDate = dtStart.Date; 1105 // dBuildDate = dBuildDate.AddDays(col); 1106 // dBuildDate = dBuildDate.AddHours(a.EndTime.Hour); 1107 // dBuildDate = dBuildDate.AddMinutes(a.EndTime.Minute); 1108 // a.EndTime = dBuildDate; 1109 1110 // //Call Document to add a new appointment 1111 // this.Document.CreateAppointmentAuto(a); 1112 // } 1113 1114 // //Increment start and end 1115 // dtStart = dtStart.AddDays(7); 1116 // dtEnd = dtStart.AddDays(6); 1117 1118 // }//end for 1077 1119 try 1078 1120 { … … 1424 1466 cg.Invalidate(); 1425 1467 } 1468 1469 1470 1471 private void saveAccessBlocksWorker_DoWork(object sender, DoWorkEventArgs e) 1472 { 1473 BackgroundWorker worker = (BackgroundWorker)sender; 1474 DAccessTemplate dlg = (DAccessTemplate)e.Argument; 1475 1476 OpenFileDialog openFileDialog1 = dlg.FileDialog; 1477 openFileDialog1.RestoreDirectory = false; // go back to our dir 1478 Stream streamFile; 1479 if ((streamFile = openFileDialog1.OpenFile()) == null) 1480 { 1481 MessageBox.Show("Unable to open template file."); 1482 return; 1483 } 1484 1485 BinaryFormatter formatter = new BinaryFormatter(); 1486 CGAppointments cgaTemp = (CGAppointments)formatter.Deserialize(streamFile); 1487 streamFile.Close(); 1488 1489 DateTime dtStart = dlg.StartDate; 1490 DateTime newStartDate, newEndDate; 1491 this.Document.WeekNeedsRefresh(1, dtStart, out newStartDate, out newEndDate); 1492 dtStart = newStartDate; 1493 int nWeeksToApply = dlg.WeeksToApply; 1494 DateTime dtEnd = dtStart.AddDays(6); // or 7? 1495 1496 string sResourceID = this.m_Document.ResourceID.ToString(); 1497 DataTable dt; 1498 1499 for (int j = 1; j < nWeeksToApply + 1; j++) 1500 { 1501 float fProgressPercentage = ((float)j / (float)nWeeksToApply) * 100; 1502 int iProgressPercentage = (int)fProgressPercentage; 1503 worker.ReportProgress(iProgressPercentage); 1504 //Convert start and end to string 1505 //string sStart = dtStart.ToString("M/d/yyyy"); 1506 //string sEnd = dtEnd.ToString("M/d/yyyy"); 1507 //i18n 1508 string sStart = FMDateTime.Create(dtStart).DateOnly.FMDateString; 1509 string sEnd = FMDateTime.Create(dtEnd).DateOnly.FMDateString; 1510 //Cancel all existing access blocks in the date range 1511 string sSql = "BSDX CANCEL AV BY DATE^" + sResourceID + "^" + sStart + "^" + sEnd; 1512 CGDocumentManager.RPMSDataTableDelegate d = new CGDocumentManager.RPMSDataTableDelegate(m_DocManager.RPMSDataTable); 1513 //dt = this.m_DocManager.RPMSDataTable(sSql, "Cancelled"); 1514 dt = d(sSql, "Cancelled"); 1515 //for each CGAppointment in AVBlocks, call AddNew 1516 string sResource = ""; 1517 sResource = (string)this.Document.Resources[0]; 1518 foreach (CGAppointment a in cgaTemp.AppointmentTable.Values) 1519 { 1520 //Change the resource to the current one 1521 a.Resource = sResource; 1522 1523 //Change the date to correspond to the GridColumn member 1524 int col = a.GridColumn; 1525 col--; 1526 DateTime dBuildDate = dtStart.Date; 1527 dBuildDate = dBuildDate.AddDays(col); 1528 dBuildDate = dBuildDate.AddHours(a.StartTime.Hour); 1529 dBuildDate = dBuildDate.AddMinutes(a.StartTime.Minute); 1530 a.StartTime = dBuildDate; 1531 dBuildDate = dtStart.Date; 1532 dBuildDate = dBuildDate.AddDays(col); 1533 dBuildDate = dBuildDate.AddHours(a.EndTime.Hour); 1534 dBuildDate = dBuildDate.AddMinutes(a.EndTime.Minute); 1535 a.EndTime = dBuildDate; 1536 1537 //Call Document to add a new appointment 1538 this.Document.CreateAppointmentAuto(a); 1539 } 1540 1541 //Increment start and end 1542 dtStart = dtStart.AddDays(7); 1543 dtEnd = dtStart.AddDays(6); 1544 1545 } 1546 1547 } 1548 1549 private void saveAccessBlocksWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) 1550 { 1551 this.statusBar1.Text = "Done saving access blocks."; 1552 } 1553 1554 private void saveAccessBlocksWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) 1555 { 1556 this.statusBar1.Text = "Saving Data to VISTA. Progress: " + e.ProgressPercentage + " %"; 1557 } 1558 1559 private void mnuDeleteAllAppointments_Click(object sender, EventArgs e) 1560 { 1561 MassAppointmentDelete(); 1562 } 1426 1563 } 1427 1564 }
Note:
See TracChangeset
for help on using the changeset viewer.