Hi,
I got several problems with the RecurrenceRule.
To check this - I use the following Pattern:
DTSTART:20140807T113000Z
DTEND:20140807T123000Z
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,WE,TH
My need is to find the first two occurrences of an appointment.
I tried this with the following code:
RecurrenceRule rR;
if
(RecurrenceRule.TryParse(rRule,
out
rR)) {
rR.MaximumCandidates = 2;
//rR.SetEffectiveRange(pAppointment.Start.AddMinutes(-1), pAppointment.End.AddDays(400));
foreach
(DateTime dtCheck
in
rR.Occurrences) {
if
(dtCheck > pAppointment.Start) {
//next occurrence found
The problem "MaximumCandidates" is for daily, weekly, monthly one day.
So in this case if I check on thuresday I get only one occurrence.
Is there a working way to limit the outcome to a fix number of results?
On thing I found when checking (with your source code) how the things work internally is a bug in SetEffectiveRange
Here the code FIRST checks if the private fields are in the correct order (_effectiveEnd <_effectiveStart).
AFTER that the values are assigned.
So I could call this with wrong parameters - and the next call (with correct parameters) would fail!
You should check the parameters not the private fields (and for sure not BEFORE they are assigned).
Last not least I found a thread with an "isolated assembly" containing only the recurrence rule classes.
http://www.telerik.com/forums/sql-reporting-display-all-recurring-appointments
Is there an "up to date" version of this assembly - and how is it licensed?
Manfred