Exemple #1
0
        public void InvoiceManagerArchiveGuestInvoice()
        {
            int            guestID  = TestCleanupAccessor.GetHotelGuest();
            ResultsArchive result   = access.ArchiveGuestInvoice(guestID);
            ResultsArchive expected = ResultsArchive.Success;

            Assert.AreEqual(expected, result);
        }
Exemple #2
0
        /// <summary>
        /// Pat Banks
        /// Created:  2015/03/03
        /// Calls methods to archive the associated database records for the selected hotel guest
        /// </summary>
        /// <remarks>
        /// Pat Banks
        /// Updated:  2015/03/19
        /// Moved decision logic to Invoice Manager
        ///
        /// Miguel Santana
        /// Updated:  2015/04/28
        /// Added message box to notify user that report is being generated
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnFinalizeInvoice_Click(object sender, RoutedEventArgs e)
        {
            Exception exception  = null;
            var       controller = await this.ShowProgressAsync("Checkout Guest", "Please wait...");

            await TaskEx.Delay(1000);

            try
            {
                var result = _invoiceManager.ArchiveGuestInvoice(CurrentInvoice.HotelGuestID);
                controller.SetMessage("Guest has been checked out!");
                await TaskEx.Delay(2000);

                switch (result)
                {
                case (ResultsArchive.ChangedByOtherUser):
                    throw new ApplicationException("Record already changed by another user.");

                case (ResultsArchive.Success):
                    controller.SetMessage("Opening Printable Invoice.");
                    await TaskEx.Delay(10);

                    var invoice = new PrintableInvoice((int)_guestToView.HotelGuestID);
                    await controller.CloseAsync();

                    invoice.ShowDialog();
                    break;

                default:
                    throw new ApplicationException("Unknown exception checkout out guest.");
                }
            }
            catch (Exception ex) { exception = ex; }
            if (exception != null)
            {
                await controller.CloseAsync();

                throw new WanderingTurtleException(this, exception);
            }
            await this.ShowMessageDialog("Guest checkout complete.");

            DialogResult = true;
            Close();
        }