Navigation bar
  Print document Start Previous page
 69 of 90 
Next page End  

Gravitybox Schedule.NET
1998-2005 Gravitybox Software LLC
Page 67 of 90
Non-Schedule Data
In the course of building an application that supports scheduling, you will undoubtedly
want to store data that the schedule does not support. For example, you may want to
associate extra information with each appointment like person_id, visit_notes,
last_update, etc. The schedule does not support these properties. There is a remedy for
this situation. The PropertyItemCollection is a collection of objects of type PropertyItem.
These objects are nothing more than a name and a value. You can think of this
collection as a set of name/value pairs. You may associate any data you wish to an
appointment using this collection.
The collection has the methods Add and Remove. You can add or remove any value
you wish and not receive any error. You do not need to data bind to use this collection
to store extra information with an appointment; however it becomes even more useful
when used with data binding. The database Appointment table can contain any fields
you wish. The defined ones map to specific appointment properties link start_date,
length, etc. However if you add a non-standard field like “person_id” to the Appointment
table, the schedule component does not recognize it, so it is placed in the
PropertyItemCollection. In other words all non-standard fields in the Appointment table
are created as a name/value pairs and placed in the PropertyItemCollection of the
associated appointment. If you set the value of one of these objects, it will be persisted
back to the database with no developer interaction! You do not need to write any code
to get database persistence functionality of custom database fields. This is built-in.
The following code assumes that you have a field in your Appointment table named
“person_id”. It is pulled off of the appointment and put in a string variable.
    'Get the first appointment in the collection
    Dim appointment As Appointment
    appointment = Schedule1.AppointmentCollection(0)
    'Get the property value and store it for later
    Dim personId As String = ""
    personId = appointment.PropertyItemCollection("person_id").Setting()
This functionality does not only apply to appointments. Any extra fields added to the
Provider, Category, or Room table triggers the same functionality. The extra fields are
added to the PropertyItemCollection of the respective provider, category, or room
objects.
Non-Standard Datasets
When developing an application that needs to interface with an existing database, you
will most likely want to use your existing database format. As described above the
schedule expects a very specific dataset format. Unless your database model has the
Appointment, Room etc tables defined with the appropriate field names, the schedule
will not bind to it. For many developers this is unacceptable. Fortunately, the schedule
has a built-in way to address this problem. The DataBindings object lets you define the
datatable for each bindable collection and each field of datatable.
http://www.purepage.com