- Timestamp:
- Dec 24, 2015, 10:43:43 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.cs
r1117 r1728 5 5 using System.Windows.Forms; 6 6 using System.Data; 7 using System.Collections.Generic; 7 8 //using System.Data.OleDb; 8 9 using System.Diagnostics; … … 66 67 private Label label18; 67 68 private TextBox txtSex; 69 private TabPage tabCloneForward; 70 private GroupBox grpCloneForward; 71 private Button button1; 72 private ComboBox cboDuration; 73 private TextBox txtFUOther; 74 private Label label21; 75 private RadioButton rdbFU90; 76 private RadioButton rdbFU60; 77 private RadioButton rdbFU30; 78 private Label label19; 79 private DateTimePicker dtCloneAppointment; 80 private ComboBox cboSlots; 81 private Label label25; 82 private Label label24; 83 private Label txtClinic; 84 private TextBox textBox1; 85 private Label label20; 86 private Label label22; 87 private Label label23; 68 88 private IContainer components; 69 89 … … 104 124 this.label2 = new System.Windows.Forms.Label(); 105 125 this.txtPatientName = new System.Windows.Forms.TextBox(); 126 this.tabCloneForward = new System.Windows.Forms.TabPage(); 127 this.grpCloneForward = new System.Windows.Forms.GroupBox(); 128 this.button1 = new System.Windows.Forms.Button(); 129 this.cboDuration = new System.Windows.Forms.ComboBox(); 130 this.txtFUOther = new System.Windows.Forms.TextBox(); 131 this.label21 = new System.Windows.Forms.Label(); 132 this.rdbFU90 = new System.Windows.Forms.RadioButton(); 133 this.rdbFU60 = new System.Windows.Forms.RadioButton(); 134 this.rdbFU30 = new System.Windows.Forms.RadioButton(); 135 this.label19 = new System.Windows.Forms.Label(); 136 this.dtCloneAppointment = new System.Windows.Forms.DateTimePicker(); 137 this.cboSlots = new System.Windows.Forms.ComboBox(); 138 this.label25 = new System.Windows.Forms.Label(); 139 this.label24 = new System.Windows.Forms.Label(); 140 this.txtClinic = new System.Windows.Forms.Label(); 141 this.textBox1 = new System.Windows.Forms.TextBox(); 142 this.label20 = new System.Windows.Forms.Label(); 143 this.label22 = new System.Windows.Forms.Label(); 144 this.label23 = new System.Windows.Forms.Label(); 106 145 this.tabPatientInfo = new System.Windows.Forms.TabPage(); 107 146 this.groupBox2 = new System.Windows.Forms.GroupBox(); … … 135 174 this.groupBox3.SuspendLayout(); 136 175 this.groupBox1.SuspendLayout(); 176 this.tabCloneForward.SuspendLayout(); 177 this.grpCloneForward.SuspendLayout(); 137 178 this.tabPatientInfo.SuspendLayout(); 138 179 this.groupBox2.SuspendLayout(); … … 146 187 // 147 188 this.tabControl1.Controls.Add(this.tabAppointment); 189 this.tabControl1.Controls.Add(this.tabCloneForward); 148 190 this.tabControl1.Controls.Add(this.tabPatientInfo); 149 191 this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; … … 151 193 this.tabControl1.Name = "tabControl1"; 152 194 this.tabControl1.SelectedIndex = 0; 153 this.tabControl1.Size = new System.Drawing.Size(47 1, 526);195 this.tabControl1.Size = new System.Drawing.Size(475, 524); 154 196 this.tabControl1.TabIndex = 0; 155 197 // … … 161 203 this.tabAppointment.Location = new System.Drawing.Point(4, 22); 162 204 this.tabAppointment.Name = "tabAppointment"; 163 this.tabAppointment.Size = new System.Drawing.Size(46 3, 500);205 this.tabAppointment.Size = new System.Drawing.Size(467, 498); 164 206 this.tabAppointment.TabIndex = 1; 165 207 this.tabAppointment.Text = "Appointment"; … … 176 218 // groupBox3 177 219 // 178 this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)179 | System.Windows.Forms.AnchorStyles.Right)));180 220 this.groupBox3.Controls.Add(this.lblClinic); 181 221 this.groupBox3.Controls.Add(this.label15); … … 295 335 this.label18.Location = new System.Drawing.Point(238, 44); 296 336 this.label18.Name = "label18"; 297 this.label18.Size = new System.Drawing.Size(2 9, 13);337 this.label18.Size = new System.Drawing.Size(28, 13); 298 338 this.label18.TabIndex = 14; 299 339 this.label18.Text = "Sex:"; … … 367 407 this.txtPatientName.TabIndex = 0; 368 408 // 409 // tabCloneForward 410 // 411 this.tabCloneForward.BackColor = System.Drawing.SystemColors.Control; 412 this.tabCloneForward.Controls.Add(this.grpCloneForward); 413 this.tabCloneForward.Location = new System.Drawing.Point(4, 22); 414 this.tabCloneForward.Name = "tabCloneForward"; 415 this.tabCloneForward.Size = new System.Drawing.Size(467, 498); 416 this.tabCloneForward.TabIndex = 2; 417 this.tabCloneForward.Text = "Clone/Forward"; 418 // 419 // grpCloneForward 420 // 421 this.grpCloneForward.Controls.Add(this.button1); 422 this.grpCloneForward.Controls.Add(this.cboDuration); 423 this.grpCloneForward.Controls.Add(this.txtFUOther); 424 this.grpCloneForward.Controls.Add(this.label21); 425 this.grpCloneForward.Controls.Add(this.rdbFU90); 426 this.grpCloneForward.Controls.Add(this.rdbFU60); 427 this.grpCloneForward.Controls.Add(this.rdbFU30); 428 this.grpCloneForward.Controls.Add(this.label19); 429 this.grpCloneForward.Controls.Add(this.dtCloneAppointment); 430 this.grpCloneForward.Controls.Add(this.cboSlots); 431 this.grpCloneForward.Controls.Add(this.label25); 432 this.grpCloneForward.Controls.Add(this.label24); 433 this.grpCloneForward.Controls.Add(this.txtClinic); 434 this.grpCloneForward.Controls.Add(this.textBox1); 435 this.grpCloneForward.Controls.Add(this.label20); 436 this.grpCloneForward.Controls.Add(this.label22); 437 this.grpCloneForward.Controls.Add(this.label23); 438 this.grpCloneForward.Location = new System.Drawing.Point(8, 13); 439 this.grpCloneForward.Name = "grpCloneForward"; 440 this.grpCloneForward.Size = new System.Drawing.Size(439, 206); 441 this.grpCloneForward.TabIndex = 16; 442 this.grpCloneForward.TabStop = false; 443 this.grpCloneForward.Text = "Clone/Forward Appointment"; 444 // 445 // button1 446 // 447 this.button1.Location = new System.Drawing.Point(357, 82); 448 this.button1.Name = "button1"; 449 this.button1.Size = new System.Drawing.Size(51, 24); 450 this.button1.TabIndex = 37; 451 this.button1.Text = "Update"; 452 this.button1.Click += new System.EventHandler(this.button1_Click); 453 // 454 // cboDuration 455 // 456 this.cboDuration.FormattingEnabled = true; 457 this.cboDuration.Location = new System.Drawing.Point(80, 51); 458 this.cboDuration.Name = "cboDuration"; 459 this.cboDuration.Size = new System.Drawing.Size(66, 21); 460 this.cboDuration.TabIndex = 36; 461 this.cboDuration.SelectedIndexChanged += new System.EventHandler(this.cboDuration_SelectedIndexChanged); 462 // 463 // txtFUOther 464 // 465 this.txtFUOther.Location = new System.Drawing.Point(297, 84); 466 this.txtFUOther.Name = "txtFUOther"; 467 this.txtFUOther.Size = new System.Drawing.Size(54, 20); 468 this.txtFUOther.TabIndex = 35; 469 this.txtFUOther.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtFUOther_KeyPress); 470 // 471 // label21 472 // 473 this.label21.AutoSize = true; 474 this.label21.Location = new System.Drawing.Point(255, 88); 475 this.label21.Name = "label21"; 476 this.label21.Size = new System.Drawing.Size(36, 13); 477 this.label21.TabIndex = 34; 478 this.label21.Text = "Other:"; 479 // 480 // rdbFU90 481 // 482 this.rdbFU90.AutoSize = true; 483 this.rdbFU90.Location = new System.Drawing.Point(203, 85); 484 this.rdbFU90.Name = "rdbFU90"; 485 this.rdbFU90.Size = new System.Drawing.Size(37, 17); 486 this.rdbFU90.TabIndex = 33; 487 this.rdbFU90.TabStop = true; 488 this.rdbFU90.Text = "90"; 489 this.rdbFU90.UseVisualStyleBackColor = true; 490 this.rdbFU90.CheckedChanged += new System.EventHandler(this.rdbFUCheckedChanged); 491 // 492 // rdbFU60 493 // 494 this.rdbFU60.AutoSize = true; 495 this.rdbFU60.Location = new System.Drawing.Point(160, 85); 496 this.rdbFU60.Name = "rdbFU60"; 497 this.rdbFU60.Size = new System.Drawing.Size(37, 17); 498 this.rdbFU60.TabIndex = 32; 499 this.rdbFU60.TabStop = true; 500 this.rdbFU60.Text = "60"; 501 this.rdbFU60.UseVisualStyleBackColor = true; 502 this.rdbFU60.CheckedChanged += new System.EventHandler(this.rdbFUCheckedChanged); 503 // 504 // rdbFU30 505 // 506 this.rdbFU30.AutoSize = true; 507 this.rdbFU30.Location = new System.Drawing.Point(117, 85); 508 this.rdbFU30.Name = "rdbFU30"; 509 this.rdbFU30.Size = new System.Drawing.Size(37, 17); 510 this.rdbFU30.TabIndex = 31; 511 this.rdbFU30.TabStop = true; 512 this.rdbFU30.Text = "30"; 513 this.rdbFU30.UseVisualStyleBackColor = true; 514 this.rdbFU30.CheckedChanged += new System.EventHandler(this.rdbFUCheckedChanged); 515 // 516 // label19 517 // 518 this.label19.Location = new System.Drawing.Point(4, 85); 519 this.label19.Name = "label19"; 520 this.label19.Size = new System.Drawing.Size(103, 16); 521 this.label19.TabIndex = 30; 522 this.label19.Text = "Quick Follow up:"; 523 this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 524 // 525 // dtCloneAppointment 526 // 527 this.dtCloneAppointment.Location = new System.Drawing.Point(80, 26); 528 this.dtCloneAppointment.Name = "dtCloneAppointment"; 529 this.dtCloneAppointment.Size = new System.Drawing.Size(136, 20); 530 this.dtCloneAppointment.TabIndex = 29; 531 this.dtCloneAppointment.ValueChanged += new System.EventHandler(this.dtCloneAppointment_ValueChanged); 532 // 533 // cboSlots 534 // 535 this.cboSlots.FormattingEnabled = true; 536 this.cboSlots.Location = new System.Drawing.Point(303, 24); 537 this.cboSlots.Name = "cboSlots"; 538 this.cboSlots.Size = new System.Drawing.Size(121, 21); 539 this.cboSlots.TabIndex = 28; 540 this.cboSlots.SelectedIndexChanged += new System.EventHandler(this.cboSlots_SelectedIndexChanged); 541 // 542 // label25 543 // 544 this.label25.AutoSize = true; 545 this.label25.Location = new System.Drawing.Point(238, 29); 546 this.label25.Name = "label25"; 547 this.label25.Size = new System.Drawing.Size(59, 13); 548 this.label25.TabIndex = 27; 549 this.label25.Text = "Time Slots:"; 550 // 551 // label24 552 // 553 this.label24.Location = new System.Drawing.Point(152, 53); 554 this.label24.Name = "label24"; 555 this.label24.Size = new System.Drawing.Size(40, 16); 556 this.label24.TabIndex = 26; 557 this.label24.Text = "Clinic:"; 558 this.label24.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 559 // 560 // txtClinic 561 // 562 this.txtClinic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; 563 this.txtClinic.Location = new System.Drawing.Point(200, 53); 564 this.txtClinic.Name = "txtClinic"; 565 this.txtClinic.Size = new System.Drawing.Size(233, 16); 566 this.txtClinic.TabIndex = 25; 567 // 568 // textBox1 569 // 570 this.textBox1.AcceptsReturn = true; 571 this.textBox1.Location = new System.Drawing.Point(80, 123); 572 this.textBox1.Multiline = true; 573 this.textBox1.Name = "textBox1"; 574 this.textBox1.Size = new System.Drawing.Size(353, 60); 575 this.textBox1.TabIndex = 24; 576 // 577 // label20 578 // 579 this.label20.Location = new System.Drawing.Point(4, 131); 580 this.label20.Name = "label20"; 581 this.label20.Size = new System.Drawing.Size(56, 16); 582 this.label20.TabIndex = 23; 583 this.label20.Text = "Notes:"; 584 this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 585 // 586 // label22 587 // 588 this.label22.Location = new System.Drawing.Point(16, 53); 589 this.label22.Name = "label22"; 590 this.label22.Size = new System.Drawing.Size(56, 16); 591 this.label22.TabIndex = 21; 592 this.label22.Text = "Duration:"; 593 this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 594 // 595 // label23 596 // 597 this.label23.Location = new System.Drawing.Point(8, 29); 598 this.label23.Name = "label23"; 599 this.label23.Size = new System.Drawing.Size(64, 16); 600 this.label23.TabIndex = 20; 601 this.label23.Text = "Start Time:"; 602 this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 603 // 369 604 // tabPatientInfo 370 605 // … … 372 607 this.tabPatientInfo.Location = new System.Drawing.Point(4, 22); 373 608 this.tabPatientInfo.Name = "tabPatientInfo"; 374 this.tabPatientInfo.Size = new System.Drawing.Size(46 3, 500);609 this.tabPatientInfo.Size = new System.Drawing.Size(467, 498); 375 610 this.tabPatientInfo.TabIndex = 0; 376 611 this.tabPatientInfo.Text = "Contact Information"; … … 562 797 this.panel1.Controls.Add(this.cmdOK); 563 798 this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; 564 this.panel1.Location = new System.Drawing.Point(0, 48 6);799 this.panel1.Location = new System.Drawing.Point(0, 484); 565 800 this.panel1.Name = "panel1"; 566 this.panel1.Size = new System.Drawing.Size(47 1, 40);801 this.panel1.Size = new System.Drawing.Size(475, 40); 567 802 this.panel1.TabIndex = 1; 568 803 // … … 572 807 this.chkPrint.Location = new System.Drawing.Point(13, 14); 573 808 this.chkPrint.Name = "chkPrint"; 574 this.chkPrint.Size = new System.Drawing.Size(1 44, 17);809 this.chkPrint.Size = new System.Drawing.Size(139, 17); 575 810 this.chkPrint.TabIndex = 2; 576 811 this.chkPrint.Text = "Print Appointment Letter"; … … 589 824 // cmdOK 590 825 // 591 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;592 826 this.cmdOK.Location = new System.Drawing.Point(317, 8); 593 827 this.cmdOK.Name = "cmdOK"; … … 617 851 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 618 852 this.CancelButton = this.cmdCancel; 619 this.ClientSize = new System.Drawing.Size(47 1, 526);853 this.ClientSize = new System.Drawing.Size(475, 524); 620 854 this.Controls.Add(this.panel1); 621 855 this.Controls.Add(this.tabControl1); … … 624 858 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 625 859 this.Text = "Patient Appointment"; 860 this.Load += new System.EventHandler(this.DAppointPage_Load); 626 861 this.tabControl1.ResumeLayout(false); 627 862 this.tabAppointment.ResumeLayout(false); … … 630 865 this.groupBox1.ResumeLayout(false); 631 866 this.groupBox1.PerformLayout(); 867 this.tabCloneForward.ResumeLayout(false); 868 this.grpCloneForward.ResumeLayout(false); 869 this.grpCloneForward.PerformLayout(); 632 870 this.tabPatientInfo.ResumeLayout(false); 633 871 this.groupBox2.ResumeLayout(false); … … 647 885 private CGDocumentManager m_DocManager; 648 886 887 private ArrayList alResources; 888 889 private bool isCloning = false; 890 891 private DateTime originalAppointment; 892 649 893 private string m_sPatientName; 650 894 private Sex m_enumPatientSex; … … 675 919 #endregion //fields 676 920 677 #region Methods 678 679 public void InitializePage(CGAppointment a) 921 #region 922 923 private void SetDurations(DateTime apptDate) 924 { 925 DateTime m_dStart = apptDate; // move to 1200 926 DateTime m_dEnd = m_dStart.Date.AddHours(23).AddMinutes(59).AddSeconds(59); //move to 235959 927 string sSearchInfo = "1|both" + "|"; 928 ArrayList m_alResources = alResources; 929 ArrayList m_alAccessTypes = new ArrayList(); 930 DataTable m_availTable = CGSchedLib.CreateAvailabilitySchedule(m_DocManager, m_alResources, m_dStart, m_dEnd, m_alAccessTypes, ScheduleType.Resource, sSearchInfo); 931 if (m_availTable.Rows.Count > 0) 932 { 933 foreach (DataRow row in m_availTable.Rows) 934 { 935 double minPerSlot = (row.Field<DateTime>("END_TIME") - row.Field<DateTime>("START_TIME")).TotalMinutes / row.Field<int>("SLOTS"); 936 int totalSlots = row.Field<int>("SLOTS"); 937 double duration = 0; 938 for (int i = 0; i < totalSlots; i++) 939 { 940 duration = duration + minPerSlot; 941 cboDuration.Items.Add(duration); 942 } 943 } 944 } 945 else 946 { 947 CGView v = this.DocManager.GetViewByResource(m_alResources); 948 int scale = v.CGrid.TimeScale; 949 //cboDuration.Items.Clear(); 950 cboDuration.Items.Add((double)scale); 951 //cboDuration.SelectedIndex = 0; 952 } 953 } 954 955 private void GetAppointmentSlots(DateTime apptDate) 956 { 957 DateTime m_dStart = apptDate; // move to 1200 958 DateTime m_dEnd = m_dStart.Date.AddHours(23).AddMinutes(59).AddSeconds(59); //move to 235959 959 string sSearchInfo = "1|both" + "|"; 960 ArrayList m_alResources = alResources; 961 ArrayList m_alAccessTypes = new ArrayList(); 962 DataTable m_availTable = CGSchedLib.CreateAvailabilitySchedule(m_DocManager, m_alResources, m_dStart, m_dEnd, m_alAccessTypes, ScheduleType.Resource, sSearchInfo); 963 DataTable m_apptTable = CGSchedLib.CreateAppointmentSchedule(m_DocManager, m_alResources, m_dStart, m_dEnd); 964 cboSlots.Items.Clear(); 965 if (m_availTable.Rows.Count>0) 966 { 967 foreach (DataRow row in m_availTable.Rows) 968 { 969 string resource = row.Field<string>("RESOURCE"); 970 DateTime start_time = row.Field<DateTime>("START_TIME"); 971 DateTime end_time = row.Field<DateTime>("END_TIME"); 972 double minPerSlot = (row.Field<DateTime>("END_TIME") - row.Field<DateTime>("START_TIME")).TotalMinutes / row.Field<int>("SLOTS"); 973 double duration = minPerSlot; 974 if (cboDuration.SelectedIndex >= 0) 975 { 976 duration = (double)cboDuration.SelectedItem; 977 } 978 int totalSlots = row.Field<int>("SLOTS"); 979 DateTime aStartTime = start_time; 980 DateTime aEndTime = start_time.AddMinutes(duration); 981 for (int i = 0; i < totalSlots; i++) 982 { 983 bool flag = true; 984 foreach (DataRow appt in m_apptTable.Rows) 985 { 986 if (resource == appt.Field<string>("RESOURCENAME")) 987 { 988 DateTime apptStartTime = appt.Field<DateTime>("START_TIME"); 989 DateTime apptEndTime = appt.Field<DateTime>("END_TIME"); 990 DateTimeRange dRange1 = new DateTimeRange(); 991 dRange1.Start = aStartTime; 992 dRange1.End = aEndTime; 993 DateTimeRange dRange2 = new DateTimeRange(); 994 dRange2.Start = apptStartTime; 995 dRange2.End = apptEndTime.AddSeconds(-1); 996 if (dRange1.Intersects(dRange2)) 997 { 998 flag = false; 999 } 1000 /*if(aStartTime.Ticks >= apptStartTime.Ticks && aStartTime.Ticks <= apptEndTime.AddSeconds(-1).Ticks) 1001 { 1002 flag = false; 1003 } 1004 if (aEndTime.Ticks <= apptStartTime.Ticks && aEndTime.Ticks >= apptEndTime.AddSeconds(-1).Ticks) 1005 { 1006 flag = false; 1007 }*/ 1008 } 1009 } 1010 if (flag) 1011 { 1012 AppointmentComboboxItem item = new AppointmentComboboxItem(); 1013 item.Value = aStartTime; 1014 item.Text = aStartTime.TimeOfDay.ToString(); 1015 cboSlots.Items.Add(item); 1016 } 1017 aStartTime = aStartTime.AddMinutes(minPerSlot); 1018 aEndTime = aStartTime.AddMinutes(duration); 1019 } 1020 } 1021 } 1022 else 1023 { 1024 CGView v= this.DocManager.GetViewByResource(m_alResources); 1025 int scale = v.CGrid.TimeScale; 1026 cboSlots.Items.Clear(); 1027 DateTime dStartTime = apptDate.Date; 1028 while (dStartTime.Day == apptDate.Date.Day) 1029 { 1030 AppointmentComboboxItem item = new AppointmentComboboxItem(); 1031 item.Value = dStartTime; 1032 item.Text = dStartTime.TimeOfDay.ToString(); 1033 cboSlots.Items.Add(item); 1034 dStartTime = dStartTime.AddMinutes((double)scale); 1035 } 1036 } 1037 } 1038 1039 public void HideCloneForwardTab() { 1040 tabControl1.TabPages.Remove(tabCloneForward); 1041 } 1042 1043 public void SetCloneForwardable(ArrayList alResources, CGAppointment a) { 1044 originalAppointment = a.StartTime; 1045 //grpCloneForward.Visible = true; 1046 isCloning = true; 1047 //grpCloneForward.Top = groupBox4.Top; 1048 //groupBox4.Top = groupBox4.Top + grpCloneForward.Height + 10; 1049 txtNote.Enabled = false; 1050 //this.Height = this.Height + grpCloneForward.Height + 20; 1051 this.alResources = alResources; 1052 cboSlots.DropDownStyle = ComboBoxStyle.DropDownList; 1053 cboDuration.DropDownStyle = ComboBoxStyle.DropDownList; 1054 cboDuration.Items.Clear(); 1055 GetAppointmentSlots(dtCloneAppointment.Value); 1056 SetDurations(dtCloneAppointment.Value); 1057 txtClinic.Text = alResources[0].ToString(); 1058 m_sClinic = txtClinic.Text; 1059 if (cboSlots.Items.Count > 0) 1060 { 1061 bool flag = true; 1062 cboDuration.SelectedIndex = 0; 1063 foreach (AppointmentComboboxItem item in cboSlots.Items) 1064 { 1065 if (originalAppointment.TimeOfDay.ToString() == item.Text) 1066 { 1067 flag = false; 1068 cboSlots.SelectedIndex = cboSlots.Items.IndexOf(item); 1069 } 1070 } 1071 if (flag) 1072 { 1073 cboSlots.SelectedIndex = 0; 1074 } 1075 m_dStartTime = ((AppointmentComboboxItem)cboSlots.SelectedItem).Value; 1076 m_dEndTime = m_dStartTime.AddMinutes((double)cboDuration.SelectedItem); 1077 } 1078 tabControl1.SelectedIndex = tabControl1.TabPages.IndexOf(tabCloneForward); 1079 } 1080 1081 public void InitializePage(CGAppointment a) 680 1082 { 681 1083 InitializePage(a.PatientID.ToString(), a.StartTime, a.EndTime, "", a.Note, a.AccessTypeID); … … 771 1173 { 772 1174 this.UpdateDialogData(false); 1175 if (isCloning) 1176 { 1177 if (cboSlots.Items.Count <=0) 1178 { 1179 MessageBox.Show("Please select the Appointment Slot before submitting the form"); 1180 return; 1181 } 1182 } 1183 this.DialogResult = System.Windows.Forms.DialogResult.OK; 773 1184 } 774 1185 … … 876 1287 } 877 1288 878 879 } //end Class 1289 private void DAppointPage_Load(object sender, EventArgs e) 1290 { 1291 1292 } 1293 1294 private void dtCloneAppointment_ValueChanged(object sender, EventArgs e) 1295 { 1296 cboDuration.Items.Clear(); 1297 GetAppointmentSlots(dtCloneAppointment.Value); 1298 SetDurations(dtCloneAppointment.Value); 1299 txtClinic.Text = alResources[0].ToString(); 1300 m_sClinic = txtClinic.Text; 1301 if (cboSlots.Items.Count > 0) 1302 { 1303 cboDuration.SelectedIndex = 0; 1304 cboSlots.SelectedIndex = cboSlots.FindStringExact(originalAppointment.TimeOfDay.ToString()); 1305 m_dStartTime = ((AppointmentComboboxItem)cboSlots.SelectedItem).Value; 1306 m_dEndTime = m_dStartTime.AddMinutes((double)cboDuration.SelectedItem); 1307 } 1308 } 1309 1310 private void rdbFUCheckedChanged(object sender, EventArgs e) 1311 { 1312 if (((RadioButton)sender).Checked) 1313 { 1314 // This is the correct control. 1315 RadioButton rb = (RadioButton)sender; 1316 dtCloneAppointment.Value = originalAppointment.AddDays(Convert.ToDouble(rb.Text)); 1317 AppointmentComboboxItem item = new AppointmentComboboxItem(); 1318 item.Value = dtCloneAppointment.Value; 1319 item.Text = dtCloneAppointment.Value.TimeOfDay.ToString(); 1320 if (cboSlots.Items.Count > 0) 1321 { 1322 cboSlots.SelectedIndex = cboSlots.FindStringExact(dtCloneAppointment.Value.TimeOfDay.ToString()); 1323 } 1324 } 1325 } 1326 1327 private void cboDuration_SelectedIndexChanged(object sender, EventArgs e) 1328 { 1329 GetAppointmentSlots(dtCloneAppointment.Value); 1330 if (cboSlots.Items.Count >0) 1331 { 1332 cboSlots.SelectedIndex = 0; 1333 m_dStartTime = ((AppointmentComboboxItem)cboSlots.SelectedItem).Value; 1334 m_dEndTime = m_dStartTime.AddMinutes((double)cboDuration.SelectedItem); 1335 } 1336 } 1337 1338 private void txtFUOther_KeyPress(object sender, KeyPressEventArgs e) 1339 { 1340 if (!char.IsDigit(e.KeyChar)) 1341 { 1342 e.Handled = true; 1343 } 1344 } 1345 1346 private void button1_Click(object sender, EventArgs e) 1347 { 1348 if (Convert.ToInt32(txtFUOther.Text)>0) 1349 { 1350 if (Convert.ToInt32(txtFUOther.Text) <= 365) 1351 { 1352 dtCloneAppointment.Value = originalAppointment.AddDays(Convert.ToInt32(txtFUOther.Text)); 1353 AppointmentComboboxItem item = new AppointmentComboboxItem(); 1354 item.Value = dtCloneAppointment.Value; 1355 item.Text = dtCloneAppointment.Value.TimeOfDay.ToString(); 1356 if (cboSlots.Items.Count > 0) 1357 { 1358 cboSlots.SelectedIndex = cboSlots.FindStringExact(dtCloneAppointment.Value.TimeOfDay.ToString()); 1359 } 1360 } 1361 else 1362 { 1363 MessageBox.Show("Please enter number less then 365."); 1364 } 1365 } 1366 else 1367 { 1368 MessageBox.Show("Please enter number of days before updating."); 1369 } 1370 } 1371 1372 private void cboSlots_SelectedIndexChanged(object sender, EventArgs e) 1373 { 1374 m_dStartTime = ((AppointmentComboboxItem)cboSlots.SelectedItem).Value; 1375 m_dEndTime = m_dStartTime.AddMinutes((double)cboDuration.SelectedItem); 1376 } 1377 } //end Class 1378 1379 public class AppointmentComboboxItem 1380 { 1381 public string Text { get; set; } 1382 public DateTime Value { get; set; } 1383 1384 public override string ToString() 1385 { 1386 return Text; 1387 } 1388 } 1389 1390 public class DateTimeRange 1391 { 1392 public DateTime Start { get; set; } 1393 public DateTime End { get; set; } 1394 1395 public bool Intersects(DateTimeRange test) 1396 { 1397 1398 if (this.Start == this.End || test.Start == test.End) 1399 return false; // No actual date range 1400 1401 if (this.Start == test.Start || this.End == test.End) 1402 return true; // If any set is the same time, then by default there must be some overlap. 1403 1404 if (this.Start < test.Start) 1405 { 1406 if (this.End > test.Start && this.End < test.End) 1407 return true; // Condition 1 1408 1409 if (this.End > test.End) 1410 return true; // Condition 3 1411 } 1412 else 1413 { 1414 if (test.End > this.Start && test.End < this.End) 1415 return true; // Condition 2 1416 1417 if (test.End > this.End) 1418 return true; // Condition 4 1419 } 1420 1421 return false; 1422 } 1423 } 880 1424 }
Note:
See TracChangeset
for help on using the changeset viewer.