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.
Unfortunately, activation email could not send to your email. Please try again.

Disable appointments not created by current user.

Thread ID:

Created:

Updated:

Platform:

Replies:

131438 Jul 10,2017 01:44 AM Jul 12,2017 03:04 AM ASP.NET Core 2
loading
Tags: Schedule
Leon
Asked On July 10, 2017 01:44 AM

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.

Leon
Replied On July 11, 2017 12:45 AM

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? 

Thanks,


Karthigeyan Krishnamurthi [Syncfusion]
Replied On July 12, 2017 03:04 AM

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. 
 
<Code> 
<ej-schedule id="Schedule1" width="100%" before-appointment-create="OnBeforeAppointmentCreate" height="525px" current-date="new DateTime(2016, 11, 18)"> 
    <e-resources> 
        <e-resource field="OwnerId" title="Owner" name="Owners" allow-multiple="true"> 
            <e-resource-settings datasource="ViewBag.Owner" text="Text" id="Id" color="Color"> 
            </e-resource-settings> 
        </e-resource> 
    </e-resources> 
    <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> 
    </e-appointment-settings> 
</ej-schedule> 
<script> 
    function OnBeforeAppointmentCreate(args) { 
        var schObj = $("#Schedule1").ejSchedule('instance'); 
        if (ej.isNullOrUndefined(args.appointment[0])) 
            obj = args.appointment; 
        else 
            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; 
    } 
</script> 
</Code> 
 
Note: Above code will prevent the double booking occurring only at the same range.  
 
Regards, 
Karthigeyan 


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.

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.

;