Skip to main content

SchedulerExtension.GetAppointmentsToInsert<T>(SchedulerSettings, FetchAppointmentsMethod, Object) Method

Obtains appointments which should be inserted into 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[] GetAppointmentsToInsert<T>(
    SchedulerSettings settings,
    FetchAppointmentsMethod fetchAppointmentsMethod,
    object resourceDataObject
)

Parameters

Name Type Description
settings SchedulerSettings

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.

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

Utilizing the GetAppointmentsToInsert<T> method allows you to handle recurring appointments correctly. Now, when an end-user selects and moves multiple recurring appointments at the same time, the corresponding number of database records will be created. For example, if two recurring appointments are moved simultaneously, two records will appear in the database.

Note

Use the GetAppointmentsToInsert<T>(String, Object, MVCxAppointmentStorage, MVCxResourceStorage) overload method to get appointments if you do not need all scheduler settings.

Example

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);
    }

}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetAppointmentsToInsert<T>(SchedulerSettings, FetchAppointmentsMethod, 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.

See Also