Пример #1
0
 private void btnDialogOk_Click(object sender, RoutedEventArgs e)
 {
     if (tbEndTime.Text == "" || tbStartTime.Text == "" || cbPatient.Text == "" || cbPatient.Text == null || cbRoom.Text == "" || cbRoom.Text == null || DatePick.Text == "Select a date")
     {
         MessageBox.Show("Niste popunili sva polja!", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         Model.Examination ex = new Model.Examination(DoctorHome.ExaminationControl.examinationService.examinationRepository.next_id++,
                                                      Convert.ToDateTime(DatePick.Text + " " + tbStartTime.Text), Convert.ToDateTime(DatePick.Text + " " + tbEndTime.Text),
                                                      "Milana123", cbPatient.Text, int.Parse(cbRoom.Text), GetExaminationType());
         DoctorHome.ExaminationControl.examinationService.examinationRepository.next_id++;
         Boolean b = DoctorHome.ExaminationControl.CreateExamination(ex);
         if (b == true)
         {
             DoctorHome.LoadAll();
             MessageBox.Show("Uspešno ste dodali resurs!", "Uspešno izvršeno!", MessageBoxButton.OK, MessageBoxImage.Information);
             this.Close();
         }
         else
         {
             MessageBox.Show("Izabrani termin je zauzet", "Upozorenje", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
 }
        private void Button_Click_OK(object sender, RoutedEventArgs e)
        {
            if (tbuStartTime.Text == "" || tbuEndTime.Text == "" || cbRoom.Text == "")
            {
                MessageBox.Show("Niste popunili sva polja!", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                int      exId   = int.Parse(lbuID.Content.ToString());
                DateTime start  = DateTime.Parse(DatePick.Text + " " + tbuStartTime.Text);
                DateTime end    = DateTime.Parse(DatePick.Text + " " + tbuEndTime.Text);
                int      roomId = int.Parse(cbRoom.Text);

                if (DoctorHome.ExaminationControl.UpdateExamination(exId, start, end, roomId))
                {
                    DoctorHome.LoadAll();
                    MessageBox.Show("Uspešno ste izmenili termin", "Uspešno!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Izabrani termin je zauzet", "ERROR");
                }
            }
        }