コード例 #1
0
        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);
        }