private void RemoveTeacher_Click(object sender, RoutedEventArgs e) { int SelectedTeacherId; SelectedTeacherId = TeachersGrid.SelectedIndex; Teacher SelectedTeacher; SelectedTeacher = (Teacher)TeachersGrid.Items[SelectedTeacherId]; if (SelectedTeacher.Account != null) { dbl.RemoveAccount(SelectedTeacher.Account); } dbl.RemovePerson(SelectedTeacher); Teachers.Remove(SelectedTeacher); }
private void RemoveDean_Click(object sender, RoutedEventArgs e) { int SelectedDeanId; SelectedDeanId = DeansGrid.SelectedIndex; Dean SelectedDean; SelectedDean = (Dean)DeansGrid.Items[SelectedDeanId]; if (SelectedDean.Account != null) { dbl.RemoveAccount(SelectedDean.Account); } dbl.RemovePerson(SelectedDean); Deans.Remove(SelectedDean); }
private void RemoveStudent_Click(object sender, RoutedEventArgs e) { int SelectedStudentId; SelectedStudentId = StudentsGrid.SelectedIndex; Student SelectedStudent; SelectedStudent = (Student)StudentsGrid.Items[SelectedStudentId]; if (SelectedStudent.Account != null) { dbl.RemoveAccount(SelectedStudent.Account); } dbl.RemovePerson(SelectedStudent); Students.Remove(SelectedStudent); }