Solutions Schedule for Silverlight - Gantt style drag and drop multi resource scheduling  
How To ...
         
    Data Bind with ctxCalendar    
   
           
      The ctxCalendar control encapsulates arrays, methods, events, and properties that allow the developer to bind the control to virtually any data source containing collaboration data, i.e. appointments, contacts, locations, and tasks. At its heart, the ctxCalendar control presents appointment information and provides a platform for a user to visually interact with that information. The ctxCalendar control manages 4 collections of appointment and appointment support objects internally:
ctxCalendar - Three Scheduling Viewis in ONE control
1. Appointments
2. Contacts
3. Locations
4. Tasks

NOTE: The control also has support for Custom Areas.

The data/control relationship that governs the binding of the ctxCalendar control to a database revolves around the Add/Edit/Delete of appointments with or without a relationship to a given Task, Location, and/or Contact. In this scenario any action on the appointment is recorded in a single record in the database.

Loading the control from a database
The ctxCalendar control objects are designed to represent the tables in which theobjects are persisted as data. Accordingly, the collections are loaded by reading in the associated tables. Appointments represent the time period assigned to a Task or Tasks and/or or to a resource or group of resources such as a Location(s) and/or a Contact(s). Before adding appointments to the control, the developer should populate the Contacts, Tasks, and Locations (if applicable) with the data being scheduled in the calendar. In addition to the standard properties used to describe the Appointment, Contact, Location, and Task entities there are two key properties on each collection object in the control used to bind the objects to the database; Cargo and Data.

The ctxCalendar control defines a period of time over which collaboration data is presented. The time period is defined by a start and end date. As each record is processed from the database the appropriate ctxCalendar method is used to add the object to the control and its properties are set to reflect the record in the database. When the control is first instanced the start and end dates for the control are set. These values then become the base parameters for selecting existing appointment records from the database to load in to the control.

To load the Appointments from the database the developer selects all appointments that match the criteria set on the ctxCalendar control (date range, Contacts, Locations, Tasks) and programmatically loops through the records creating an appointment using the AddAppointment method for each record.

Cargo Property
The Cargo property (of type string) can be used to capture the value of the key field in the table representing the entity.  For example, the Appointment_Cargo field value stores the key field (unique) value of the Appointment Record in the Appointments Table.

Data Property
The Data property (of type Long Integer) can also be used to capture the value of the key field in the table. 

Writing changes back to the database
Changes to an appointment are surfaced through events raised in the control at the time the user interacts with the ctxCalendar control or an appointment in the control; for example, creating, moving, or selecting to delete an appointment. The key to reflecting these changes is to create, or identify and modify the data related to the appointment being created or changed. Any changes to the appointment object fire events that allow the developer to query the appointment for its Cargo or Data property value which can then be used to persist the change back to the database.

XML Data
The ctxCalendar control is capable of reading and writing XML data. The data can be read and written as a string into or from memory, or to and from a file. The control is also capable of creating XML data for the entire control, Appointments details only, or all the objects except the appointments.

READ AND WRITE AN XML FILE
The methods used to read and write the xml files are the ReadFile and WriteFile. A valid XML file can be read from a local drive, a mapped drive, or from a web site. The WriteFile method supports committing data to local drive or a mapped drive. More on XML data support next time.


SUMMARY
Databinding the ctxCalendar control requires three distinct points of integration; loading the data from the database, responding to changes (moves/edits) to the appointments in the calendar object, and responding to Adds (new) and Deletes to the appointments in the calendar object. Each of the objects in the calendar (appointments, contacts, tasks, and locations) has properties that allow the developer to persist the relationship of the object in the database being reflected. Each event that is fired in the calendar passes the appointment against which the event occurred (move, size, add) to allow the developer to read the necessary property values (start time, end time, etc.) and its persistence scheme (record id in Cargo or Data, to the object in the database.
   
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
           
           
 
       
       
       
DBI Support Products Downloads Purchase
         
Customers Support Request Form COM Tools Trial Downloads Order Page
News Releases FAQ dbi Calendar Silverlight Online Evaluations Academic
Contact Us License Registration dbi Calendar WPF Legacy
Updates Extractor - Text Analytics Events
Utilities Solutions Schedule for COM
Support Policies Solutions Schedule Silverlight
Product Life Support Solutions Schedule for .NET
Platform Products Solutions Schedule WPF
Contact Us Studio Controls for COM
  Studio Controls for .NET
.NET Scheduling Framework
  all rights reserved  |  copyright  1996 - 2018 |  Terms of Use