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

What would be the best approach to project a recurrent appointment

We need to display in a grid a recurrent appointment in separate records.

Considering that the recurrent appointment is stored as one record in the Schedule table, how we could achieve this.

Do you think we should create a record per day in the Schedule table when an recurrent appointment is created or would be better to parse the Recurrent string, for example: (FREQ=DAILY;INTERVAL=1;COUNT=19;EXDATE=5/3/2017,5/5/2017)

to project it in several records during runtime.

We expect to have thousands of schedule records with hundreds of concurrent session.

What option could you think would be the best for us, or if you have a clever idea.

Thanks

David

1 Reply

KK Karthigeyan Krishnamurthi Syncfusion Team May 8, 2017 12:13 PM UTC

Hi David, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared the sample to show the recurrence appointment with all its occurrence in Grid which can be download from the below location. Kindly refer the below link and code example used in the sample. 
 
<Code> 
if (app.Recurrence == true) // this code block will execute only for recurrence appointment 
            { 
                List<DateTime> dates = new List<DateTime>(); 
                
                int intMax = _context.DefaultSchedule.ToList().Count > 0 ? _context.DefaultSchedule.ToList().Max(p => p.Id) : 1; 
                DateTime startTime = Convert.ToDateTime(app.StartTime); 
                DateTime startTime1 = Convert.ToDateTime(app.StartTime); 
                DateTime endTime = Convert.ToDateTime(app.EndTime); 
                //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(app.RecurrenceRule, Convert.ToDateTime(app.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 
 
                    DefaultSchedule appoint = new DefaultSchedule()// Appointment object creation 
                    { 
                        Id = intMax + i, 
                        StartTime = startTime, 
                        EndTime = endTime, 
                        Subject = app.Subject, 
                        Recurrence = app.Recurrence, 
                        AllDay = app.AllDay, 
                        RecurrenceRule = app.RecurrenceRule, 
                    }; 
                    newApp.Add(appoint); 
                } 
                return newApp;                
           } 
</Code> 
 
Regards, 
Karthigeyan 


Loader.
Up arrow icon