Repository navigation
Expand file tree
/
Copy pathclsTaskItem.cls
More file actions
143 lines (124 loc) · 4.66 KB
/
Copy pathclsTaskItem.cls
File metadata and controls
143 lines (124 loc) · 4.66 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
Attribute VB_Name = "clsTaskItem"
Attribute VB_Base = "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Option Compare Database
Option Explicit
' =============================================================================
' clsTaskItem
' Strongly-typed ORM entity in AccessSQLiteDemo implementing ISQLiteEntity
' from the referenced AccessSQLite library. Used by frmTaskDetail.
' =============================================================================
Implements AccessSQLite.ISQLiteEntity
Private m_TaskID As Long
Private m_TaskTitle As String
Private m_CategoryName As String
Private m_PriorityLevel As String
Private m_EstimateCost As Currency
Private m_DueDate As Variant
Private m_IsCompleted As Boolean
Private m_TaskNotes As String
Private m_CreatedAt As Variant
Private m_UpdatedAt As Variant
Private m_DeletedAt As Variant
Private Sub Class_Initialize()
m_CategoryName = "General"
m_PriorityLevel = "Medium"
m_EstimateCost = 0@
m_DueDate = Null
m_CreatedAt = Null
m_UpdatedAt = Null
m_DeletedAt = Null
End Sub
Public Property Get TaskID() As Long
TaskID = m_TaskID
End Property
Public Property Let TaskID(ByVal lngVal As Long)
m_TaskID = lngVal
End Property
Public Property Get TaskTitle() As String
TaskTitle = m_TaskTitle
End Property
Public Property Let TaskTitle(ByVal strVal As String)
m_TaskTitle = strVal
End Property
Public Property Get CategoryName() As String
CategoryName = m_CategoryName
End Property
Public Property Let CategoryName(ByVal strVal As String)
m_CategoryName = strVal
End Property
Public Property Get PriorityLevel() As String
PriorityLevel = m_PriorityLevel
End Property
Public Property Let PriorityLevel(ByVal strVal As String)
m_PriorityLevel = strVal
End Property
Public Property Get EstimateCost() As Currency
EstimateCost = m_EstimateCost
End Property
Public Property Let EstimateCost(ByVal curVal As Currency)
m_EstimateCost = curVal
End Property
Public Property Get DueDate() As Variant
DueDate = m_DueDate
End Property
Public Property Let DueDate(ByVal varVal As Variant)
m_DueDate = varVal
End Property
Public Property Get IsCompleted() As Boolean
IsCompleted = m_IsCompleted
End Property
Public Property Let IsCompleted(ByVal blnVal As Boolean)
m_IsCompleted = blnVal
End Property
Public Property Get TaskNotes() As String
TaskNotes = m_TaskNotes
End Property
Public Property Let TaskNotes(ByVal strVal As String)
m_TaskNotes = strVal
End Property
Public Property Get CreatedAt() As Variant
CreatedAt = m_CreatedAt
End Property
Public Property Get UpdatedAt() As Variant
UpdatedAt = m_UpdatedAt
End Property
Public Property Get DeletedAt() As Variant
DeletedAt = m_DeletedAt
End Property
Private Property Get ISQLiteEntity_EntityTableName() As String
ISQLiteEntity_EntityTableName = "Tasks"
End Property
Private Function ISQLiteEntity_CreateBlank() As AccessSQLite.ISQLiteEntity
Set ISQLiteEntity_CreateBlank = New clsTaskItem
End Function
Private Sub ISQLiteEntity_ReadFromRow(ByVal dictRow As Scripting.Dictionary)
If dictRow Is Nothing Then Exit Sub
If dictRow.Exists("TaskID") Then m_TaskID = CLng(Nz(dictRow("TaskID"), 0))
If dictRow.Exists("TaskTitle") Then m_TaskTitle = CStr(Nz(dictRow("TaskTitle"), vbNullString))
If dictRow.Exists("CategoryName") Then m_CategoryName = CStr(Nz(dictRow("CategoryName"), "General"))
If dictRow.Exists("PriorityLevel") Then m_PriorityLevel = CStr(Nz(dictRow("PriorityLevel"), "Medium"))
If dictRow.Exists("EstimateCost") Then m_EstimateCost = CCur(Nz(dictRow("EstimateCost"), 0@))
If dictRow.Exists("DueDate") Then m_DueDate = dictRow("DueDate")
If dictRow.Exists("IsCompleted") Then m_IsCompleted = CBool(Nz(dictRow("IsCompleted"), False))
If dictRow.Exists("TaskNotes") Then m_TaskNotes = CStr(Nz(dictRow("TaskNotes"), vbNullString))
If dictRow.Exists("CreatedAt") Then m_CreatedAt = dictRow("CreatedAt")
If dictRow.Exists("UpdatedAt") Then m_UpdatedAt = dictRow("UpdatedAt")
If dictRow.Exists("DeletedAt") Then m_DeletedAt = dictRow("DeletedAt")
End Sub
Private Sub ISQLiteEntity_WriteToRow(ByVal dictRow As Scripting.Dictionary)
If dictRow Is Nothing Then Exit Sub
dictRow("TaskID") = m_TaskID
dictRow("TaskTitle") = m_TaskTitle
dictRow("CategoryName") = m_CategoryName
dictRow("PriorityLevel") = m_PriorityLevel
dictRow("EstimateCost") = m_EstimateCost
dictRow("DueDate") = m_DueDate
dictRow("IsCompleted") = m_IsCompleted
dictRow("TaskNotes") = m_TaskNotes
End Sub