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. Image for the cookie policy date

Disable appointments not created by current user.

I want to show all the appointments in the schedule but I want to prevent double booking. I want  each user to only create or modify their own appointments. Is that possible? I am already using user accounts and each appointment has an owner field.

2 Replies

LE Leon July 11, 2017 04:45 AM UTC

So far I was able to accomplish what I need using the events query-cell-info, appointment-click and drag-start. I just need some ideas on how to prevent double booking. 

How do I know if a cell already has an appointment? 


KK Karthigeyan Krishnamurthi Syncfusion Team July 12, 2017 07:04 AM UTC

Hi Juan  
Thank you for contacting Syncfusion support. 
We have prepared the sample to prevent the double-booking appointments which can be download from the below location. In the sample, at initial load 1 appointment will be rendered from 10-11 AM at November 18, 2016 and if a user try to create another appointment in the same range (10-11 AM at November 18, 2016) it will be prevented. 
<ej-schedule id="Schedule1" width="100%" before-appointment-create="OnBeforeAppointmentCreate" height="525px" current-date="new DateTime(2016, 11, 18)"> 
        <e-resource field="OwnerId" title="Owner" name="Owners" allow-multiple="true"> 
            <e-resource-settings datasource="ViewBag.Owner" text="Text" id="Id" color="Color"> 
    <e-group resources="ViewBag.Group"></e-group> 
    <e-appointment-settings apply-time-offset="false" id="Id" subject='"Subject"' start-time='"StartTime"' end-time='"EndTime"' all-day='"AllDay"' recurrence='"Recurrence"' recurrence-rule='"RecurrenceRule"' resource-fields='"OwnerId"'> 
        <e-datamanager id="Data" json="ViewBag.dataSource"></e-datamanager> 
    function OnBeforeAppointmentCreate(args) { 
        var schObj = $("#Schedule1").ejSchedule('instance'); 
        if (ej.isNullOrUndefined(args.appointment[0])) 
            obj = args.appointment; 
            obj = args.appointment[0]; 
        var predicate = ej.Predicate(schObj._appointmentSettings["startTime"], ej.FilterOperators.lessThanOrEqual, new Date(obj.StartTime)).and(schObj._appointmentSettings["endTime"], ej.FilterOperators.greaterThanOrEqual, new Date(new Date(obj.EndTime))); 
        var newAppList = new ej.DataManager(schObj._processed).executeLocal(new ej.Query().where(predicate)); 
        if (newAppList.length > 0) 
            args.cancel = true; 
Note: Above code will prevent the double booking occurring only at the same range.  

Live Chat Icon For mobile
Up arrow icon