This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
/
Scheduling.vb
98 lines (93 loc) · 3.62 KB
/
Scheduling.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Imports Microsoft.VisualBasic
Imports System.Collections
Imports System.Linq
Imports DevExpressMvcApplication1
Imports DevExpress.Web.Mvc
Imports System.Collections.Generic
Public Class SchedulerDataObject
Private privateAppointments As IEnumerable
Public Property Appointments() As IEnumerable
Get
Return privateAppointments
End Get
Set(ByVal value As IEnumerable)
privateAppointments = value
End Set
End Property
Private privateResources As IEnumerable
Public Property Resources() As IEnumerable
Get
Return privateResources
End Get
Set(ByVal value As IEnumerable)
privateResources = value
End Set
End Property
End Class
Public Class SchedulerDataHelper
Public Shared Function GetResources() As IEnumerable
Dim db As New SchedulingDataClassesDataContext()
Return From res In db.DBResources _
Select res
End Function
Public Shared Function GetAppointments() As IEnumerable
Dim db As New SchedulingDataClassesDataContext()
Return From apt In db.DBAppointments _
Select apt
End Function
Public Shared Function GetAppointmentsFilteredByResources(ByVal resourceIds As List(Of Integer)) As IEnumerable
Dim db As New SchedulingDataClassesDataContext()
Return From apt In db.DBAppointments _
Where resourceIds.Contains(apt.ResourceID.Value) _
Select apt
End Function
Public Shared ReadOnly Property DataObject() As SchedulerDataObject
Get
Return New SchedulerDataObject() With {.Appointments = GetAppointments(), .Resources = GetResources()}
End Get
End Property
Public Shared Function GetDataObjectFilteredByResources(ByVal resourceIds As List(Of Integer)) As SchedulerDataObject
Return New SchedulerDataObject() With {.Appointments = GetAppointmentsFilteredByResources(resourceIds), .Resources = GetResources()}
End Function
Private Shared defaultAppointmentStorage_Renamed As MVCxAppointmentStorage
Public Shared 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 Shared Function CreateDefaultAppointmentStorage() As MVCxAppointmentStorage
Dim appointmentStorage As New MVCxAppointmentStorage()
appointmentStorage.Mappings.AppointmentId = "UniqueID"
appointmentStorage.Mappings.Start = "StartDate"
appointmentStorage.Mappings.End = "EndDate"
appointmentStorage.Mappings.Subject = "Subject"
appointmentStorage.Mappings.Description = "Description"
appointmentStorage.Mappings.Location = "Location"
appointmentStorage.Mappings.AllDay = "AllDay"
appointmentStorage.Mappings.Type = "Type"
appointmentStorage.Mappings.RecurrenceInfo = "RecurrenceInfo"
appointmentStorage.Mappings.ReminderInfo = "ReminderInfo"
appointmentStorage.Mappings.Label = "Label"
appointmentStorage.Mappings.Status = "Status"
appointmentStorage.Mappings.ResourceId = "ResourceID"
Return appointmentStorage
End Function
Private Shared defaultResourceStorage_Renamed As MVCxResourceStorage
Public Shared 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 Shared Function CreateDefaultResourceStorage() As MVCxResourceStorage
Dim resourceStorage As New MVCxResourceStorage()
resourceStorage.Mappings.ResourceId = "ResourceID"
resourceStorage.Mappings.Caption = "ResourceName"
Return resourceStorage
End Function
End Class