Hi,
I have implemented a scheduler and the schedules contains recurrence data.
Now I need to show these schedules created, in a telerik report.
My report page would not contain a scheduler. I just want to connect to the database, get the schedules data from the table and show it in a telerik report.
My question is, the recurrence field in the database, contains a string like this:
"DTSTART:20090106T150000Z DTEND:20090106T190000Z RRULE:FREQ=DAILY;COUNT=10;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU ".
How to parse this and show it in the report ?
Should I follow this logic or is there a better way to do it ?
1. Read data from the database.
2. Create new instances of "Appointment" based on the data read from the database, for each row.
3. Use "RecurrenceRule" to parse the recurrence, if recurrence field is not empty.
4. Add the result to a datatable and bind it to the report.
Is the above logic the way to go ? Please advice.
Thanks in advance.
-Karthik Selvaraj
8 Answers, 1 is accepted
0
Accepted
Hi karthik,
You need to parse the recurrence rules as shown in this kb article:
http://www.telerik.com/support/kb/aspnet-ajax/scheduler/how-to-display-all-radscheduler-appointments-in-gridview.aspx
Greetings,
Peter
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You need to parse the recurrence rules as shown in this kb article:
http://www.telerik.com/support/kb/aspnet-ajax/scheduler/how-to-display-all-radscheduler-appointments-in-gridview.aspx
Greetings,
Peter
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
karthik
Top achievements
Rank 1
answered on 12 Jan 2009, 04:32 PM
Hi Peter,
Thanks and I appreciate your fast reply.
I have implemented the following code based on the link you suggested:
private DataTable GetGridDataSource()
{
//Create a dynamic table to store the appointments' information:
DataTable table1 = new DataTable();
table1.Columns.Add("Subject");
table1.Columns.Add("StartDate");
table1.Columns.Add("EndDate");
SchedulesService schedulesService = new SchedulesService(); //Our custom service to get the schedules info from database
TList<Schedules> schedulesList = schedulesService.GetAll(); //This will be a list of all schedules as it exists in database.
foreach (Schedules schedule in schedulesList) //Each schedule as it exists in database
{
if (string.IsNullOrEmpty(schedule.RecurrenceRule)) //No recurrence rule
{
table1.Rows.Add(new string[] { schedule.Subject.ToString()
, schedule.StartTime.ToString()
, schedule.EndTime.ToString() });
}
else //Recurrence rule exists
{
RecurrenceRule parsedRule;
RecurrenceRule.TryParse(schedule.RecurrenceRule,out parsedRule);
foreach (DateTime occurrence in parsedRule.Occurrences)
{
table1.Rows.Add(new string[] { schedule.Subject.ToString()
, occurrence.ToString()
, occurrence.AddHours(1).ToString() });
}
}
}
return table1;
}
This code works fine. However please look at the bold line in the code to get the end time of the recurrence schedule. (I am just adding one hour to the start time).
Is there any way to get the end time of that schedule (without having to create instances of "Appointment" object as mentioned in the link you had suggested)..
Thanks for your invaluable help..
- Karthik
0
karthik
Top achievements
Rank 1
answered on 12 Jan 2009, 05:06 PM
Hi,
Never mind.
I got it working using this:
occurrence.Add(parsedRule.Range.EventDuration).ToString()
Thanks.
- Karthik Selvaraj
0
shashidhar
Top achievements
Rank 1
answered on 01 Jul 2009, 02:41 PM
hi,
SchedulesService schedulesService = new SchedulesService(); //Our custom service to get the schedules info from database
SchedulesService schedulesService = new SchedulesService(); //Our custom service to get the schedules info from database
TList<Schedules> schedulesList = schedulesService.GetAll(); //This will be a list of all
where should i get the " SchedulesService " class to get the schedules info from database ";
please help me
Thanking you
where should i get the " SchedulesService " class to get the schedules info from database ";
please help me
Thanking you
0
Hi shashidhar,
SchedulerWebService.asmx and SchedulerWebService.cs can be found at your locall isntallation of the Telerik ASP.NET AJAX suit ->Live Demos\Scheduler\Examples\WebService
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
SchedulerWebService.asmx and SchedulerWebService.cs can be found at your locall isntallation of the Telerik ASP.NET AJAX suit ->Live Demos\Scheduler\Examples\WebService
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sunit
Top achievements
Rank 1
answered on 01 Jul 2009, 03:22 PM
Hi Shashidhar,
That was just an ASP.Net class which I wrote that would query the database to read the schedule info. Sorry if the name had you confused.. :)
Thanks,
Karthik
0
shashidhar
Top achievements
Rank 1
answered on 02 Jul 2009, 06:09 AM
Hi Karthik,
Thank you for your reply. can you please send the the class file
Thank you for your reply. can you please send the the class file
can you please send me the class to read the schedule info from database which you have written.
Thanks
Shashi
Thanks
Shashi
0
shashidhar
Top achievements
Rank 1
answered on 02 Jul 2009, 06:26 AM
Hi,
I am not finding
SchedulerWebService.asmx and SchedulerWebService.cs in my locall isntallation of the Telerik ASP.NET AJAX suit ->Live Demos\Scheduler\Examples\WebService " . How can i get these 2 files . please help me .
Thanking You
Shashi
I am not finding
SchedulerWebService.asmx and SchedulerWebService.cs in my locall isntallation of the Telerik ASP.NET AJAX suit ->Live Demos\Scheduler\Examples\WebService " . How can i get these 2 files . please help me .
Thanking You
Shashi