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.
Unfortunately, activation email could not send to your email. Please try again.

What would be the best approach to project a recurrent appointment

Thread ID:

Created:

Updated:

Platform:

Replies:

130317 May 5,2017 08:15 PM May 8,2017 08:13 AM ASP.NET Core 1
loading
Tags: Schedule
dsapo
Asked On May 5, 2017 08:15 PM

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

Karthigeyan Krishnamurthi [Syncfusion]
Replied On May 8, 2017 08:13 AM

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 


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.

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.

;