How to use multiple recurrence patterns

2010-09-16
2012-09-15
  • Robin Banks

    Robin Banks - 2010-09-16

    I have been using a single recurrence pattern by:

    1) Creating an event

    2) Adding a recurrence: i.e. .RecurrenceRules.Add(pattern);

    3) Calling GetOccurences

    If I want to apply multiple recurrence patterns (over days, weeks) it seems
    the start and end date are properties of the event not the recurrence pattern.
    In my data I have start and end dates as properties of the recurrence. How do
    I make this compatible? Do I create multiple events with each have just one
    pattern so I can specify the start and end times.

    Then what do I call to get the occurrence output?

    Great Product.

     
  • Doug Day

    Doug Day - 2010-09-16

    I'm not sure I fully understand what you're asking, but I'll try to give an
    answer.

    It sounds like rather than a recurrence pattern, you're wanting to specify
    recurrence dates. A pattern is something like "every day for 6 weeks". Using
    recurrence dates, you'd specify something like "Recurs on 10/5/2010,
    10/6/2010, and 10/7/2010".

    To use recurrence dates, you'd do something like the following:

    IICalendar calendar = new iCalendar();

    IEvent evt = calendar.Create<Event>();

    IPeriodList times = new PeriodList();

    times.Add(new iCalDateTime(2010, 10, 1));

    evt.RecurrenceDates.Add(times);

    This should be a bit simpler in the future, but for now, it should work.

    Regards,

    -Doug

     
  • Doug Day

    Doug Day - 2010-09-16

    Note that since you have both start/end times in your current data, you could
    do this instead:

    IPeriodList times = new PeriodList();

    times.Add(new Period(startTime, endTime));

    evt.RecurrenceDates.Add(times);

    -Doug

     
  • Robin Banks

    Robin Banks - 2010-10-03

    Let's say for example I have a recurrence of every 2nd monday of the month
    from 1-1-2010 to 1-1-2020. Then I have a different recurrence of every Tuesday
    of the week from 1-1-2015 to 1-1-2019. So where would I specify these
    dates:1-1-2010 to 1-1-2020 and 1-1-2015 to 1-1-2019. Since as in my original
    post, it seems the event only allows 1 date window. Thanks.

     
  • Doug Day

    Doug Day - 2010-10-04

    Robin,

    You'd either need to use the RecurrenceDates collection to add every date/time
    the event recurs, or you'd need to split your event into two Event objects,
    one for "every 2nd monday of the month from 1-1-2010 to 1-1-2020", and one for
    "every Tuesday of the week from 1-1-2015 to 1-1-2019".

    Thanks,

    -Doug

     
  • Robin Banks

    Robin Banks - 2010-10-04

    Thanks Doug. Seems obvious now that you mention it. LOL.

    Thanks again.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks