예제 #1
0
        private void btn_delete_Click(object sender, RoutedEventArgs e)
        {
            if (docselected == null)
            {
                return;
            }
            MessageBoxResult result = MessageBox.Show("Do you want to delete " + docselected.Employee.emp_firstname + "'s record?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (!(MessageBoxResult.Yes == result))
            {
                return;
            }
            docselected.cat_id = int.Parse(this.specialization_update.SelectedValue.ToString());
            hmsfac.remove(docselected);
            doctorList.Remove(docselected);
            dataGrid_Doctor.Items.Refresh();
            dataGrid_Patient.Items.Refresh();
            this.btn_delete.IsEnabled   = false;
            firstnametxt_update.Text    = "";
            lastnametxt_update.Text     = "";
            usernametxt_update.Text     = "";
            passwordbox_update.Password = "";
            datepicker_update.Text      = "";
            specialization_update.Text  = "";
            salary_update.Text          = "";
            rbMale_update.IsChecked     = false;
            rbFemale_update.IsChecked   = false;
        }
        private void meddelete_Btn_Click(object sender, RoutedEventArgs e)
        {
            if (medselected == null)
            {
                return;
            }

            MessageBoxResult result = MessageBox.Show("Do you want to delete " + medselected.med_name + "' medicine?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (!(MessageBoxResult.Yes == result))
            {
                return;
            }
            hmsfac.remove(medselected);
            medlist.Remove(medselected);
            dataGrid_AllMedicines.Items.Refresh();
            medupdate_Btnu.IsEnabled = false;
            meddelete_Btn.IsEnabled  = false;
        }
        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();
        }