if (param.action == "insert" || (param.action == "batch" && param.added != null)) // this block of code will execute while inserting the appointments
{
var value = (param.action == "insert") ? param.value : param.added[0];
int intMax = db.ScheduleEventDatas.ToList().Count > 0 ? db.ScheduleEventDatas.ToList().Max(p => p.Id) : 1;
DateTime startTime = Convert.ToDateTime(value.StartTime);
DateTime endTime = Convert.ToDateTime(value.EndTime);
ScheduleEventData appointment = new ScheduleEventData()
{
Id = intMax + 1,
StartTime = startTime.ToLocalTime(),
EndTime = endTime.ToLocalTime(),
Subject = value.Subject,
IsAllDay = value.IsAllDay,
StartTimezone = value.StartTimezone,
EndTimezone = value.EndTimezone,
RecurrenceRule = value.RecurrenceRule,
RecurrenceID = value.RecurrenceID,
RecurrenceException = value.RecurrenceException
};
db.ScheduleEventDatas.InsertOnSubmit(appointment);
db.SubmitChanges(); |
@Html.EJS().Schedule("schedule").Width("100%").Height("550px").EventSettings(es => es.DataSource(dataManger =>
{
dataManger.Url("Home/LoadData").CrudUrl("Home/UpdateData").CrossDomain(true).Adaptor("UrlAdaptor");
})).Render()
<script>
document.addEventListener('DOMContentLoaded', function () {
var scheduleObject = document.getElementById('schedule').ej2_instances[0];
loadCultureFiles('pt');
var ajax = new ej.base.Ajax('Scripts/pt.json', 'GET', false);
ajax.onSuccess = function (value) {
ej.base.L10n.load(JSON.parse(value));
};
ajax.send();
ej.base.setCulture('pt');
});
function loadCultureFiles(name) {
var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json'];
var loadCulture = function (prop) {
var val, ajax;
ajax = new ej.base.Ajax(location.origin + '/../Scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', false);
ajax.onSuccess = function (value) {
val = value;
};
ajax.send();
ej.base.loadCldr(JSON.parse(val));
};
for (var prop = 0; prop < files.length; prop++) {
loadCulture(prop);
}
}
</script> |