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

MonthlyRecurrenceRule and Last Week

4 Answers 97 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Ming Zhao
Top achievements
Rank 1
Ming Zhao asked on 26 Jan 2010, 07:50 PM
We want to set recurrencerule as following

last week of every month

How can we do this in code using MonthlyRecurrenceRule ?

4 Answers, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 27 Jan 2010, 10:26 AM
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.
0
Ming Zhao
Top achievements
Rank 1
answered on 27 Jan 2010, 02:16 PM
==================================================
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.





0
Ming Zhao
Top achievements
Rank 1
answered on 27 Jan 2010, 03:06 PM
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;

0
Dobry Zranchev
Telerik team
answered on 28 Jan 2010, 08:29 AM
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.
Tags
Scheduler and Reminder
Asked by
Ming Zhao
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Ming Zhao
Top achievements
Rank 1
Share this question
or