Version

Data Binding Support for Appointments and Owners

The Ultimate UI for Windows Forms 2004 Volume 2 release of WinSchedule™ includes data binding support for Appointments and Owners . This provides the ability to use an ADO.NET data source to populate and/or store the contents of the Appointments and Owners collections. The contents of the Appointments collection is handled by the AppointmentsDataBinding object, and the contents of the Owners collection is handled by the OwnersDataBinding object. Two new properties were added to the UltraCalendarInfo component to support data binding, DataBindingsForAppointments, and DataBindingsForOwners, which are of type AppointmentsDataBinding and OwnersDataBinding, respectively.

The AppointmentsDataBinding Object

To populate the Appointments collection from a data source, the AppointmentsDataBinding object has to be made aware of the data source with which it is dealing, and the names of the fields that will contain the property values for each Appointment object. The DataSource property is of type object and must be set to a valid data source, for example, a Dataset. For the WinSchedule data binding mechanism to be able to create appointments from the data, at least 3 other properties of the AppointmentsDataBinding must be set - the SubjectMember , the StartDateTimeMember and the EndDateTimeMember properties. These properties are of type string and correspond to the Subject, StartDateTime and EndDateTime properties, respectively, of the Appointment object. The properties must be set to the name of a field in the table that contains the data for the property to which it corresponds. Other Appointment properties have corresponding properties on the AppointmentsDataBinding object; to make these properties easy to locate,the fieldname properties of the AppointmentsDataBinding object contain the name of the Appointment property followed by the word "Member". A special fieldname property also exists, AllPropertiesMember , which enables the end developer to save the entire Appointment object to one field as a byte array.

While not all Appointment properties are required to be bound to a data field, any property whose value is to be persisted must be bound. For example, the RecurrenceIdMember and RecurrenceMember properties must be set to valid data fields in order to persist a recurring appointment and any occurrences that have been modified. If the RecurrenceMember property is not set, and appointments that are recurring appointment roots will not be persisted as such, since no data field has been specified in which to save the value of the Appointment’s Recurrence property. Similarly, if the RecurrenceIdMember property is not set, any variances associated with that recurrence will not be signaled as such, because the connection between the recurring appointment root and its associated variances cannot be maintained unless that value is persisted.

The OwnersDataBinding Object

As with Appointment data binding, in order to populate the Appointments collection from a data source, the OwnersDataBinding object has to be made aware of the data source with which it is dealing, and the names of the fields that will contain the property values for each Owner object. A DataSource property is exposed by the OwnersDataBinding object, just as it is for the AppointmentsDataBinding object. Fieldname members also exist for the OwnersDataBinding object, which correspond to the name of the property that they provide values for. The only fieldname member that is required to be set for a valid binding is the KeyMember property. As with Appointment data binding, an AllPropertiesMember property is exposed so that the entire Owner object can be saved to one field as a byte array.