ComponentOne Scheduler for ASP.NET: Working with Scheduler for ASP.NET AJAX > Appointments > Resources > Assigning Resources to an Appointment

Assigning Resources to an Appointment

At run time, assigning a resource or multiple resources can be done through the Resources dialog box. By default, the Resources dialog box does not contain any resources. For information on how to add resources to the Resources dialog box, see Adding Resources to the Master Resources List.

To assign a resource to an appointment at run time:

1.   Click the Resources button in the Appointment dialog box.

2.   Select the check box next to the desired resource and click OK.

 

 

The resource appears next to the Resources text box. Note that you can assign multiple resources to an appointment.

 

To assign a category to an appointment programmatically:

Suppose you have already created an appointment and added a category using the following code in the Page_Load event, for example:

      Visual Basic

' Add an appointment

Dim app As C1.C1Schedule.Appointment

app = Me.C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add()

 

' Set some details for the appointment.

app.Subject = "Meeting"

app.Location = "Large Conference Room"

app.Duration = TimeSpan.FromMinutes(45)

app.Start = New Date(2009, 3, 3, 11, 30, 0)

 

' Create the Digital Projector resource.

Dim rescol As C1.C1Schedule.ResourceCollection

rescol = Me.C1Schedule1.DataStorage.ResourceStorage.Resources

Dim roomres As New C1.C1Schedule.Resource

roomres.Text = "Digital Projector"

 

' Insert the resource into the Main List of Resources.

rescol.Insert(0, roomres)

 

' Assign the resource to the appointment.

app.Resources.Add(roomres)

      C#

// Add a new appointment.

C1.C1Schedule.Appointment app;

app = this.C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add();

 

// Set some details for the appointment.

app.Subject = "Meeting";

app.Location = "Large Conference Room";

app.Duration = TimeSpan.FromMinutes(45);

app.Start = new DateTime(2009, 3, 3, 11, 30, 0);

 

// Create the Digital Projector resource.

C1.C1Schedule.ResourceCollection rescol;

rescol = this.C1Schedule1.DataStorage.ResourceStorage.Resources;

C1.C1Schedule.Resource roomres = new C1.C1Schedule.Resource();

roomres.Text = "Digital Projector";

 

// Insert the resource into the Main List of Resources.

rescol.Insert(0, roomres);

 

// Assign the resource to the appointment.

app.Resources.Add(roomres);

To assign the new resource to the appointment you created, use the following code:

      Visual Basic

' Assign the resource to the appointment.

app.Resources.Add(roomres)

      C#

// Assign the resource to the appointment.

app.Resources.Add(roomres);


Send comments about this topic to ComponentOne.
Copyright ComponentOne LLC. All rights reserved.