Exemple #1
0
        /// <summary>
        /// Tony Noel
        /// Created: 2015/03/04
        /// A method to cancel a booking.
        /// The object is then sent to the OrderManager-EditBooking method to be processed.
        /// </summary>
        /// <remarks>
        /// Pat Banks
        /// Updated: 2015/03/08
        /// Updated fields to reflect cancellation of booking
        ///
        /// Pat Banks
        /// Updated: 2015/03/19
        /// Moved logic to BookingManager - CancelBookingResults
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void BtnConfirmCancel_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //get the cancellation fee
                CurrentBooking.TotalCharge = _cancelFee;

                //cancel booking and get results
                ResultsEdit result = _bookingManager.CancelBookingResults(CurrentBooking);

                switch (result)
                {
                case (ResultsEdit.ChangedByOtherUser):
                    throw new ApplicationException("This booking has already been cancelled.");

                case (ResultsEdit.Success):
                    await this.ShowMessageDialog("Booking successfully cancelled.");

                    DialogResult = true;
                    Close();
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new WanderingTurtleException(this, ex);
            }
        }
Exemple #2
0
        public void TestCancelBookingResults()
        {
            //Tests the Cancel Booking Results method in the Booking Manager- which takes a BookingDetails object.
            //Grabs the ID for the dummy booking
            int id = TestCleanupAccessor.GetBooking();
            //retrieves the full booking information
            Booking booking1 = myBook.RetrieveBooking(id);

            //Creates a BookingDetails object and assigns variables from the booking to it.
            bookingDetails               = new BookingDetails();
            bookingDetails.BookingID     = id;
            bookingDetails.GuestID       = guestID;
            bookingDetails.EmployeeID    = empID;
            bookingDetails.ItemListID    = itemID;
            bookingDetails.Quantity      = bQuantity;
            bookingDetails.DateBooked    = dateBooked;
            bookingDetails.TicketPrice   = ticket;
            bookingDetails.ExtendedPrice = extended;
            bookingDetails.Discount      = discount;
            bookingDetails.TotalCharge   = total;
            //Passes the object to the CancelBookingResults method and asserts that that cancel will be successful
            ResultsEdit result   = myBook.CancelBookingResults(bookingDetails);
            ResultsEdit expected = ResultsEdit.Success;

            Assert.AreEqual(expected, result);
        }