- Home
- Forum
- ASP.NET MVC - EJ 2
- Schedule CRUD for recurring events
Schedule CRUD for recurring events
Hi guys,


I am using vs2017, EJ2, MVC5, EF6, MySql.
I am not able to create recurrent events, simple date events works fine.
Please see bellow:
1 - Recurrence rules are sent ok to controller:
2 - But they are not in the appointment created to be sent to db:
How to correctly work with recurrences?
How to save them to db?
Do you suggest a db table schema to save recurrencies?
Thanks, happy new year!
SIGN IN To post a reply.
3 Replies
NR
Nevitha Ravi
Syncfusion Team
December 31, 2018 09:06 AM UTC
Hi Vanderlei,
In the shared screenshot, the following highlighted code has been missed which is the cause for the reported problem and for the same we have prepared a sample for your reference which can be downloaded from the following link.
If the below reported fields RecurrenceRule, RecurrenceID, RecurrenceException has not been defined in your DB Schema, kindly add these fields to your table entity as well as map them accordingly to Scheduler event settings. To know more about the Recurrence fields as well as its usage, please refer the UG reference as well as recurrence options.
|
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(); |
Please check the sample and let us know if it solves your problem and also let us know, if you need any further assistance on this.
We wish you too a happy and great new year.
Regards,
Nevitha.
VA
Vanderlei
December 31, 2018 01:23 PM UTC
Hi Nevitha,
Thank you for your attention, I made little changes in sample code in order to work with EF6, it is working fine!
Could you help with another question?
How can I translate all schedule component texts to portuguese (pt-BR)?
Thank you so much.
KK
Karthigeyan Krishnamurthi
Syncfusion Team
January 2, 2019 09:31 AM UTC
Thanks for your update.
We have prepared the below sample to render Scheduler in Portuguese culture and kindly refer the below UG.
Please find the EJ2 culture local text files in the below link and refer the corresponding culture file in the above sample to automatically convert the Schedule local words to the corresponding culture.
|
@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> |
Regards,
Karthigeyan
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
VA Vanderlei
- Dec 28, 2018 02:59 PM UTC
- Jan 2, 2019 09:31 AM UTC