Hi Dojo,
I am trying to move reservation to new time slot, however I keep getting "ExecutionTime must be before the end of the ReservationInstance" exception.
I'm doing the following:
- Get reservation to move
- Remove all events
- Set new time range for the reservation
- Add events with new time stamps
- Update reservation
Job object that is passed as argument to these methods comes from the same flow, just two different outcomes, so there is no difference between those. In CreateReservation method everything works fine, but on the UpdateReservation method I get the aforementioned exception. The method ReservationInstance.AddEvent checks if executionTime(first parameter) is > then ReservationInstance.End, which would mean that executionTime == ReservationInstance.End should be valid, as it is in the CreateReservation.
Any idea what might be causing this and how can I fix it?
Thanks,
Cheers
Thanks Jorge, manged to get it working. Here is the updated code:
Not really related with the question, but consider not doing all ForEach, but just one, and also pass all updated reservations at once to method AddOrUpdateReservationInstances to improve the performance.