We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Conflicting appointments

Thread ID:

Created:

Updated:

Platform:

Replies:

131774 Jul 26,2017 02:17 PM UTC Jul 28,2017 05:14 AM UTC WinForms 3
loading
Tags: ScheduleControl
Mohit
Asked On July 26, 2017 02:17 PM UTC

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

Mohanraj Gunasekaran [Syncfusion]
Replied On 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;   
             }   
        }   
   
    }      
}   
   
Sample link: ScheduleControl   
   
Regards,   
Mohanraj G   
 


Mohit
Replied On July 27, 2017 12:16 PM UTC

Hi Gunasekaran,

Thank you very much for your help!


Mohanraj Gunasekaran [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;