private void Add_Form_Click(object sender, RoutedEventArgs e)
        {
            if (!checkIfSomethingLeft())
            {
                ErrorMessage.Visibility = Visibility.Visible;
            }
            else
            {
                if ((bool)Yes.IsChecked)
                {
                    EmergencyRequest emergencyRequest = new EmergencyRequest();
                    emergencyRequest.MedicalRecord     = medicalRecordController.GetMedicalRecord(Informations.currentRecord.MedicalRecord.IdRecord);
                    emergencyRequest.Scheduled         = false;
                    emergencyRequest.SideNotes         = ShortDescr.Text;
                    emergencyRequest.Specialization    = doctor.Specializations[0];
                    emergencyRequest.TypeOfAppointment = TypeOfAppointment.examination;
                    emergencyRequestController.CreateEmergencyRequest(emergencyRequest);

                    MyEvents.CloseAddFormHandler.RaiseMyCustomEvent(this, new MyEvents.CloseAddForm());
                    NavigationService.Navigate(new Uri("/Pages/MedicalRecord/Informations.xaml", UriKind.Relative));
                }
                else
                {
                    Appointment a = new Appointment();
                    a.Doctor           = doctor;
                    a.ShortDescription = ShortDescr.Text;
                    string[] parts = ((string)TimeBox.SelectedItem).Split(":");
                    a.MedicalRecord = medicalRecordController.GetMedicalRecord(Informations.currentRecord.MedicalRecord.IdRecord);

                    a.TypeOfAppointment = TypeOfAppointment.examination;
                    a.Room = doctor.ExaminationRoom;
                    DateTime date = (DateTime)DateSelected.SelectedDate;
                    a.StartTime = new DateTime(date.Year, date.Month, date.Day, int.Parse(parts[0]), int.Parse(parts[1]), 0);
                    a.Urgent    = false;
                    try
                    {
                        appointemntController.AddAppointment(a, false);

                        MyEvents.CloseAddFormHandler.RaiseMyCustomEvent(this, new MyEvents.CloseAddForm());
                        NavigationService.Navigate(new Uri("/Pages/MedicalRecord/Informations.xaml", UriKind.Relative));
                    }
                    catch (PatientAlreadyHasAnAppointment)
                    {
                        Error.Text = "Pacijent već ima zakazan pregled u budućnosti";
                        ErrorMessage.Visibility = Visibility.Visible;
                    }
                    catch (AlreadyScheduled)
                    {
                        Error.Text = "U međuvremenu, termin se zakazao!";
                        ErrorMessage.Visibility = Visibility.Visible;
                    }
                    catch (NotValidTimeForScheduling)
                    {
                        Error.Text = "Vreme je nevalidno za zakazivanje";
                        ErrorMessage.Visibility = Visibility.Visible;
                    }
                }
            }
        }
        public Notification NewEmergencyRequest(EmergencyRequest emergencyRequest)
        {
            Notification notification = new Notification();

            notification.NotificationCategory  = NotificationCategory.EMERGENCY_REQUEST;
            notification.NotificationFrom      = null;
            notification.NotificationTo        = MakeListOfSecretaries(userRepository.GetAllSecrateries()).ToList();
            notification.ContentOfNotification = "Novi zahtev za zakazivanje hitnog pregleda za pacijenta " +
                                                 emergencyRequest.MedicalRecord.Patient.Name + " " + emergencyRequest.MedicalRecord.Patient.Surname;
            return(notificationRepository.Create(notification));
        }
 public bool DeleteEmergencyRequest(EmergencyRequest request) => emergencyRequestRepository.Delete(request);
 public EmergencyRequest UpdateEmergencyRequest(EmergencyRequest request) => emergencyRequestRepository.Update(request);
 public EmergencyRequest CreateEmergencyRequest(EmergencyRequest request)
 {
     notificationService.NewEmergencyRequest(request);
     return(emergencyRequestRepository.Create(request));
 }
Ejemplo n.º 6
0
 public bool DeleteEmergencyRequest(EmergencyRequest request) => emergencyRequestService.DeleteEmergencyRequest(request);
Ejemplo n.º 7
0
 public EmergencyRequest UpdateEmergencyRequest(EmergencyRequest request) => emergencyRequestService.UpdateEmergencyRequest(request);
Ejemplo n.º 8
0
 public EmergencyRequest CreateEmergencyRequest(EmergencyRequest request) => emergencyRequestService.CreateEmergencyRequest(request);