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. Image for the cookie policy date

Javascript Scheduler Database

I really like the tool for the Scheduler... But I have a need for different functionality on the back end...
Right now, when I create a schedule that spans multiple days, by default it creates a single database record... While this may seem counterintuitive, i have a need for 'individual records' in the database for each of those days....
Is there a setting that I can set, that will force a single record/day by default?

5 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team June 16, 2017 09:21 AM UTC

Hi Darren, 
 
Thank you for contacting Syncfusion support. 
 
We request you to conform, whether your requirement is to store the exact number of occurrences of the recurrence appointment in database instead of storing its parent appointment. If we misunderstand your requirement kindly share more information like image/video demo/code example which clearly depicts your requirement to proceed further. 
 
Regards, 
Karthigeyan 



DM Darren McDaniel June 16, 2017 04:34 PM UTC

That is correct... for example.. if I had a recurring event that occurred 87 times... I would like to have 87 records in the database... 


KK Karthigeyan Krishnamurthi Syncfusion Team June 20, 2017 06:44 AM UTC

Hi Darren 
 
Thanks for your update. 
 
We can parse the recurrence rule using explicitly created new generic utility class RecurrenceHelper in the project. To make use of this generic class in your sample, please refer this below KB link and refer it in your sample. 
https://www.syncfusion.com/kb/5390/how-to-parse-the-recurrencerule-in-server-side  (The RecurrenceHelper Class is available in the sample link provided in this KB). Within this utility RecurrenceHelper class, GetRecurrenceDateTimeCollection method is defined which generates the date instances based on the RecurrenceRule and start date of the appointment. Using these auto-generated date collections from this method, we need to manually create the individual appointment instances as mentioned below in the code example, 
 
<Code> 
if (value.Recurrence!=0) // this code block will execute only for recurrence appointment 
{ 
    //Pass the recurrencerule string and the start date of the appointment to this method that will return the dates collection based on the recurrence rule 
    dates = RecurrenceHelper.GetRecurrenceDateTimeCollection(value.RecurrenceRule, Convert.ToDateTime(value.StartTime)).ToList(); 
    // Now, the variable “dates” contains the date collection, with which the appointment instances are needed to be created manually. 
    var diff = endTime - startTime1; 
    for (var i = 0; i < dates.Count; i++) // this loop is used to create the appointment instances for the generated dates 
    { 
        startTime = Convert.ToDateTime(dates[i].AddHours(startTime1.Hour).AddMinutes(startTime1.Minute)); //start time for each occurrences will be calculated 
        endTime = Convert.ToDateTime(startTime.AddHours(diff.Hours).AddMinutes(diff.Minutes)); //end time for each occurrences will be calculated 
 
        MultipleResource appoint = new MultipleResource()// Appointment object creation 
        { 
            Id = value.Id + i, 
            StartTime = startTime, 
            EndTime = endTime, 
            Subject = value.Subject, 
            Recurrence = 0, 
            AllDay = value.AllDay, 
            RecurrenceRule = value.RecurrenceRule 
        }; 
        db.MultipleResources.InsertOnSubmit(appoint); 
    } 
} 
</Code> 
 
We have prepared the sample for your reference which can be download from the below location. 
 
In the above sample, we have stored the recurrence appointment (including its occurrences) as normal appointment (without repeat option) in the database. Initially, we used to store only the parent recurrence appointment (as single appointment) in the database and by using that parent appointment recurrence rule, we have internally processed to create the other occurrence of that recurrence appointment in the Schedule control. It is possible way to achieve your requirement and it is not recommended.  
 
Regards, 
Karthigeyan 



DM Darren McDaniel replied to Karthigeyan Krishnamurthi June 22, 2017 01:03 AM UTC

Hi Darren 
 
Thanks for your update. 
 
We can parse the recurrence rule using explicitly created new generic utility class RecurrenceHelper in the project. To make use of this generic class in your sample, please refer this below KB link and refer it in your sample. 
https://www.syncfusion.com/kb/5390/how-to-parse-the-recurrencerule-in-server-side  (The RecurrenceHelper Class is available in the sample link provided in this KB). Within this utility RecurrenceHelper class, GetRecurrenceDateTimeCollection method is defined which generates the date instances based on the RecurrenceRule and start date of the appointment. Using these auto-generated date collections from this method, we need to manually create the individual appointment instances as mentioned below in the code example, 
 
<Code> 
if (value.Recurrence!=0) // this code block will execute only for recurrence appointment 
{ 
    //Pass the recurrencerule string and the start date of the appointment to this method that will return the dates collection based on the recurrence rule 
    dates = RecurrenceHelper.GetRecurrenceDateTimeCollection(value.RecurrenceRule, Convert.ToDateTime(value.StartTime)).ToList(); 
    // Now, the variable “dates” contains the date collection, with which the appointment instances are needed to be created manually. 
    var diff = endTime - startTime1; 
    for (var i = 0; i < dates.Count; i++) // this loop is used to create the appointment instances for the generated dates 
    { 
        startTime = Convert.ToDateTime(dates[i].AddHours(startTime1.Hour).AddMinutes(startTime1.Minute)); //start time for each occurrences will be calculated 
        endTime = Convert.ToDateTime(startTime.AddHours(diff.Hours).AddMinutes(diff.Minutes)); //end time for each occurrences will be calculated 
 
        MultipleResource appoint = new MultipleResource()// Appointment object creation 
        { 
            Id = value.Id + i, 
            StartTime = startTime, 
            EndTime = endTime, 
            Subject = value.Subject, 
            Recurrence = 0, 
            AllDay = value.AllDay, 
            RecurrenceRule = value.RecurrenceRule 
        }; 
        db.MultipleResources.InsertOnSubmit(appoint); 
    } 
} 
</Code> 
 
We have prepared the sample for your reference which can be download from the below location. 
 
In the above sample, we have stored the recurrence appointment (including its occurrences) as normal appointment (without repeat option) in the database. Initially, we used to store only the parent recurrence appointment (as single appointment) in the database and by using that parent appointment recurrence rule, we have internally processed to create the other occurrence of that recurrence appointment in the Schedule control. It is possible way to achieve your requirement and it is not recommended.  
 
Regards, 
Karthigeyan 


Thank You for the insight....

Yes, understand it's not recommended... but for what I am utilizing it for... it's required... :)



KK Karthigeyan Krishnamurthi Syncfusion Team June 22, 2017 12:32 PM UTC

 
Thanks for your update. 

Kindly try our solution as per your requirement. 
 
Regards, 
Karthigeyan 
  


Loader.
Up arrow icon