Skip to main content

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

Obtains appointments which should be removed from the data source.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5

Declaration

public static T[] GetAppointmentsToRemove<T>(
    string schedulerName,
    object appointmentDataObject,
    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.

appointmentDataObject Object

A collection of appointments in the scheduler.

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 GetAppointmentsToRemove<T> method creates a fake Scheduler but does not apply all scheduler settings specified in the view, for better performance. Then, an appointment being inserted is retrieved from this Scheduler instance.

Example

View Example: Scheduler - Lesson 2 - Insert-Update-Delete appointment feature

@model MVCSchedulerEditable.Models.SchedulerDataObject

@Html.Partial("SchedulerPartial", Model)
@*#region #SchedulerPartial*@
@Html.DevExpress().Scheduler(
settings => {
    settings.Name = "scheduler";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "SchedulerPartial" };
    settings.EditAppointmentRouteValues = new { Controller = "Home", Action = "EditAppointment" };
    settings.Storage.Appointments.Assign(MVCSchedulerEditable.Models.SchedulerStorageProvider.DefaultAppointmentStorage);
    settings.Storage.Resources.Assign(MVCSchedulerEditable.Models.SchedulerStorageProvider.DefaultResourceStorage);

    settings.Storage.EnableReminders = true;

    settings.ActiveViewType = SchedulerViewType.FullWeek;
    settings.Views.FullWeekView.Styles.ScrollAreaHeight = 600;
    settings.Start = new DateTime(2015, 4, 18);

}).Bind(Model.Appointments, Model.Resources).GetHtml()
@*#endregion #SchedulerPartial*@
public ActionResult EditAppointment()
{
    UpdateAppointment();
    return PartialView("SchedulerPartial", SchedulerDataHelper.DataObject);
}

static void UpdateAppointment()
{
    DBAppointment[] insertedAppointments = SchedulerExtension.GetAppointmentsToInsert<DBAppointment>("scheduler", SchedulerDataHelper.GetAppointments(),
        SchedulerDataHelper.GetResources(), SchedulerStorageProvider.DefaultAppointmentStorage, SchedulerStorageProvider.DefaultResourceStorage);
    foreach (var appt in insertedAppointments)
    {
        AppointmentDataAccessor.InsertAppointment(appt);
    }

    DBAppointment[] updatedAppointments = SchedulerExtension.GetAppointmentsToUpdate<DBAppointment>("scheduler", SchedulerDataHelper.GetAppointments(),
        SchedulerDataHelper.GetResources(), SchedulerStorageProvider.DefaultAppointmentStorage, SchedulerStorageProvider.DefaultResourceStorage);
    foreach (var appt in updatedAppointments)
    {
        AppointmentDataAccessor.UpdateAppointment(appt);
    }

    DBAppointment[] removedAppointments = SchedulerExtension.GetAppointmentsToRemove<DBAppointment>("scheduler", SchedulerDataHelper.GetAppointments(),
        SchedulerDataHelper.GetResources(), SchedulerStorageProvider.DefaultAppointmentStorage, SchedulerStorageProvider.DefaultResourceStorage);
    foreach (var appt in removedAppointments)
    {
        AppointmentDataAccessor.RemoveAppointment(appt);
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetAppointmentsToRemove<T>(String, Object, Object, MVCxAppointmentStorage, MVCxResourceStorage) 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