-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIndex.razor
More file actions
84 lines (80 loc) · 2.73 KB
/
Index.razor
File metadata and controls
84 lines (80 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@page "/"
@using T1019796.Data
@using T1019796.Utils
<span>Appointments count: @apptCount</span>
<DxScheduler StartDate="currentDate"
StartDateChanged="OnStartDateChanged"
ActiveViewType="activeType"
ActiveViewTypeChanged="OnActiveViewChanged"
DataStorage="@DataStorage"
CssClass="w-100">
<DxSchedulerDayView DayCount="1" ShowWorkTimeOnly="false"></DxSchedulerDayView>
<DxSchedulerWeekView></DxSchedulerWeekView>
<DxSchedulerMonthView CellMinWidth="120"></DxSchedulerMonthView>
<DxSchedulerTimelineView Duration="timeLineDuration"></DxSchedulerTimelineView>
</DxScheduler>
@code {
int apptCount = 0;
DateTime currentDate = DateTime.Today;
DateTime startDate = new DateTime();
DateTime endDate = new DateTime();
SchedulerViewType activeType = SchedulerViewType.Day;
TimeSpan timeLineDuration = TimeSpan.FromHours(72);
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage()
{
AppointmentMappings = new DxSchedulerAppointmentMappings()
{
Id = "AppointmentId",
Type = "AppointmentType",
Start = "StartDate",
End = "EndDate",
Subject = "Caption",
AllDay = "AllDay",
Location = "Location",
Description = "Description",
LabelId = "Label",
StatusId = "Status"
}
};
protected override void OnInitialized()
{
base.OnInitialized();
LoadAppointments();
}
void OnStartDateChanged(DateTime newStartDate)
{
currentDate = newStartDate;
LoadAppointments();
}
void OnActiveViewChanged(SchedulerViewType newView)
{
activeType = newView;
LoadAppointments();
}
void LoadAppointments()
{
switch (activeType)
{
case SchedulerViewType.Day:
startDate = currentDate;
endDate = currentDate.AddDays(1);
break;
case SchedulerViewType.Week:
startDate = currentDate.StartOfWeek(DayOfWeek.Sunday);
endDate = startDate.AddDays(7);
break;
case SchedulerViewType.Month:
startDate = currentDate.StartOfMonth();
endDate = currentDate.AddMonths(1);
break;
case SchedulerViewType.Timeline:
startDate = currentDate;
endDate = currentDate.Add(timeLineDuration);
break;
}
var newDataSource = AppointmentCollection.GetAppointments(startDate, endDate);
DataStorage.AppointmentsSource = newDataSource;
DataStorage.RefreshData();
apptCount = newDataSource.ToList().Count;
}
}