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

How to update recurrence rule to include exception

3 Answers 81 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
prashant
Top achievements
Rank 1
prashant asked on 29 Jun 2010, 03:12 PM
Hi All,

I have a situation where i have to update a recurrence rule in such a way that it includes exception in recurrence rule itself programmaticly.
For ex if there is a weekly recurrence rule but i would like to add exception that there should be no occurrences for all Wednesdays.

Please do the needful.

Thanks
Prashant

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 02 Jul 2010, 01:51 PM
Hi Prashant,

The WeeklyRecurrenceRule supports this functionality natively, so you don't have to create explicit exceptions. Simply set the recurrence rule to occur on all other days, excluding Wednesday:

RecurrenceDay mask = RecurrenceDay.EveryDay ^ RecurrenceDay.Wednesday;

I hope this helps.

Best wishes,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
prashant
Top achievements
Rank 1
answered on 02 Jul 2010, 02:45 PM
Hi All,

I have a scenario where i have to deal with Daily, Weekly, Monthly and Annually Recurrence rules (i.e. it can be any of these except hourly).

In my custom scenario while deleting any particular occurrence in a series , I am planning to add exception in recurrence rule at that moment and updating the recurrence rule in database. While retrieving recurrence rule from DB it can be any of the above four mentioned, I am getting full occurences generated and a separate list (IList<DateTime>) of exceptions. Which I obviously can manipulate by removing occurrences that are exceptions.
SInce I have to make generic logic I am planning to use this approach.
I would like to know is there any other approach so that when I parse for recurrence rule, which is retrieved from DB, I automatically get the occurrences that are not exceptions without need to manipulate manually IList<DateTime> of Exception.
Please do the needful and let me know also whether I am doing the right thing.

Thanks
Prashant
0
T. Tsonev
Telerik team
answered on 12 Jul 2010, 05:18 PM
Hi,

Apologies for the late reply.

The RecurrenceRule.Occurrences property is already filtered and contains now dates from the Exceptions property. Just make sure that the Exceptions list is populated before enumerating Occurrences.

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
prashant
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
prashant
Top achievements
Rank 1
Share this question
or