public OrderTest(UserInfo info, Appointment appt, VisitInfo owner) { InitializeComponent(); testController = new TestController(); userID = info; lblUserName.Text = userID.userID; this.appt = appt; _owner = owner; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OrderTest_FormClosing); }
private void btnVisits_Click(object sender, EventArgs e) { Appointment appt = AppointmentController.GetAppointment(Convert.ToInt32(cboAppointments.SelectedValue)); try { DateTime apptDate = Convert.ToDateTime(cboAppointments.Text); if (cboAppointments.ValueMember == "") { MessageBox.Show("No applicable appointment.", "No appointment selected"); } else if (appt.isCheckedIn == "False" && apptDate.Date < DateTime.Now.Date) { MessageBox.Show("The patient did not visit, they missed the appointment!"); } else if (apptDate.Date != DateTime.Now.Date) { MessageBox.Show("This date is not today, you may not check in!"); //String appointmentText = cboAppointments.Text; //int apptID = int.Parse(cboAppointments.SelectedValue.ToString()); //ModifyVisitInfo visitInfo = new ModifyVisitInfo(this.info, apptID, appointmentText, this.patientID, false); //visitInfo.MdiParent = this.MdiParent; //visitInfo.FormClosing += new FormClosingEventHandler(this.Visits_FormClosing); //visitInfo.Show(); } else if (appt.isCheckedIn == "True" || appt.isCheckedIn == "1") { MessageBox.Show("You have already checked in today!"); //String appointmentText = cboAppointments.Text; //int apptID = int.Parse(cboAppointments.SelectedValue.ToString()); //ModifyVisitInfo visitInfo = new ModifyVisitInfo(this.info, apptID, this.patientID, false); //visitInfo.MdiParent = this.MdiParent; //visitInfo.FormClosing += new FormClosingEventHandler(this.Visits_FormClosing); //visitInfo.Show(); } else { int apptID = int.Parse(cboAppointments.SelectedValue.ToString()); VisitInfo visitInfo = new VisitInfo(this.info, apptID, this.patientID, false, this); visitInfo.FormClosing += new FormClosingEventHandler(this.Visits_FormClosing); visitInfo.MdiParent = this.MdiParent; visitInfo.Show(); } } catch (Exception) { MessageBox.Show("An error occured while trying to check in, please try again!"); } }