Navigation bar
  Print document Start Previous page
 38 of 65 
Next page End  

Gravitybox WebSchedule.NET
1998-2005 Gravitybox Software LLC
Page 36 of 65
List2 = Schedule1.AppointmentCollection.Find(“John Doe”)
Now comes the interesting part. These are the three operations defined on lists: Union,
Intersection, and Subtraction. You can use these list operations to define arbitrarily
complex queries. 
Following the two examples above, we can now build a list that contains all items in list1
and also all items in list2. This is a set operation known as Intersection. Essentially
finding all appointments for John Doe between the dates of January 1, 2004 and
January 5, 2004.
Dim list3 As Gravitybox.Objects.AppointmentList
list3 = list1.Intersect(list2)
The new “list3” variable will hold the intersection of the two lists, meaning appointments
that are in both lists, with no duplicates. If you wanted to find all appointments for that
date range (for any patient) or any appointments for “John Doe”, you would use the
“Union” method. This would basically concatenate both lists into one. If you wanted all
appointments in the date range except for “John Doe” appointments then you would use
the “Subtract” method to remove any appointments in list2 from list1.
Keep in mind when building lists that the Find method will never return duplicate objects
in the same list. Although you can programmatically add the same object to a list
multiple times, the schedule will not do this. For example, if the “Union” method is called
to concatenate two lists, the result will not have duplicates. So two joined lists may have
less elements than their combined source lists.
Conflicts
Conflict resolution is the most interesting and aggravating part of scheduling. Many
applications require that conflicts do not exist. In other situations it is necessary and
expected. The schedule does not disallow conflicts but does provide you with
functionality to expose them and correct for them if necessary. By default, the schedule
displays conflicting appointments side-by-side so that the user can see all
appointments. The appointments are shown partial width to allow other appointments in
the same slot to be seen.
The AppointmentList class exposes methods that facilitate conflict searching. The
method “IsConflict” allows you to specify an appointment and determine if it conflicts
with any appointments in the list. In the following code snippet, an appointment is
specified to check if it conflicts with any appointments in a defined list.
Dim b As Boolean
b = list1.IsConflict(appointment)
If you wish to disallow conflicts then you will wish to not create them programmatically.
Before creating an appointment with code, you can check to determine if the proposed
http://www.purepage.com