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

Use of RecurrenceRule.Exceptions

5 Answers 139 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 03 May 2011, 05:00 PM
We are representing assignment of an employee to a shift using a recurring appointment, which is working just fine.  What we want to add are non-working days, or exceptions to the normal schedule, such as vacation, sick days, etc.  These days should not appear on the calendar as scheduled time.

Would RecurrenceRule.Exceptions be the correct way to represent this?  If not, what is the recommended way?

If it is a valid use, could you please provide a working code sample?  I have experimented with creating a new ExceptionOccurrence object, assigning the date of the day I want to be blanked out, and adding it to the RecurrenceRule.Exceptions.  This does nothing.  When I also assign the appointment associated with the RecurrenceRule, not only is there is no effect on the calendar, but there is also some kind of recursive call that causes an Out of Memory exception when I double-click on the appointment to edit it.

5 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 09 May 2011, 09:02 AM
Hello Steve,

 
Thank you for contacting us.

Using the exceptions is the right approach. You could delete the appointments in the recurrence rule in order to hide these exceptions(appointments) from the calendar. You could refer to our online documentation for more information about recurrence rule and exceptions - http://www.telerik.com/help/silverlight/radscheduler-features-recurrences-recurrence-rule.html

Could you please specify what is your scenario? Do you need to generate the exceptions runtime using code or using the UI?

I am glad to assist you further.

Kind regards,
George
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Steve
Top achievements
Rank 1
answered on 09 May 2011, 04:45 PM
We need to generate exceptions at runtime, since they will be read from the database.  I followed the instructions from the link you posted but had no success.  I am posting a solution that illustrates how we are trying to generate exceptions as well as our issue with using ScrollIntoView().

By the way, the link you posted refers to Scheduler rather than ScheduleView.  This particular function may work for both controls, but as a new user, I find it confusing to be pointed to docs for 1) a similar but different Silverlight control or 2) the WPF version of the same control.  This seems to happen a lot in the forums. 
0
Accepted
Yana
Telerik team
answered on 12 May 2011, 03:39 PM
Hi Steve,

In order to remove a given occurrence from the recurrence rule, you should use AddException method with only one parameter -  the exact DateTime of the occurrence including its start time. Here is an example of a recurrent appointment with an exception:

Dim appointment As New Appointment()
 
Dim startTime = New DateTime(2011, 5, 9, 8, 0, 0)
appointment.Subject = "Fitness"
appointment.Start = startTime
appointment.[End] = startTime.AddHours(2)
 
Dim pattern As New RecurrencePattern()
pattern.Frequency = RecurrenceFrequency.Daily
pattern.MaxOccurrences = 10
 
Dim rule As New RecurrenceRule(pattern)
Dim exceptionTime = New DateTime(DateTime.Today.Year,
                      DateTime.Today.Month,
                      DateTime.Today.Day,
                      appointment.Start.Hour,
                      appointment.Start.Minute,
                      appointment.Start.Second)
rule.AddException(exceptionTime)
appointment.RecurrenceRule = rule


Regarding the documentation - we haven't created these articles for RadScheduleView control yet, we pointed to RadScheduler links, because the use of RecurrenceRule.Exceptions is the same in both controls. We're sorry for any inconvenience caused.

Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Steve
Top achievements
Rank 1
answered on 12 May 2011, 03:48 PM
I should point out that the doc mentioned in this thread, http://www.telerik.com/help/silverlight/radscheduler-features-recurrences-recurrence-rule.html, does not mention that the DateTime used in the single argument overload requires the Appointment's start time in addition to the calendar date.  Adding one sentence to that document would have saved a number of hours.
0
Yana
Telerik team
answered on 12 May 2011, 03:51 PM
Hello Steve,

You're absolutely right, we'll update the article shortly. Thanks

Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ScheduleView
Asked by
Steve
Top achievements
Rank 1
Answers by
George
Telerik team
Steve
Top achievements
Rank 1
Yana
Telerik team
Share this question
or