blazor-devexpress-dot-blazor-dot-dxschedulerdatastorage-dot-getappointments-x28-devexpress-dot-blazor-dot-dxschedulerdatetimerange-x29.md
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
public IEnumerable<DxSchedulerAppointmentItem> GetAppointments(
DxSchedulerDateTimeRange interval
)
| Name | Type | Description |
|---|---|---|
| interval | DxSchedulerDateTimeRange |
The time interval.
|
| Type | Description |
|---|---|
| IEnumerable<DxSchedulerAppointmentItem> |
The appointment collection.
|
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.
<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);
}
}
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; }
}
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