Changeset 1106 for Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs
- Timestamp:
- Mar 20, 2011, 3:22:11 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.