/* * Checks if the booking can be saved or updated on the basis of * window field values, and acts accordingly (closes the window, * except if the booking was a new one). */ private void btnSave_Click(object sender, RoutedEventArgs e) { if (areAllValuesValid()) { if (!mFacade.IsABookingLoaded()) { mFacade.CreateBooking((DateTime)dtpArrival.SelectedDate, (DateTime)dtpDeparture.SelectedDate); mFacade.PersistCurrentBooking(); refreshDisplay(); } else { mFacade.UpdateBooking((DateTime)dtpArrival.SelectedDate, (DateTime)dtpDeparture.SelectedDate); mFacade.PersistCurrentBooking(); } } }