This is a migrated thread and some comments may be shown as answers.

Resizing a recurring appointment

5 Answers 165 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 16 Jul 2008, 01:16 PM
Please can you help - I have a RadScheduler control linked to a provider based on the DbSchedulerProviderBase.

If I create a recurring appointment and then move one of the occurences the Update method is called (I guess to add the EXDATE section to the recurrence rule field) and then the Insert method is called to create the 'new' appointment.

However, if I create a recurring appointment and then resize one of the appointments, (after selecting "only this occurence") the Update method is called, but the Insert method is never called. The net effect is that the occurence I have resized disappears.

Can you help?
Thanks
Mark

5 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 17 Jul 2008, 09:02 AM
I have done some more poking around with my code and found the issue - I am using code to prevent appointments overlapping based on the code in the forum article

http://www.telerik.com/community/forums/thread/b311D-batdbh.aspx#432219

- however the "GetAppointmentsInRange" function used here does not appear to work correctly with recurring appointments that have 'excluded' dates in.

Example -

1. I create an appointment at 09:00-10:00  that recurs every 2 hours for the rest of the day. Therefore appointments are created at 09:00, 11:00, 13:00, 15:00 etc..

2. I then resize the appointment at 11:00 (so it changes from 11:00-12:00 to 11:00-12:30)

3. I select to "resize only this occurence"

4. The AppointmentUpdate event is fired to change the recurrence rule (add the EXDATE record) on the original appointment record. All ok.

5. The AppointmentInsert event is fired and I call the GetAppointmentsInRange() with the date range of 11:00-12:30. However, this returns the appointment from 11:00-12:00 (the one that should now be 'excluded' from the original recurring appointment because this is the one I am now recreating as a separate occurence), which 'overlaps' with the appointment I am creating and therefore the insert cancels. 

6. The net result is that the 11:00 appointment disappears (it is included in the EXDATE recurrence rule of the original appointment but is never inserted as a separate occurence because it 'overlaps' with the excluded date of the original appointment)

Hope this makes sense - can anyone help with this? I am on a tight deadline to sort this out and any advice would be great!

Thanks
Mark
0
Mark
Top achievements
Rank 1
answered on 17 Jul 2008, 12:53 PM
I have done some more tinkering and have come to the conclusion that the RadScheduler1.Appointments collection does not get updated with the changed appointment between the AppointmentUpdate and the AppointmentInsert events  - this means that when the Insert event is fired the change to the original recurring appointment has not been saved in the Appointments collection so is still returned in the GetAppointmentsInRange function.

I have got round this in my overlapping checking function by getting my collection of Appointments from the database provider directly rather than using RadScheduler1.Appointments - however I am still left with one problem  -

When you change a single occurence of a recurring appointment the control fires an AppointmentUpdate event followed by an AppointmentInsert event. If, for one reason or another, the insert event is cancelled the changes made in the Update event are still kept - since this should be treated as a single operation the changes in the Update event should be rolled back if the Insert is cancelled - has this bug been fixed in the latest version?

Sorry about the long messages !
Thanks
Mark
0
Peter
Telerik team
answered on 17 Jul 2008, 02:32 PM

Hello Mark,

When you change a single occurence of a recurring appointment the RecurrenceExceptionCreated event is also fired. I suggest you consider using this event.

If you need to limit the number of appointments per time slot for recurring appointments, you can enumerate through all appointments in RadScheduler using this kb article.



Greetings,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mark
Top achievements
Rank 1
answered on 17 Jul 2008, 02:40 PM
Thanks - I have now started to use the RecurrenceExceptionCreated in order to detect when this is happening.

Correct me if I'm wrong  but after that event has fired it then goes on to fire AppointmentUpdated (which, if not cancelled, updates the recurring appointment with the exception), and then fires the AppointmentInsert event (which, if not cancelled, inserts the exception appointment).

The problem is, if the AppointmentInsert event IS cancelled the exception appointment is not added to the database but the exception IS removed from the recurring appointment. Surely if the Insert is cancelled the Update should be rolled back? 

I have now achieved this manually by using the RecurrenceExceptionCreated event to grab a copy of the recurring appointment before it is changed, and then updating the database manually with this if the Insert is cancelled, but this feels like a bug to me.
0
Peter
Telerik team
answered on 21 Jul 2008, 02:48 PM

Hi Mark,

You can just cancell teh RecurrenceExceptionCreated event, in which case the other two events will not fire. Also, RadScheduler does not roll back changes if just one of the events is stopped.

I hope this helps.



Regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Peter
Telerik team
Share this question
or