Changeset 1097 for Scheduling
- Timestamp:
- Mar 3, 2011, 4:44:18 AM (14 years ago)
- Location:
- Scheduling/trunk/cs/bsdx0200GUISourceCode
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAVDocument.cs
r1095 r1097 169 169 DateTime sStart2 = a.StartTime; 170 170 DateTime sEnd2 = a.EndTime; 171 if ((a.AppointmentKey != pAppt.AppointmentKey) && (C GSchedLib.TimesOverlap(dNewStart, dNewEnd, a.StartTime, a.EndTime)))171 if ((a.AppointmentKey != pAppt.AppointmentKey) && (CalendarGrid.TimesOverlap(dNewStart, dNewEnd, a.StartTime, a.EndTime))) 172 172 { 173 173 MessageBox.Show("Access blocks may not overlap.","Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); … … 298 298 DateTime sStart2 = a.StartTime; 299 299 DateTime sEnd2 = a.EndTime; 300 if (C GSchedLib.TimesOverlap(aCopy.StartTime, aCopy.EndTime, a.StartTime, a.EndTime))300 if (CalendarGrid.TimesOverlap(aCopy.StartTime, aCopy.EndTime, a.StartTime, a.EndTime)) 301 301 { 302 302 // throw new Exception("Access blocks may not overlap."); … … 374 374 ArrayList apptTypeIDs = new ArrayList(); 375 375 376 rAppointmentSchedule = CGSchedLib.CreateA ssignedSlotSchedule(m_DocManager, (string) m_sResourcesArray[0], this.m_dStartDate, this.m_dEndDate, apptTypeIDs,/* */ this.m_ScheduleType, "0");376 rAppointmentSchedule = CGSchedLib.CreateAvailabilitySchedule(m_DocManager, m_sResourcesArray, this.m_dStartDate, this.m_dEndDate, apptTypeIDs,/* */ this.m_ScheduleType, "0"); 377 377 378 378 foreach (DataRow r in rAppointmentSchedule.Rows) -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAVView.cs
r1068 r1097 106 106 this.panelRight.Location = new System.Drawing.Point(728, 0); 107 107 this.panelRight.Name = "panelRight"; 108 this.panelRight.Size = new System.Drawing.Size(120, 3 64);108 this.panelRight.Size = new System.Drawing.Size(120, 343); 109 109 this.panelRight.TabIndex = 1; 110 110 // … … 167 167 this.panelBottom.Controls.Add(this.statusBar1); 168 168 this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; 169 this.panelBottom.Location = new System.Drawing.Point(8, 3 40);169 this.panelBottom.Location = new System.Drawing.Point(8, 319); 170 170 this.panelBottom.Name = "panelBottom"; 171 171 this.panelBottom.Size = new System.Drawing.Size(720, 24); … … 195 195 this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right; 196 196 this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right; 197 this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short; 198 this.dateTimePicker1.Location = new System.Drawing.Point(592, 0); 197 this.dateTimePicker1.Location = new System.Drawing.Point(517, 0); 199 198 this.dateTimePicker1.Name = "dateTimePicker1"; 200 this.dateTimePicker1.Size = new System.Drawing.Size( 128, 20);199 this.dateTimePicker1.Size = new System.Drawing.Size(203, 20); 201 200 this.dateTimePicker1.TabIndex = 4; 202 201 this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged); … … 219 218 this.panelCenter.Location = new System.Drawing.Point(8, 24); 220 219 this.panelCenter.Name = "panelCenter"; 221 this.panelCenter.Size = new System.Drawing.Size(712, 316);220 this.panelCenter.Size = new System.Drawing.Size(712, 295); 222 221 this.panelCenter.TabIndex = 4; 223 222 // … … 255 254 this.tvSchedules.Location = new System.Drawing.Point(0, 0); 256 255 this.tvSchedules.Name = "tvSchedules"; 257 this.tvSchedules.Size = new System.Drawing.Size(8, 3 64);256 this.tvSchedules.Size = new System.Drawing.Size(8, 343); 258 257 this.tvSchedules.Sorted = true; 259 258 this.tvSchedules.TabIndex = 5; … … 456 455 this.splitter1.Location = new System.Drawing.Point(720, 24); 457 456 this.splitter1.Name = "splitter1"; 458 this.splitter1.Size = new System.Drawing.Size(8, 316);457 this.splitter1.Size = new System.Drawing.Size(8, 295); 459 458 this.splitter1.TabIndex = 6; 460 459 this.splitter1.TabStop = false; … … 486 485 this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources"))); 487 486 this.calendarGrid1.SelectedAppointment = 0; 488 this.calendarGrid1.Size = new System.Drawing.Size(712, 316);487 this.calendarGrid1.Size = new System.Drawing.Size(712, 295); 489 488 this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); 490 489 this.calendarGrid1.TabIndex = 2; 491 490 this.calendarGrid1.TimeScale = 20; 492 this.calendarGrid1.CGAppointment Added += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);493 this.calendarGrid1.CGAppointment Changed += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged);494 this.calendarGrid1.CGSelectionChanged += new CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged);491 this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); 492 this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); 493 this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); 495 494 this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick); 496 495 // … … 498 497 // 499 498 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 500 this.ClientSize = new System.Drawing.Size(848, 3 64);499 this.ClientSize = new System.Drawing.Size(848, 343); 501 500 this.Controls.Add(this.panelCenter); 502 501 this.Controls.Add(this.splitter1); … … 727 726 DateTime sStart2 = a.StartTime; 728 727 DateTime sEnd2 = a.EndTime; 729 if (C GSchedLib.TimesOverlap(dStart, dEnd, a.StartTime, a.EndTime))728 if (CalendarGrid.TimesOverlap(dStart, dEnd, a.StartTime, a.EndTime)) 730 729 { 731 730 MessageBox.Show("Access blocks may not overlap.","Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAVView.resx
r1011 r1097 113 113 </resheader> 114 114 <resheader name="reader"> 115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 116 116 </resheader> 117 117 <resheader name="writer"> 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="ctxApptClipMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">120 <metadata name="ctxApptClipMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 121 <value>17, 17</value> 122 122 </metadata> 123 <metadata name="ctxCalendarGrid.TrayLocation" type="System.Drawing.Point, System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">123 <metadata name="ctxCalendarGrid.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 124 <value>151, 17</value> 125 125 </metadata> … … 130 130 </value> 131 131 </data> 132 <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">132 <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 133 133 <value>281, 17</value> 134 134 </metadata> 135 <metadata name="saveAccessBlocksWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">135 <metadata name="saveAccessBlocksWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 136 136 <value>398, 17</value> 137 137 </metadata> 138 <assembly alias="System.Drawing" name="System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />138 <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 139 139 <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 140 140 <value> -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs
r1095 r1097 7 7 using System.Windows.Forms; 8 8 using IndianHealthService.BMXNet; 9 using System.Linq; 9 10 10 11 namespace IndianHealthService.ClinicalScheduling … … 627 628 } 628 629 630 /// <summary> 631 /// Gets number of slots left in a certain selection on the grid. Used in Multiple Places. 632 /// </summary> 633 /// <param name="dSelStart">Selection Start Date</param> 634 /// <param name="dSelEnd">Selection End Date</param> 635 /// <param name="sResource">Resource Name</param> 636 /// <param name="sAccessType">Out: Name of Access Type</param> 637 /// <param name="sAvailabilityMessage">Out: Access Note</param> 638 /// <returns>Number of slots</returns> 629 639 public int SlotsAvailable(DateTime dSelStart, DateTime dSelEnd, string sResource, out string sAccessType, out string sAvailabilityMessage) 630 640 { 641 642 643 sAccessType = ""; //default out value 644 sAvailabilityMessage = ""; //default out value 645 646 double slotsAvailable = 0; //defalut return value 647 648 //NOTE: What's this lock? This lock makes sure that nobody is editing the availability array 649 //when we are looking at it. Since the availability array could potentially be updated on 650 //a different thread, we are can be potentially left stuck with an empty array. 651 // 652 //The other place that uses this lock is the RefershAvailabilitySchedule method 653 // 654 //This is a temporary fix until I figure out how to divorce the availbilities here from those drawn 655 //on the calendar. Appointments are cloned b/c they are in an object that supports that; and b/c I 656 //don't need to suddenly query them at runtime like I do with Availabilities. 657 658 //Let's Try Linq 659 lock (this.m_pAvArray) 660 { 661 //This foreach loop looks for an availability that overlaps where the user clicked. 662 //There can only be one, as availabilites cannot overlap each other (enforced at the DB level) 663 //If selection hits multiple blocks, get the block with the most slots (reflected by the sorting here) 664 CGAvailability[] pAVs = (from pAV in this.m_pAvArray.Cast<CGAvailability>() 665 where (sResource == pAV.ResourceList && CalendarGrid.TimesOverlap(dSelStart, dSelEnd, pAV.StartTime, pAV.EndTime)) 666 orderby pAV.Slots descending 667 select pAV) 668 .ToArray<CGAvailability>(); 669 670 if ((pAVs.Length) == 0) return 0; 671 672 slotsAvailable = pAVs[0].Slots; 673 sAccessType = pAVs[0].AccessTypeName; 674 sAvailabilityMessage = pAVs[0].Note; 675 676 //Subtract total slots current appointments take up. 677 slotsAvailable -= (from appt in this.Appointments.AppointmentTable.Values.Cast<CGAppointment>() 678 //If the resource is the same and the user selection overlaps, then... 679 where (sResource == appt.Resource && CalendarGrid.TimesOverlap(pAVs[0].StartTime, pAVs[0].EndTime, appt.StartTime, appt.EndTime)) 680 // if appt starttime is before avail start time, only count against the avail starting from the availability start time 681 let startTimeToCountAgainstBlock = appt.StartTime < pAVs[0].StartTime ? pAVs[0].StartTime : appt.StartTime 682 // if appt endtime is after the avail ends, only count against the avail up to where the avail ends 683 let endTimeToCountAgainstBlock = appt.EndTime > pAVs[0].EndTime ? pAVs[0].EndTime : appt.EndTime 684 // theoretical minutes per slot for the availability 685 let minPerSlot = (pAVs[0].EndTime - pAVs[0].StartTime).TotalMinutes / pAVs[0].Slots 686 // how many minutes does this appointment take away from the slot 687 let minPerAppt = (endTimeToCountAgainstBlock - startTimeToCountAgainstBlock).TotalMinutes 688 // how many slots the appointment takes up using this availability's scale 689 let slotsConsumed = minPerAppt / minPerSlot 690 select slotsConsumed) 691 // add up SlotsConsumed to substract from slotsAvailable 692 .Sum(); 693 } 694 695 return (int)slotsAvailable; 696 697 /* OLD ALGOTHRIM 2 698 699 lock (this.m_pAvArray) 700 { 701 //This foreach loop looks for an availability that overlaps where the user clicked. 702 //There can only be one, as availabilites cannot overlap each other (enforced at the DB level) 703 //Therefore, we loop, and once we find it, we break. 704 foreach (CGAvailability pAV in this.m_pAvArray) 705 { 706 //If the resource is the same and the user selection overlaps, then... 707 if (sResource == pAV.ResourceList && CalendarGrid.TimesOverlap(dSelStart, dSelEnd, pAV.StartTime, pAV.EndTime)) 708 { 709 slotsAvailable = pAV.Slots; //variable now holds the total number of slots 710 sAccessType = pAV.AccessTypeName; //Access Name 711 sAvailabilityMessage = pAV.Note; //Access Block Note 712 713 //Here we substract each appointment weight in slots from slotsAvailable 714 foreach (DictionaryEntry apptDict in this.m_appointments.AppointmentTable) 715 { 716 CGAppointment appt = (CGAppointment)apptDict.Value; 717 //If the appointment is in the same resource and overlaps with this availablity 718 if (sResource == appt.Resource && CalendarGrid.TimesOverlap(pAV.StartTime, pAV.EndTime, appt.StartTime, appt.EndTime)) 719 { 720 // if appt starttime is before avail start time, only count against the avail starting from the availability start time 721 DateTime startTimeToCountAgainstBlock = appt.StartTime < pAV.StartTime ? pAV.StartTime : appt.StartTime; 722 // if appt endtime is after the avail ends, only count against the avail up to where the avail ends 723 DateTime endTimeToCountAgainstBlock = appt.EndTime > pAV.EndTime ? pAV.EndTime : appt.EndTime; 724 // theoretical minutes per slot for the availability 725 double minPerSlot = (pAV.EndTime - pAV.StartTime).TotalMinutes/pAV.Slots; 726 // how many minutes does this appointment take away from the slot 727 double minPerAppt = (endTimeToCountAgainstBlock - startTimeToCountAgainstBlock).TotalMinutes; 728 // how many slots the appointment takes up using this availability's scale 729 double slotsConsumed = minPerAppt / minPerSlot; 730 // subscract that from the total slots for the availability 731 slotsAvailable -= slotsConsumed; 732 } //end if 733 //now go to the next appointment in foreach 734 } 735 // As I said above, we can match only one availability. Once we found it and substracted from it; we are done. 736 break; 737 } 738 } 739 // We return the integer portion of the variable for display to the user or for calculations. 740 // That means, if 2.11 slots are left, the user sees 2. If 2.66, still 2. 741 return (int)slotsAvailable; 742 } 743 */ 744 745 /* ORIGINAL ALGORITHM 631 746 sAccessType = ""; 632 747 sAvailabilityMessage = ""; … … 695 810 } 696 811 return nAvailableSlots; 812 */ 697 813 } 698 814 -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGSchedLib.cs
r1095 r1097 1 1 using System; 2 2 using System.Data; 3 //using System.Data.OleDb;4 3 using System.Collections; 5 4 using System.Diagnostics; 6 5 using System.Drawing; 7 using IndianHealthService.BMXNet;8 6 9 7 namespace IndianHealthService.ClinicalScheduling … … 24 22 /// Gets appointments from VISTA to display in Grid 25 23 /// </summary> 26 /// <param name="docManager"> </param>27 /// <param name="saryResNames"> </param>28 /// <param name="StartTime"> </param>29 /// <param name="EndTime"> </param>24 /// <param name="docManager">God Class</param> 25 /// <param name="saryResNames">Resource Names Array</param> 26 /// <param name="StartTime">Self Explanatory</param> 27 /// <param name="EndTime">Self Explanatory</param> 30 28 /// <returns></returns> 31 29 public static DataTable CreateAppointmentSchedule(CGDocumentManager docManager, ArrayList saryResNames, DateTime StartTime, DateTime EndTime) 32 30 { 33 string sResName = ""; 34 for (int i = 0; i < saryResNames.Count; i++) 35 { 36 sResName += saryResNames[i]; 37 if ((i+1) < saryResNames.Count) 38 sResName += "|"; 39 } 40 41 31 string sResName = string.Join("|", saryResNames.ToArray()); 42 32 string sStart = FMDateTime.Create(StartTime).DateOnly.FMDateString; 43 33 string sEnd = FMDateTime.Create(EndTime).FMDateString; … … 45 35 DataTable dtRet = docManager.RPMSDataTable(sSql, "AppointmentSchedule"); 46 36 return dtRet; 47 48 37 } 49 38 … … 57 46 /// <param name="EndTime">Self-Explanatory</param> 58 47 /// <param name="saryApptTypes">Array of Access Type IDs</param> 59 /// <param name="stType"> </param>60 /// <param name="sSearchInfo"> </param>48 /// <param name="stType">Not used</param> 49 /// <param name="sSearchInfo">Specific Search Parameters</param> 61 50 /// <returns></returns> 62 public static DataTable CreateAvailabilitySchedule(CGDocumentManager docManager, 63 ArrayList saryResourceNames, DateTime StartTime, DateTime EndTime, 64 ArrayList saryApptTypes,/**/ ScheduleType stType, string sSearchInfo) 65 { 66 DataTable rsOut; 67 rsOut = new DataTable("AvailabilitySchedule"); 68 69 DataTable rsSlotSchedule; 70 DataTable rsApptSchedule; 71 DataTable rsTemp1; 72 73 int nSize = saryResourceNames.Count; 74 if (nSize == 0) 75 { 76 return rsOut; 77 } 78 79 string sResName; 51 public static DataTable CreateAvailabilitySchedule(CGDocumentManager docManager, 52 ArrayList saryResourceNames, DateTime StartTime, DateTime EndTime, 53 ArrayList saryApptTypes,/**/ ScheduleType stType, string sSearchInfo) 54 { 55 DataTable rsOut = new DataTable("AvailabilitySchedule"); 56 if (saryResourceNames.Count == 0) return rsOut; 57 string sResNames = string.Join("|", saryResourceNames.ToArray()); 58 string sApptTypeIDs = string.Join("|", saryApptTypes.ToArray()); 59 string sStart = FMDateTime.Create(StartTime).DateOnly.FMDateString; 60 string sEnd = FMDateTime.Create(EndTime).FMDateString; 61 string sSql = "BSDX CREATE ASGND SLOT SCHED^" + sResNames + "^" + sStart + "^" + sEnd + "^" + sApptTypeIDs + "^" + sSearchInfo; //+ "^" + sSTType ; 62 rsOut = docManager.RPMSDataTable(sSql, "AssignedSlotSchedule"); 63 64 return rsOut; 65 } 66 67 /*NOT USED ANYMORE 80 68 //TODO: Optimize: no need to keep looping through resources. 81 69 // for each resource … … 84 72 sResName = saryResourceNames[i].ToString(); 85 73 //Gets all the slots (or Availabities, or AV Blocks if you like) 86 rsSlotSchedule = CGSchedLib.CreateAssignedSlotSchedule(docManager, sResName, StartTime, EndTime, saryApptTypes,/**/ stType, sSearchInfo); 87 74 rsSlotSchedule = CGSchedLib.CreateAssignedSlotSchedule(docManager, sResName, StartTime, EndTime, saryApptTypes, stType, sSearchInfo); 75 rsTemp1 = rsSlotSchedule; 76 88 77 //if we have slots 89 90 78 if (rsSlotSchedule.Rows.Count > 0 ) 79 { 91 80 // Get appointment count to substract from the slots 92 81 rsApptSchedule = CGSchedLib.CreateAppointmentSlotSchedule(docManager, sResName, StartTime, EndTime, stType); 93 82 94 83 // Perform the substraction 95 96 97 84 rsTemp1 = CGSchedLib.SubtractSlotsRS2(rsSlotSchedule, rsApptSchedule, sResName); 85 86 } 98 87 //otherwise, just return the slot schedule we have. 99 else 100 { 101 rsTemp1 = rsSlotSchedule; 102 103 } 88 else 89 { 90 rsTemp1 = rsSlotSchedule; 91 92 } 93 104 94 105 95 // if only one resource was passed in, its availablility is what we want … … 117 107 return rsOut; 118 108 } 119 109 */ 120 110 121 111 /* NOT USED ANYMORE!!! … … 281 271 /// D00030START_TIME^D00030END_TIME^I00010SLOTS^T00030RESOURCE^T00010ACCESS_TYPE^T00250NOTE^I00030AVAILABILITYID 282 272 /// </returns> 283 public static DataTable CreateAssignedSlotSchedule(CGDocumentManager docManager, string sResourceName, DateTime StartTime, 284 DateTime EndTime, ArrayList rsaryApptTypeIDs, /**/ ScheduleType stType, string sSearchInfo) 273 /* 274 * public static DataTable CreateAssignedSlotSchedule(CGDocumentManager docManager, string sResourceName, DateTime StartTime, 275 DateTime EndTime, ArrayList rsaryApptTypeIDs, ScheduleType stType, string sSearchInfo) 285 276 { 286 277 //Appointment type ids is now always "" so that all appointment types are returned. 287 string sApptTypeIDs = ""; 288 289 //flatten types by '|' 290 int nSize = rsaryApptTypeIDs.Count; //nSize is used to decide where to put the '|' sent in the RPC as we flatten sApptTypeIDs 291 for (int i=0; i < nSize; i++) 292 { 293 sApptTypeIDs += rsaryApptTypeIDs[i]; 294 if (i < (nSize-1)) 295 sApptTypeIDs += "|"; 296 } 297 278 string sApptTypeIDs = string.Join("|", rsaryApptTypeIDs.ToArray()); 298 279 string sStart = FMDateTime.Create(StartTime).DateOnly.FMDateString; 299 280 string sEnd = FMDateTime.Create(EndTime).FMDateString; … … 303 284 return dtRet; 304 285 } 305 286 */ 287 288 /* 306 289 public static DataTable CreateCopyTable() 307 290 { … … 358 341 return dtCopy; 359 342 } 343 */ 360 344 361 345 /// <summary> … … 368 352 /// <param name="stType"></param> 369 353 /// <returns>DataTable with 4 columns: START_TIME, END_TIME, SLOTS, RESOURCE </returns> 370 public static DataTable CreateAppointmentSlotSchedule(CGDocumentManager docManager, string sResourceName, DateTime StartTime, DateTime EndTime, ScheduleType stType) 354 /* 355 public static DataTable CreateAppointmentSlotSchedule(CGDocumentManager docManager, string sResourceName, DateTime StartTime, DateTime EndTime, ScheduleType stType) 371 356 { 372 357 //Change Dates to FM Format … … 424 409 ScheduleFromArray(cdtArray, StartTime, EndTime, ref ctbApptSchedule); 425 410 426 /*So far, we have the following:411 So far, we have the following: 427 412 * dtRet -> List of Appointments Start and End times, one row per appointment 428 413 * cdtArray -> Linear 1 dimensional Array of dtRet Start and End times, sorted … … 432 417 * 2 appts as 10:10-10:30 and 10:20-10:40 get converted into 10:10-10:20, 433 418 * 10:20-10:30, 10:30-10:40). 434 */419 435 420 436 421 //Find number of TimeBlocks in ctbApptSchedule that overlap the TimeBlocks in ctbAppointments … … 498 483 499 484 } 500 485 */ 486 487 /* 501 488 public static int BlocksOverlap(CGAvailability rBlock, ArrayList rTBArray) 502 489 { … … 542 529 return nCount; 543 530 } 531 */ 544 532 545 533 /// <summary> … … 552 540 /// <returns>true or false</returns> 553 541 /// <remarks>Draws 2 rectangles and sees if they overlap using minutes from 1980 as the start point</remarks> 554 public static bool TimesOverlap(DateTime dStart1, DateTime dEnd1, DateTime dStart2, DateTime dEnd2) 542 /* 543 public static bool TimesOverlap(DateTime dStart1, DateTime dEnd1, DateTime dStart2, DateTime dEnd2) 555 544 { 556 545 Rectangle rect1 = new Rectangle(); … … 568 557 return bRet; 569 558 } 570 559 */ 560 561 /* 571 562 public static void ConsolidateBlocks(ArrayList rTBArray) 572 563 { … … 607 598 } 608 599 while (!((bDirty == false) || (rTBArray.Count == 1))); 609 } 600 } */ 610 601 611 602 /// <summary> … … 616 607 /// <param name="sResource"></param> 617 608 /// <returns></returns> 618 public static DataTable SubtractSlotsRS2(DataTable rsBlocks1, DataTable rsBlocks2, string sResource) 609 /* 610 public static DataTable SubtractSlotsRS2(DataTable rsBlocks1, DataTable rsBlocks2, string sResource) 619 611 { 620 612 //Subtract slots in rsBlocks2 from rsBlocks1 … … 680 672 681 673 } 682 674 */ 675 676 /* 683 677 public static DataTable UnionBlocks(DataTable rs1, DataTable rs2) 684 678 { … … 714 708 return rsCopy; 715 709 } 716 710 */ 711 712 /* 717 713 public static DataTable IntersectBlocks(DataTable rs1, DataTable rs2) 718 714 { … … 770 766 // rect2.Height = CGSchedLib.MinSince80(dEnd2) - rect2.Y; 771 767 if ( 772 /*(rect2.IntersectsWith(rect1) == true) */768 /*(rect2.IntersectsWith(rect1) == true) 773 769 (CGSchedLib.TimesOverlap(dStart1, dEnd1, dStart2, dEnd2) == true) 774 770 && … … 797 793 return rsCopy; 798 794 }//end IntersectBlocks 799 795 */ 796 800 797 /// <summary> 801 798 /// Number of minutes since Jan 1 1980 … … 803 800 /// <param name="d">Date to compare</param> 804 801 /// <returns>Minutes as integer</returns> 805 public static int MinSince80(DateTime d) 802 /* 803 public static int MinSince80(DateTime d) 806 804 { 807 805 //Returns the total minutes between d and 1 Jan 1980 … … 814 812 return nMinutes; 815 813 } 816 814 */ 815 816 /* 817 817 /// <summary> 818 818 /// Converts an Array of Times like this: … … 909 909 910 910 }//end ScheduleFromArray 911 912 //long CResourceLink::SlotsInBlock(CTimeBlock &rTimeBlock, _RecordsetPtr rsBlock) 911 */ 912 913 /* 914 //long CResourceLink::SlotsInBlock(CTimeBlock &rTimeBlock, _RecordsetPtr rsBlock) 913 915 public static int SlotsInBlock(CGAvailability rTimeBlock, DataTable rsBlock) 914 916 { … … 952 954 return nSlots; 953 955 }//end SlotsInBlock 954 956 */ 957 958 /* 955 959 public static string ClinicInBlock(CGAvailability rTimeBlock, DataTable rsBlock) 956 960 { … … 991 995 return sClinic; 992 996 }//end ClinicInBlock 993 997 */ 998 999 /* 994 1000 public static bool ResourceRulesInBlock(CGAvailability rTimeBlock, DataTable rsBlock, ref string sResourceList, ref string sAccessRuleList, ref string sNote) 995 1001 { … … 1059 1065 return true; 1060 1066 }//End ResourceRulesInBlock 1067 */ 1061 1068 1062 1069 -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
r1095 r1097 617 617 this.tvSchedules.Location = new System.Drawing.Point(0, 0); 618 618 this.tvSchedules.Name = "tvSchedules"; 619 this.tvSchedules.Size = new System.Drawing.Size(128, 400);619 this.tvSchedules.Size = new System.Drawing.Size(128, 358); 620 620 this.tvSchedules.Sorted = true; 621 621 this.tvSchedules.TabIndex = 1; … … 664 664 this.panelRight.Location = new System.Drawing.Point(941, 0); 665 665 this.panelRight.Name = "panelRight"; 666 this.panelRight.Size = new System.Drawing.Size(128, 400);666 this.panelRight.Size = new System.Drawing.Size(128, 358); 667 667 this.panelRight.TabIndex = 3; 668 668 this.panelRight.Visible = false; … … 737 737 this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right; 738 738 this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right; 739 this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short; 740 this.dateTimePicker1.Location = new System.Drawing.Point(685, 0); 739 this.dateTimePicker1.Location = new System.Drawing.Point(607, 0); 741 740 this.dateTimePicker1.Name = "dateTimePicker1"; 742 this.dateTimePicker1.Size = new System.Drawing.Size( 128, 20);741 this.dateTimePicker1.Size = new System.Drawing.Size(206, 20); 743 742 this.dateTimePicker1.TabIndex = 1; 744 743 this.dateTimePicker1.CloseUp += new System.EventHandler(this.dateTimePicker1_CloseUp); … … 761 760 this.panelCenter.Location = new System.Drawing.Point(136, 24); 762 761 this.panelCenter.Name = "panelCenter"; 763 this.panelCenter.Size = new System.Drawing.Size(802, 3 52);762 this.panelCenter.Size = new System.Drawing.Size(802, 310); 764 763 this.panelCenter.TabIndex = 7; 765 764 // … … 847 846 this.panelBottom.Controls.Add(this.statusBar1); 848 847 this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; 849 this.panelBottom.Location = new System.Drawing.Point(136, 3 76);848 this.panelBottom.Location = new System.Drawing.Point(136, 334); 850 849 this.panelBottom.Name = "panelBottom"; 851 850 this.panelBottom.Size = new System.Drawing.Size(802, 24); … … 865 864 this.splitter1.Location = new System.Drawing.Point(128, 24); 866 865 this.splitter1.Name = "splitter1"; 867 this.splitter1.Size = new System.Drawing.Size(8, 3 76);866 this.splitter1.Size = new System.Drawing.Size(8, 334); 868 867 this.splitter1.TabIndex = 9; 869 868 this.splitter1.TabStop = false; … … 874 873 this.splitter2.Location = new System.Drawing.Point(938, 24); 875 874 this.splitter2.Name = "splitter2"; 876 this.splitter2.Size = new System.Drawing.Size(3, 3 76);875 this.splitter2.Size = new System.Drawing.Size(3, 334); 877 876 this.splitter2.TabIndex = 10; 878 877 this.splitter2.TabStop = false; … … 902 901 this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources"))); 903 902 this.calendarGrid1.SelectedAppointment = 0; 904 this.calendarGrid1.Size = new System.Drawing.Size(802, 3 52);903 this.calendarGrid1.Size = new System.Drawing.Size(802, 310); 905 904 this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); 906 905 this.calendarGrid1.TabIndex = 0; … … 915 914 // 916 915 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 917 this.ClientSize = new System.Drawing.Size(1069, 400);916 this.ClientSize = new System.Drawing.Size(1069, 358); 918 917 this.Controls.Add(this.panelCenter); 919 918 this.Controls.Add(this.panelBottom); … … 1988 1987 this.Document.CheckInAppointment(nApptID, dtCheckIn); 1989 1988 1990 //Tell appointment that it is checked in --smh cancel that!1991 //a.CheckInTime = DateTime.Now;1989 //Tell appointment that it is checked in 1990 a.CheckInTime = DateTime.Now; 1992 1991 1993 1992 //smh new code … … 1996 1995 // end new code 1997 1996 1998 //redraw grid (would this work???)1997 //redraw grid 1999 1998 this.calendarGrid1.Invalidate(); 2000 1999 } … … 2475 2474 return; 2476 2475 2477 string sResource = dSearch.SelectedResource; 2476 CGAvailability av = dSearch.SelectedAvailability; 2477 2478 2478 ArrayList alResource = new ArrayList(); 2479 alResource.Add( sResource);2480 DateTime sDate = dSearch.SelectedDate;2481 m_sDocName = sResource;2479 alResource.Add(av.ResourceList); 2480 DateTime sDate = av.StartTime; 2481 m_sDocName = av.ResourceList; 2482 2482 OpenSelectedSchedule(alResource, sDate); 2483 2483 -
Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user
r1095 r1097 37 37 </RemoteDebugMachine> 38 38 <StartAction>Project</StartAction> 39 <StartArguments>/s=1 92.168.56.101 /p=9260 /a=shabiel12 /v=catdog.77</StartArguments>39 <StartArguments>/s=172.16.16.108 /p=9250 /a=s.habiel /v=catdog.66</StartArguments> 40 40 <StartPage> 41 41 </StartPage> -
Scheduling/trunk/cs/bsdx0200GUISourceCode/DApptSearch.cs
r1095 r1097 1 1 using System; 2 using System.Drawing;3 2 using System.Collections; 4 using System.Co mponentModel;3 using System.Collections.Generic; 5 4 using System.Windows.Forms; 6 5 using System.Data; 6 using System.Linq; 7 7 //using System.Data.OleDb; 8 using IndianHealthService.BMXNet;9 8 10 9 namespace IndianHealthService.ClinicalScheduling 11 10 { 12 11 /// <summary> 13 /// Summary description for DApptSearch.12 /// Modal Dialog for searching for Patient Slots 14 13 /// </summary> 15 14 public class DApptSearch : System.Windows.Forms.Form … … 17 16 private System.Windows.Forms.Panel panel1; 18 17 private System.Windows.Forms.Button cmdCancel; 19 private System.Windows.Forms.Button cmdOK;18 private System.Windows.Forms.Button btnAccept; 20 19 private System.Windows.Forms.Panel pnlDescription; 21 20 private System.Windows.Forms.GroupBox grpDescription; … … 38 37 private System.Windows.Forms.RadioButton rdoPM; 39 38 private System.Windows.Forms.RadioButton rdoAM; 40 private System.Windows.Forms.Label label1; 41 private System.Windows.Forms.MonthCalendar calStartDate; 42 private System.Windows.Forms.GroupBox groupBox2; 43 private System.Windows.Forms.DataGrid grdResult; 44 private System.Windows.Forms.Button cmdSearch; 45 /// <summary> 46 /// Required designer variable. 47 /// </summary> 48 private System.ComponentModel.Container components = null; 39 private System.Windows.Forms.Label label1; 40 private System.Windows.Forms.GroupBox groupBox2; 41 private System.Windows.Forms.Button cmdSearch; 42 private ListView lstResults; 43 private ColumnHeader colStartTime; 44 private ColumnHeader colEndTime; 45 private ColumnHeader colResource; 46 private ColumnHeader colSlots; 47 private ColumnHeader colAccessType; 48 private ColumnHeader colDate; 49 private Label lblEnd; 50 private Label lblStart; 51 private DateTimePicker dtEnd; 52 private DateTimePicker dtStart; 53 private ColumnHeader colDOW; 54 private ColumnHeader colID; 55 56 private System.ComponentModel.IContainer components; 49 57 50 58 public DApptSearch() … … 60 68 DataTable m_dtTypes; 61 69 DataView m_dvTypes; 62 70 List<CGAvailability> lstResultantAvailabilities; 71 private CGAvailability _selectedAvailability; 63 72 DateTime m_dStart; 64 73 DateTime m_dEnd; 65 74 ArrayList m_alResources; 66 75 ArrayList m_alAccessTypes; 67 string m_sWeekDays; 68 string m_sAmpm; 69 70 DataTable m_dtResult; 71 DataView m_dvResult; 72 73 string m_sSelectedResource; 74 DateTime m_sSelectedDate; 76 string m_sWeekDays; //only practical use now is for sending to server 77 string m_sAmpm; // same here. 75 78 76 79 #endregion Fields … … 110 113 { 111 114 112 this.m_DocManager = docManager; 115 this.Text = "Searching for Appointments in: " + string.Join(" | ", alResources.Cast<string>()); 116 117 this.m_DocManager = docManager; 113 118 this.m_dsGlobal = m_DocManager.GlobalDataSet; 114 System.IntPtr pHandle = this.Handle;119 115 120 LoadListBox("ALL"); 116 121 … … 136 141 cboAccessTypeFilter.Refresh(); 137 142 138 //Create DataGridTableStyle for Result grid 143 144 /* OLD CODE 145 //Create DataGridTableStyle for Result grid 139 146 DataGridTableStyle tsResult = new DataGridTableStyle(); 140 147 tsResult.MappingName = "Result"; 141 148 tsResult.ReadOnly = true; 149 142 150 // Add START_TIME column style. 143 151 DataGridTextBoxColumn colStartTime = new DataGridTextBoxColumn(); 144 colStartTime.MappingName = "START_TIME";152 colStartTime.MappingName = "StartTime"; 145 153 colStartTime.HeaderText = "Start Time"; 146 154 colStartTime.Width = 200; … … 150 158 // Add END_TIME column style. 151 159 DataGridTextBoxColumn colEndTime = new DataGridTextBoxColumn(); 152 colEndTime.MappingName = "END_TIME";160 colEndTime.MappingName = "EndTime"; 153 161 colEndTime.HeaderText = "End Time"; 154 162 colEndTime.Width = 75; … … 158 166 // Add RESOURCE column style. 159 167 DataGridTextBoxColumn colResource = new DataGridTextBoxColumn(); 160 colResource.MappingName = "RESOURCE";168 colResource.MappingName = "ResourceList"; 161 169 colResource.HeaderText = "Resource"; 162 170 colResource.Width = 200; … … 176 184 colAccess.Width = 200; 177 185 tsResult.GridColumnStyles.Add(colAccess); 178 grdResult.TableStyles.Add(tsResult); 179 186 //grdResult.TableStyles.Add(tsResult); 187 */ 188 180 189 this.UpdateDialogData(true); 181 190 … … 232 241 233 242 //Start 234 this.m_dStart = this.calStartDate.SelectionStart;243 this.m_dStart = this.dtStart.Value; 235 244 236 245 //End 237 m_dEnd = calStartDate.SelectionEnd; 238 m_dEnd = m_dEnd.AddHours(23); 239 m_dEnd = m_dEnd.AddMinutes(59); 240 246 this.m_dEnd = this.dtEnd.Value; 241 247 } 242 248 } … … 270 276 this.cmdSearch = new System.Windows.Forms.Button(); 271 277 this.cmdCancel = new System.Windows.Forms.Button(); 272 this. cmdOK= new System.Windows.Forms.Button();278 this.btnAccept = new System.Windows.Forms.Button(); 273 279 this.pnlDescription = new System.Windows.Forms.Panel(); 274 280 this.grpDescription = new System.Windows.Forms.GroupBox(); 275 281 this.lblDescription = new System.Windows.Forms.Label(); 276 282 this.groupBox1 = new System.Windows.Forms.GroupBox(); 283 this.lblEnd = new System.Windows.Forms.Label(); 284 this.lblStart = new System.Windows.Forms.Label(); 285 this.dtEnd = new System.Windows.Forms.DateTimePicker(); 286 this.dtStart = new System.Windows.Forms.DateTimePicker(); 277 287 this.label3 = new System.Windows.Forms.Label(); 278 288 this.label2 = new System.Windows.Forms.Label(); … … 292 302 this.rdoAM = new System.Windows.Forms.RadioButton(); 293 303 this.label1 = new System.Windows.Forms.Label(); 294 this.calStartDate = new System.Windows.Forms.MonthCalendar();295 304 this.groupBox2 = new System.Windows.Forms.GroupBox(); 296 this.grdResult = new System.Windows.Forms.DataGrid(); 305 this.lstResults = new System.Windows.Forms.ListView(); 306 this.colID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 307 this.colDate = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 308 this.colDOW = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 309 this.colStartTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 310 this.colEndTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 311 this.colResource = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 312 this.colSlots = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 313 this.colAccessType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 297 314 this.panel1.SuspendLayout(); 298 315 this.pnlDescription.SuspendLayout(); … … 302 319 this.grpTimeOfDay.SuspendLayout(); 303 320 this.groupBox2.SuspendLayout(); 304 ((System.ComponentModel.ISupportInitialize)(this.grdResult)).BeginInit();305 321 this.SuspendLayout(); 306 322 // … … 309 325 this.panel1.Controls.Add(this.cmdSearch); 310 326 this.panel1.Controls.Add(this.cmdCancel); 311 this.panel1.Controls.Add(this. cmdOK);327 this.panel1.Controls.Add(this.btnAccept); 312 328 this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; 313 329 this.panel1.Location = new System.Drawing.Point(0, 461); … … 334 350 this.cmdCancel.Text = "Cancel"; 335 351 // 336 // cmdOK 337 // 338 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK; 339 this.cmdOK.Location = new System.Drawing.Point(128, 8); 340 this.cmdOK.Name = "cmdOK"; 341 this.cmdOK.Size = new System.Drawing.Size(64, 24); 342 this.cmdOK.TabIndex = 0; 343 this.cmdOK.Text = "OK"; 344 this.cmdOK.Visible = false; 345 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click); 352 // btnAccept 353 // 354 this.btnAccept.DialogResult = System.Windows.Forms.DialogResult.OK; 355 this.btnAccept.Location = new System.Drawing.Point(128, 8); 356 this.btnAccept.Name = "btnAccept"; 357 this.btnAccept.Size = new System.Drawing.Size(176, 24); 358 this.btnAccept.TabIndex = 0; 359 this.btnAccept.Text = "Select Slot for Appointment"; 360 this.btnAccept.Click += new System.EventHandler(this.btnAccept_Click); 346 361 // 347 362 // pnlDescription … … 378 393 // groupBox1 379 394 // 395 this.groupBox1.Controls.Add(this.lblEnd); 396 this.groupBox1.Controls.Add(this.lblStart); 397 this.groupBox1.Controls.Add(this.dtEnd); 398 this.groupBox1.Controls.Add(this.dtStart); 380 399 this.groupBox1.Controls.Add(this.label3); 381 400 this.groupBox1.Controls.Add(this.label2); … … 385 404 this.groupBox1.Controls.Add(this.grpTimeOfDay); 386 405 this.groupBox1.Controls.Add(this.label1); 387 this.groupBox1.Controls.Add(this.calStartDate);388 406 this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top; 389 407 this.groupBox1.Location = new System.Drawing.Point(0, 0); … … 393 411 this.groupBox1.TabStop = false; 394 412 this.groupBox1.Text = "Search Parameters"; 413 // 414 // lblEnd 415 // 416 this.lblEnd.AutoSize = true; 417 this.lblEnd.Location = new System.Drawing.Point(12, 124); 418 this.lblEnd.Name = "lblEnd"; 419 this.lblEnd.Size = new System.Drawing.Size(153, 13); 420 this.lblEnd.TabIndex = 67; 421 this.lblEnd.Text = "End Date to Search (Inclusive)"; 422 // 423 // lblStart 424 // 425 this.lblStart.AutoSize = true; 426 this.lblStart.Location = new System.Drawing.Point(12, 35); 427 this.lblStart.Name = "lblStart"; 428 this.lblStart.Size = new System.Drawing.Size(159, 13); 429 this.lblStart.TabIndex = 66; 430 this.lblStart.Text = "Start Date to Search (Inclusive)"; 431 // 432 // dtEnd 433 // 434 this.dtEnd.Location = new System.Drawing.Point(12, 141); 435 this.dtEnd.Name = "dtEnd"; 436 this.dtEnd.Size = new System.Drawing.Size(200, 20); 437 this.dtEnd.TabIndex = 65; 438 // 439 // dtStart 440 // 441 this.dtStart.Location = new System.Drawing.Point(12, 54); 442 this.dtStart.Name = "dtStart"; 443 this.dtStart.Size = new System.Drawing.Size(200, 20); 444 this.dtStart.TabIndex = 64; 395 445 // 396 446 // label3 … … 542 592 // 543 593 this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 544 this.label1.Location = new System.Drawing.Point( 16, 24);594 this.label1.Location = new System.Drawing.Point(6, 16); 545 595 this.label1.Name = "label1"; 546 596 this.label1.Size = new System.Drawing.Size(136, 16); … … 548 598 this.label1.Text = "Date Range:"; 549 599 // 550 // calStartDate551 //552 this.calStartDate.Location = new System.Drawing.Point(16, 40);553 this.calStartDate.MaxSelectionCount = 62;554 this.calStartDate.Name = "calStartDate";555 this.calStartDate.TabIndex = 56;556 //557 600 // groupBox2 558 601 // 559 this.groupBox2.Controls.Add(this. grdResult);602 this.groupBox2.Controls.Add(this.lstResults); 560 603 this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; 561 604 this.groupBox2.Location = new System.Drawing.Point(0, 208); … … 566 609 this.groupBox2.Text = "Search Result"; 567 610 // 568 // grdResult 569 // 570 this.grdResult.CaptionVisible = false; 571 this.grdResult.DataMember = ""; 572 this.grdResult.Dock = System.Windows.Forms.DockStyle.Fill; 573 this.grdResult.HeaderForeColor = System.Drawing.SystemColors.ControlText; 574 this.grdResult.Location = new System.Drawing.Point(3, 16); 575 this.grdResult.Name = "grdResult"; 576 this.grdResult.ReadOnly = true; 577 this.grdResult.Size = new System.Drawing.Size(917, 170); 578 this.grdResult.TabIndex = 0; 579 this.grdResult.DoubleClick += new System.EventHandler(this.grdResult_DoubleClick); 580 this.grdResult.CurrentCellChanged += new System.EventHandler(this.grdResult_CurrentCellChanged); 611 // lstResults 612 // 613 this.lstResults.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 614 this.colID, 615 this.colDate, 616 this.colDOW, 617 this.colStartTime, 618 this.colEndTime, 619 this.colResource, 620 this.colSlots, 621 this.colAccessType}); 622 this.lstResults.Dock = System.Windows.Forms.DockStyle.Fill; 623 this.lstResults.FullRowSelect = true; 624 this.lstResults.GridLines = true; 625 this.lstResults.Location = new System.Drawing.Point(3, 16); 626 this.lstResults.MultiSelect = false; 627 this.lstResults.Name = "lstResults"; 628 this.lstResults.Size = new System.Drawing.Size(917, 170); 629 this.lstResults.TabIndex = 0; 630 this.lstResults.UseCompatibleStateImageBehavior = false; 631 this.lstResults.View = System.Windows.Forms.View.Details; 632 this.lstResults.DoubleClick += new System.EventHandler(this.lstResults_DoubleClick); 633 // 634 // colID 635 // 636 this.colID.Text = "ID"; 637 this.colID.Width = 0; 638 // 639 // colDate 640 // 641 this.colDate.Text = "Date"; 642 this.colDate.Width = 91; 643 // 644 // colDOW 645 // 646 this.colDOW.Text = "Day of Week"; 647 this.colDOW.Width = 80; 648 // 649 // colStartTime 650 // 651 this.colStartTime.Text = "Start Time"; 652 this.colStartTime.Width = 87; 653 // 654 // colEndTime 655 // 656 this.colEndTime.Text = "End Time"; 657 this.colEndTime.Width = 116; 658 // 659 // colResource 660 // 661 this.colResource.Text = "Resource"; 662 this.colResource.Width = 370; 663 // 664 // colSlots 665 // 666 this.colSlots.Text = "Slots"; 667 this.colSlots.Width = 47; 668 // 669 // colAccessType 670 // 671 this.colAccessType.Text = "Access Type"; 672 this.colAccessType.Width = 101; 581 673 // 582 674 // DApptSearch … … 596 688 this.grpDescription.ResumeLayout(false); 597 689 this.groupBox1.ResumeLayout(false); 690 this.groupBox1.PerformLayout(); 598 691 this.grpDayOfWeek.ResumeLayout(false); 599 692 this.grpTimeOfDay.ResumeLayout(false); 600 693 this.groupBox2.ResumeLayout(false); 601 ((System.ComponentModel.ISupportInitialize)(this.grdResult)).EndInit();602 694 this.ResumeLayout(false); 603 695 … … 606 698 607 699 #region Event Handlers 608 private void cmdOK_Click(object sender, System.EventArgs e)609 {610 611 }612 700 613 701 private void cmdSearch_Click(object sender, System.EventArgs e) 614 702 { 615 //Get the control data into local vars 703 //Tell user we are processing 704 this.Cursor = Cursors.WaitCursor; 705 706 //Get the control data into local vars 616 707 UpdateDialogData(false); 617 708 //Resource array, Begin date, Access type array, MTWTF , AM PM 618 //Assemble |-delimited resource string 619 string sResources = ""; 620 for (int j=0; j < m_alResources.Count; j++) 621 { 622 sResources = sResources + m_alResources[j]; 623 if (j < (m_alResources.Count - 1)) 624 sResources = sResources + "|"; 625 } 626 627 //Access Types Array 628 string sTypes = ""; 629 if (m_alAccessTypes.Count > 0) 630 { 631 for (int j=0; j < m_alAccessTypes.Count; j++) 632 { 633 sTypes = sTypes + (string) m_alAccessTypes[j]; 634 if (j < (m_alAccessTypes.Count-1)) 635 sTypes = sTypes + "|"; 636 } 637 } 638 709 710 //Get Availabilities and Appointments from the DB 711 //NB: m_sAmpm and m_sWeekDays don't have an effect on the M side side right now 639 712 string sSearchInfo = "1|" + m_sAmpm + "|" + m_sWeekDays; 640 m_dtResult = CGSchedLib.CreateAvailabilitySchedule(m_DocManager, m_alResources, m_dStart, m_dEnd, m_alAccessTypes, ScheduleType.Resource, sSearchInfo); 641 642 if (m_dtResult.Rows.Count == 0) 643 { 644 MessageBox.Show("No availability found."); 645 return; 646 } 647 648 m_dtResult.TableName = "Result"; 649 m_dtResult.Columns.Add("AMPM", System.Type.GetType("System.String") ,"Convert(START_TIME, 'System.String')" ); 650 m_dtResult.Columns.Add("DAYOFWEEK", System.Type.GetType("System.String")); 651 m_dtResult.Columns.Add("ACCESSNAME", System.Type.GetType("System.String")); 652 653 DataRow drAT; 654 DateTime dt; 655 string sDOW; 656 int nAccessTypeID; 657 string sAccessType; 658 659 foreach (DataRow dr in m_dtResult.Rows) 660 { 661 dt = (DateTime) dr["START_TIME"]; 662 sDOW = dt.DayOfWeek.ToString(); 663 dr["DAYOFWEEK"] = sDOW; 664 if (dr["ACCESS_TYPE"].ToString() != "") 665 { 666 nAccessTypeID =Convert.ToInt16(dr["ACCESS_TYPE"].ToString()); 667 drAT = m_dsGlobal.Tables["AccessTypes"].Rows.Find(nAccessTypeID); 668 if (drAT != null) 669 { 670 sAccessType = drAT["ACCESS_TYPE_NAME"].ToString(); 671 dr["ACCESSNAME"] = sAccessType; 672 } 673 } 674 } 675 676 677 m_dvResult = new DataView(m_dtResult); 678 679 string sFilter = "(SLOTS > 0)"; 680 if (m_sAmpm != "") 681 { 682 if (m_sAmpm == "AM") 683 sFilter = sFilter + " AND (AMPM LIKE '*AM*')"; 684 if (m_sAmpm == "PM") 685 sFilter = sFilter + " AND (AMPM LIKE '*PM*')"; 686 } 687 688 bool sOr = false; 689 if (m_sWeekDays != "") 690 { 691 sFilter += " AND ("; 692 if (chkMon.Checked == true) 693 { 694 sFilter = sFilter + "(DAYOFWEEK LIKE '*Monday*')"; 695 sOr = true; 696 } 697 if (chkTue.Checked == true) 698 { 699 sFilter = (sOr == true)?sFilter + " OR ":sFilter; 700 sFilter = sFilter + "(DAYOFWEEK LIKE '*Tuesday*')"; 701 sOr = true; 702 } 703 if (chkWed.Checked == true) 704 { 705 sFilter = (sOr == true)?sFilter + " OR ":sFilter; 706 sFilter = sFilter + "(DAYOFWEEK LIKE '*Wednesday*')"; 707 sOr = true; 708 } 709 if (chkThu.Checked == true) 710 { 711 sFilter = (sOr == true)?sFilter + " OR ":sFilter; 712 sFilter = sFilter + "(DAYOFWEEK LIKE '*Thursday*')"; 713 sOr = true; 714 } 715 if (chkFri.Checked == true) 716 { 717 sFilter = (sOr == true)?sFilter + " OR ":sFilter; 718 sFilter = sFilter + "(DAYOFWEEK LIKE '*Friday*')"; 719 sOr = true; 720 } 721 if (chkSat.Checked == true) 722 { 723 sFilter = (sOr == true)?sFilter + " OR ":sFilter; 724 sFilter = sFilter + "(DAYOFWEEK LIKE '*Saturday*')"; 725 sOr = true; 726 } 727 if (chkSun.Checked == true) 728 { 729 sFilter = (sOr == true)?sFilter + " OR ":sFilter; 730 sFilter = sFilter + "(DAYOFWEEK LIKE '*Sunday*')"; 731 sOr = true; 732 } 733 sFilter += ")"; 734 } 735 736 if (m_alAccessTypes.Count > 0) 737 { 738 sFilter += " AND ("; 739 sOr = false; 740 foreach (string sType in m_alAccessTypes) 741 { 742 if (sOr == true) 743 sFilter += " OR "; 744 sOr = true; 745 sFilter += "(ACCESSNAME = '" + sType + "')"; 746 } 747 sFilter += ")"; 748 } 749 750 m_dvResult.RowFilter = sFilter; 751 this.grdResult.DataSource = m_dvResult; 752 713 DataTable m_availTable = CGSchedLib.CreateAvailabilitySchedule(m_DocManager, m_alResources, m_dStart, m_dEnd, m_alAccessTypes, ScheduleType.Resource, sSearchInfo); 714 DataTable m_apptTable = CGSchedLib.CreateAppointmentSchedule(m_DocManager, m_alResources, m_dStart, m_dEnd); 715 716 #if DEBUG 717 System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); 718 stopwatch.Start(); 719 #endif 720 lstResultantAvailabilities = (from rowAV in m_availTable.AsEnumerable() 721 722 // Calculate the number of slots consumed in this availability by appointments 723 let slotsConsumed = (from appt in m_apptTable.AsEnumerable() 724 //If the resource is the same and the user selection overlaps, then... 725 where (rowAV.Field<string>("RESOURCE") == appt.Field<string>("RESOURCENAME") 726 && CalendarGrid.TimesOverlap(rowAV.Field<DateTime>("START_TIME"), rowAV.Field<DateTime>("END_TIME"), appt.Field<DateTime>("START_TIME"), appt.Field<DateTime>("END_TIME"))) 727 // if appt starttime is before avail start time, only count against the avail starting from the availability start time 728 let startTimeToCountAgainstBlock = appt.Field<DateTime>("START_TIME") < rowAV.Field<DateTime>("START_TIME") ? rowAV.Field<DateTime>("START_TIME") : appt.Field<DateTime>("START_TIME") 729 // if appt endtime is after the avail ends, only count against the avail up to where the avail ends 730 let endTimeToCountAgainstBlock = appt.Field<DateTime>("END_TIME") > rowAV.Field<DateTime>("END_TIME") ? rowAV.Field<DateTime>("END_TIME") : appt.Field<DateTime>("END_TIME") 731 // theoretical minutes per slot for the availability 732 let minPerSlot = (rowAV.Field<DateTime>("END_TIME") - rowAV.Field<DateTime>("START_TIME")).TotalMinutes / rowAV.Field<int>("SLOTS") 733 // how many minutes does this appointment take away from the slot 734 let minPerAppt = (endTimeToCountAgainstBlock - startTimeToCountAgainstBlock).TotalMinutes 735 // how many slots the appointment takes up using this availability's scale 736 let slotsConsumed = minPerAppt / minPerSlot 737 select slotsConsumed).Sum() 738 739 // Subtract the number consumed from the original ones 740 let slotsLeft = (float)rowAV.Field<int>("SLOTS") - slotsConsumed 741 // filter by that value if it is at least one slot 742 where slotsLeft >= 1 743 // Sort by Start Time, then by Resource Name 744 orderby rowAV.Field<DateTime>("START_TIME"), rowAV.Field<string>("RESOURCE") 745 //return as a CGAvailability 746 select new CGAvailability 747 { 748 ResourceList = rowAV.Field<string>("RESOURCE"), 749 StartTime = rowAV.Field<DateTime>("START_TIME"), 750 EndTime = rowAV.Field<DateTime>("END_TIME"), 751 Slots = (int)slotsLeft, 752 // AccessTypeName is grabbed from the Access Type Table using a psuedojoin syntax. 753 // "ACCESS_TYPE" is the IEN of the AcceesType. 754 // Single or default is b/c we are expecting one result. 755 AccessTypeName = (from at in m_dsGlobal.Tables["AccessTypes"].AsEnumerable() 756 where at.Field<int>("BMXIEN")==Int32.Parse(rowAV.Field<string>("ACCESS_TYPE")) 757 select at.Field<string>("ACCESS_TYPE_NAME")).SingleOrDefault<string>(), 758 AvailabilityType = rowAV.Field<int>("AVAILABILITYID") 759 }) 760 // convert to Generic List 761 .ToList<CGAvailability>(); 762 763 // if specific access types are chosen, filter the results based on a join against them. 764 if (m_alAccessTypes.Count > 0) 765 lstResultantAvailabilities = (from av in lstResultantAvailabilities 766 join at in m_alAccessTypes.Cast<string>() on av.AccessTypeName equals at 767 select av).ToList<CGAvailability>(); 768 769 // if user chose AM radio button, get morning appointments 770 // TimeSpan.FromHours(12) gets the number of ticks since Midnight 771 if (rdoAM.Checked) // less than 12 pm 772 { 773 lstResultantAvailabilities = (from av in lstResultantAvailabilities 774 where av.StartTime.TimeOfDay < TimeSpan.FromHours(12) 775 select av).ToList<CGAvailability>(); 776 } 777 // if user chose PM radio button, get morning appointments 778 if (rdoPM.Checked) // after or equal to 12 pm 779 { 780 lstResultantAvailabilities = (from av in lstResultantAvailabilities 781 where av.StartTime.TimeOfDay >= TimeSpan.FromHours(12) 782 select av).ToList<CGAvailability>(); 783 } 784 785 // if any of the days of week are checked, create a new list based on them 786 // and clear the original list, and join the new lists together 787 if (chkMon.Checked || chkTue.Checked || chkWed.Checked || chkThu.Checked || chkFri.Checked || chkSat.Checked || chkSun.Checked) 788 { 789 790 var lstMonday = new List<CGAvailability>(); 791 var lstTuesday = new List<CGAvailability>(); 792 var lstWednesday = new List<CGAvailability>(); 793 var lstThursday = new List<CGAvailability>(); 794 var lstFriday = new List<CGAvailability>(); 795 var lstSaturday = new List<CGAvailability>(); 796 var lstSunday = new List<CGAvailability>(); 797 798 if (chkMon.Checked == true) 799 { 800 lstMonday = (from av in lstResultantAvailabilities 801 where av.StartTime.DayOfWeek == DayOfWeek.Monday 802 select av).ToList<CGAvailability>(); 803 } 804 805 if (chkTue.Checked == true) 806 { 807 lstTuesday = (from av in lstResultantAvailabilities 808 where av.StartTime.DayOfWeek == DayOfWeek.Tuesday 809 select av).ToList<CGAvailability>(); 810 } 811 812 if (chkWed.Checked == true) 813 { 814 lstWednesday = (from av in lstResultantAvailabilities 815 where av.StartTime.DayOfWeek == DayOfWeek.Wednesday 816 select av).ToList<CGAvailability>(); 817 818 } 819 820 if (chkThu.Checked == true) 821 { 822 lstThursday = (from av in lstResultantAvailabilities 823 where av.StartTime.DayOfWeek == DayOfWeek.Thursday 824 select av).ToList<CGAvailability>(); 825 826 } 827 828 if (chkFri.Checked == true) 829 { 830 lstFriday = (from av in lstResultantAvailabilities 831 where av.StartTime.DayOfWeek == DayOfWeek.Friday 832 select av).ToList<CGAvailability>(); 833 } 834 835 if (chkSat.Checked == true) 836 { 837 lstSaturday = (from av in lstResultantAvailabilities 838 where av.StartTime.DayOfWeek == DayOfWeek.Saturday 839 select av).ToList<CGAvailability>(); 840 841 } 842 843 if (chkSun.Checked == true) 844 { 845 lstSunday = (from av in lstResultantAvailabilities 846 where av.StartTime.DayOfWeek == DayOfWeek.Sunday 847 select av).ToList<CGAvailability>(); 848 849 } 850 851 852 lstResultantAvailabilities.Clear(); 853 lstResultantAvailabilities.AddRange(lstMonday); 854 lstResultantAvailabilities.AddRange(lstTuesday); 855 lstResultantAvailabilities.AddRange(lstWednesday); 856 lstResultantAvailabilities.AddRange(lstThursday); 857 lstResultantAvailabilities.AddRange(lstFriday); 858 lstResultantAvailabilities.AddRange(lstSaturday); 859 lstResultantAvailabilities.AddRange(lstSunday); 860 861 lstResultantAvailabilities.OrderBy(av => av.StartTime).ThenBy(av => av.ResourceList); 862 } 863 864 865 866 #if DEBUG 867 System.Diagnostics.Debug.Write("LINQ took this long: " + stopwatch.ElapsedMilliseconds + "\n"); 868 stopwatch = null; 869 #endif 870 871 //Then, convert the availabilities to ListViewItems 872 var items = (from item in lstResultantAvailabilities 873 let s = new string[] {item.AvailabilityType.ToString(), item.StartTime.ToShortDateString(), item.StartTime.DayOfWeek.ToString(),item.StartTime.ToShortTimeString() ,item.EndTime.ToShortTimeString() ,item.ResourceList,item.Slots.ToString(),item.AccessTypeName} 874 let lvItem = new ListViewItem(s) 875 select lvItem).ToArray<ListViewItem>(); 876 877 //--Updating Listview 878 lstResults.BeginUpdate(); //tell listview to suspend drawing for now 879 lstResults.Items.Clear(); //empty it from old data 880 881 //if (items.Length == 0) lstResults.Items.Add(new ListViewItem(new string[] { "", "", "", "" , "", "No Slots found", "", "" })); // no results 882 if (items.Length > 0) lstResults.Items.AddRange(items); // add new data 883 884 lstResults.EndUpdate(); // ok done adding items, draw now. 885 //--End Update Listview 886 887 //We are done 888 this.Cursor = Cursors.Default; 753 889 } 754 890 … … 770 906 private void grdResult_DoubleClick(object sender, System.EventArgs e) 771 907 { 772 if (grdResult.DataSource == null) 908 /* 909 if (lstResults.DataSource == null) 773 910 return; 774 911 775 DataGrid Cell dgCell;912 DataGridViewCell dgCell; 776 913 dgCell = this.grdResult.CurrentCell; 777 dgCell.ColumnNumber = 2; 778 this.m_sSelectedResource = grdResult[dgCell.RowNumber, dgCell.ColumnNumber].ToString(); 779 this.m_sSelectedDate = (DateTime) grdResult[dgCell.RowNumber,0]; 914 this.m_sSelectedResource = grdResult.SelectedRows[0].Cells[2].ToString(); 915 this.m_sSelectedDate = (DateTime)grdResult.SelectedRows[0].Cells[0].Value; 780 916 this.DialogResult = DialogResult.OK; 781 917 this.Close(); 918 */ 782 919 } 783 920 784 921 private void grdResult_CurrentCellChanged(object sender, System.EventArgs e) 785 922 { 786 DataGridCell dgCell;787 dgCell = this.grdResult.CurrentCell;788 this.grdResult.Select(dgCell.RowNumber);789 923 /* 924 DataGridViewCell dgCell; 925 dgCell = this.grdResult.CurrentCell; 926 */ 790 927 } 791 928 929 /// <summary> 930 /// BAAAAAAAAAAAAAAAAAD. Use a shared method instead. 931 /// </summary> 932 /// <param name="sender"></param> 933 /// <param name="e"></param> 934 private void lstResults_DoubleClick(object sender, EventArgs e) 935 { 936 btnAccept_Click(sender, e); 937 } 938 939 private void btnAccept_Click(object sender, EventArgs e) 940 { 941 if (lstResults.SelectedIndices.Count == 0) 942 { 943 this.DialogResult = DialogResult.None; 944 return; 945 } 946 947 long availabilityKey = long.Parse(lstResults.SelectedItems[0].SubItems[0].Text); 948 _selectedAvailability = (from av in lstResultantAvailabilities 949 where av.AvailabilityType == availabilityKey 950 select av).Single<CGAvailability>(); 951 this.DialogResult = DialogResult.OK; 952 } 953 792 954 #endregion Event Handlers 793 955 794 956 #region Properties 957 958 795 959 /// <summary> 796 /// Gets the resource selected by the user 797 /// </summary> 798 public string SelectedResource 799 { 800 get 801 { 802 return this.m_sSelectedResource; 803 } 804 } 805 806 /// <summary> 807 /// Gets the date selected by the user 808 /// </summary> 809 public DateTime SelectedDate 810 { 811 get 812 { 813 return this.m_sSelectedDate; 814 } 815 } 960 /// Gets the Availability Selected by the User in which to put an appointment 961 /// </summary> 962 public CGAvailability SelectedAvailability 963 { 964 get { return this._selectedAvailability; } 965 } 966 816 967 #endregion Properties 817 818 } 968 } 819 969 } -
Scheduling/trunk/cs/bsdx0200GUISourceCode/DApptSearch.resx
r908 r1097 113 113 </resheader> 114 114 <resheader name="reader"> 115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 116 116 </resheader> 117 117 <resheader name="writer"> 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 120 </root> -
Scheduling/trunk/cs/bsdx0200GUISourceCode/DPatientLookup.cs
r868 r1097 1 1 using System; 2 using System.Drawing;3 using System.Collections;4 using System.ComponentModel;5 2 using System.Windows.Forms; 6 3 using System.Data; 7 //using System.Data.OleDb; 8 using IndianHealthService.BMXNet; 4 9 5 10 6 namespace IndianHealthService.ClinicalScheduling
Note:
See TracChangeset
for help on using the changeset viewer.