/* * 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); } }
// METHODS RELATED TO BOOKINGS: /* * Persists the BookingComponent to {dataDirectory}/{bookingNb}.csv; * returns true if data was persisted successfuly or false if not. */ public bool Persist(BookingComponent booking) { String filePath = (String.Format(@"{0}/{1}.csv", dataDirectory, booking.GetBookingNb())); return(dataWriter.Persist(booking, filePath)); }