This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
/
SchedulerHelper.vb
79 lines (72 loc) · 3.55 KB
/
SchedulerHelper.vb
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
Imports Microsoft.VisualBasic
Imports System
Imports System.Web.Mvc
Imports System.Web.Mvc.Html
Imports DevExpress.Web.Mvc
Imports DevExpress.Web.Mvc.UI
Namespace SchdulerBestPracticesMvc.Code
Public Module SchedulerHelper
Private settings_Renamed As SchedulerSettings
Public ReadOnly Property Settings() As SchedulerSettings
Get
If settings_Renamed Is Nothing Then
settings_Renamed = CreateSchedulerSettings(Nothing)
End If
Return settings_Renamed
End Get
End Property
<System.Runtime.CompilerServices.Extension()> _
Public Function CreateSchedulerSettings(ByVal htmlHelper As HtmlHelper) As SchedulerSettings
Dim settings As New SchedulerSettings()
settings.Name = "scheduler"
settings.CallbackRouteValues = New With {Key .Controller = "Home", Key .Action = "SchedulerPartial"}
settings.EditAppointmentRouteValues = New With {Key .Controller = "Home", Key .Action = "EditAppointment"}
settings.Storage.Appointments.Assign(DefaultAppointmentStorage)
settings.Storage.Resources.Assign(DefaultResourceStorage)
settings.Storage.Appointments.ResourceSharing = True
settings.Start = New DateTime(2008, 7, 11)
Return settings
End Function
Private defaultAppointmentStorage_Renamed As MVCxAppointmentStorage
Public ReadOnly Property DefaultAppointmentStorage() As MVCxAppointmentStorage
Get
If defaultAppointmentStorage_Renamed Is Nothing Then
defaultAppointmentStorage_Renamed = CreateDefaultAppointmentStorage()
End If
Return defaultAppointmentStorage_Renamed
End Get
End Property
Private Function CreateDefaultAppointmentStorage() As MVCxAppointmentStorage
Dim appointmentStorage As New MVCxAppointmentStorage()
appointmentStorage.Mappings.AppointmentId = "ID"
appointmentStorage.Mappings.Start = "StartTime"
appointmentStorage.Mappings.End = "EndTime"
appointmentStorage.Mappings.Subject = "Subject"
appointmentStorage.Mappings.Description = "Description"
appointmentStorage.Mappings.Location = "Location"
appointmentStorage.Mappings.AllDay = "AllDay"
appointmentStorage.Mappings.Type = "EventType"
appointmentStorage.Mappings.RecurrenceInfo = "RecurrenceInfo"
appointmentStorage.Mappings.ReminderInfo = "ReminderInfo"
appointmentStorage.Mappings.Label = "Label"
appointmentStorage.Mappings.Status = "Status"
appointmentStorage.Mappings.ResourceId = "CarId"
Return appointmentStorage
End Function
Private defaultResourceStorage_Renamed As MVCxResourceStorage
Public ReadOnly Property DefaultResourceStorage() As MVCxResourceStorage
Get
If defaultResourceStorage_Renamed Is Nothing Then
defaultResourceStorage_Renamed = CreateDefaultResourceStorage()
End If
Return defaultResourceStorage_Renamed
End Get
End Property
Private Function CreateDefaultResourceStorage() As MVCxResourceStorage
Dim resourceStorage As New MVCxResourceStorage()
resourceStorage.Mappings.ResourceId = "ID"
resourceStorage.Mappings.Caption = "Model"
Return resourceStorage
End Function
End Module
End Namespace