/// <summary> /// Creator: Austin Gee /// Created On: 5/1/2020 /// /// Auto generates columns /// </summary> /// <remarks> /// Updater Name /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void CancelApplication_Click(object sender, RoutedEventArgs e) { IAdoptionAppointmentManager adoptionAppointmentManager = new AdoptionAppointmentManager(); if (DGViewData.SelectedItem == null) { WPFErrorHandler.ErrorMessage("Please select an adoption application."); } else { System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Are you sure you want to cancel the Adoption Application?", "Cancel Application", System.Windows.Forms.MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { var appointments = adoptionAppointmentManager.RetrieveAdoptionAppointmentsByCustomerEmailAndActive(((ApplicationVM)DGViewData.SelectedItem).CustomerEmail); foreach (var a in appointments) { adoptionAppointmentManager.EditAdoptionAppointmentActive(a.AppointmentID, false); } IAdoptionAnimalManager adoptionAnimalManager = new AdoptionAnimalManager(); adoptionAnimalManager.EditAnimalAdoptable(((ApplicationVM)DGViewData.SelectedItem).AnimalID, true); _adoptionApplicationManager.DeactivateAdoptionApplication(((ApplicationVM)DGViewData.SelectedItem).AdoptionApplicationID); } else if (dialogResult == System.Windows.Forms.DialogResult.No) { } } DGViewData.ItemsSource = _adoptionApplicationManager.RetrieveAdoptionApplicationsByActiveWithName(true); }
public ActionResult CustomerCancelAdoption(FormCollection formCollection) { string applicationIDSring = formCollection[1]; try { int applicationID = Int32.Parse(applicationIDSring); var application = _adoptionApplicationManager.RetrieveAdoptionApplicationByID(applicationID); _adoptionApplicationManager.DeactivateAdoptionApplication(applicationID); _adoptionAnimalManager.EditAnimalAdoptable(application.AnimalID, true); return(RedirectToAction("CustomerApplicationList", new { customerEmail = formCollection[2] })); } catch (Exception) { return(View()); } }