SchedulerStorage.SetAppointmentId(Appointment, Object) Method
Sets the identifier of the specified appointment to a specified value.
public virtual void SetAppointmentId( Appointment apt, object id )
Public Overridable Sub SetAppointmentId( apt As Appointment, id As Object )
An Appointment object.
An object that is the appointment identifier to assign.
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.