public DoctorPanelUc(User u, login3 login)
        {
            hmsfac = new HMSFACTORY();
            InitializeComponent();
            this.login     = login;
            user           = u;
            docOwner       = hmsfac.getDoctorByUid(user.user_id);
            NewPatientList = hmsfac.getMyPatients(docOwner);
            OldPatientList = hmsfac.getMyOldPatients(docOwner);
            medicineList   = hmsfac.getMedicine();
            presList       = hmsfac.getMyPrescriptions(docOwner);

            patmed_doc.ItemsSource    = medicineList;
            patmed1_doc.ItemsSource   = medicineList;
            patmed2_doc.ItemsSource   = medicineList;
            oldpatmed_doc.ItemsSource = medicineList;
            mypresc_med.ItemsSource   = medicineList;

            patmed_doc.SelectedValuePath    = "med_id";
            patmed_doc.DisplayMemberPath    = "med_name";
            patmed1_doc.SelectedValuePath   = "med_id";
            patmed1_doc.DisplayMemberPath   = "med_name";
            patmed2_doc.DisplayMemberPath   = "med_name";
            patmed2_doc.SelectedValuePath   = "med_id";
            oldpatmed_doc.SelectedValuePath = "med_id";
            oldpatmed_doc.DisplayMemberPath = "med_name";
            mypresc_med.DisplayMemberPath   = "med_name";
            mypresc_med.SelectedValuePath   = "med_id";

            dataGrid_NewPatient.ItemsSource      = NewPatientList;
            dataGrid_MyPrescriptions.ItemsSource = presList;
            dataGrid_OldPatient.ItemsSource      = OldPatientList;
        }
        private void submit_presc_Click(object sender, RoutedEventArgs e)
        {
            if (patSelected == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(pattypecombo_doc.Text))
            {
                MessageBox.Show("Please select patient type.", "Reminder", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }


            if (pattypecombo_doc.Text.Equals("Indoor"))
            {
                if (string.IsNullOrEmpty(patdisease_doc.Text))
                {
                    MessageBox.Show("Please enter a diease", "Reminder", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                IndoorPatient patIndoor = new IndoorPatient();
                DateTime      admitdate = DateTime.Today;
                patIndoor.indpat_disease = patdisease_doc.Text;
                patIndoor.Patient        = patSelected;
                patIndoor.admit_date     = admitdate;
                patIndoor.indpat_status  = "admitted";
                hmsfac.addIndoor(patIndoor);
                patSelected.pat_type = "indoor";
            }
            else
            {
                patSelected.pat_type = "outdoor";
            }


            if (!string.IsNullOrEmpty(patmed_doc.Text))
            {
                int mid1 = int.Parse(patmed_doc.SelectedValue.ToString());

                string dosage1 = patdosage_doc.Text;

                Prescription p1 = new Prescription();
                p1.med_id       = mid1;
                p1.presc_dosage = dosage1;
                p1.pat_id       = patSelected.pat_id;
                p1.doc_id       = docOwner.doc_id;
                hmsfac.addPrescription(p1);
                presList.Add(p1);


                if (!string.IsNullOrEmpty(patmed1_doc.Text))
                {
                    Prescription p2 = new Prescription();
                    p2.med_id       = int.Parse(patmed1_doc.SelectedValue.ToString());
                    p2.presc_dosage = patdosage1_doc.Text;
                    p2.pat_id       = patSelected.pat_id;
                    p2.doc_id       = docOwner.doc_id;
                    hmsfac.addPrescription(p2);
                    presList.Add(p2);
                }

                if (!string.IsNullOrEmpty(patmed2_doc.Text.ToString()))
                {
                    Prescription p3 = new Prescription();
                    p3.med_id       = int.Parse(patmed2_doc.SelectedValue.ToString());
                    p3.presc_dosage = patdosage2_doc.Text;
                    p3.pat_id       = patSelected.pat_id;
                    p3.doc_id       = docOwner.doc_id;
                    hmsfac.addPrescription(p3);
                    presList.Add(p3);
                }

                patSelected.doc_id = docOwner.doc_id;
                hmsfac.updatePatient(patSelected);
                NewPatientList.Remove(patSelected);
                dataGrid_NewPatient.Items.Refresh();
                dataGrid_MyPrescriptions.Items.Refresh();
                MessageBox.Show("Prescription submisson success.", "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                dataGrid_OldPatient.ItemsSource = hmsfac.getMyOldPatients(docOwner);
                dataGrid_OldPatient.Items.Refresh();
                this.pattypecombo_doc.Text  = "";
                this.patmed_doc.Text        = "";
                this.patdisease_doc.Text    = "";
                this.patdosage_doc.Text     = "";
                this.patdosage1_doc.Text    = "";
                this.patdosage2_doc.Text    = "";
                this.patmed1_doc.Text       = "";
                this.patmed2_doc.Text       = "";
                this.submit_presc.IsEnabled = true;
            }
            else
            {
                MessageBox.Show("At least one medicine is required for prescription", "Reminder", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
        }