// This event handler is fired when the unassign employee button is clicked. It unassigns the chosen employee from the chosen activity. private void BtnUnassignEmployee_Click(object sender, RoutedEventArgs e) { try { if (dgScheduledEmployees.SelectedItem == null) { MessageBox.Show("You must select a scheduled employee."); return; } if (_scheduleManager.DeactivateSchedule(((PersonScheduleVM)dgScheduledEmployees.SelectedItem).ScheduleID)) { MessageBox.Show("You have Unassigned " + ((PersonScheduleVM)dgScheduledEmployees.SelectedItem).FirstName + " " + ((PersonScheduleVM)dgScheduledEmployees.SelectedItem).LastName + " from " + ((ActivityVM)dgAllActivities.SelectedItem).ActivityName); //populateAllActivities(); populateAllEmployees(); populateEmployeesScheduled(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message); } }
// This event handler is fired when the cancel activity button is pushed. It will allows the user to cancel // an activity they have previously signed up for private void BtnCancelActivity_Click(object sender, RoutedEventArgs e) { if (dgUserVolunteerActivities.SelectedItem == null) { MessageBox.Show("You must make a volunteering selection."); return; } if (MessageBox.Show("Are you sure?", "Cancel Volunteering", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { try { if (_scheduleManager.DeactivateSchedule(((ActivityVM)dgUserVolunteerActivities.SelectedItem).ScheduleID)) { MessageBox.Show("Volunteering Canceled."); populateUserVolunteerActivities(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message); } } }