Assigning Appointments to Resources
- 3 minutes to read
This document describes how appointments can be assigned to different resources.
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.
Resources are not shared, i.e. the AppointmentStorageBase.ResourceSharing property is set to
false
.To assign an appointment to a particular resource, the appointment’s Appointment.ResourceId property should be set to the ID of an appropriate resource. Note that the resource’s ID is accessed via its IPersistentObject.Id property.
The image below demonstrates this concept.
Resources are shared, i.e. the AppointmentStorageBase.ResourceSharing property is set to
true
.To assign an appointment to several resources, it is necessary to add their IPersistentObject.Id property values to the appointment’s Appointment.ResourceIds collection.
The image below demonstrates this concept.
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 dates in the Month View.
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
Resources for appointments can be stored in a data table. Refer to the Data Table Structure document for more information.
ASPxScheduler uses the mappings mechanism to bind scheduler objects to the data fields. See the ASPxResourceMappingInfo class description for the mappings overview.
When resources are assigned to a particular appointment, the Appointment.ResourceId and Appointment.ResourceIds values’ storing and retrieving are automatically accomplished by the AppointmentMappingInfo.ResourceId mapping. The AppointmentStorageBase.ResourceSharing value controls how the data field value should be interpreted.
Note
If the resource for an appointment is not specified, it is assumed that the appointment belongs to any resource. Use the SchedulerOptionsViewBase.ShowOnlyResourceAppointments property to specify its visibility. If the resource assigned to an appointment is missing in a resource storage, this appointment is not loaded in appointment storage. It means that a Scheduler without resources does not display appointments with resources.
Recurrent Appointment Limitations
- Scheduler does not allow to edit resources for recurrent appointments’ occurrences. It is possible only to change resources for the entire series of appointments created with a recurrent rule.
- Dragging recurrent appointments to different resources is not supported.