Skip to main content

SchedulerExtension.GetAppointmentsToUpdate<T>(String, FetchAppointmentsMethod, Object, MVCxAppointmentStorage, MVCxResourceStorage) Method

Obtains appointments whose data should be updated in the data source using the delegate method that enables you to dynamically limit the number of loaded appointments.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.2.dll

Declaration

public static T[] GetAppointmentsToUpdate<T>(
    string schedulerName,
    FetchAppointmentsMethod fetchAppointmentsMethod,
    object resourceDataObject,
    MVCxAppointmentStorage appointmentStorage,
    MVCxResourceStorage resourceStorage
)

Parameters

Name Type Description
schedulerName String

The name of a Scheduler as it is specified by the SettingsBase.Name property.

fetchAppointmentsMethod FetchAppointmentsMethod

A FetchAppointmentsMethod delegate that provides appointments to insert.

resourceDataObject Object

A collection of resources in the scheduler.

appointmentStorage MVCxAppointmentStorage

An MVCxAppointmentStorage object that implements the appointment storage functionality and contains mappings.

resourceStorage MVCxResourceStorage

An MVCxResourceStorage object that implements the resource storage functionality and contains mappings.

Type Parameters

Name
T

Returns

Type Description
T[]

A Model data class instance that is the entity contained in the appointment data source and mapped to an appointment.

Remarks

The GetAppointmentsToUpdate<T> method instantiates a Scheduler and applies the specified settings. Then, an appointment being inserted is retrieved from this Scheduler instance.

For an example of use refer to the following code snippet.

View Example: Scheduler - How to implement the FetchAppointment event functionality

@Html.DevExpress().Scheduler(SchedulerSettingsHelper.CommonSchedulerSettings).Bind(Model.FetchAppointments, Model.Resources).GetHtml()
static void UpdateAppointment() {

    DBAppointment[] insertedAppt = SchedulerExtension.GetAppointmentsToInsert<DBAppointment>(SchedulerSettingsHelper.CommonSchedulerSettings,
        SchedulerDataHelper.FetchAppointmentsHelperMethod,
        SchedulerDataHelper.GetResources());
    foreach (var appt in insertedAppt) {
        SchedulerDataHelper.InsertAppointment(appt);
    }

    DBAppointment[] updatedAppt = SchedulerExtension.GetAppointmentsToUpdate<DBAppointment>(SchedulerSettingsHelper.CommonSchedulerSettings,
        SchedulerDataHelper.FetchAppointmentsHelperMethod,
        SchedulerDataHelper.GetResources());

    foreach (var appt in updatedAppt) {
        SchedulerDataHelper.UpdateAppointment(appt);
    }

    DBAppointment[] removedAppt = SchedulerExtension.GetAppointmentsToRemove<DBAppointment>(SchedulerSettingsHelper.CommonSchedulerSettings,
        SchedulerDataHelper.FetchAppointmentsHelperMethod, 
        SchedulerDataHelper.GetResources());
    foreach (var appt in removedAppt) {
        SchedulerDataHelper.RemoveAppointment(appt);
    }

}
See Also