Telerik blogs

The big [new] feature for Q3 2009 release in RadScheduler for WinForms has got to be the resource grouping functionality.
There are, however, numerous other improvements that also deserve attention, such as data binding. Some of you may remember that in its first release the WinForms Scheduler had just basic support for binding to appointment data. Later we extended this functionality to support storing associations to resources in the data source.

Well, the Q3 2009 release brings to RadScheduler support for binding to exceptions (through the SchedulerBindingDataSource) out-of-the-box. No, these are not exceptions as in “C# exceptions” (although this could be an interesting feature), but exceptions as in “exceptions to recurring appointments”. This marks a significant milestone in the data binding functionality of the control, because it can now store all data it can work with in the data source.

The data binding example in the QSF demo app has been extended to demonstrate this new functionality, so you can refer to it anytime you need a complete, working demo. It also includes a sample database that shows a data schema that works well with RadScheduler.

Similar to the support for storing resource associations in the data source, the data binding functionality relies on some kind of relation to be present. This could be either a data relation if you are [still] using a data set, or some kind of a collection if you are using some ORM tool or custom made business objects.

To get this to work, you just have to set the name of the relation in the appointment mapping info like bellow in order to bind RadScheduler to any exceptions that may be present in your data source (assuming that you have the latest Q3 2009 assemblies):

appointmentMappingInfo.Exceptions = "AppointmentsAppointments";

In a relational data store such as a data base, the relation between an occurring appointment and its exceptions will most probably be expressed as a self reference. In order to not load the exceptions in the appointments collection we need a way to tell whether an item in the data source is an occurring appointment or an exception. For these purposes we have to know the name of the parent Id property, which is accomplished as shown below:

appointmentMappingInfo.MasterEventId = "ParentID";

If the value of that property for a data source item is null or DBNull, this data source item is considered a recurring appointment by default. If this does not fit to your data source (for example for occurring events the property has a value of -1) you just need to point the  IsMasterEventIdCallback property of the Events provider to some code that returns true if the value corresponds to a occurring appointment:
dataSource.EventProvider.IsMasterEventIdCallback = delegate(object value)
{
return (int)value == -1;
};

Again, for a full working example please refer to the RadScheduler Data Binding Example in the Quick Start application which is installed with the suite. And for the most impatient of you here is how it looks like:

recurring_event_with_exceptions

In the picture above we see a recurring appointment at the top of the time table that has two exceptions. The first exceptions was made not visible by using the delete button in the appointment edit dialog and the second exception has a different background color.

Obviously the sky is the limit with this provider architecture and you may be wondering what's next. Well, it is now time for you, dear customers, to speak up. What data source do you need to bind to? What kind of data provider do you think should be implemented next?


Comments

Comments are disabled in preview mode.