示例#1
0
        private void RequestConsultation_Click(object sender, EventArgs e, Doctor doc, ComboBox docComb, DateTimePicker dtPk)
        {
            try
            {
                DateTime perfectTime = doc.FreeTime(dtPk.Value);

                DialogResult res = MessageBox.Show(
                    "Doctor have free time at " + perfectTime.ToString("hh:mm") + @"
Press OK to register for that time, or Cancel and try other time", "Consultation", MessageBoxButtons.OKCancel);

                if (res == DialogResult.OK)
                {
                    patient.RequestForConsult(doc, dtPk.Value);
                    patient.ChangeBalance(-1 * doc.ConsultationCost);
                    balanceLabel.Text = patient.Balance.ToString();
                    doc.ChangeBalance(doc.ConsultationCost);
                    docComb.SelectedIndex = -1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    @"This doctor is busy whole day
Please choose other doctor or other day");
            }
        }