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.

Limiting the amount of appointment by time

Thread ID:

Created:

Updated:

Platform:

Replies:

129158 Mar 1,2017 10:56 AM Mar 2,2017 09:14 AM ASP.NET MVC 2
loading
Tags: Schedule
Richard Presley
Asked On March 1, 2017 10:56 AM

I am trying to add the schedule control to one of our application. In this the user will be able to add an appointment, but he cannot add an appointment at a time that already has 2 in a time period. 

Ex: there is already 2 appointment from 2:00 to 3:00 but the user tries to add one at 1:30 to 2:30. the schedule will validate the date and deny the user the ability to add that appointment until he changes the date and time.

Is there a functionnality for that? 

Karthigeyan Krishnamurthi [Syncfusion]
Replied On March 2, 2017 09:13 AM

Hi Jan, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared the sample to prevent the rendering of an appointment in the time range of an already rendered appointments which can be download from the below location. 
 
In the sample, initially two appointment will render in same day and same time. When  3rd appointment is created in already rendered appointment interval range it will not be created. Kindly refer the below code example used in the sample. 
 
<Code> 
function onBeforeAppointmentCreate(args) { // this function will be called before saving an app  
        var curApps = (ej.isNullOrUndefined(args.appointment[0])) ? args.appointment : args.appointment[0]; 
        var proxy = this, _appList = this._processed, appointmentsList = [], app = [], appList = [], overlapList = []; 
        appointmentsList = _appList.filter(function (obj) { return obj[proxy._appointmentSettings["endTime"]] > curApps[proxy._appointmentSettings["startTime"]] && obj[proxy._appointmentSettings["startTime"]] < curApps[proxy._appointmentSettings["endTime"]]; }); 
        appointmentsList.forEach(function (obj) { 
            appList = _appList.filter(function (list) { return list[proxy._appointmentSettings["endTime"]] >= new Date(obj[proxy._appointmentSettings["startTime"]]) && list[proxy._appointmentSettings["startTime"]] <= new Date(obj[proxy._appointmentSettings["endTime"]]); }); 
            var collection = $(appList).not(appointmentsList); 
            if (collection.length != 0) app = $.merge(app, collection); 
            return app; 
        }); 
        overlapList = $.merge(appointmentsList, app); 
        args.cancel = (overlapList.length > 1); 
    } 
</Code> 
 
 Regards, 
Karthigeyan 


Karthigeyan Krishnamurthi [Syncfusion]
Replied On March 2, 2017 09:14 AM

Hi Richard, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared the sample to prevent the rendering of an appointment in the time range of an already rendered appointments which can be download from the below location. 
 
In the sample, initially two appointment will render in same day and same time. When  3rd appointment is created in already rendered appointment interval range it will not be created. Kindly refer the below code example used in the sample. 
 
<Code> 
function onBeforeAppointmentCreate(args) { // this function will be called before saving an app  
        var curApps = (ej.isNullOrUndefined(args.appointment[0])) ? args.appointment : args.appointment[0]; 
        var proxy = this, _appList = this._processed, appointmentsList = [], app = [], appList = [], overlapList = []; 
        appointmentsList = _appList.filter(function (obj) { return obj[proxy._appointmentSettings["endTime"]] > curApps[proxy._appointmentSettings["startTime"]] && obj[proxy._appointmentSettings["startTime"]] < curApps[proxy._appointmentSettings["endTime"]]; }); 
        appointmentsList.forEach(function (obj) { 
            appList = _appList.filter(function (list) { return list[proxy._appointmentSettings["endTime"]] >= new Date(obj[proxy._appointmentSettings["startTime"]]) && list[proxy._appointmentSettings["startTime"]] <= new Date(obj[proxy._appointmentSettings["endTime"]]); }); 
            var collection = $(appList).not(appointmentsList); 
            if (collection.length != 0) app = $.merge(app, collection); 
            return app; 
        }); 
        overlapList = $.merge(appointmentsList, app); 
        args.cancel = (overlapList.length > 1); 
    } 
</Code> 
 
 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.

;