This is a migrated thread and some comments may be shown as answers.

Verifying Appointments

5 Answers 102 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 12 May 2009, 09:33 PM
Background:

I have implemented RadScheduler (Q3 ASP.NET AJAX) into a custom MOSS web part. The scheduler is bound to a SharePoint Datasource on the page. The ds is attached to a standard SP task list. I have bound the scheduler start time field to the start date and the scheduler end time field to the due date.

Problem:

I am getting the following error: System.Exception: Appointment is invalid: Start time must be before the End time. at Telerik.Web.UI.Appointment.Validate()

In looking through my task list data, I see that some tasks are scheduled to start and end on the same day. I also see that I have tasks that do not have either a start date or a due date.

I assume my error is being generated from these inconsistencies.

Proposed Resolution:

I think I would need to verify each appointment, but I am unsure as to the best way to handle the exceptions. I am thinking the AppointmentDataBound event could be used to verify each appointment. I could check to make sure all fields exist and make sure the due date is after the start date. Would using this event work? 

Question:

Can the scheduler handle using dates only without a time field? I would like to have all appointments register as full day appointments. If the start date was 5/1 and the due date was 5/2, can the sceduler evaluate this? Also, if the start date and due date were the same, can the scheduler evaluate this? Or do I need to add custom handling in the AppointmentDataBound event for these scenarios?

Thanks.

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 May 2009, 09:04 AM
Hi Joe,

You cannot verify dates in the AppointmentDataBound event since an exception would be already thrown if there are invalid start and end values. Your database needs be verified beforehand.

If you need to create all day appointments, you should set the Start and End dates to specific values. Namely, the start datetime should be 12 am of the current day, and the end datetime should be 12 am the day after. For example:
protected void Page_Load(object sender, EventArgs e)   
{   
  Appointment allDayAppointment = new Appointment();   
  allDayAppointment.Subject = "All day appointment for May 15, 2009";   
  allDayAppointment.Start = new DateTime(2009, 5, 15, 0, 0, 0);   
  allDayAppointment.End = new DateTime(2009, 5, 16, 0, 0, 0);   
  RadScheduler1.InsertAppointment(allDayAppointment);   
}   
 




Kind regards,
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
Joe
Top achievements
Rank 1
answered on 19 May 2009, 05:34 PM
Peter, thanks for the info.

Is there any event that I could use to trap these problems? I want to use the SharePoint data source to utilize the insert and update commands. So I am just looking for a way to manipulate the data from the data source prior to the scheduler throwing any data related errors? I know my data is never going to be perfect. Since we are talking about SharePoint lists, the user is always going to have a hand in creating the data, and causing problems like I described below. My only other option seems to be implementing a more manual read and clean of the data to manually code new appointments, which also means I'll need to manually code everything else and not be able to use the inherent functionality of the data source. Any other ideas would be appreciated.

Thanks.
0
T. Tsonev
Telerik team
answered on 21 May 2009, 11:39 AM
Hi Joe,

I'm afraid that manual sanitizing of the data will be necessary in this case. We have a Code Library entry that can serve you as a starting point:
http://www.telerik.com/community/code-library/aspnet-ajax/scheduler/radscehduler-sharepoint-recurrence.aspx

We'll consider adding some type of event for the case when the AppointmentData cannot be parsed successfully. This might prove useful when you don't have full control over the data coming from the data source and you want to "repair" it as it's consumed.

Kind regards,
Tsvetomir Tsonev
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
Lucania
Top achievements
Rank 1
answered on 12 Jun 2012, 01:08 AM
I would very much like to see such an event too, it's a relatively large task to write a provider just for that.

ROSCO
0
Peter
Telerik team
answered on 12 Jun 2012, 03:45 PM
Hi ROSCO,

Actually, we have already written an Exchange provider which you can use for your case. Attached is a sample with an updated version of the Exchange provider that resolves some issues with recurring appointments.

An alternative is to use Microsoft Exchange Web Services managed API as discussed in this forum thread.

All the best,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Joe
Top achievements
Rank 1
Answers by
Peter
Telerik team
Joe
Top achievements
Rank 1
T. Tsonev
Telerik team
Lucania
Top achievements
Rank 1
Share this question
or