private void btnSelect_Click(object sender, RoutedEventArgs e) { // Open the select teacher window so they can select which teacher they want to view details on or modify SelectTeacherWindow stw = new SelectTeacherWindow(); stw.ShowDialog(); // If they selected a teacher if (stw.selected) { // Assign the selected variable to keep track of they staff they selected selectedStaff_ = stw.selectedTeacher; // Enable buttons btnChangePassword.IsEnabled = true; btnDeleteStaff.IsEnabled = true; btnForename.IsEnabled = true; btnSurname.IsEnabled = true; // And fill the form contents lblID.Content = selectedStaff_.StaffID; lblForename.Content = selectedStaff_.StaffForename; lblSurname.Content = selectedStaff_.StaffSurname; lblType.Content = selectedStaff_.IsAdministrative.Value ? "Admin" : "Teacher"; } }
private void btnTeacher_Click(object sender, RoutedEventArgs e) { // Open a select teacher window SelectTeacherWindow stw = new SelectTeacherWindow(); stw.ShowDialog(); // If they selected a member of staff if (stw.selected) { // Set the teacher label to match their name and update the class & db lblTeacher.Content = stw.selectedTeacher.FullName; selectedClass_.Staff = stw.selectedTeacher; App.db.SubmitChanges(); } }