private void Open_CreateNewPatient(object sender, RoutedEventArgs e) { Window_Client ch = new Window_Client(StaffRole, null); ch.combobox_Gender.SelectedIndex = 0; ch.combobox_AgeGroup.SelectedIndex = 0; ch.combobox_ethnicity.SelectedIndex = 0; ch.ShowDialog(); // Refresh the grid after closing the create new patient Refresh_ClientGrid(sender, e); }
// ----------------------------------------------------------------------------- /// <summary> /// This method is for when the EditPatient button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditPatient(object sender, RoutedEventArgs e) { try { DataGrid dg = sender as DataGrid; PatientGrid p = (PatientGrid)dg.SelectedItems[0]; // OR: Patient p = (Patient)dg.SelectedItem; Window_Client clientWindow = new Window_Client(StaffRole, p); clientWindow.ShowDialog(); } catch (Exception error) { } // Refresh the grid Refresh_ClientGrid(sender, e); }