Back to Devexpress

Appointment.ResourceId Property

corelibraries-devexpress-dot-xtrascheduler-dot-appointment-966d66e0.md

latest8.6 KB
Original Source

Appointment.ResourceId Property

Gets or sets the unique identifier of the resource associated with the current appointment, or the ID of the first resource if resource sharing is enabled.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.Core.dll

NuGet Package : DevExpress.Scheduler.Core

Declaration

csharp
object ResourceId { get; set; }
vb
Property ResourceId As Object

Property Value

TypeDescription
Object

A Object value that specifies the resource’s unique identifier.

|

Remarks

The ResourceId property specifies the identifier of the appointment’s associated resource. All resources must have unique IDs.

Tip

Use the Appointment.ResourceIds property to get a collection of associated resources if resource sharing is enabled.

Resources are used to group schedules. An appointment can be associated with a resource, or it can be standalone. To associate an appointment with a resource, the appointment’s ResourceId property should be set to the value specified by the required resource’s IPersistentObject.Id property. For standalone appointments, the ResourceId property is set to the EmptyResourceId value.

Note

If resource sharing is enabled (the AppointmentStorageBase.ResourceSharing property is set to true ), the ResourceId property returns the ID of the first resource contained in the Appointment.ResourceIds collection.

Note

If an appointment doesn’t belong to any particular resource (the ResourceId property is set to the EmptyResourceId), the scheduler shows it for all resources when the SchedulerControl.GroupType property is set to the SchedulerGroupType.Resource or SchedulerGroupType.Date value. . Appointments without assigned resources are hidden if the SchedulerOptionsViewBase.ShowOnlyResourceAppointments property is set to true.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ResourceId property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-scheduler-resolve-appointment-conflicts/CS/DXApplication1/Form1.cs#L52

csharp
Appointment apt1 = schedulerControl1.DataStorage.Appointments.CreateAppointment(AppointmentType.Normal, DateTime.Now, DateTime.Now.AddHours(2));
apt1.ResourceId = schedulerControl1.DataStorage.Resources[0].Id;
apt1.Subject = "Test1";

asp-net-mvc-scheduler-custom-appointment-form/CS/Models/Scheduling.cs#L167

csharp
get {
    object carId = Appointment.ResourceId;
    return carId == ResourceEmpty.Id ? 1 : (int?)carId; // select first resource if empty

winforms-scheduler-manage-resources-runtime/CS/SchedulerResourcesManagement/Form1.cs#L102

csharp
private bool IsAssignedToCurrentResource(Appointment apt) {
    return (Object.Equals(apt.ResourceId, ResourceEmpty.Id) || Convert.ToInt32(apt.ResourceId) == Convert.ToInt32(schedulerControl1.SelectedResource.Id));
}

winforms-scheduler-optimize-performance-large-dataset/CS/FetchAppointmentExample/SchedulerHelper.cs#L65

csharp
apt.LabelKey = rnd.Next(1, 12);
apt.ResourceId = rnd.Next(0, resources.Length);
return apt;

asp-net-web-forms-scheduler-copy-paste-appointment-context-menu-items/CS/WebApplication1/Default.aspx.cs#L103

csharp
newAppointment.Location = sourceAppointment.Location;
newAppointment.ResourceId = ASPxScheduler1.SelectedResource.Id; ;
newAppointment.Subject = sourceAppointment.Subject;

winforms-scheduler-resolve-appointment-conflicts/VB/DXApplication1/Form1.vb#L42

vb
Dim apt1 As Appointment = schedulerControl1.DataStorage.Appointments.CreateAppointment(AppointmentType.Normal, Date.Now, Date.Now.AddHours(2))
apt1.ResourceId = schedulerControl1.DataStorage.Resources(0).Id
apt1.Subject = "Test1"

asp-net-mvc-scheduler-custom-appointment-form/VB/Models/Scheduling.vb#L184

vb
Get
    Dim lCarId As Object = Appointment.ResourceId
    Return If(lCarId Is ResourceEmpty.Id, 1, CType(lCarId, Integer?)) ' select first resource if empty

winforms-scheduler-manage-resources-runtime/VB/SchedulerResourcesManagement/Form1.vb#L105

vb
Private Function IsAssignedToCurrentResource(ByVal apt As Appointment) As Boolean
    Return (Object.Equals(apt.ResourceId, ResourceEmpty.Id) OrElse Convert.ToInt32(apt.ResourceId) = Convert.ToInt32(schedulerControl1.SelectedResource.Id))
End Function

winforms-scheduler-optimize-performance-large-dataset/VB/FetchAppointmentExample/SchedulerHelper.vb#L54

vb
apt.LabelKey = rnd.Next(1, 12)
apt.ResourceId = rnd.Next(0, resources.Length)
Return apt

asp-net-web-forms-scheduler-copy-paste-appointment-context-menu-items/VB/WebApplication1/Default.aspx.vb#L106

vb
newAppointment.Location = sourceAppointment.Location
newAppointment.ResourceId = ASPxScheduler1.SelectedResource.Id
newAppointment.Subject = sourceAppointment.Subject

See Also

ResourceIds

Id

GetResourceById(Object)

Appointment Interface

Appointment Members

DevExpress.XtraScheduler Namespace