//Add Patient details to grid after verifying the data. private void AddPatient_Click(object sender, RoutedEventArgs e) { string patientFullName = patientFName.Text + " " + patientLName.Text; if (CheckValidityPatient()) { //this FOR loop from https://social.msdn.microsoft.com/Forums/vstudio/en-US/01a15d97-d321-4b93-8757-7b7b07378ee2/get-cell-value-from-wpf-datagrid-c?forum=wpf for (int i = 0; i < PatientDataGrid.Items.Count; i++) { TextBlock x = PatientDataGrid.Columns[1].GetCellContent(PatientDataGrid.Items[i]) as TextBlock; if (x != null) { dummy.Text = x.Text; } } int newRecordNo = int.Parse(dummy.Text); PatientDetails newPatient = new PatientDetails(patientFullName, newRecordNo + 1); HealthcareDatabase.AllPatientFiles.Add(newPatient); RefreshPatientDataGrid(); scrollDownPatient(); MessageBox.Show("The record of " + patientFullName + " is Added successfully", "Sucess..!! "); } else { MessageBox.Show("Please fill the FirstName and Last Name of Patient..!! ", "ERROR"); } patientFName.Text = ""; patientLName.Text = ""; dummy.Text = ""; }
public PharmacyPage(PatientDetails patientName, object _mainPage) { InitializeComponent(); // MedicineDataGrid.ItemsSource = HealthcareDatabase.AllMedications; DisplayCombo(); paientblock.Text = patientName.patientName; patient = patientName; mainPage = _mainPage; }
public VisitDoctor(PatientDetails patientName, DoctorDetails doctorName, object _mainPage) { InitializeComponent(); DisplayMedicineCombo(); RefillCount.Text = "0"; pNameToShow = patientName; dNameToShow = doctorName; mainPage = _mainPage; AssignValues(); }
private void VisitPhar_Click(object sender, RoutedEventArgs e) { Object selectedPatient = PatientDataGrid.SelectedItem; if (selectedPatient == null) { MessageBox.Show("Please select Patient details from lists", "ERROR!!!"); } else { PatientDetails chosenPatient = (PatientDetails)selectedPatient; Page PharmacyPage = new PharmacyPage(chosenPatient, this.Content); this.Content = PharmacyPage; } }
private void VisitDoc_Click(object sender, RoutedEventArgs e) { Object selectedPatient = PatientDataGrid.SelectedItem; object selectedDoctor = DoccomboBox.SelectedItem; if (selectedPatient == null || selectedDoctor == null) { MessageBox.Show("Please select both Patient and Doctor details from lists", "ERROR!!!"); } else { PatientDetails chosenPatient = (PatientDetails)selectedPatient; DoctorDetails chosenDoctor = (DoctorDetails)selectedDoctor; Page VisitDoctor = new VisitDoctor(chosenPatient, chosenDoctor, this.Content); this.Content = VisitDoctor; } }
private void RemovePatient_Click(object sender, RoutedEventArgs e)//Removes Patient data { object selectedPatient = PatientDataGrid.SelectedItem; if (selectedPatient != null) { PatientDetails chosenPatient = (PatientDetails)PatientDataGrid.SelectedItem; MessageBoxResult removePatient = MessageBox.Show("Do you want to remove the record of " + chosenPatient.patientName, "Delete Item", MessageBoxButton.YesNo); if (removePatient == MessageBoxResult.Yes) { HealthcareDatabase.AllPatientFiles.Remove(chosenPatient); RefreshPatientDataGrid(); MessageBox.Show("The record of " + chosenPatient.patientName + " is Removed successfully", "Sucess..!!, "); } else { MessageBox.Show("Select a recored to delete...", "Error..!!"); } } }