Conflicting appointments
Hi,
How do we check conflicting appointment in a schedule, while adding appointment to the schedule?
Please provide a sample application, that implements the above requirement.
Regards,
Mohit Saxena
How do we check conflicting appointment in a schedule, while adding appointment to the schedule?
Please provide a sample application, that implements the above requirement.
Regards,
Mohit Saxena
SIGN IN To post a reply.
3 Replies
MG
Mohanraj Gunasekaran
Syncfusion Team
July 27, 2017 11:05 AM UTC
Hi Mohit,
Thanks for using Syncfusion product.
To find the conflicting appointment, we can use the GetSchedule method, to get the list of appointment in that specified date and use the ItemChanging event to handle an appointment. Please refer to the code example and a sample,
Code example
|
this.scheduleControl1.ItemChanging += scheduleControl1_ItemChanging;
void scheduleControl1_ItemChanging(object sender,ScheduleAppointmentCancelEventArgs e)
{
if (e.Action == ItemAction.Add)
{
bool isConflict = false;
SimpleScheduleDataProvider provider = this.scheduleControl1.DataSource asSimpleScheduleDataProvider;
IScheduleAppointmentList list = provider.GetSchedule(e.ProposedItem.StartTime, e.ProposedItem.EndTime);
if (list is ScheduleAppointmentList)
{
ScheduleAppointmentList applist = list as ScheduleAppointmentList;
foreach (IScheduleAppointment item in applist)
{
if (item.StartTime <= e.ProposedItem.EndTime && e.ProposedItem.StartTime <= item.EndTime)
{
isConflict = true;
}
}
if (isConflict)
{
//Handle the appointments.
e.Cancel = true;
}
}
}
} |
Regards,
Mohanraj G
MO
Mohit
July 27, 2017 12:16 PM UTC
Hi Gunasekaran,
Thank you very much for your help!
MG
Mohanraj Gunasekaran
Syncfusion Team
July 28, 2017 05:14 AM UTC
Hi Mohit,
Thanks for your update.
We are glad to know that your reported problem has resolved.
Please let us know, if you have any concerns.
Regards,
Mohanraj G
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
MO Mohit
- Jul 26, 2017 02:17 PM UTC
- Jul 28, 2017 05:14 AM UTC