private void Button_Click(object sender, RoutedEventArgs e) { ScheduleAppointmentView appointment = new ScheduleAppointmentView(); appointment.StartTime = SelectedApp.AvailableAppointment.StartTime; appointment.EndTime = SelectedApp.AvailableAppointment.EndTime; appointment.DoctorWorkDayId = SelectedApp.Id; MedicalExamination medicalExamination = new MedicalExamination(); medicalExamination.DoctorId = SelectedApp.DoctorId; medicalExamination.RoomId = SelectedApp.RoomId; appointment.MedicalExamination = medicalExamination; if (Backend.App.Instance().DoctorWorkDayService.ScheduleAppointment(ScheduleAppoitmentConverter.AppointmentDtoToAppointment(appointment, SelektovaniPacijent))) { MessageBox.Show("The appointment is successfully made "); ResultSchedule s = new ResultSchedule(Dstart, Dend, DoctorS, PriorityS); s.Show(); this.Close(); } else { MessageBox.Show("Error"); } }
public static Appointment AppointmentDtoToAppointment(ScheduleAppointmentView dto, PatientView patient) { Appointment appointment = new Appointment(); appointment.Canceled = dto.Canceled; appointment.DoctorWorkDayId = dto.DoctorWorkDayId; appointment.StartTime = dto.StartTime; appointment.EndTime = dto.EndTime; appointment.MedicalExamination = dto.MedicalExamination; appointment.MedicalExamination.PatientId = patient.IdOfPatient; return(appointment); }