- Timestamp:
- Apr 12, 2011, 2:13:18 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGView.cs
r1131 r1140 1 1 using System; 2 2 using System.Collections; 3 using System.Collections.Generic; 3 4 using System.ComponentModel; 4 5 using System.Windows.Forms; … … 106 107 private MenuItem menuItem12; 107 108 private MenuItem mnuRefresh; 109 private MenuItem ctxCalGridMkRadAppt; 110 private MenuItem ctxCalGridCancelRadAppt; 108 111 private IContainer components; 109 112 … … 246 249 this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu(); 247 250 this.ctxCalGridAdd = new System.Windows.Forms.MenuItem(); 251 this.ctxCalGridMkRadAppt = new System.Windows.Forms.MenuItem(); 248 252 this.ctxCalGridEdit = new System.Windows.Forms.MenuItem(); 249 253 this.ctxCalGridDelete = new System.Windows.Forms.MenuItem(); 254 this.ctxCalGridCancelRadAppt = new System.Windows.Forms.MenuItem(); 250 255 this.ctxCalGridCheckIn = new System.Windows.Forms.MenuItem(); 251 256 this.ctxCalGridUndoCheckin = new System.Windows.Forms.MenuItem(); … … 647 652 this.tvSchedules.Location = new System.Drawing.Point(0, 0); 648 653 this.tvSchedules.Name = "tvSchedules"; 649 this.tvSchedules.Size = new System.Drawing.Size(128, 359);654 this.tvSchedules.Size = new System.Drawing.Size(128, 254); 650 655 this.tvSchedules.Sorted = true; 651 656 this.tvSchedules.TabIndex = 1; … … 716 721 this.panelRight.Location = new System.Drawing.Point(996, 0); 717 722 this.panelRight.Name = "panelRight"; 718 this.panelRight.Size = new System.Drawing.Size(128, 359);723 this.panelRight.Size = new System.Drawing.Size(128, 254); 719 724 this.panelRight.TabIndex = 3; 720 725 this.panelRight.Visible = false; … … 812 817 this.panelCenter.Location = new System.Drawing.Point(136, 24); 813 818 this.panelCenter.Name = "panelCenter"; 814 this.panelCenter.Size = new System.Drawing.Size(857, 311);819 this.panelCenter.Size = new System.Drawing.Size(857, 206); 815 820 this.panelCenter.TabIndex = 7; 816 821 // … … 819 824 this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { 820 825 this.ctxCalGridAdd, 826 this.ctxCalGridMkRadAppt, 821 827 this.ctxCalGridEdit, 822 828 this.ctxCalGridDelete, 829 this.ctxCalGridCancelRadAppt, 823 830 this.ctxCalGridCheckIn, 824 831 this.ctxCalGridUndoCheckin, … … 838 845 this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click); 839 846 // 847 // ctxCalGridMkRadAppt 848 // 849 this.ctxCalGridMkRadAppt.Index = 1; 850 this.ctxCalGridMkRadAppt.Text = "Make Radiology Appointment"; 851 this.ctxCalGridMkRadAppt.Click += new System.EventHandler(this.ctxCalGridMkRadAppt_Click); 852 // 840 853 // ctxCalGridEdit 841 854 // 842 this.ctxCalGridEdit.Index = 1;855 this.ctxCalGridEdit.Index = 2; 843 856 this.ctxCalGridEdit.Text = "Edit Appointment"; 844 857 this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click); … … 846 859 // ctxCalGridDelete 847 860 // 848 this.ctxCalGridDelete.Index = 2;861 this.ctxCalGridDelete.Index = 3; 849 862 this.ctxCalGridDelete.Text = "Cancel Appointment"; 850 863 this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click); 851 864 // 865 // ctxCalGridCancelRadAppt 866 // 867 this.ctxCalGridCancelRadAppt.Index = 4; 868 this.ctxCalGridCancelRadAppt.Text = "Cancel Radiology Appointment"; 869 // 852 870 // ctxCalGridCheckIn 853 871 // 854 this.ctxCalGridCheckIn.Index = 3;872 this.ctxCalGridCheckIn.Index = 5; 855 873 this.ctxCalGridCheckIn.Text = "Check In Patient"; 856 874 this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click); … … 858 876 // ctxCalGridUndoCheckin 859 877 // 860 this.ctxCalGridUndoCheckin.Index = 4;878 this.ctxCalGridUndoCheckin.Index = 6; 861 879 this.ctxCalGridUndoCheckin.Text = "&Undo Check In"; 862 880 this.ctxCalGridUndoCheckin.Click += new System.EventHandler(this.ctxCalGridUndoCheckin_Click); … … 864 882 // menuItem2 865 883 // 866 this.menuItem2.Index = 5;884 this.menuItem2.Index = 7; 867 885 this.menuItem2.Text = "-"; 868 886 // 869 887 // ctxCalGridNoShow 870 888 // 871 this.ctxCalGridNoShow.Index = 6;889 this.ctxCalGridNoShow.Index = 8; 872 890 this.ctxCalGridNoShow.Text = "Mark as No Show"; 873 891 this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click); … … 875 893 // ctxCalGridNoShowUndo 876 894 // 877 this.ctxCalGridNoShowUndo.Index = 7;895 this.ctxCalGridNoShowUndo.Index = 9; 878 896 this.ctxCalGridNoShowUndo.Text = "Undo NoShow"; 879 897 this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click); … … 881 899 // menuItem9 882 900 // 883 this.menuItem9.Index = 8;901 this.menuItem9.Index = 10; 884 902 this.menuItem9.Text = "-"; 885 903 // 886 904 // ctxCalGridWalkin 887 905 // 888 this.ctxCalGridWalkin.Index = 9;906 this.ctxCalGridWalkin.Index = 11; 889 907 this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment"; 890 908 this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click); … … 892 910 // menuItem10 893 911 // 894 this.menuItem10.Index = 1 0;912 this.menuItem10.Index = 12; 895 913 this.menuItem10.Text = "-"; 896 914 // 897 915 // ctxCalGridReprintApptSlip 898 916 // 899 this.ctxCalGridReprintApptSlip.Index = 1 1;917 this.ctxCalGridReprintApptSlip.Index = 13; 900 918 this.ctxCalGridReprintApptSlip.Text = "&Reprint Appointment Slip"; 901 919 this.ctxCalGridReprintApptSlip.Click += new System.EventHandler(this.ctxCalGridReprintApptSlip_Click); … … 905 923 this.panelBottom.Controls.Add(this.statusBar1); 906 924 this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; 907 this.panelBottom.Location = new System.Drawing.Point(136, 335);925 this.panelBottom.Location = new System.Drawing.Point(136, 230); 908 926 this.panelBottom.Name = "panelBottom"; 909 927 this.panelBottom.Size = new System.Drawing.Size(857, 24); … … 923 941 this.splitter1.Location = new System.Drawing.Point(128, 24); 924 942 this.splitter1.Name = "splitter1"; 925 this.splitter1.Size = new System.Drawing.Size(8, 335);943 this.splitter1.Size = new System.Drawing.Size(8, 230); 926 944 this.splitter1.TabIndex = 9; 927 945 this.splitter1.TabStop = false; … … 932 950 this.splitter2.Location = new System.Drawing.Point(993, 24); 933 951 this.splitter2.Name = "splitter2"; 934 this.splitter2.Size = new System.Drawing.Size(3, 335);952 this.splitter2.Size = new System.Drawing.Size(3, 230); 935 953 this.splitter2.TabIndex = 10; 936 954 this.splitter2.TabStop = false; … … 955 973 this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources"))); 956 974 this.calendarGrid1.SelectedAppointment = 0; 957 this.calendarGrid1.Size = new System.Drawing.Size(857, 311);975 this.calendarGrid1.Size = new System.Drawing.Size(857, 206); 958 976 this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); 959 977 this.calendarGrid1.TabIndex = 0; … … 968 986 // 969 987 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 970 this.ClientSize = new System.Drawing.Size(1124, 359);988 this.ClientSize = new System.Drawing.Size(1124, 254); 971 989 this.Controls.Add(this.panelCenter); 972 990 this.Controls.Add(this.panelBottom); … … 1289 1307 private void ctxCalendarGrid_Popup(object sender, System.EventArgs e) 1290 1308 { 1309 bool bEditAppointments = (EditAppointmentEnabled() && (calendarGrid1.SelectedAppointment > 0)) ; 1310 1311 if (IsThisARadiologyResource())//this is a radiology resource 1312 { 1313 ctxCalGridAdd.Visible = false; 1314 ctxCalGridDelete.Visible = false; 1315 ctxCalGridEdit.Visible = false; 1316 ctxCalGridCheckIn.Visible = false; 1317 ctxCalGridNoShow.Visible = false; 1318 ctxCalGridNoShowUndo.Visible = false; 1319 ctxCalGridWalkin.Visible = false; 1320 ctxCalGridUndoCheckin.Visible = false; 1321 1322 ctxCalGridMkRadAppt.Visible = true; 1323 ctxCalGridCancelRadAppt.Visible = true; 1324 1325 1326 } 1327 1328 else // this is a normal resource 1329 { 1330 ctxCalGridAdd.Visible = true; 1331 ctxCalGridDelete.Visible = true; 1332 ctxCalGridEdit.Visible = true; 1333 ctxCalGridCheckIn.Visible = true; 1334 ctxCalGridNoShow.Visible = true; 1335 ctxCalGridNoShowUndo.Visible = true; 1336 ctxCalGridWalkin.Visible = true; 1337 ctxCalGridUndoCheckin.Visible = true; 1338 1339 ctxCalGridMkRadAppt.Visible = false; 1340 ctxCalGridCancelRadAppt.Visible = false; 1341 } 1342 1291 1343 //Toggle availability of make, edit, checkin and delete appointments 1292 1344 //based on whether appropriate element is selected. 1293 1345 ctxCalGridAdd.Enabled = AddAppointmentEnabled(); 1294 bool bEditAppointments = (EditAppointmentEnabled() && (calendarGrid1.SelectedAppointment > 0)) ;1346 1295 1347 ctxCalGridDelete.Enabled = bEditAppointments; 1296 1348 ctxCalGridEdit.Enabled = bEditAppointments; … … 1299 1351 ctxCalGridNoShowUndo.Enabled = !NoShowEnabled() && calendarGrid1.SelectedAppointment > 0; 1300 1352 ctxCalGridWalkin.Enabled = ctxCalGridAdd.Enabled; 1301 //smh new code1302 1353 ctxCalGridReprintApptSlip.Enabled = bEditAppointments; 1303 1354 ctxCalGridUndoCheckin.Enabled = UndoCheckinEnabled(); 1304 //end new code 1355 1356 //if the rad ones are visible, then these apply 1357 ctxCalGridMkRadAppt.Enabled = !bEditAppointments; 1358 ctxCalGridCancelRadAppt.Enabled = bEditAppointments; 1305 1359 } 1306 1360 … … 1357 1411 #region Methods 1358 1412 1413 private bool IsThisARadiologyResource() 1414 { 1415 // I don't like this logic!!! 1416 if (this.calendarGrid1.SelectedRange.Cells.CellCount < 1 && this.calendarGrid1.SelectedAppointment < 1) 1417 return false; 1418 if (this.calendarGrid1.SelectedAppointment > 0) 1419 if ((this.Appointments.AppointmentTable[this.calendarGrid1.SelectedAppointment] as CGAppointment).RadiologyExamIEN > 0) 1420 return true; 1421 1422 DateTime dStart; 1423 DateTime dEnd; 1424 string sResource; 1425 bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource); 1426 if (bRet == false) 1427 { 1428 return false; 1429 } 1430 1431 return (from hl in CGDocumentManager.Current.GlobalDataSet.Tables["HospitalLocation"].AsEnumerable() 1432 where hl.Field<string>("IS_RADIOLOGY_LOCATION")=="1" 1433 join res in CGDocumentManager.Current.GlobalDataSet.Tables["Resources"].AsEnumerable() 1434 on hl.Field<int>("HOSPITAL_LOCATION_ID") equals res.Field<int>("HOSPITAL_LOCATION_ID") 1435 where res.Field<string>("RESOURCE_NAME") == sResource 1436 select hl).Any(); 1437 } 1438 1359 1439 private bool EditAppointmentEnabled() 1360 1440 { … … 3544 3624 } 3545 3625 3626 private void ctxCalGridMkRadAppt_Click(object sender, EventArgs e) 3627 { 3628 DateTime dStart, dEnd; 3629 string sResource; 3630 int nAccessTypeID = 0; 3631 3632 this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource); 3633 this.calendarGrid1.GetSelectedType(out nAccessTypeID); 3634 //Display a dialog to collect Patient Name 3635 DPatientLookup dPat = new DPatientLookup(); 3636 dPat.DocManager = m_DocManager; 3637 3638 if (dPat.ShowDialog(this) == DialogResult.Cancel) 3639 { 3640 return; 3641 } 3642 3643 int DFN = Int32.Parse(dPat.PatientIEN); 3644 int hlIEN = (from resource in CGDocumentManager.Current.GlobalDataSet.Tables["Resources"].AsEnumerable() 3645 where resource.Field<string>("RESOURCE_NAME") == sResource 3646 select resource.Field<int>("HOSPITAL_LOCATION_ID")).FirstOrDefault(); 3647 3648 List<RadiologyExam> _radExams = CGDocumentManager.Current.DAL.GetRadiologyExamsForPatientinHL(DFN, hlIEN); 3649 3650 if (!_radExams.Any()) 3651 { 3652 MessageBox.Show("Patient does not have any radiology exams to register."); 3653 return; 3654 } 3655 3656 DRadExamsSelect _radform = new DRadExamsSelect(_radExams); 3657 3658 if (_radform.ShowDialog() == DialogResult.Cancel) return; 3659 3660 int _examien = _radform.ExamIEN; 3661 string _procedurename = _radform.ProcedureName; 3662 3663 CGDocumentManager.Current.DAL.ScheduleRadiologyExam(DFN, _examien); 3664 3665 //Now create and save the appointment 3666 CGAppointment appt = new CGAppointment(); 3667 string _sNote = "Radiology Exam (" + _examien + "): " + _procedurename; 3668 appt.CreateAppointment(dStart, dEnd, _sNote, 0, sResource); 3669 appt.PatientID = Int32.Parse(dPat.PatientIEN); 3670 appt.PatientName = dPat.PatientName; 3671 appt.AccessTypeID = nAccessTypeID; 3672 appt.RadiologyExamIEN = _examien; 3673 this.Document.CreateAppointment(appt); 3674 3675 //Now redraw the grid to display the new appointments 3676 this.UpdateArrays(); 3677 } 3678 3546 3679 3547 3680
Note:
See TracChangeset
for help on using the changeset viewer.