BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
@(Html.EJ().Schedule("Schedule1")
.Width("100%")
-------------------
-------------------
.Description("Description")
)
.ScheduleClientSideEvents(evt => evt.AppointmentWindowOpen("onAppointmentWindowOpen").AppointmentSaved("appValidate").AppointmentEdited("appValidate").ResizeStop("appValidate").DragStop("appValidate")))
//Here we bind the events to block the particular time slot for users
function appValidate(args) {
var schObj = $("#Schedule1").data("ejSchedule");
var appList = schObj._processed;
(args.type == "appointmentSaved" || args.type == "appointmentEdited") && schObj._timeZoneAppointments(args.appointment, "reverse");
for (var i = 0; i < appList.length; i++) {
if ((args.type == "appointmentSaved" ? true : (appList[i][schObj.model.appointmentSettings["id"]] != args.appointment.Id)) && (new Date(appList[i][schObj.model.appointmentSettings["endTime"]]) > new Date(args.appointment.StartTime))) {
if ((new Date(appList[i][schObj.model.appointmentSettings["startTime"]]) < new Date(args.appointment.EndTime))) {
// You can write your own condition to block the appointment creation based on the user details. For example, if the resource 1 is assigned to user 1 means you can block the appointment creation for user 2 by checking the condition and setting the args.cancel value as true
args.cancel = true;
return false;
}
}
}
(args.type == "appointmentSaved" || args.type == "appointmentEdited") && schObj._timeZoneAppointments(args.appointment, "");
}
</code>
Regards,
Sarath Kumar P K