SchedulerDataStorage.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
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 SchedulerDataStorage.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 snippets (auto-collected from DevExpress Examples) contain references 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.