private void CarSelectedHandler(object sender, EventArgs e) { if (view.Car == null) { view.CarInfo = ""; return; } CarModel car = view.Car as CarModel; view.CarInfo = car.CarInfo(); // TODO Find free periods for the new offer if (state == ViewState.New) { FindFreePeriods(car.ID); DisplayFreePeriods(); } else if (state == ViewState.Update) { if (selectedOffer.Record.CarID == car.ID) { FindUpdateLimits(); DisplayUpdateLimits(); } else { FindFreePeriods(car.ID); DisplayFreePeriods(); } } }
// Event Handler private void CarPickedHandler(object sender, EventArgs e) { CarModel car = view.SelectedCar as CarModel; if (car == null) { view.CarInfo = ""; return; } view.CarInfo = car.CarInfo(); eventAggregator.Publish(new CarSelectedMessage(car)); }
private void CarSelectedHandler(object sender, EventArgs e) { if (view.Car == null) { view.CarInfo = ""; return; } CarModel car = view.Car as CarModel; view.CarInfo = car.CarInfo(); if (state == ViewState.New) { FindFreePeriods(car.ID); DisplayFreePeriods(); CalculatePriceForPickedPeriod(); } else if (state == ViewState.Update) { TimePeriod reservationPeriod = new TimePeriod(selectedReservation.Record.From, selectedReservation.Record.To); if (reservationPeriod.IsBefore(DateTime.Today)) { return; } if (selectedReservation.Record.CarID == car.ID) { FindUpdateLimits(); DisplayUpdateLimits(); CalculatePriceForPickedPeriod(); } else { FindFreePeriods(car.ID); DisplayFreePeriods(); CalculatePriceForPickedPeriod(); } } }