Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Expand]Appearance
    [Collapse]Data Binding
      How to: Create Appointments with Custom Fields
      How to: Prevent Appointments and Resources from Reloading
      How to: Use the FetchAppointments Event for Faster Appointment Loading
      How to: Filter Appointments
      How to: Filter Resources
      How to: Enable Multi-Resource Appointments
      How to: Bind the Scheduler with Multi-resource Appointments to XPO
    [Expand]Data Exchange
    [Expand]DateTime
    [Expand]DateNavigator
    [Expand]Forms
    [Expand]Gantt View
    [Expand]Initialization
    [Expand]Labels and Statuses
    [Expand]Layout
    [Expand]Menu
    [Expand]Printing and Reporting
    [Expand]Protection
    [Expand]Range Control
    [Expand]Recurrence
    [Expand]Reminders
    [Expand]Selection
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Use the FetchAppointments Event for Faster Appointment Loading

To speed up processing when there is a large amount of data in the Scheduler Storage, you can use the SchedulerStorageBase.FetchAppointments event. Handle this event to fetch data for the visible time interval only. Before looking at the example, it is recommended that you review the FetchAppointments Event - Handling Large Datasets article.

Create an example that demonstrates the use of the FetchAppointments event by following the steps below.

  1. Create a project with the Scheduler bound to SQL Server data as described in the Lesson 5 - Bind a Scheduler to MS SQL Database at Design Time article.
    Important

    Add a mapping for the Appointment.Id property value using the AppointmentMappingInfo.AppointmentId property. This is required for correct appointment resizing beyond the visible interval when handling the SchedulerStorageBase.FetchAppointments event.

  2. A new parameterized query is required for the FetchAppointment event handler. It will contain From and To parameters, which specify the time interval in which the data will be queried. Note that appointments of the AppointmentType.Pattern type should always be loaded, otherwise all recurring appointments for the series based on this pattern will be lost. To load changed and deleted occurrences, compare the dates contained in the fields mapped with AppointmentMappingInfo.OriginalOccurrenceStart and AppointmentMappingInfo.OriginalOccurrenceEnd mappings instead of Start and End. Enter the following query string in the FillBy Method of the AppointmentsTableAdapter.

    The underlying data source does not contain all appointments in a recurrence series. Only pattern, changed and deleted appointments are stored. When a pattern appointment is loaded into the SchedulerControl, it calculates all appointments in the series and displays them in the View. Thus, the loading of appointment patterns does not result in performance issues in the case of a large data source.

    Double-click the DataSet xsd file to open a data set designer. Right-click the AppointmentsTableAdapter and select Add Query... in the context menu.

    The TableAdapter Query Configuration Wizard is invoked. Enter the query text and click Finish.

  3. We need a way to modify this query at runtime to specify resources. To access the TableAdapter queries, add a new property as shown in the following code snippet:

  4. Add the FetchAppointments handler, as shown in the following code snippet.

    Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E2730.

    To pad the time interval used to query appointments, we use a range of seven days (PADDING_DAYS constant). You can specify another interval arbitrarily.

  5. Run the project. Navigate the schedule using the DateNavigator control, and observe the changes in the number of rows in the appointment data source.

Expanded See Also

How would you rate this topic?​​​​​​​