public void updateBookingDates(Booking b) { CarHire car = facade.getCarHireForBooking(b); if (car != null) { if (car.StartDate < b.ArrivalDate || car.StartDate > b.DepartureDate || car.EndDate > b.DepartureDate || car.EndDate < b.ArrivalDate) { if (MessageBox.Show("Your car hire start and end dates aren't between your newly selected booking dates. If you want to continue, the car hire wil be cancelled and you will have to enter a new one.", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return; } else { facade.deleteCarHire(b); } } } facade.updateBookingDates(b); /* * bookings.Remove(oldB); * * if(!this.bookings.Contains(b)) * { * this.bookings.Add(b); * } * * this.dataGridBooking.ItemsSource = bookings; * this.dataGridBooking.Items.Refresh(); * this.btnModifyBooking.IsEnabled = false; * * CarHire car = facade.getCarHire(b.BookingReferenceNumber); * * if(car != null) * { * if (car.StartDate < b.ArrivalDate || car.StartDate > b.DepartureDate || car.EndDate > b.DepartureDate || car.EndDate < b.ArrivalDate) * { * if (MessageBox.Show("Your car hire start and end dates aren't between your newly selected booking dates. If you want to continue, the car hire wil be cancelled and you will have to enter a new one.", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) * { * return; * } * else * { * data.deleteCarHire(b.BookingReferenceNumber); * } * } * } * * * data.updateBookingDates(b.BookingReferenceNumber, c.CustomerReferenceNumber, b.ArrivalDate, b.DepartureDate); * */ }