public bool MoveRoom(bool showConfirm) { bool isSuccess = false; Exception eMove = null; if (!isOccSelected()) { isSuccess = false; eMove = new Exception("A destination room was not selected."); } else { List <Person> Attendees = CD.GetAttendees(SourceOccurrence.Id).Where(x => x.Checkout.Date == new DateTime(1900, 1, 1)).ToList(); foreach (Person Attendee in Attendees) { PersonId = Attendee.Id; try { isSuccess = Checkout(false); } catch (Exception ex) { isSuccess = false; eMove = new Exception("Some moves may have been completed successfully, but an error has occurred when moving " + Attendee.FullName + ".", ex); } if (!isSuccess) { break; } try { CD.Checkin(personId, int.Parse(destinationOccurrenceId.Value), Attendee.SecurityCode, Attendee.PersonType); } catch (Exception ex1) { isSuccess = false; eMove = new Exception("Some moves may have been completed successfully, but an an error has occurred when moving + " + Attendee.FullName, ex1); } if (!isSuccess) { break; } } } if (!isSuccess) { if (eMove != null) { throw eMove; } } return(isSuccess); }
/// <summary>Move the person from the source occurence to the user-selected occurrence.</summary> /// <returns>Success flag.</returns> public bool Move(bool bShowConfirm, out string DestinationSecurityCode) { bool bSuccess = true; DestinationSecurityCode = null; if (!isOccSelected()) { bSuccess = false; } else { Exception eCheckout = null, eCheckin = null; //Check out from the old occurrence. try { bSuccess = Checkout(false); } catch (Exception e1) { eCheckout = e1; } //Check into the new occurrence. try { CD.Checkin(PersonId, int.Parse(destinationOccurrenceId.Value), SecurityCode, OccurrenceAttendanceType); DestinationSecurityCode = SecurityCode; } catch (Exception e2) { eCheckin = e2; bSuccess = false; } //Doesn't work when embedded in an AJAX panel if (bSuccess && bShowConfirm) { //int.Parse(lstDestinationOccurrence.SelectedValue) Occurrence destinationOcc = GetOccurrenceById(int.Parse(destinationOccurrenceId.Value)); ScriptManager.RegisterStartupScript(this.Parent, this.Parent.GetType(), "CheckoutComplete", String.Format("alert('{0} {1}has been moved from\n\r{2}\n\r {3}\n\r {4}\n\rto\n\r{5}\n\r {6}\n\r {7}');", Person.FullName, (OccurrenceAttendanceType == Arena.Enums.OccurrenceAttendanceType.Leader ? "(Leader) " : ""), SourceOccurrence.AttendanceTypeCategoryName, SourceOccurrence.AttendanceTypeName, SourceOccurrence.Name, destinationOcc.AttendanceTypeCategoryName, destinationOcc.AttendanceTypeName, destinationOcc.Name), true); } //Inform user what part of the move failed. } return(bSuccess); }