In the BeforeDiplauAppointmentDialog I use the custom dialog and then a custom dialog for recurrence, In the recurrence dialog I add a check box if the user wants the occurrence to be deleted. When the user clicks ok with both form I need all the occurences of this appointments to be removed. I set the Recurrence =NULL but nothing is happening. What is wrong please?
Hi Alex,Thank you for the update.I am glad that you have figured this issue out. Do not hesitate to contact us with any additional questions you may have.
Found out
first had to save it then delete.
Thank you for your response.
this will remove the recurrences but it seems that when I save the changes to database it is not saving with that information! Also when I use "AcceptChanges" on the binding DataSet it is getting all the occurrences back again!
My procedure for saving is easy: dbSet.GetChanges() iif it has changes. And after that I use dbSet.AcceptChanges(), but this seems not to work good for occurrences.
So there seems to be two problem here:
1. after removing recurrences I save changes to database but the changes does not save the removed occurrences but the appointment with the recurrences!
2. If after saving, but no retrieving, the Appointment I do AcceptChanges on the binding dataset it will bring back all the recurrences. For example, if I do not use AcceptChanges on the binding dataset it is finem but the binding dataset have unchanged data and when saved and retrieved it will bring back those!
Hi Alex,Thank you for posting in our forums.Setting the Recurrence property to null should remove all the recurrences of this appointment. However this will only work if you do this to the root appointment, not one of its recurrences. Maybe this is the issue in your case. What you can do in order to prevent this is to simply check if this is the root appointment and if it isn’t to use the RecurringAppointmentRoot property in order to get it: private static void RemoveRecurrence(Appointment app) { if (app.IsRecurringAppointmentRoot == false) app = app.RecurringAppointmentRoot; if(app != null) app.Recurrence = null; }Let me know if this suggestion resolves your issue.