private void Recepti_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (Recepti.SelectedItem != null)
     {
         ModelHCI.PrescriptionHCI p = ((showPrescription)Recepti.SelectedItem).prescription;
         ExportPrescrption.ExportAsPdf(p);
     }
 }
        private void Generate_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
            {
                ModelHCI.MedicationHCI medForPrescription = null;
                foreach (ModelHCI.MedicationHCI med in ModelHCI.MedicationData.meds)
                {
                    if (med.name.ToLower().Trim().Equals(Medication.Text.Trim().ToLower()))
                    {
                        medForPrescription = med;
                    }
                }

                ModelHCI.PrescriptionHCI prescription = new ModelHCI.PrescriptionHCI();
                prescription.medication         = medForPrescription;
                prescription.dateOfPrescription = DateTime.Today;
                prescription.patient            = Appointments.currentExamination.appointment.patient;
                prescription.id = 15;
                if (HourlyUsage.SelectedIndex != 0)
                {
                    prescription.intake = int.Parse((string)HourlyUsage.SelectedItem);
                }
                else
                {
                    prescription.intake = 0;
                }
                prescription.reasonWhy = HowToUSe.Text;
                ExportPrescrption.ExportAsPdf(prescription);
            }
        }