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

Check if appointment intersects with other appointment

1 Answer 69 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
AMF
Top achievements
Rank 2
AMF asked on 28 Nov 2012, 09:38 AM
Hi all,

How can I check if an appointment intersects with an other appointment?

I'm using the radscheduler for a planning tool. I'm using recurring appointments to determent the work scheduler for the employees. 
But I can't figure out how to check if the appointments intersects with the recurrencerule of the appointments.

Edit
I also would like to know how I can add an appointment for every resource. This specifically for the holydays (Christmas for instance)

greetings

1 Answer, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 30 Nov 2012, 07:49 AM
Hello,

Thank you for your question.

To check if appointments intersect, you should compare their StartDate and EndDate properties. In the case of recurring appointments, you should get their occurrences by using either of the following approaches:
// iterate all appointment occurrances
foreach (IEvent ev in recurringAppointment.Occurrences)
{
    //...
}
 
// iterate only occurrences in a given date interval
IEnumerable<IEvent> occurrences = recurringAppointment.GetOccurrences(
 new DateTime(2008, 10, 1, 10, 0, 0), DateTime.Now);
 
foreach (IEvent ev in occurrences)
{
    //...
}

You might also need to iterate through the Exceptions collection of the recurring appointments because the occurrence enumerators do not iterate the exceptions:
foreach (IEvent ev in recurringAppointment.Exceptions)
{
    //...
}

More information about recurring appointments can be found in our online documentation.

Hope you find this useful. Feel free to ask if you have any additional questions.

Regards,
Ivan Todorov
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
Scheduler and Reminder
Asked by
AMF
Top achievements
Rank 2
Answers by
Ivan Todorov
Telerik team
Share this question
or