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

How to get Recurence Rule Object from Recurence Rule String

3 Answers 104 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 09 Dec 2010, 04:19 PM
Hello


We are storing recurrence rules string in appointment table. Now we need to generate recurrences for the rule stored in appointment table.  We try to create object of recurrence rule with the examples found in your forum by passing the RecurrencePattern  object as in posted code below but it gives an error of having no such constructor. is there any other way to get recurrences for recurrence rule string.

Appointment fitnessAppointment = new Appointment();
fitnessAppointment.Subject = "Fitness";
fitnessAppointment.Start = DateTime.Now;
fitnessAppointment.End = DateTime.Now.AddHours(2);

RecurrencePattern recurrencePattern = new RecurrencePattern();
recurrencePattern.Frequency = RecurrenceFrequency.Weekly;
recurrencePattern.MaxOccurrences = 30;
recurrencePattern.DaysOfWeekMask = RecurrenceDays.Monday | RecurrenceDays.Wednesday | RecurrenceDays.Friday;

RecurrenceRule recurrenceRule = new RecurrenceRule( recurrencePattern );

fitnessAppointment.RecurrenceRule = recurrenceRule;


we are using this code but gives an error that no such constructor is available for this class.



Thanks
Regards
Rahul M

3 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 14 Dec 2010, 06:08 PM
Hi rahul,

Here is a snippet that should give you an idea:
RecurrenceRule parsedRule; 
RecurrenceRule.TryParse(recurrenceString, out parsedRule);


Regards,
Nikolay Tsenkov
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Michael
Top achievements
Rank 1
answered on 24 Feb 2012, 01:10 AM
We are converting from another calendar control to the telerik scheduler.  We have historic appointments that are stored in separate fields in the database (frequency, maxoccurrences, interval, etc).  We need the ability to display these old appointments in the new telerik scheduler.  In order to do this we need to convert the data from the database into the telerik recurrence string.  We would like to use the code below.

RecurrencePattern recurrencePattern = new RecurrencePattern();
recurrencePattern.Frequency = RecurrenceFrequency.Weekly;
recurrencePattern.MaxOccurrences = 30;
recurrencePattern.DaysOfWeekMask = RecurrenceDays.Monday | RecurrenceDays.Wednesday | RecurrenceDays.Friday;

RecurrenceRule parsedRule; 
RecurrenceRule.TryParse(recurrenceString, out parsedRule);

In the code above how can I get the recurrenceString?
0
Plamen
Telerik team
answered on 28 Feb 2012, 11:39 AM
Hi Michael,

Here is a sample code how the recurrence rule can be added to an appointment:

RecurrenceRule newDayly = new DailyRecurrenceRule(interval, range);
      newAppointment.RecurrenceRule = newDayly.ToString();

You can also refer to the Populating the Recurrence rule help topic.

Hope this will be helpful.

Regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Rahul
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Michael
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or