Back to Devexpress

DxSchedulerDataStorage.GetAppointments(DxSchedulerDateTimeRange) Method

blazor-devexpress-dot-blazor-dot-dxschedulerdatastorage-dot-getappointments-x28-devexpress-dot-blazor-dot-dxschedulerdatetimerange-x29.md

latest4.1 KB
Original Source

DxSchedulerDataStorage.GetAppointments(DxSchedulerDateTimeRange) Method

Retrieves the collection of appointments that belong to the specified time interval.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public IEnumerable<DxSchedulerAppointmentItem> GetAppointments(
    DxSchedulerDateTimeRange interval
)

Parameters

NameTypeDescription
intervalDxSchedulerDateTimeRange

The time interval.

|

Returns

TypeDescription
IEnumerable<DxSchedulerAppointmentItem>

The appointment collection.

|

Remarks

The GetAppointments method returns standard and recurrent appointments that belong to the specified time interval. If an appointment’s time interval partially overlaps the specified interval, this appointment is also included in the resulting collection.

razor
<DxScheduler StartDate="@DateTime.Today" DataStorage="@DataStorage">
    <DxSchedulerWeekView ShowWorkTimeOnly="true"></DxSchedulerWeekView>
</DxScheduler>

@code {
    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentsSource = AppointmentCollection.GetAppointments(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Type = "AppointmentType",
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            AllDay = "AllDay",
            Location = "Location",
            Description = "Description",
            LabelId = "Label",
            StatusId = "Status",
            RecurrenceInfo = "Recurrence"
        }
    };

    // ...
    void GetMyAppointments() {
        DxSchedulerDateTimeRange range = new DxSchedulerDateTimeRange(DateTime.Today, 
          DateTime.Today.AddDays(7));
        var appointments = DataStorage.GetAppointments(range);
    }
}
csharp
public class Appointment {
    public Appointment() {}

    public int AppointmentType { get; set; }
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public string Caption { get; set; }
    public string Description { get; set; }
    public string Location { get; set; }
    public int Label { get; set; }
    public int Status { get; set; }
    public bool AllDay { get; set; }
    public string Recurrence { get; set; }
}
csharp
public static partial class AppointmentCollection {
    public static List<Appointment> GetAppointments() {
        DateTime date = DateTime.Today;
        var dataSource = new List<Appointment>() {
            new Appointment {
                Caption = "Install New Router in Dev Room",
                StartDate = date + (new TimeSpan(0, 10, 0, 0)),
                EndDate = date + (new TimeSpan(0, 12, 0, 0)),
                Label = 6, 
                Status = 1
            },
            new Appointment {
                Caption = "Upgrade Personal Computers",
                StartDate = date + (new TimeSpan(0, 13, 0, 0)),
                EndDate = date + (new TimeSpan(0, 14, 30, 0)),
                Label = 1, 
                Status = 1
            },
            new Appointment {
                Caption = "Website Redesign Plan",
                StartDate = date + (new TimeSpan(1, 9, 30, 0)),
                EndDate = date + (new TimeSpan(1, 11, 30, 0)),
                Label = 1, 
                Status = 1
            },
            // ...
        };
        return dataSource;
    }
}

See Also

DxSchedulerDataStorage Class

DxSchedulerDataStorage Members

DevExpress.Blazor Namespace