/* * Updates the BookingComponent instance currently loaded in the * system. */ public void UpdateBooking(DateTime arrival, DateTime departure) { List <PersonComponent> savedGuests = CurrentBook.GetGuests(); List <BookingDecorator> decorationStack; BookingComponent booking = CurrentBook.Unwrap(out decorationStack); booking = bFact.UpdateBooking(booking.GetBookingNb(), CurrentCust, arrival, departure); if (decorationStack != null) { foreach (BookingDecorator reference in decorationStack) { reference.Setcomponent(booking); booking = reference; } } CurrentBook = booking; foreach (PersonComponent g in savedGuests) { CurrentBook.AddGuest(g); } }
/* * Adds current customer to current booking's list of guests. */ public void AddCustomerToGuests(String passportNb, int age) { List <PersonComponent> savedGuests = CurrentBook.GetGuests(); DateTime arrival; DateTime departure; CurrentBook.GetDates(out arrival, out departure); CurrentCust = pFact.GetNewGuest(CurrentCust, passportNb, age); CurrentBook = bFact.UpdateBooking(CurrentBook.GetBookingNb(), CurrentCust, arrival, departure); foreach (PersonComponent g in savedGuests) { CurrentBook.GetGuests().Add(g); } CurrentBook.AddGuest(CurrentCust); }
// METHOD RELATED TO CURRENT BOOKING'S GUESTS: /* * Adds a new person to current booking's list of guests. */ public void AddGuest(String name, String passportNb, int age) { CurrentBook.AddGuest(pFact.GetNewGuest(name, passportNb, age)); }