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

Gravitybox Schedule.NET
1998-2005 Gravitybox Software LLC
Page 13 of 90
Lists
Overview
The lists are complementary to the collections in that they hold the same type of objects
but allow much more functionality on its contents. There are three operation defined for
each list object: Intersect, Union, and Subtract. These actions may be used in any
combination to construct arbitrarily complex queries. Given two or more lists you may
union their contents to get a list of all objects in both lists. Moreover, you may subtract
one list from the other list to get all objects in first that are not in the second. Finally you
can find only common objects to both lists using the Intersect method. Each collection
that has a matching list allows you to create a list of all objects by calling its ToList
method. However the real potential comes from the ability to work with subsets of
collections.
AppointmentList
This is the most important list in the namespace. It allows you to query a group of
appointments. The AppointmentCollection allows you to form some simple, pre-made
queries using the GetBlocked and GetUnBlocked methods. Each returns a list of
appointments. However the advanced functionality of the schedule is rooted in the
AppointmentCollection’s Find method. It allows to you ask many different questions of
the collection and get an AppointmentList in return. You may ask as many questions as
you wish each time getting a list of appointments for each. You may then create a
master lists by using one or more of the defined list actions: Union, Subtract, or
Intersect.
Using the AppointmentCollection “Find” method, the following code snippet creates
three AppointmentList objects. The first retrieves a list of all appointments on January 1,
2004. The second get a list of all appointments with the subject “MySubject”. The third is
the union of both lists. We could have just as easily subtracted one list from the other.
Dim list1 As AppointmentList
Dim list2 As AppointmentList
Dim list3 As AppointmentList
list1 = Schedule1.AppointmentCollection.Find(#1/1/2004#, #1/1/2004#)
list2 = Schedule1.AppointmentCollection.Find("MySubject")
list3 = list1.Union(list2)
Using this simple example you can see the power of lists. It basically allows you to
apply set arithmetic to sets of schedule objects.
The AppointmentList has a three other methods of special interest: IsAreaAvailable,
IsConflict, and NextAreaAvailable. The IsAreaAvailable method determines whether an
appointment is scheduled in a specific schedule area. An area is defined by the set of
parameters passed into this method. It is overloaded multiple times to allow almost any
region to be queried. If any part of one or more appointments overlaps any portion of
the defined area, this method returns false. The IsConflict method allows you to
determine if a specified appointment conflicts with any other appointments in the list.