private void Delete() { List<Group> groups = new List<Group>(); groups = LoadGroupsForInstructor(selected_instructor); if ((groups.Any()) && (DeleteGroupsCheck.IsChecked == false)) { MessageBox.Show("Opening Edit window to assign new instructor for associated groups"); foreach (Group gp in groups) { EditGroupWindow edit = new EditGroupWindow(gp, connection); edit.ShowDialog(); } Delete(); } else if ((groups.Any()) && (DeleteGroupsCheck.IsChecked == true)) { foreach (Group gp in groups) { groups_to_delete.Add(gp); } instructors_to_delete.Add(selected_instructor); MessageBox.Show("Instructor added to deletion list.\n All associated groups marked for deletion \n Waiting for confirmation"); } else { instructors_to_delete.Add(selected_instructor); MessageBox.Show("Instructor added to deletion list. Waiting for confirmation"); } }
private void EditGroupButton_Click(object sender, RoutedEventArgs e) { if (connection != null && connection.State == ConnectionState.Open)//If we have connection { if (selected_group != null)//and some group selected { EditGroupWindow window = new EditGroupWindow(selected_group, connection);//we open interation window for editing window.ShowDialog();//again we wnat it to return only when window is closed, which will mean that data is updated in DB ReloadData();//And realod it } else { MessageBox.Show("Pick group first"); } } else { MessageBox.Show("Connection is not open"); } }