/* * Returns a list of references to each of the CurrentBooking's * decorators (= extras), or null if it is not decorated at all. */ public List <BookingDecorator> GetCurrentExtras() { List <BookingDecorator> references; CurrentBook.Unwrap(out references); return(references); }
/* * 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); } }
/* * Returns the current booking's cost per night, or -1 if no booking * is currently loaded. */ public float GetCurrentCostPerNight() { float costPerNight = -1; if (CurrentBook != null) { List <BookingDecorator> extras = GetCurrentExtras(); costPerNight = CurrentBook.Unwrap(out extras).GetCostPerNight(); } return(costPerNight); }
/* * Returns the current booking's number of nights, or -1 if no * booking is currently loaded. */ public int GetCurrentNbNights() { int nbNights = -1; if (CurrentBook != null) { List <BookingDecorator> extras; nbNights = CurrentBook.Unwrap(out extras).GetNbNights(); } return(nbNights); }