private void Generate_Click(object sender, RoutedEventArgs e) { if (StartDate.SelectedDate == null && EndDate.SelectedDate == null && Lek.Text.Equals("")) { } if ((StartDate.SelectedDate == null) || (EndDate.SelectedDate == null) || ((Lek.Text.Equals("")) && (!(bool)SviLekovi.IsChecked))) { Error.Text = ERROR2; ErrorMessage.Visibility = Visibility.Visible; } else { if (!(bool)SviLekovi.IsChecked) { foreach (Medication medic in medicationController.GetAllApprovedMeds()) { if (medic.Med.ToLower().Equals(Lek.Text.ToLower())) { medToGenerate = medic; } } MedicationConsumptionReport report = reportController.GenerateMedicalConsumptionReport((DateTime)StartDate.SelectedDate, (DateTime)EndDate.SelectedDate, medToGenerate); ExportToPDF.ExportAsPDF(report); } else { } NavigationService.Navigate(new Uri("Pages/Medications.xaml", UriKind.Relative)); } }
private void Medication_TextChanged(object sender, TextChangedEventArgs e) { if (Medication.Text.Equals("")) { autoList.Visibility = Visibility.Collapsed; boxic.Visibility = Visibility.Collapsed; return; } String text = Medication.Text; medications = new List <Medication>(); List <ShowMedications> medication = new List <ShowMedications>(); autoList.ItemsSource = new List <string>(); foreach (Medication med in medicationController.GetAllApprovedMeds()) { if (med.Med.ToLower().StartsWith(text.ToLower())) { medication.Add(new ShowMedications() { medication = med, name = med.Med }); medications.Add(med); } } if (medication.Count > 0) { autoList.Visibility = Visibility.Visible; boxic.Visibility = Visibility.Visible; autoList.ItemsSource = medication; } else { autoList.Visibility = Visibility.Collapsed; boxic.Visibility = Visibility.Collapsed; } }
public Medications() { InitializeComponent(); var app = Application.Current as App; medicationController = app.medicationController; validationMedicationController = app.validationMedicationController; MyEvents.OpenRecord.CustomEvent += ClosePanel; if (Validation != null) { Validation.ItemsSource = new List <ModelHCI.MedicationHCI>(); List <ModelHCI.MedicationHCI> validations = new List <ModelHCI.MedicationHCI>(); List <string> allergens = new List <string>(); List <string> ingredients = new List <string>(); foreach (Medication medication in medicationController.GetAllOnValidationForDoctor(MainWindow.doctor)) { allergens = new List <string>(); ingredients = new List <string>(); foreach (Allergens allergen1 in medication.Allergens) { allergens.Add(allergen1.Allergen); } foreach (DosageOfIngredient dosage in medication.MedicationContent) { ingredients.Add(dosage.MedicationIngredient.Name + " " + dosage.Amount + " mg"); } validations.Add(new ModelHCI.MedicationHCI(medication.Med, true, allergens, ingredients, "Tableta") { medication = medication }); } Validation.ItemsSource = validations; Storage.ItemsSource = new List <ModelHCI.MedicationHCI>(); List <ModelHCI.MedicationHCI> storage = new List <ModelHCI.MedicationHCI>(); foreach (Medication medication in medicationController.GetAllApprovedMeds()) { allergens = new List <string>(); ingredients = new List <string>(); foreach (Allergens allergen1 in medication.Allergens) { allergens.Add(allergen1.Allergen); } foreach (DosageOfIngredient dosage in medication.MedicationContent) { ingredients.Add(dosage.MedicationIngredient.Name + " " + dosage.Amount + " mg"); } storage.Add(new ModelHCI.MedicationHCI(medication.Med, false, allergens, ingredients, "Tableta") { medication = medication }); } Storage.ItemsSource = storage; } }