/// <summary> /// Arik Chadima /// Created: 2015/4/16 Binds the hosted report viewer to the PrintableInvoice with the given /// guest with the guestID. /// </summary> /// <param name="guestId">guest id of the guest to use for the invoice</param> /// <returns>bool successful</returns> /// <remarks>Updated by Arik Chadima 2015/4/17</remarks> /// <exception cref="WanderingTurtleException" /> public void BuildInvoice(int guestId) { //builds the managers required InvoiceManager invoiceManager = new InvoiceManager(); HotelGuestManager guestManager = new HotelGuestManager(); try { RvHostArea.LocalReport.DataSources.Clear(); ReportDataSource reportDataSource1 = new ReportDataSource { Name = "HotelGuestDataset" }; //Name of the report dataset in our .RDLC file List <HotelGuest> guestSet = new List <HotelGuest>(); var foundGuest = guestManager.GetHotelGuest(guestId); guestSet.Add(foundGuest); reportDataSource1.Value = guestSet; RvHostArea.LocalReport.DataSources.Add(reportDataSource1); ReportDataSource reportDataSource2 = new ReportDataSource { Name = "InvoiceDetailsDataset" }; //Name of the report dataset in our .RDLC file List <InvoiceDetails> invoiceSet = new List <InvoiceDetails> { invoiceManager.RetrieveInvoiceByGuest(guestId) }; reportDataSource2.Value = invoiceSet; RvHostArea.LocalReport.DataSources.Add(reportDataSource2); ReportDataSource reportDataSource3 = new ReportDataSource { Name = "BookingDetailsSet", Value = invoiceManager.RetrieveGuestBookingDetailsList(guestId) }; //Name of the report dataset in our .RDLC file RvHostArea.LocalReport.DataSources.Add(reportDataSource3); ReportDataSource reportDataSource4 = new ReportDataSource { Name = "ZipCodeDataset" }; //Name of the report dataset in our .RDLC file List <CityState> zipSet = new List <CityState> { foundGuest.CityState }; reportDataSource4.Value = zipSet; RvHostArea.LocalReport.DataSources.Add(reportDataSource4); RvHostArea.LocalReport.ReportEmbeddedResource = "com.WanderingTurtle.FormPresentation.Views.PrintableInvoice.rdlc"; RvHostArea.RefreshReport(); } catch (Exception ex) { throw new WanderingTurtleException(this, ex); } }
/// <summary> /// Pat Banks /// Created: 2015/03/03 /// Constructs a populated form that shows the final charges for a guest and /// allows employee to submit to close the invoice /// </summary> /// <param name="selectedHotelGuestId">Guest selected from the ViewInvoiceUI</param> /// <exception cref="WanderingTurtleException">Child window errored during initialization.</exception> public ArchiveInvoice(int selectedHotelGuestId) { try { InitializeComponent(); CurrentInvoice = _invoiceManager.RetrieveInvoiceByGuest(selectedHotelGuestId); Title = "Archiving Invoice"; _guestToView = _hotelGuestManager.GetHotelGuest(CurrentInvoice.HotelGuestID); _myBookingList = _invoiceManager.RetrieveGuestBookingDetailsList(CurrentInvoice.HotelGuestID); FillFormFields(); } catch (Exception ex) { throw new WanderingTurtleException(this, ex); } }
/// <summary> /// Pat Banks /// Created: 2015/03/03 /// Opens the EditGuest UI as dialog box /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEditGuest_Click(object sender, RoutedEventArgs e) { try { //retrieve the guest information HotelGuest selectedGuest = _hotelGuestManager.GetHotelGuest(CurrentInvoice.HotelGuestID); //refreshes guest information after AddEditHotelGuest UI if (new AddEditHotelGuest(selectedGuest).ShowDialog() == false) { return; } RefreshGuestInformation(CurrentInvoice.HotelGuestID); Result = true; } catch (Exception ex) { throw new WanderingTurtleException(this, ex); } }
public void HotelManagerGet() { HotelGuest guest = access.GetHotelGuest(100); Assert.AreEqual(100, guest.HotelGuestID); }