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

Disable appointments not created by current user.

Thread ID:





131438 Jul 10,2017 05:44 AM UTC Jul 12,2017 07:04 AM UTC ASP.NET Core 2
Tags: Schedule
Asked On July 10, 2017 05:44 AM UTC

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.

Replied On 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? 


Karthigeyan Krishnamurthi [Syncfusion]
Replied On 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.  


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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