/// <summary> /// Patient confirms that they want to cancel the selected appointment /// </summary> private void ConfirmCancelAppointmentButton_Click(object sender, EventArgs e) { //store the currently selected appointment ListViewItem.ListViewSubItemCollection items = AppointmentsList.FocusedItem.SubItems; //find the AppointmentClass object corresponding to the selected appointment //first get all appointments related to the patient from the database List <AppointmentClass> lstAppointments = DataAccessClass.getAppointmentsWithCustomerName(m_strUserName); //determine which appointment object corresponds to the selected list item String date = items[1].Text.ToString(); String time = items[2].Text.ToString(); DateTime dateAndTime = DateTime.Parse(date + " " + time); AppointmentClass selectedAppointment = null; foreach (AppointmentClass appointment in lstAppointments) { if (appointment.m_dtDateTime == dateAndTime) { selectedAppointment = appointment; } } //send appointment back to the database with cancel status DataAccessClass.updateAppointmentStatus(selectedAppointment, 'C'); //strikeout appointment in the "Upcoming Appointments" list and hide cancel appointment panel AppointmentsList.FocusedItem.Font = new Font("Arial", 9F, FontStyle.Strikeout, GraphicsUnit.Point, ((byte)(0))); AppointmentDetailsPanel.Visible = false; ConfirmCancelAppointmentPanel.Visible = false; }
public AppoinmentDetailsPage(AppointmentClass appoinment) { if (appoinment == null) { throw new ArgumentNullException(); } BindingContext = appoinment; InitializeComponent(); }
private void AdminWarnAcceptButton_Click(object sender, EventArgs e) { AdminWarnPanel.Visible = false; if (AdminWarnLabel.Text == "ARE YOU SURE YOU WANT TO DELETE ACCOUNT?") { if (DataAccessClass.deleteUser(AdminUserNameLabel.Text)) { AdminConfirmPanel.Visible = true; AdminConfirmPanel.Left = 900; AdminConfirmPanel.Top = 575 - 33; AdminConfirmLabel.Text = "THE USER HAS BEEN DELETED"; timer1.Start(); DataAccessClass.QueryDatabaseForUser(AdminUserNameLabel.Text); AdminHomeUserSearchButton_Click(sender, e); } else { AdminHomeErrorPanel.Visible = true; AdminHomeErrorPanel.Left = 900; AdminHomeErrorPanel.Top = 575 - 33; AdminErrorMessageLabel.Text = "THAT IS NOT AN ACTIVE USER"; timer1.Start(); } } else if (AdminWarnLabel.Text == "ARE YOU SURE YOU WANT TO CANCEL?") { AppointmentClass acAppointmentToCancel = DataAccessClass.QueryDatabaseForAppointmentWithDateTime(g_strFocusedApptDateTime); if (acAppointmentToCancel != null && DataAccessClass.updateAppointmentStatus(acAppointmentToCancel, 'C')) { AdminConfirmPanel.Visible = true; AdminConfirmPanel.Left = 900; AdminConfirmPanel.Top = 575 - 33; AdminConfirmLabel.Text = "APPOINTMENT CANCELLED"; timer1.Start(); AdminApptSearchButton_Click(sender, e); } else { AdminHomeErrorPanel.Visible = true; AdminHomeErrorPanel.Left = 900; AdminHomeErrorPanel.Top = 575 - 33; AdminErrorMessageLabel.Text = "NOT AN ACTIVE APPOINTMENT"; timer1.Start(); } } }