public void LoadData(object sender, DoWorkEventArgs e) { doctorList = hmsfac.getDoctor(); nurseList = hmsfac.getNurse(); patientList = hmsfac.getPatient(); roomList = hmsfac.getRoom(); indpatList = hmsfac.getIndoorPatient(); prescList = hmsfac.getPrescriptions(); billpatlist = hmsfac.getBills(); this.Dispatcher.Invoke(new Action(delegate { dataGrid_Doctor.ItemsSource = doctorList; dataGrid_Nurse.ItemsSource = nurseList; dataGrid_Patient.ItemsSource = patientList; dataGrid_Room.ItemsSource = roomList; dataGrid_IndoorPatients.ItemsSource = indpatList; dataGrid_Patients_Bill.ItemsSource = billpatlist; specialization_update.ItemsSource = hmsfac.getCategories(); governedbytxt_update.ItemsSource = nurseList; cboselroom_no.ItemsSource = roomList; patname_bill.ItemsSource = patientList; patname_bill.SelectedValuePath = "pat_id"; patname_bill.DisplayMemberPath = "pat_name"; patcombobox_updatedoc.ItemsSource = doctorList; })); }
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(); }