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

Gravitybox WebSchedule.NET
1998-2005 Gravitybox Software LLC
Page 55 of 65
Chapter 7
How do I…
How do I add an appointment (room, category, etc.) in code?
Adding an appointment or any other object in code is easy. All you need to do is call the
“Add” method on the collection to which you wish to add an object. Code to add an
appointment to the Appointments collection is below. The added appointment will be
scheduled for Jan1, 2004 at 10:00AM for a 1-hour duration.
Schedule1.AppointmentCollection.Add("", #1/1/2004#, #10:00:00 AM#, 60)
To add a category, provider, or room is may be performed with one line of code as well
as follows.
Call Schedule1.CategoryCollection.Add("", "MyCategory")
Call Schedule1.ProviderCollection.Add("", "MyProvider")
Call Schedule1.RoomCollection.Add("", "MyRoom")
Each Add method’s first parameter is a key (string). If this parameter is not specified
(empty string) then one is assigned to the object when it is created.
How do I associate a room with an appointment?
Each appointment may be assigned to exactly 0 or 1 room. If no room is associated
then the appointment wil not be displayed when the schedule is in a viewmode that
shows room information. However if a room is associated with an appointment, it will be
shown in its proper room in these viewmodes. The following example adds 1 room and
then adds 1 appointment. It sets the appointment’s room property to the newly created
room object.
Dim room As Room = Schedule1.RoomCollection.Add("", "MyRoom")
Dim appointment As Appointment = Schedule1.AppointmentCollection.Add("",
                                 #1/1/2004#, _
                                 #10:00:00 AM#, 60)
appointment.Room = room
How do I add categories and providers to an appointment?
Unlike rooms where only 1 object may be associated with an appointment, any number
of categories or providers may be associated with an appointment. The following
example adds 10 categories and provider to the schedule’s CategoryCollection and
ProviderCollection. These collections must be populated because appointments cannot
http://www.purepage.com