Ejemplo n.º 1
0
 /// <summary>
 /// Pat Banks
 /// Created: 2015/03/03
 /// Calls the InvoiceAccessor method that
 /// retrieves a list of invoices that are active
 /// </summary>
 /// <returns>List of all active guest invoices</returns>
 public List <InvoiceDetails> RetrieveActiveInvoiceDetails()
 {
     try
     {
         return(InvoiceAccessor.GetAllInvoicesList().Where(i => i.Active).ToList());
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Pat Banks
 /// Created: 2015/02/25
 /// Calls the InvoiceAccessor method that
 /// retrieves a list of bookings for a hotel guest
 /// </summary>
 /// <param name="hotelGuestId">Hotel guest ID</param>
 /// <returns>List of bookings for a hotel guest</returns>
 public List <BookingDetails> RetrieveGuestBookingDetailsList(int hotelGuestId)
 {
     try
     {
         return(InvoiceAccessor.GetInvoiceBookingsByGuest(hotelGuestId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Arik Chadima
        /// Created: 2015/5/1
        /// Assembles and returns an AccountingDetails Object with booking details for invoices and supplier listings for closed out invoices within the start and end params
        /// </summary>
        /// <param name="start">start date of invoices</param>
        /// <param name="end">end date of invoices</param>
        /// <returns>AccountingDetails with object data as requested by the params</returns>
        /// <remarks>
        /// Arik Chadima
        /// Updated: 2015/05/01
        /// Implemented method from just a stub to complete.
        /// Arik Chadima
        /// Updated 2015/05/05
        /// Added try-catch blocks for "dangerous" code.
        /// </remarks>
        /// <exception cref="ArgumentNullException"><paramref name="match" /> is null.</exception>
        public AccountingDetails GetAccountingDetails(DateTime start, DateTime end)
        {
            AccountingDetails details = new AccountingDetails
            {
                StartDate = start,
                EndDate   = end
            };
            InvoiceManager        im               = new InvoiceManager();
            BookingManager        bm               = new BookingManager();
            List <ItemListing>    listings         = ItemListingAccessor.GetAllItemListingList();
            List <InvoiceDetails> inactiveInvoices = InvoiceAccessor.GetAllInvoicesList().FindAll(i => i.Active == false && i.DateOpened >= start && i.DateClosed <= end);
            List <BookingDetails> bookings         = new List <BookingDetails>();
            List <int>            listingIDs       = new List <int>();

            foreach (InvoiceDetails i in inactiveInvoices)
            {
                var guestBookings = im.RetrieveGuestBookingDetailsList(i.HotelGuestID);
                details.Invoices.Add(new AccountingInvoiceDetails {
                    InvoiceInformation = i, Bookings = guestBookings
                });                                                                                                      //translations into a "lower" subset.

                foreach (BookingDetails bd in guestBookings)
                {
                    bookings.Add(bd);
                    if (!listingIDs.Contains(bd.ItemListID))
                    {
                        listingIDs.Add(bd.ItemListID);
                    }
                }
            }

            var suppliers = SupplierAccessor.GetSupplierList();

            foreach (Supplier s in suppliers)
            {
                IEnumerable <int> itemIDs = listings.FindAll(l => listingIDs.Contains(l.ItemListID)).Select(l => l.ItemListID);
                var iDs = itemIDs as IList <int> ?? itemIDs.ToList();
                List <ItemListingDetails> items = iDs.Select(i => bm.RetrieveItemListingDetailsList(i)).ToList();

                //probably too condensed, but it compiles everyting necessary for stuffs.
                details.SupplierListings.Add(new AccountingSupplierListingDetails {
                    Vendor = s, Items = items, Bookings = bookings.FindAll(b => iDs.Contains(b.ItemListID))
                });
            }

            return(details);
        }
Ejemplo n.º 4
0
        public List <Invoice> GetInvoiceList(string contractType)
        {
            try
            {
                var invoiceList = InvoiceAccessor.FetchInvoice(contractType);

                if (invoiceList.Count > 0)
                {
                    return(invoiceList);
                }
                else
                {
                    throw new ApplicationException("No records found");
                }
            }
            catch (Exception)
            {
                return(null);
                //throw ;
            }
        }