Resources

  • 4 minutes to read

Overview

In real-life scheduling applications, appointments are seldom processed simply "as is", but usually are assigned to different resources. There are different kinds of resources, and the decision as to what should be a resource in a particular scheduling application depends upon the specifics of the task solved by the application. Here are some examples of scheduling tasks, illustrating what can be an appointment and a resource in these examples.

  • A Business.

    Resource: Every employee in this company.

    Appointment: Any time interval spent by an employee, to perform a particular task.

  • A Car Rental Agency.

    Resource: Every car which is owned by this firm, and can be leased.

    Appointment: Any time interval when any of the firm's cars are leased.

  • An Educational Center.

    Resources: Every teacher who works at this center, or every room in this center.

    Appointment: Any time interval when any of the teachers is delivering a lecture in any of the rooms at the center.

    NOTE

    In the latter example, two kinds or resources are possible (teachers and rooms). However, the Bootstrap Scheduler doesn't allow appointments to belong to resources of different types. So, to display this data in a scheduling application, we suggest using two pages with different Scheduler Controls.

An appointment can have one or several resources assigned to it. If it has no resources assigned, then it is assumed that any resource can be associated with that appointment.

Assigning Appointments to Resources

A single resource is an object that exposes the Resource interface. All of scheduler's resources are stored in the ASPxResourceStorage (which is a part of the Scheduler Storage and is accessed via its ASPxSchedulerStorage.Resources property).

If a Resource Storage contains at least one resource, then it is possible to assign appointments to resources. This may be done in different ways, depending on whether resource sharing is enabled or not.

Grouping by Resources

A resource becomes enabled in the Scheduler only when its data is shown grouped by either dates (SchedulerControl.GroupType is set to SchedulerGroupType.Date) or by resources (SchedulerControl.GroupType is set to SchedulerGroupType.Resource).

NOTE

If the Resource.Visible property of any resource is set to false, and appointments grouping is enabled, then all the appointments that belong to this resource will be hidden.

The following image demonstrates the common look of the Scheduler Control grouped by resources in the Day View.

BootstrapScheduler_GroupByResources

The Resource Navigator element is shown when the scheduler enters the group mode. It can be used by end-users to scroll through resources, and to change the number of resources displayed at one time on screen. To hide the Resource Navigator, set its ResourceNavigator.Visibility property to ResourceNavigatorVisibility.Never.

NOTE

You can manually set the number of resources visible at once on a screen for every view via the SchedulerViewBase.ResourcesPerPage property of the appropriate view.

Storing and Retrieving Resources

The Scheduler control uses the mappings mechanism to bind scheduler objects to the data fields. See the ASPxResourceMappingInfo class description for the mappings overview.

Specify the following data field mapping properties (available through ASPxResourceStorage.Mappings) to allow the Scheduler control to save and retrieve resource data to/from the data source.

Additionally, specify the ASPxAppointmentMappingInfo.ResourceId property to store appointments’ associated resource.

To learn more, see the Resource Data Binding demo online.