SchedulerStorage.SetAppointmentId(Appointment, Object) Method
Sets the identifier of the specified appointment to a specified value.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
apt | Appointment | An Appointment object. |
id | Object | An object that is the appointment identifier to assign. |
Remarks
Important
This API is intended to be used with the legacy SchedulerStorage only. Starting with version 18.1, SchedulerStorage and all of its satellite storages are replaced with their updated versions.
- SchedulerDataStorage replaces SchedulerStorage
- AppointmentDataStorage replaces AppointmentStorage
- ResourceDataStorage replaces ResourceStorage
- AppointmentDependencyDataStorage replaces AppointmentDependencyStorage
Use the SetAppointmentId method to assign an arbitrary identifier to an appointment. The method sets the Appointment.Id value.
There are two common situations for using the SetAppointmentId method.
Application Sets the ID
If the scheduler is bound to a data source, and you initialize the appointment Ids manually by using the SetAppointmentId method, it is necessary to enable the AppointmentStorage.CommitIdToDataSource option to post the Appointment.Id property value to the data storage.
Database Sets the ID
The SetAppointmentId method can also be utilized to assign the appointment identifier after the newly created appointment is committed to the data source with an auto incremented Id field, as described below.
After a new record in the data source is created, use a SELECT @@IDENTITY statement or an OUT parameter of a corresponding stored procedure to get the identifier assigned to a new appointment in the database. The obtained value is used to fill the ID column in the current data row of the appointment data source (handle the RowUpdated event of the data adapter). Then, handle the SchedulerStorageBase.AppointmentsInserted event to set the PersistentObject.Id property of the currently inserted appointment. Now, the appointment in the Scheduler has the same Id as the specified corresponding database record.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SetAppointmentId(Appointment, Object) method.
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.