コード例 #1
0
        private void buttonMakeAppointment_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxDoctor.Text.Equals("") || datePickerExamination.Text.Equals("") || comboBoxAppointemtTime.Text.Equals(""))
            {
                ValidationMessageWindow validationWindow = new ValidationMessageWindow();
                validationWindow.Show();
            }
            else
            {
                patientCard = patientCardController.ViewPatientCard(MainWindow.patient.Jmbg);
                int               lastId                 = examinationController.getLastId();
                DateTime          dateAndTime            = (DateTime)datePickerExamination.SelectedDate;
                string            date                   = dateAndTime.ToShortDateString();
                string            time                   = comboBoxAppointemtTime.Text;
                DateTime          dateAndTimeExamination = Convert.ToDateTime(date + " " + time, CultureInfo.InvariantCulture);
                TypeOfExamination general                = TypeOfExamination.Opsti;
                doctor = (Doctor)comboBoxDoctor.SelectedItem;

                Examination examination = examinationController.ScheduleExamination(new Examination(++lastId, general, dateAndTimeExamination, doctor, doctor.DoctorsOffice, patientCard));

                if (examination == null)
                {
                    BusyTermWindow busyTermWindow = new BusyTermWindow();
                    busyTermWindow.caption.Text = "Termin koji ste izabrali " + date + " " + time + " " + "je već zauzet kod doktora " + doctor.Name + " " + doctor.Surname + " " + doctor.Jmbg;
                    busyTermWindow.Show();
                }
                else
                {
                    ReviewExaminationsWindow reviewExaminationsWindow = new ReviewExaminationsWindow();
                    reviewExaminationsWindow.Show();
                    this.Close();
                }
            }
        }