Beispiel #1
0
 private void btnDone_Click(object sender, EventArgs e)
 {
     if (patientHome != null && dialogResult == DialogResult.Yes)
     {
         try
         {
             patientHome.AppointmentSchedule = this.schedule();
             string period           = String.Format("Day: {0};    Time: {1}", schedule()["day"], schedule()["time"]);
             int    appointSetResult = patientHome.Patient.setAppointment(doctorID, period);
             if (appointSetResult > 0)
             {
                 label.Text = "BUSY";
                 int result = WeeklySchedule.updateWeeklySchedule(doctorID, row, col, label.Text);
                 if (result == 0)
                 {
                     MessageBox.Show("Update not successful");
                 }
                 else
                 {
                     MessageBox.Show("Appointment successful");
                 }
             }
             else
             {
                 MessageBox.Show("Appointment could not be set.");
             }
         }
         catch (Exception exp)
         {
             throw new Exception(exp.Message);
         }
     }
     this.Close();
 }
Beispiel #2
0
        private void label_Schedule_Click(object sender, EventArgs e)
        {
            label = (Label)sender;
            TableLayoutPanelCellPosition cellPosition = tableLayoutPanel1.GetCellPosition(label);

            row = cellPosition.Row;
            col = cellPosition.Column;

            scheduleStatus ^= true;
            if (doctor != null) //only doctor and change schedule from busy to free onclick
            {
                if (scheduleStatus)
                {
                    busy(label);
                }
                else
                {
                    free(label);
                }
                int result = WeeklySchedule.updateWeeklySchedule(doctorID, row, col, label.Text);
                if (result == 0)
                {
                    MessageBox.Show("Update not successful");
                }
            }
            else
            {
                if (label.Text != "BUSY")
                {
                    dialogResult = MessageBox.Show("Do you want to set schedule?", "Question", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        label.BackColor = Color.SkyBlue;
                    }
                }
            }
        }