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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Schedule CRUD for recurring events

Thread ID:

Created:

Updated:

Platform:

Replies:

141700 Dec 28,2018 02:59 PM UTC Jan 2,2019 09:31 AM UTC ASP.NET MVC - EJ 2 3
loading
Tags: Schedule
Vanderlei
Asked On December 28, 2018 02:59 PM UTC

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!

Nevitha Ravi [Syncfusion]
Replied On 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.

Vanderlei
Replied On 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.

Karthigeyan Krishnamurthi [Syncfusion]
Replied On 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 
 
 
 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;