コード例 #1
0
        private void btnCancelAllToday_Click(object sender, EventArgs e)
        {
            DataTable appointmentTable = AppointmentRepo.GetSpecificDoctorAppointments(Doctorid);

            if (appointmentTable.Rows.Count > 0)
            {
                var answer = MessageBox.Show("Cancel All Today's Appointment", "Cancel", MessageBoxButtons.YesNo);
                if (answer == DialogResult.Yes)
                {
                    for (int ax = 0; ax < appointmentTable.Rows.Count; ax++)
                    {
                        AppointmentRepo.DeleteAllToday(Doctorid);
                        CancelledAppointmentsRepo.CreateCancelledAppointment(appointmentTable.Rows[ax]["starttime"].ToString(), appointmentTable.Rows[ax]["date"].ToString(), Convert.ToInt32(appointmentTable.Rows[ax]["personid"].ToString()), Doctorid);
                    }
                    MessageBox.Show("All appointments cancelled successfully");

                    PopulateGridView();
                    ClearInfo();
                }
            }
            else
            {
                MessageBox.Show("NO appointments to cancel today");
            }
        }
コード例 #2
0
 private void btnCancel_Click_1(object sender, EventArgs e)
 {
     if (txtPersonID.Text != "")
     {
         var answer = MessageBox.Show("Cancel Appointment", "Cancel", MessageBoxButtons.YesNo);
         if (answer == DialogResult.Yes)
         {
             AppointmentRepo appointmentRepo = new AppointmentRepo();
             DataGridViewRow dataRow         = dgvAppointmentView.CurrentRow;
             //CancelledAppointmentsRepo.CreateCancelledAppointment(dataRow.Cells[8].Value.ToString(), dataRow.Cells[7].Value.ToString(), Convert.ToInt32(dataRow.Cells[1].Value.ToString()), Doctorid);
             //appointmentRepo.DeleteAppointment(Convert.ToInt32(dataRow.Cells[0].Value.ToString()));
             //MessageBox.Show(cmbAppointmentTime.Text);
             DateTime.Parse(dtpAppointmentDate.Text);
             //MessageBox.Show(DateTime.Parse(dtpAppointmentDate.Text).ToString("d"));
             CancelledAppointmentsRepo.CreateCancelledAppointment(cmbAppointmentTime.Text.ToString(), DateTime.Parse(dtpAppointmentDate.Text).ToString("d"), Convert.ToInt32(txtPersonID.Text), Doctorid);
             AppointmentRepo.DeleteByPatient(Convert.ToInt32(txtPersonID.Text), Doctorid);
             MessageBox.Show("Appointment cancelled successfully");
             PopulateGridView();
             ClearInfo();
         }
     }
     else
     {
         MessageBox.Show("NO appointment is selected");
     }
 }