private void updteBtn_pres_Click(object sender, RoutedEventArgs e)
        {
            if (presSelected == null)
            {
                return;
            }



            String patType = mypresc_pattype.Text;
            int    mid     = int.Parse(mypresc_med.SelectedValue.ToString());
            String Dosage  = mypresc_dosage.Text;
            String disease = null;

            if (string.IsNullOrEmpty(patType) || string.IsNullOrEmpty(Dosage))
            {
                MessageBox.Show("Please make sure all attributes are compelted.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }


            string prevType = presSelected.Patient.pat_type;

            presSelected.Patient.pat_type = patType.ToLower();
            presSelected.med_id           = mid;
            presSelected.presc_dosage     = Dosage;



            IndoorPatient indo = hmsfac.getIndoorByPid(presSelected.pat_id);

            if (patType.ToLower().Equals("indoor") && prevType.Equals("outdoor"))
            {
                this.mypresc_disease.IsEnabled = true;
                disease = mypresc_disease.Text;
                if (!String.IsNullOrEmpty(disease))
                {
                    IndoorPatient indpat = new IndoorPatient();
                    indpat.indpat_disease = disease;
                    indpat.pat_id         = presSelected.pat_id;
                    indpat.indpat_status  = "admitted";
                    hmsfac.addIndoor(indpat);
                }
                else
                {
                    MessageBox.Show("Please enter a diesease.");
                    return;
                }
            }
            else if (patType.ToLower().Equals("outdoor"))
            {
                if (indo != null)
                {
                    hmsfac.remove(indo);
                }
            }
            else
            {
                indo.indpat_disease = disease;
                hmsfac.updateIndoor(indo);
            }



            hmsfac.updatePrescription(presSelected);


            MessageBox.Show("Record updated success.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
            dataGrid_MyPrescriptions.Items.Refresh();
            NewPatientList = hmsfac.getPatient();
            dataGrid_NewPatient.Items.Refresh();
        }