MonthlyRecurrenceRule and Last Week

5 posts, 0 answers
  1. Ming Zhao
    Ming Zhao avatar
    44 posts
    Member since:
    Sep 2009

    Posted 26 Jan 2010 Link to this post

    We want to set recurrencerule as following

    last week of every month

    How can we do this in code using MonthlyRecurrenceRule ?
  2. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    353 posts

    Posted 27 Jan 2010 Link to this post

    Hi Ming Zhao,

    Thank you for your question. You should use the following code. This code will create a recurrence rule that shows appointments every last Monday of the month.

    MonthlyRecurrenceRule rule = new MonthlyRecurrenceRule();
    rule.DayNumber = 0;
    //every Monday
    rule.WeekDays = WeekDays.Monday;
    //last week is set
    rule.Offset = -1;

    I hope that your code will help you. If you have additional questions feel free to ask. Sorry for the inconvenience.

    Sincerely yours,
    Dobry
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Ming Zhao
    Ming Zhao avatar
    44 posts
    Member since:
    Sep 2009

    Posted 27 Jan 2010 Link to this post

    ==================================================
    MonthlyRecurrenceRule rule =
    new MonthlyRecurrenceRule();
    rule.DayNumber = 0;
    //every Monday
    rule.WeekDays = WeekDays.Monday;
    //last week is set
    rule.Offset = -1;

    ==========================================================


    Above code set recurrencerule as the last Monday of every month.


    This is not exactly what we asked in the original question.

    In the original question, we ask for every day of the last week of every month

    Eg, every day of the last week of February of 2010 is  Sunday ( 2/28/2010)
        every day of the last week of March of 2010 are Sunday (3/28/2010), Monday (3/29), Tuesday (3/30) and Wedesnday (3/31/2010)
        so on

    We can do this using your configuration form.  see attached.
    How can we use recurrencerule to set this up in code.





  4. Ming Zhao
    Ming Zhao avatar
    44 posts
    Member since:
    Sep 2009

    Posted 27 Jan 2010 Link to this post

    never mind.  It seems that we figure out how to do this.

    Using following code seems to work.

    MonthlyRecurrenceRule rule = new MonthlyRecurrenceRule();
    rule.WeekDays = WeekDays.EveryDay;
    rule.WeekNumber = -1;

  5. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    353 posts

    Posted 28 Jan 2010 Link to this post

    Hello Ming Zhao,

    I am happy that you found a solution. Feel free to contact us if you have more questions.

    Greetings,
    Dobry
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top