Changeset 1106 for Scheduling/trunk
- Timestamp:
- Mar 20, 2011, 3:22:11 AM (14 years ago)
- Location:
- Scheduling/trunk/cs/bsdx0200GUISourceCode
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGAppointment.cs
r900 r1106 303 303 } 304 304 } 305 306 public Patient Patient { get; set; } 305 307 } 306 308 } -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs
r1097 r1106 8 8 using IndianHealthService.BMXNet; 9 9 using System.Linq; 10 using System.Collections.Generic; 10 11 11 12 namespace IndianHealthService.ClinicalScheduling … … 321 322 } 322 323 323 public void OnOpenDocument( )324 public void OnOpenDocument(DateTime dDate) 324 325 { 325 326 try … … 328 329 m_ScheduleType = (m_sResourcesArray.Count == 1) ? ScheduleType.Resource : ScheduleType.Clinic; 329 330 bool bRet = false; 330 331 //Set initial From and To dates based on current day 332 DateTime dDate = DateTime.Today; 331 333 332 if (m_ScheduleType == ScheduleType.Resource) 334 333 { … … 396 395 private bool RefreshSchedule() 397 396 { 398 try 399 { 400 bool bRet = this.RefreshAvailabilitySchedule(); 401 if (bRet == false) 402 { 403 return bRet; 404 } 405 bRet = this.RefreshDaysSchedule(); 406 return bRet; 407 } 408 catch (ApplicationException aex) 409 { 410 Debug.Write("CGDocument.RefreshSchedule Application Error: " + aex.Message + "\n"); 411 return false; 412 } 413 catch (Exception ex) 414 { 415 MessageBox.Show("CGDocument.RefreshSchedule error: " + ex.Message + "\n"); 416 return false; 417 } 397 this.RefreshAvailabilitySchedule(); 398 this.RefreshDaysSchedule(); 399 return true; 418 400 } 419 401 … … 637 619 /// <param name="sAvailabilityMessage">Out: Access Note</param> 638 620 /// <returns>Number of slots</returns> 639 public int SlotsAvailable(DateTime dSelStart, DateTime dSelEnd, string sResource, out string sAccessType, out string sAvailabilityMessage) 640 { 641 642 643 sAccessType = ""; //default out value 644 sAvailabilityMessage = ""; //default out value 621 public int SlotsAvailable(DateTime dSelStart, DateTime dSelEnd, string sResource, int viewTimeScale, out CGAvailability resultantAV) 622 { 623 624 resultantAV = null; 645 625 646 626 double slotsAvailable = 0; //defalut return value 627 628 double effectiveSlotsAvailable = 0; //Slots available based on the time scale. 629 647 630 648 631 //NOTE: What's this lock? This lock makes sure that nobody is editing the availability array … … 660 643 { 661 644 //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)645 //Availabilites cannot overlap each other (enforced at the DB level) 663 646 //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 647 List<CGAvailability> lstAV = (from avail in this.m_pAvArray.Cast<CGAvailability>() 648 where (sResource == avail.ResourceList && CalendarGrid.TimesOverlap(dSelStart, dSelEnd, avail.StartTime, avail.EndTime)) 649 select avail).ToList(); 650 651 //if we don't have any availabilities, then return with zero slots. 652 if (lstAV.Count == 0) return 0; 653 654 CGAvailability pAV; 655 656 //if there is just one, that's it. 657 if (lstAV.Count == 1) pAV = lstAV.First(); 658 //otherwise... 659 else 660 { 661 //if availabilities are contigous to each other, need to join them together. 662 663 //First, are they the same? 664 string firsttype = lstAV.First().AccessTypeName; 665 bool bAllSameType = lstAV.All(av => av.AccessTypeName == firsttype); 666 667 //Second are they ALL contigous? 668 DateTime lastEndTime = DateTime.Today; //bogus value to please compiler who wants it assigned. 669 int index = 0; 670 671 bool bContigous = lstAV.OrderBy(av => av.StartTime) 672 .All(av => 673 { 674 index++; 675 if (index == 1) 676 { 677 lastEndTime = av.EndTime; 678 return true; 679 } 680 if (av.StartTime == lastEndTime) 681 { 682 lastEndTime = av.EndTime; 683 return true; 684 } 685 686 return false; 687 }); 688 689 690 691 if (bContigous && bAllSameType) 692 { 693 var enumAVOrdered = lstAV.OrderBy(av => av.StartTime); 694 695 pAV = new CGAvailability 696 { 697 StartTime = enumAVOrdered.First().StartTime, 698 EndTime = enumAVOrdered.Last().EndTime, 699 Slots = enumAVOrdered.Sum(av => av.Slots), 700 AccessTypeName = enumAVOrdered.First().AccessTypeName, 701 Note = enumAVOrdered.First().Note 702 }; 703 } 704 else 705 { 706 pAV = lstAV.OrderByDescending(av => av.Slots).First(); 707 } 708 } 709 710 resultantAV = pAV; // out var 711 712 slotsAvailable = pAV.Slots; 713 676 714 //Subtract total slots current appointments take up. 677 715 slotsAvailable -= (from appt in this.Appointments.AppointmentTable.Values.Cast<CGAppointment>() 678 716 //If the resource is the same and the user selection overlaps, then... 679 where (sResource == appt.Resource && CalendarGrid.TimesOverlap(pAV s[0].StartTime, pAVs[0].EndTime, appt.StartTime, appt.EndTime))717 where (sResource == appt.Resource && CalendarGrid.TimesOverlap(pAV.StartTime, pAV.EndTime, appt.StartTime, appt.EndTime)) 680 718 // if appt starttime is before avail start time, only count against the avail starting from the availability start time 681 let startTimeToCountAgainstBlock = appt.StartTime < pAV s[0].StartTime ? pAVs[0].StartTime : appt.StartTime719 let startTimeToCountAgainstBlock = appt.StartTime < pAV.StartTime ? pAV.StartTime : appt.StartTime 682 720 // if appt endtime is after the avail ends, only count against the avail up to where the avail ends 683 let endTimeToCountAgainstBlock = appt.EndTime > pAV s[0].EndTime ? pAVs[0].EndTime : appt.EndTime721 let endTimeToCountAgainstBlock = appt.EndTime > pAV.EndTime ? pAV.EndTime : appt.EndTime 684 722 // theoretical minutes per slot for the availability 685 let minPerSlot = (pAV s[0].EndTime - pAVs[0].StartTime).TotalMinutes / pAVs[0].Slots723 let minPerSlot = (pAV.EndTime - pAV.StartTime).TotalMinutes / pAV.Slots 686 724 // how many minutes does this appointment take away from the slot 687 725 let minPerAppt = (endTimeToCountAgainstBlock - startTimeToCountAgainstBlock).TotalMinutes … … 691 729 // add up SlotsConsumed to substract from slotsAvailable 692 730 .Sum(); 693 } 694 695 return (int)slotsAvailable; 731 732 //theoretical minutes per slot for the availability 733 double minPerSlot2 = (pAV.EndTime - pAV.StartTime).TotalMinutes / pAV.Slots; 734 735 //Convert it to the view's time scale. 736 effectiveSlotsAvailable = (minPerSlot2 / viewTimeScale) * slotsAvailable; 737 738 } 739 740 //round it down. 741 return (int)effectiveSlotsAvailable; 696 742 697 743 /* OLD ALGOTHRIM 2 -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs
r1104 r1106 410 410 { 411 411 bRetry = true; 412 _current.m_ConnectInfo.ChangeServerInfo(); 412 //I hate this, but this is how the library is designed. It throws an error if the user cancels. XXX: Won't fix library until BMX 4.0 port. 413 try { _current.m_ConnectInfo.ChangeServerInfo(); } 414 catch (Exception) 415 { 416 closeSplashDelegate(); 417 bRetry = false; 418 return false; //tell main that it's a no go. 419 } 413 420 } 414 421 else -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
r1097 r1106 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, 3 58);619 this.tvSchedules.Size = new System.Drawing.Size(128, 393); 620 620 this.tvSchedules.Sorted = true; 621 621 this.tvSchedules.TabIndex = 1; 622 622 this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect); 623 this.tvSchedules. Click += new System.EventHandler(this.tvSchedules_Click);623 this.tvSchedules.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvSchedules_NodeMouseClick); 624 624 this.tvSchedules.DoubleClick += new System.EventHandler(this.tvSchedules_DoubleClick); 625 this.tvSchedules.MouseEnter += new System.EventHandler(this.tvSchedules_MouseEnter); 625 626 // 626 627 // contextMenu1 … … 662 663 this.panelRight.Controls.Add(this.panelClip); 663 664 this.panelRight.Dock = System.Windows.Forms.DockStyle.Right; 664 this.panelRight.Location = new System.Drawing.Point(9 41, 0);665 this.panelRight.Location = new System.Drawing.Point(996, 0); 665 666 this.panelRight.Name = "panelRight"; 666 this.panelRight.Size = new System.Drawing.Size(128, 3 58);667 this.panelRight.Size = new System.Drawing.Size(128, 393); 667 668 this.panelRight.TabIndex = 3; 668 669 this.panelRight.Visible = false; … … 730 731 this.panelTop.Location = new System.Drawing.Point(128, 0); 731 732 this.panelTop.Name = "panelTop"; 732 this.panelTop.Size = new System.Drawing.Size(8 13, 24);733 this.panelTop.Size = new System.Drawing.Size(868, 24); 733 734 this.panelTop.TabIndex = 6; 734 735 // … … 737 738 this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right; 738 739 this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right; 739 this.dateTimePicker1.Location = new System.Drawing.Point(6 07, 0);740 this.dateTimePicker1.Location = new System.Drawing.Point(662, 0); 740 741 this.dateTimePicker1.Name = "dateTimePicker1"; 741 742 this.dateTimePicker1.Size = new System.Drawing.Size(206, 20); … … 760 761 this.panelCenter.Location = new System.Drawing.Point(136, 24); 761 762 this.panelCenter.Name = "panelCenter"; 762 this.panelCenter.Size = new System.Drawing.Size(8 02, 310);763 this.panelCenter.Size = new System.Drawing.Size(857, 345); 763 764 this.panelCenter.TabIndex = 7; 764 765 // … … 846 847 this.panelBottom.Controls.Add(this.statusBar1); 847 848 this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; 848 this.panelBottom.Location = new System.Drawing.Point(136, 3 34);849 this.panelBottom.Location = new System.Drawing.Point(136, 369); 849 850 this.panelBottom.Name = "panelBottom"; 850 this.panelBottom.Size = new System.Drawing.Size(8 02, 24);851 this.panelBottom.Size = new System.Drawing.Size(857, 24); 851 852 this.panelBottom.TabIndex = 8; 852 853 // … … 856 857 this.statusBar1.Location = new System.Drawing.Point(0, 0); 857 858 this.statusBar1.Name = "statusBar1"; 858 this.statusBar1.Size = new System.Drawing.Size(8 02, 24);859 this.statusBar1.Size = new System.Drawing.Size(857, 24); 859 860 this.statusBar1.SizingGrip = false; 860 861 this.statusBar1.TabIndex = 0; … … 864 865 this.splitter1.Location = new System.Drawing.Point(128, 24); 865 866 this.splitter1.Name = "splitter1"; 866 this.splitter1.Size = new System.Drawing.Size(8, 3 34);867 this.splitter1.Size = new System.Drawing.Size(8, 369); 867 868 this.splitter1.TabIndex = 9; 868 869 this.splitter1.TabStop = false; … … 871 872 // 872 873 this.splitter2.Dock = System.Windows.Forms.DockStyle.Right; 873 this.splitter2.Location = new System.Drawing.Point(9 38, 24);874 this.splitter2.Location = new System.Drawing.Point(993, 24); 874 875 this.splitter2.Name = "splitter2"; 875 this.splitter2.Size = new System.Drawing.Size(3, 3 34);876 this.splitter2.Size = new System.Drawing.Size(3, 369); 876 877 this.splitter2.TabIndex = 10; 877 878 this.splitter2.TabStop = false; … … 901 902 this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources"))); 902 903 this.calendarGrid1.SelectedAppointment = 0; 903 this.calendarGrid1.Size = new System.Drawing.Size(8 02, 310);904 this.calendarGrid1.Size = new System.Drawing.Size(857, 345); 904 905 this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); 905 906 this.calendarGrid1.TabIndex = 0; … … 914 915 // 915 916 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 916 this.ClientSize = new System.Drawing.Size(1 069, 358);917 this.ClientSize = new System.Drawing.Size(1124, 393); 917 918 this.Controls.Add(this.panelCenter); 918 919 this.Controls.Add(this.panelBottom); … … 946 947 private CGDocumentManager m_DocManager; 947 948 private int m_nSlots; 948 bool bSchedulesClicked = false;949 949 private ArrayList m_alSelectedTreeResourceArray = new ArrayList(); 950 950 private string m_sDocName; … … 1360 1360 } 1361 1361 1362 void UpdateStatusBar(DateTime dStart, DateTime dEnd, string sAccessType, string sAvailabilityMessage) 1363 { 1364 string sMsg = dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString(); 1365 if (m_nSlots > 0) 1366 { 1367 sMsg = sMsg + ": " + m_nSlots.ToString() + " slot"; 1368 sMsg = sMsg + ((m_nSlots > 1)?"s " : " "); 1369 sMsg = sMsg + "available"; 1370 if (sAccessType != "") 1371 { 1372 sMsg = sMsg + " for " + sAccessType; 1373 } 1374 sMsg = sMsg + "."; 1375 if (sAvailabilityMessage != "") 1376 { 1377 sMsg = sMsg + " Note: " + sAvailabilityMessage; 1378 } 1379 } 1362 void UpdateStatusBar(DateTime dStart, DateTime dEnd, CGAvailability av) 1363 { 1364 System.Text.StringBuilder sbMsg = new System.Text.StringBuilder(100); 1365 sbMsg.Append(dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString()); 1366 if (av != null && m_nSlots > 0) 1367 { 1368 sbMsg.Append(String.Format(" has {0} slot(s) available for {1}. ", m_nSlots.ToString(), av.AccessTypeName)); 1369 } 1380 1370 else 1381 1371 { 1382 sMsg += ": No appointment slots available."; 1383 } 1384 1385 this.statusBar1.Text = sMsg; 1372 sbMsg.Append(": No appointment slots available. "); 1373 } 1374 1375 if (av != null) 1376 { 1377 sbMsg.Append(String.Format("Source Block: {0} to {1} with {2} slot(s) of type {3}", 1378 av.StartTime.ToShortTimeString(), 1379 av.EndTime.ToShortTimeString(), 1380 av.Slots.ToString(), 1381 av.AccessTypeName)); 1382 1383 sbMsg.Append(". "); 1384 1385 if (av.Note.Trim().Length > 0) sbMsg.Append("Note: " + av.Note + "."); 1386 } 1387 1388 this.statusBar1.Text = sbMsg.ToString(); 1386 1389 } 1387 1390 … … 1475 1478 v.Activate(); 1476 1479 v.dateTimePicker1.Value = dDate; 1480 v.RequestRefreshGrid(); 1477 1481 return; 1478 1482 } … … 1507 1511 try 1508 1512 { 1509 doc.OnOpenDocument( );1513 doc.OnOpenDocument(dDate); 1510 1514 } 1511 1515 … … 1638 1642 try 1639 1643 { 1640 doc.OnOpenDocument( );1644 doc.OnOpenDocument(DateTime.Today); 1641 1645 } 1642 1646 catch (Exception ex) … … 2046 2050 //SMH: Takes too long to do. 2047 2051 //this.Document.RefreshDocument(); 2048 string sAccessType = "";2049 string sAvailabilityMessage = ""; 2050 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);2052 CGAvailability resultantAvail; 2053 2054 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, this.calendarGrid1.TimeScale, out resultantAvail); 2051 2055 2052 2056 if (m_nSlots < 1) … … 2155 2159 } 2156 2160 2157 TimeSpan tsDuration = dEnd - dStart;2158 int nDuration = (int) tsDuration.TotalMinutes;2159 Debug.Assert(nDuration > 0);2160 2161 2162 2161 //Sam: takes too long. Remove this call; deal with the issue of concurrent appointments another way. 2163 2162 //this.Document.RefreshDocument(); 2164 string sAccessType = ""; 2165 string sAvailabilityMessage = ""; 2166 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage); 2163 CGAvailability resultantAvail; 2164 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, this.calendarGrid1.TimeScale, out resultantAvail); 2167 2165 2168 2166 if (m_nSlots < 1) … … 2192 2190 dAppt.DocManager = this.m_DocManager; 2193 2191 string sNote = ""; 2194 dAppt.InitializePage(dPat.PatientIEN, dStart, nDuration, sResource, sNote);2192 dAppt.InitializePage(dPat.PatientIEN, dStart, dEnd, sResource, sNote, nAccessTypeID); 2195 2193 2196 2194 if (dAppt.ShowDialog(this) == DialogResult.Cancel) … … 2199 2197 } 2200 2198 2201 CGAppointment appt = new CGAppointment(); 2199 CGAppointment appt = dAppt.Appointment; 2200 2201 // old way of making an appointment 2202 /*new CGAppointment(); 2202 2203 appt.PatientID = Convert.ToInt32(dPat.PatientIEN); 2203 2204 appt.PatientName = dPat.PatientName; … … 2208 2209 appt.HealthRecordNumber = dPat.HealthRecordNumber; 2209 2210 appt.AccessTypeID = nAccessTypeID; 2211 */ 2210 2212 2211 2213 //Call Document to add a new appointment. Document adds appointment to CGAppointments array. 2212 2214 this.Document.CreateAppointment(appt); 2215 2216 //Experimental now. 2217 if (dAppt.PrintAppointmentSlip) 2218 { 2219 System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument(); 2220 pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(appt, e); 2221 pd.Print(); 2222 } 2213 2223 2214 2224 //Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments … … 2505 2515 calendarGrid1.Focus(); 2506 2516 } 2517 2518 /// <summary> 2519 /// If mouse enters the Tree Section, check if the grid is on the active form first before stealing the focus 2520 /// </summary> 2521 /// <param name="sender"></param> 2522 /// <param name="e"></param> 2523 private void tvSchedules_MouseEnter(object sender, EventArgs e) 2524 { 2525 if (GetActiveWindow() == this.Handle) 2526 tvSchedules.Focus(); 2527 } 2507 2528 2508 2529 private void CGView_Load(object sender, System.EventArgs e) … … 2520 2541 //Show the Form 2521 2542 this.Activate(); 2543 2544 //Set focus on the calendar grid 2545 this.calendarGrid1.Focus(); 2522 2546 } 2523 2547 … … 2592 2616 } 2593 2617 2594 private void tvSchedules_Click(object sender, System.EventArgs e) 2595 { 2596 bSchedulesClicked = true; 2597 } 2618 2598 2619 2599 2620 private void tvSchedules_DoubleClick(object sender, System.EventArgs e) … … 2636 2657 } 2637 2658 2659 2638 2660 private void tvSchedules_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) 2639 { 2640 if (bSchedulesClicked == false) 2641 return; 2642 bSchedulesClicked = false; 2643 2661 { 2644 2662 m_alSelectedTreeResourceArray = new ArrayList(); 2645 2663 string sResource = e.Node.FullPath; … … 2662 2680 } 2663 2681 2682 /// <summary> 2683 /// Makes sure that the node gets selected no matter where we click. 2684 /// Incidentally, Invokes AfterSelect event. 2685 /// </summary> 2686 /// <param name="sender"></param> 2687 /// <param name="e"></param> 2688 private void tvSchedules_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) 2689 { 2690 e.Node.TreeView.SelectedNode = e.Node; 2691 } 2692 2693 /// <summary> 2694 /// Useless code now... Good place to test something. 2695 /// </summary> 2696 /// <param name="sender"></param> 2697 /// <param name="e"></param> 2664 2698 private void mnuTest1_Click(object sender, System.EventArgs e) 2665 2699 { … … 2718 2752 private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e) 2719 2753 { 2720 string sAccessType = ""; 2721 string sAvailabilityMessage = ""; 2722 m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage); 2723 UpdateStatusBar(e.StartTime, e.EndTime, sAccessType, sAvailabilityMessage); 2754 CGAvailability resultantAvail; 2755 m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail); 2756 UpdateStatusBar(e.StartTime, e.EndTime, resultantAvail); 2724 2757 } 2725 2758 … … 2758 2791 2759 2792 //20040909 Cherokee Replaced this block with following 2760 string sAccessType = "";2761 string sAvailabilityMessage = "";2762 2793 // if (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) < 1) 2763 2794 // { … … 2775 2806 bModSchedule = (bool) this.m_htModifySchedule[e.Resource.ToString()]; 2776 2807 } 2777 bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0); 2808 CGAvailability resultantAvail; 2809 bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail) > 0); 2778 2810 if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) )) 2779 2811 { … … 2966 2998 try 2967 2999 { 2968 string sAccessType = "";2969 string sAvailabilityMessage = "";2970 3000 bool bSlotsAvailable; 2971 3001 bool bOverbook; … … 2990 3020 bOverbook = (bool) this.m_htOverbook[e.Resource.ToString()]; 2991 3021 bModSchedule = (bool) this.m_htModifySchedule[e.Resource.ToString()]; 2992 bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0); 3022 CGAvailability resultantAvail; 3023 3024 bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, this.calendarGrid1.TimeScale, out resultantAvail) > 0); 2993 3025 2994 3026 if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) )) … … 3339 3371 } 3340 3372 3373 3374 3375 3376 3341 3377 3342 3378 -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CalendarGrid.cs
r1095 r1106 24 24 private bool m_bDrawWalkIns = true; 25 25 private bool m_bGridEnter; 26 private bool m_bInitialUpdate;26 //private bool m_bInitialUpdate; 27 27 private bool m_bMouseDown; 28 28 private bool m_bScroll; … … 49 49 private StringFormat m_sfRight; 50 50 private ArrayList m_sResourcesArray; 51 private Timer m_Timer; // Time er used in Drag and Drop Operations51 private Timer m_Timer; // Timer used in Drag and Drop Operations 52 52 private ToolTip m_toolTip; 53 53 private const int WM_HSCROLL = 0x114; // Horizontal Scrolling Windows Message 54 54 private const int WM_VSCROLL = 0x115; // Vertical Scrolling Windows Message 55 55 private const int WM_MOUSEWHEEL = 0x20a; // Windows Mouse Scrolling Message 56 private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); 57 56 58 57 59 public delegate void CGAppointmentChangedHandler(object sender, CGAppointmentChangedArgs e); … … 90 92 this.m_sfHour.LineAlignment = StringAlignment.Center; 91 93 this.m_sfHour.Alignment = StringAlignment.Far; 92 this.m_bInitialUpdate = false;94 // this.m_bInitialUpdate = false; 93 95 } 94 96 … … 113 115 { 114 116 this.m_Timer.Stop(); 117 this.m_Timer.Tick -= new EventHandler(this.tickEventHandler); 115 118 this.m_Timer.Dispose(); 116 119 this.m_Timer = null; … … 232 235 private void CalendarGrid_MouseDown(object sender, MouseEventArgs e) 233 236 { 237 //watch.Restart(); 234 238 if (e.Button == MouseButtons.Left) 235 239 { … … 247 251 private void CalendarGrid_MouseMove(object Sender, MouseEventArgs e) 248 252 { 253 //test 254 //System.Diagnostics.Debug.Write(watch.ElapsedMilliseconds + "\n"); 255 //test 256 257 //if the left mouse button is down and we are moving the mouse... 249 258 if (this.m_bMouseDown) 250 259 { 260 //if Y axis is outside the top or bottom 251 261 if ((e.Y >= base.ClientRectangle.Bottom) || (e.Y <= base.ClientRectangle.Top)) 252 262 { 263 //start auto scrolling. m_bScrollDown decides whether we scroll up or down. 253 264 this.m_bScrollDown = e.Y >= base.ClientRectangle.Bottom; 254 } 265 AutoDragStart(); 266 } 267 268 //if Y axis within client rectagle, stop dragging (whether you started or not) 255 269 if ((e.Y < base.ClientRectangle.Bottom) && (e.Y > base.ClientRectangle.Top)) 256 270 { 257 bool bAutoDrag = this.m_bAutoDrag;271 AutoDragStop(); 258 272 } 259 273 if (this.m_bSelectingRange) … … 278 292 else 279 293 { 294 //test 295 AutoDragStop(); //is this needed? 296 //test 280 297 int y = e.Y - base.AutoScrollPosition.Y; 281 298 int x = e.X - base.AutoScrollPosition.X; … … 348 365 { 349 366 this.DrawGrid(e.Graphics); 367 /* 350 368 if (!this.m_bInitialUpdate) 351 369 { … … 354 372 this.m_bInitialUpdate = true; 355 373 } 374 */ 356 375 } 357 376 } … … 602 621 if (this.m_sResourcesArray.Count > 0) 603 622 { 623 //IMP 624 //this is the place where we the selected cells are drawn in Light Light Blue. 625 //IMP 604 626 if (this.m_selectedRange.CellIsInRange(cellFromRowCol)) 605 627 { 606 628 g.FillRectangle(Brushes.Aquamarine, r); 629 //g.FillRectangle(Brushes.AntiqueWhite, r); 607 630 } 608 631 else … … 1142 1165 } 1143 1166 1167 /// <summary> 1168 /// Handles scrolling when the mouse button is down 1169 /// </summary> 1170 /// <param name="o"></param> 1171 /// <param name="e"></param> 1144 1172 private void tickEventHandler(object o, EventArgs e) 1145 1173 { 1174 //if there are still WM_TIME messages in the Queue after the timer is dead, don't do anything. 1175 if (this.m_Timer == null) return; 1176 1146 1177 Point point = new Point(base.AutoScrollPosition.X, base.AutoScrollPosition.Y); 1147 1178 int x = point.X; 1148 1179 int num = point.Y * -1; 1149 num = this.m_bScrollDown ? (num + 5) : (num - 5);1180 num = this.m_bScrollDown ? (num + 2) : (num - 2); 1150 1181 point.Y = num; 1151 1182 base.AutoScrollPosition = point; -
Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj
r1098 r1106 302 302 </Compile> 303 303 <Compile Include="Options.cs" /> 304 <Compile Include="Patient.cs" /> 304 305 <Compile Include="Printing.cs" /> 305 306 <Compile Include="UCPatientAppts.cs"> -
Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln
r1099 r1106 11 11 EndGlobalSection 12 12 GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.ActiveCfg = Release|Any CPU14 {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.Build.0 = Release|Any CPU13 {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 15 {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 16 {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Release|Any CPU.Build.0 = Release|Any CPU 17 {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.ActiveCfg = Release|Any CPU18 {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Release|Any CPU17 {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 18 {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 19 {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 20 {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.Build.0 = Release|Any CPU -
Scheduling/trunk/cs/bsdx0200GUISourceCode/CustomPrinting.cs
r1091 r1106 112 112 } 113 113 } 114 114 115 /// <summary> 116 /// Prints a single appointment slip to give to the patient 117 /// </summary> 118 /// <param name="appt">The Appointment to print</param> 119 /// <param name="e">PrintPageEventArgs from PrintDocument Print handler</param> 120 public virtual void PrintAppointmentSlip(CGAppointment appt, PrintPageEventArgs e) 121 { 122 Rectangle printArea = e.MarginBounds; 123 Graphics g = e.Graphics; 124 StringFormat sf = new StringFormat(); 125 sf.Alignment = StringAlignment.Center; //for title 126 Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title 127 Font fBody = new Font(FontFamily.GenericSerif, 12); 128 string s = "Appointment Reminder Slip"; 129 g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title 130 131 // move down 132 int titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height; 133 printArea.Y += titleHeight; 134 printArea.Height -= titleHeight; 135 136 // draw underline 137 g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y)); 138 printArea.Y += 15; 139 printArea.Height -= 15; 140 141 142 143 } 144 145 115 146 /// <summary> 116 147 /// Print Letter to be given or mailed to the patient -
Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.cs
r913 r1106 63 63 private Label label7; 64 64 private TextBox txtCountry; 65 private CheckBox chkPrint; 65 66 private IContainer components; 66 67 … … 125 126 this.dsPatientApptDisplay2BindingSource = new System.Windows.Forms.BindingSource(this.components); 126 127 this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2(); 128 this.chkPrint = new System.Windows.Forms.CheckBox(); 127 129 this.tabControl1.SuspendLayout(); 128 130 this.tabAppointment.SuspendLayout(); … … 532 534 // panel1 533 535 // 536 this.panel1.Controls.Add(this.chkPrint); 534 537 this.panel1.Controls.Add(this.cmdCancel); 535 538 this.panel1.Controls.Add(this.cmdOK); … … 573 576 this.dsPatientApptDisplay2.DataSetName = "dsPatientApptDisplay2"; 574 577 this.dsPatientApptDisplay2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; 578 // 579 // chkPrint 580 // 581 this.chkPrint.AutoSize = true; 582 this.chkPrint.Location = new System.Drawing.Point(13, 14); 583 this.chkPrint.Name = "chkPrint"; 584 this.chkPrint.Size = new System.Drawing.Size(144, 17); 585 this.chkPrint.TabIndex = 2; 586 this.chkPrint.Text = "Print Appointment Letter"; 587 this.chkPrint.UseVisualStyleBackColor = true; 575 588 // 576 589 // DAppointPage … … 596 609 this.groupBox2.PerformLayout(); 597 610 this.panel1.ResumeLayout(false); 611 this.panel1.PerformLayout(); 598 612 ((System.ComponentModel.ISupportInitialize)(this.patientApptsBindingSource)).EndInit(); 599 613 ((System.ComponentModel.ISupportInitialize)(this.dsPatientApptDisplay2BindingSource)).EndInit(); … … 611 625 private string m_sPatientHRN; 612 626 private string m_sPatientIEN; 613 private string m_sPatientDOB;627 private DateTime m_dPatientDOB; 614 628 private string m_sPatientPID; 615 629 … … 623 637 private string m_sNote; 624 638 private DateTime m_dStartTime; 639 private DateTime m_dEndTime; 625 640 private int m_nDuration; 626 641 private string m_sClinic; … … 629 644 private string m_sEmail; 630 645 private string m_sCountry; 646 private int m_iAccessTypeID; 631 647 632 648 #endregion //fields … … 636 652 public void InitializePage(CGAppointment a) 637 653 { 638 InitializePage(a.PatientID.ToString(), a.StartTime, a. Duration, "", a.Note);654 InitializePage(a.PatientID.ToString(), a.StartTime, a.EndTime, "", a.Note, a.AccessTypeID); 639 655 } 640 656 641 public void InitializePage(string sPatientIEN, DateTime dStart, int nDuration, string sClinic, string sNote)657 public void InitializePage(string sPatientIEN, DateTime dStart, DateTime dEnd, string sClinic, string sNote, int iAccessTypeID) 642 658 { 643 659 m_dStartTime = dStart; 644 m_nDuration = nDuration; 660 m_dEndTime = dEnd; 661 m_nDuration = (int)(dEnd - dStart).TotalMinutes; 662 m_iAccessTypeID = iAccessTypeID; 645 663 m_sClinic = sClinic; 646 664 m_sPatientIEN = sPatientIEN; … … 659 677 this.m_sPatientIEN = r["IEN"].ToString(); 660 678 this.m_sPatientPID = r["PID"].ToString(); 661 DateTime dDob =(DateTime) r["DOB"]; //what if it's null? 662 this.m_sPatientDOB = dDob.ToShortDateString(); 679 this.m_dPatientDOB = (DateTime) r["DOB"]; 663 680 this.m_sStreet = r["STREET"].ToString(); 664 681 this.m_sCity = r["CITY"].ToString(); … … 695 712 696 713 txtCity.Text = this.m_sCity; 697 txtDOB.Text = this.m_ sPatientDOB;714 txtDOB.Text = this.m_dPatientDOB.ToShortDateString(); 698 715 txtHRN.Text = this.m_sPatientHRN; 699 716 txtNote.Text = this.m_sNote; … … 767 784 } 768 785 786 public bool PrintAppointmentSlip 787 { 788 get { return chkPrint.Checked; } 789 } 790 791 public CGAppointment Appointment 792 { 793 get 794 { 795 Patient pt = new Patient 796 { 797 DFN = Int32.Parse(m_sPatientIEN), 798 Name = m_sPatientName, 799 DOB = m_dPatientDOB, 800 ID = m_sPatientPID, 801 HRN = m_sPatientHRN, 802 Appointments = null, //for now 803 Street = m_sStreet, 804 City = m_sCity, 805 State = m_sState, 806 Zip = m_sZip, 807 Country = m_sCountry, 808 Email = m_sEmail, 809 HomePhone = m_sPhoneHome, 810 WorkPHone = m_sPhoneOffice, 811 CellPhone = m_sPhoneCell 812 }; 813 814 CGAppointment appt = new CGAppointment() 815 { 816 PatientID = Convert.ToInt32(m_sPatientIEN), 817 PatientName = m_sPatientName, 818 StartTime = m_dStartTime, 819 EndTime = m_dEndTime, 820 Resource = m_sClinic, 821 Note = m_sNote, 822 HealthRecordNumber = m_sPatientHRN, 823 AccessTypeID = m_iAccessTypeID, 824 Patient = pt 825 }; 826 827 return appt; 828 } 829 } 769 830 #endregion //Properties 770 831 -
Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.resx
r913 r1106 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="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">120 <metadata name="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 121 <value>412, 17</value> 122 122 </metadata> 123 <metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">123 <metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 124 <value>179, 17</value> 125 125 </metadata> 126 <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version= 2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">126 <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 127 127 <value>17, 17</value> 128 128 </metadata> -
Scheduling/trunk/cs/bsdx0200GUISourceCode/DApptSearch.cs
r1097 r1106 53 53 private ColumnHeader colDOW; 54 54 private ColumnHeader colID; 55 private Label lblMessage; 55 56 56 57 private System.ComponentModel.IContainer components; … … 312 313 this.colSlots = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 313 314 this.colAccessType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 315 this.lblMessage = new System.Windows.Forms.Label(); 314 316 this.panel1.SuspendLayout(); 315 317 this.pnlDescription.SuspendLayout(); … … 323 325 // panel1 324 326 // 327 this.panel1.Controls.Add(this.lblMessage); 325 328 this.panel1.Controls.Add(this.cmdSearch); 326 329 this.panel1.Controls.Add(this.cmdCancel); … … 334 337 // cmdSearch 335 338 // 336 this.cmdSearch.Location = new System.Drawing.Point( 536, 8);339 this.cmdSearch.Location = new System.Drawing.Point(33, 6); 337 340 this.cmdSearch.Name = "cmdSearch"; 338 341 this.cmdSearch.Size = new System.Drawing.Size(72, 24); … … 344 347 // 345 348 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 346 this.cmdCancel.Location = new System.Drawing.Point( 616, 8);349 this.cmdCancel.Location = new System.Drawing.Point(828, 8); 347 350 this.cmdCancel.Name = "cmdCancel"; 348 351 this.cmdCancel.Size = new System.Drawing.Size(64, 24); … … 353 356 // 354 357 this.btnAccept.DialogResult = System.Windows.Forms.DialogResult.OK; 355 this.btnAccept.Location = new System.Drawing.Point(1 28, 8);358 this.btnAccept.Location = new System.Drawing.Point(135, 8); 356 359 this.btnAccept.Name = "btnAccept"; 357 360 this.btnAccept.Size = new System.Drawing.Size(176, 24); … … 436 439 this.dtEnd.Size = new System.Drawing.Size(200, 20); 437 440 this.dtEnd.TabIndex = 65; 441 this.dtEnd.ValueChanged += new System.EventHandler(this.dtEnd_ValueChanged); 438 442 // 439 443 // dtStart … … 443 447 this.dtStart.Size = new System.Drawing.Size(200, 20); 444 448 this.dtStart.TabIndex = 64; 449 this.dtStart.ValueChanged += new System.EventHandler(this.dtStart_ValueChanged); 445 450 // 446 451 // label3 … … 672 677 this.colAccessType.Width = 101; 673 678 // 679 // lblMessage 680 // 681 this.lblMessage.AutoSize = true; 682 this.lblMessage.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 683 this.lblMessage.ForeColor = System.Drawing.Color.Red; 684 this.lblMessage.Location = new System.Drawing.Point(337, 16); 685 this.lblMessage.Name = "lblMessage"; 686 this.lblMessage.Size = new System.Drawing.Size(0, 16); 687 this.lblMessage.TabIndex = 3; 688 // 674 689 // DApptSearch 675 690 // … … 685 700 this.Text = "Find Clinic Availability"; 686 701 this.panel1.ResumeLayout(false); 702 this.panel1.PerformLayout(); 687 703 this.pnlDescription.ResumeLayout(false); 688 704 this.grpDescription.ResumeLayout(false); … … 703 719 //Tell user we are processing 704 720 this.Cursor = Cursors.WaitCursor; 705 721 this.lblMessage.Text = String.Empty; 722 706 723 //Get the control data into local vars 707 724 UpdateDialogData(false); … … 879 896 lstResults.Items.Clear(); //empty it from old data 880 897 881 //if (items.Length == 0) lstResults.Items.Add(new ListViewItem(new string[] { "", "", "", "" , "", "No Slots found", "", "" })); // no results882 898 if (items.Length > 0) lstResults.Items.AddRange(items); // add new data 899 else this.lblMessage.Text = "No available Appointment Slots Found!"; 883 900 884 901 lstResults.EndUpdate(); // ok done adding items, draw now. … … 904 921 } 905 922 906 private void grdResult_DoubleClick(object sender, System.EventArgs e) 907 { 908 /* 909 if (lstResults.DataSource == null) 910 return; 911 912 DataGridViewCell dgCell; 913 dgCell = this.grdResult.CurrentCell; 914 this.m_sSelectedResource = grdResult.SelectedRows[0].Cells[2].ToString(); 915 this.m_sSelectedDate = (DateTime)grdResult.SelectedRows[0].Cells[0].Value; 916 this.DialogResult = DialogResult.OK; 917 this.Close(); 918 */ 919 } 920 921 private void grdResult_CurrentCellChanged(object sender, System.EventArgs e) 922 { 923 /* 924 DataGridViewCell dgCell; 925 dgCell = this.grdResult.CurrentCell; 926 */ 927 } 928 929 /// <summary> 930 /// BAAAAAAAAAAAAAAAAAD. Use a shared method instead. 931 /// </summary> 932 /// <param name="sender"></param> 933 /// <param name="e"></param> 923 934 924 private void lstResults_DoubleClick(object sender, EventArgs e) 935 925 { 936 btnAccept_Click(sender, e);926 ProcessChoice(sender, e); 937 927 } 938 928 939 929 private void btnAccept_Click(object sender, EventArgs e) 930 { 931 ProcessChoice(sender, e); 932 } 933 934 /// <summary> 935 /// Shared method to process a user's choice 936 /// </summary> 937 /// <param name="s">sender</param> 938 /// <param name="e">EventArgs</param> 939 private void ProcessChoice(object s, EventArgs e) 940 940 { 941 941 if (lstResults.SelectedIndices.Count == 0) 942 942 { 943 943 this.DialogResult = DialogResult.None; 944 lblMessage.Text = "No Appointment Slot selected!"; 944 945 return; 945 946 } … … 952 953 } 953 954 955 /// <summary> 956 /// Adjust start date based on end date. 957 /// </summary> 958 /// <param name="sender"></param> 959 /// <param name="e"></param> 960 private void dtStart_ValueChanged(object sender, EventArgs e) 961 { 962 if (dtEnd.Value < dtStart.Value) dtEnd.Value = dtStart.Value; 963 } 964 965 /// <summary> 966 /// Adjust end date based on start date. 967 /// </summary> 968 /// <param name="sender"></param> 969 /// <param name="e"></param> 970 private void dtEnd_ValueChanged(object sender, EventArgs e) 971 { 972 if (dtStart.Value > dtEnd.Value) dtStart.Value = dtEnd.Value; 973 } 974 954 975 #endregion Event Handlers 955 976 956 977 #region Properties 957 958 978 959 979 /// <summary> … … 966 986 967 987 #endregion Properties 988 989 968 990 } 969 991 }
Note:
See TracChangeset
for help on using the changeset viewer.