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

Gravitybox Schedule.NET
1998-2005 Gravitybox Software LLC
Page 55 of 90
this condition. This overloaded method takes a variety of parameters based on the
viewmode setting. If the viewmode is date and time then you will need to query based
on dates and times to get a meaningful result from the method. Given a set of
parameters the method determines if there is any appointment overlapping and if so
returns false. If the proposed appointment area does not overlap any other appointment
in the list the method return true, indicating the proposed area is available for
scheduling.
The following code snippet checks to determine if any appointments overlap the
schedule area January 2, 2004 from 10am through 11am.
Dim b As Boolean
b = list1.IsAreaAvailable(#1/2/2004#, #10:00:00 AM#, 60)
Checking for availability is important but in an office environment many times you wish
to know when is the next available time slot for an appointment. Instead of building
complicated algorithms to find schedule availability, you can use the built-in functionality
already provided. The method “NextAreaAvailable” exists as an enhancement to the
“IsAreaAvailable” method. The latter just checks a specific schedule slot, while the
former starts a specific schedule slot and returns the next available slot after it.
For example if you were on the phone with a client and he said “The earliest I can come
in is next Tuesday.” You would then call this function with next Tuesday date and the
proposed appointment length and it would return the next schedule slot that would fit the
proposed appointment. The method uses the schedule StartTime and DayLength
properties to narrow the calculations. If the schedule only displays 8am through 6pm,
the “NextAreaAvailable” method would never returns a slot outside of this range. It also
uses the MinDate and MaxDate schedule properties as well as boundaries.
In the following code snippet, the search will begin on January 6, 2004 at 8am. The
schedule will continue to search for an appointment slot to fit a 1-hour appointment. If it
finds a free schedule area it will be returned in an appointment object. This appointment
does not on the schedule it only is a holder for the information. If you wish to add the
returned value as an appointment to the AppointmentCollection then simply call the
AppointmetnCollection’s Add method with the returned object.
Dim proposed As Gravitybox.Objects.Appointment
proposed = list1.NextAreaAvailable(#1/6/2004#, #8:00:00 AM#, 60)
If Not (proposed Is Nothing) Then
  Debug.WriteLine(proposed.StartDate)
  Debug.WriteLine(proposed.StartTime)
  Schedule1.AppointmentCollection.Add(proposed)
End If
Schedule Areas
The NoDropCollection and ColoredAreaCollection are created from the
ScheduleAreaCollection class. These two class instances define the no-drop areas and
other colored areas of a schedule. There is also a matching ScheduleAreaList class. 
http://www.purepage.com