![]() Gravitybox WebSchedule.NET
1998-2005 Gravitybox Software LLC
Page 49 of 65
Dim MyDataset As DataSet
'Populate the Dataset
'...
'Manually bind the datatable to the AppointmentCollection
schedule1.DataBindings.AppointmentBinding.DataSource = ds.Tables("Engagement")
'Setup the AppointmentBinding object
schedule1.DataBindings.AppointmentBinding.DataFieldBindingCollection.Add("appointment_guid
"Key")
schedule1.DataBindings.AppointmentBinding.DataFieldBindingCollection.Add("start_date",
"Starting")
schedule1.DataBindings.AppointmentBinding.DataFieldBindingCollection.Add("length",
"Duration")
schedule1.DataBindings.AppointmentBinding.DataFieldBindingCollection.Add("subject", "Text"
Schedule1.DataSource = MyDataset
Schedule1.Bind()
There is a binding object for each table to which data can be bound. You may bind up to
eight tables: Appointment, Category, Provider, Room, Resource,
Appointment_Category, Appointment_Provider, and Appointment_Resource. When a
DataTable does not match the standard name, you must set the table binding as shown
above with the AppointmentBinding object. There is one for each of the eight tables.
You may map as many or as few fields as you wish so long as you map the required
ones. If a field in your DataTable happens to have the standard name, there is no need
to remap it in the DataBindingCollection object as it will be automatically recognized.
There are a few rules to remember when working with mappings. First, you cannot
create a mapping and add it to more than one collection. You can create a binding and
add it to a DataBindingCollection object or you can specify the binding settings from the
Add method. Also once a DataBinding object has been added to a collection it cannot
be changed. Lastly, only valid fields can be added to the DataBindingCollection object
based on the table to which it maps. For example, you cannot map the room property
PhoneNumber to anything since the room has no such property.
Controllers
If you are data binding to a local database, you can bind simply by selecting the
appointment table, with the proper fields. This is quick and will work, but you will most
likely want more robust functionality. The schedule can natively process a dataset with
the tables: Appointment, Provider, Room, Category, Resource, Appointment_Provider,
Appointment_Category, and Appointment_Resource. If you use the database scripts
provided with the install, you can create all of these tables with the proper format. They
are related as described in Figure 8.1 above.
ScheduleController
Gravitybox provides a companion component named ScheduleController that is
included in with the install and allows you to connect to a database with no code. The
|