private void AddPrescription_Click(object sender, RoutedEventArgs e) { autoList.Visibility = Visibility.Collapsed; boxic.Visibility = Visibility.Collapsed; if (Medication.Text.Equals("") && HourlyUsage.SelectedItem == null) { ErrorMessage.Visibility = Visibility.Visible; } else { TreatmentForm form = new TreatmentForm(); form.TreatmentType = TreatmentType.prescription; form.AdditionalNotes = HowToUSe.Text; form.Medications.Add(medication); form.DateOfExamination = DateTime.Today; if (HourlyUsage.SelectedIndex != 0) { form.Intake = int.Parse((string)HourlyUsage.SelectedItem); } form.Flag = (bool)Reserved.IsChecked; Treatment treatment = treatmentController.CreateTreatment(TreatmentFactory.CreateTreatment(form)); ExaminationSurgery examination = examinationSurgeryController.GetCurrentExamination(MedicalRecord.Informations.currentRecord.MedicalRecord.IdRecord); examinationSurgeryController.UpdateTreatment(examination, treatment); /* * ModelHCI.MedicationHCI medForPrescription = null; * foreach (ModelHCI.MedicationHCI med in ModelHCI.MedicationData.meds) * { * if (med.name.ToLower().Equals(Medication.Text.ToLower())) * { * medForPrescription = med; * } * } * ModelHCI.PrescriptionHCI prescription = new ModelHCI.PrescriptionHCI(); * prescription.medication = medForPrescription; * * if (HourlyUsage.SelectedIndex != 0) * { * prescription.intake = int.Parse((string)HourlyUsage.SelectedItem); * } * prescription.reasonWhy = HowToUSe.Text; * prescription.patient = Appointments.currentExamination.appointment.patient; */ // Appointments.currentExamination.examination.treatments.Add(prescription); // Pages.MedicalRecord.Informations.currentRecord.Therapies.Add(new ModelHCI.TherapyHCI() { medication = prescription.medication, hourlyUsage = prescription.intake }); NavigationService.Navigate(new Uri("Pages/MedicalRecord/Informations.xaml", UriKind.Relative)); } }
private void AddPrescription_Click(object sender, RoutedEventArgs e) { TreatmentForm treatmentForm = new TreatmentForm(); treatmentForm.LabTestTypes = types; treatmentForm.TreatmentType = TreatmentType.labTestType; Treatment t = treatmentController.CreateTreatment(TreatmentFactory.CreateTreatment(treatmentForm)); ExaminationSurgery exam = ExaminationSurgeryController.GetCurrentExamination(Informations.currentRecord.MedicalRecord.IdRecord); ExaminationSurgeryController.UpdateTreatment(exam, t); NavigationService.Navigate(new Uri("Pages/MedicalRecord/Vaccines.xaml", UriKind.Relative)); }
private void Add_Form_Click(object sender, RoutedEventArgs e) { if (StartDate.SelectedDate == null || EndDate.SelectedDate == null || Department.SelectedItem == null) { ErrorMessage.Visibility = Visibility.Visible; Error.Text = ALL_INPUTS_ERROR; } else { TreatmentForm form = new TreatmentForm(); form.TreatmentType = TreatmentType.hospitalTreatment; form.Department = departmentController.GetDepartmentByName((string)Department.SelectedItem); form.StartDate = (DateTime)StartDate.SelectedDate; form.EndDate = (DateTime)EndDate.SelectedDate; Treatment treatment = treatmentController.CreateTreatment(TreatmentFactory.CreateTreatment(form)); ExaminationSurgery examination = examinationSurgeryController.GetCurrentExamination(MedicalRecord.Informations.currentRecord.MedicalRecord.IdRecord); examinationSurgeryController.UpdateTreatment(examination, treatment); NavigationService.Navigate(new Uri("/Pages/MedicalRecord/Informations.xaml", UriKind.Relative)); } }