|
- <%
- '=======================================================================================================================
- ' InkjetRecords Model
- '=======================================================================================================================
-
- Class InkjetRecordsModel_Class
- Public Validator
- Public Class_Get_Properties
-
- Public ID '90
- Public KitID '122
- Public VOTERID '106
- Public LASTNAME '106
- Public FIRSTNAME '106
- Public MIDDLENAME '106
- Public SUFFIX '106
- Public PRECINCT '106
- Public ADDRESS1 '106
- Public ADDRESS2 '106
- Public ADDRESS3 '106
- Public ADDRESS4 '106
- Public ADDRESS5 '106
- Public APPSENT '106
- Public APPRETURNED '106
- Public BALSENT '106
- Public BALRETURNED '106
- Public CountingBoard '106
- Public UOCAVASTATUS '106
- Public EMAILADDRESS '106
- Public PHONENUMBER '106
- Public BALLOT_NUMBER '106
- Public CassADDRESS1 '106
- Public CassADDRESS2 '106
- Public CassADDRESS3 '106
- Public CassADDRESS4 '106
- Public CassADDRESS5 '106
- Public KitLabelID
- Private Sub Class_Initialize
- 'ValidateExitsts Me, "",""
- Class_Get_Properties = Array("ID, KitID, VOTERID, LASTNAME, FIRSTNAME, MIDDLENAME, SUFFIX, PRECINCT, ADDRESS1, ADDRESS2, ADDRESS3, ADDRESS4, ADDRESS5, APPSENT, APPRETURNED, BALSENT, BALRETURNED, CountingBoard, UOCAVASTATUS, EMAILADDRESS, PHONENUMBER, BALLOT_NUMBER, CassADDRESS1, CassADDRESS2, CassADDRESS3, CassADDRESS4, CassADDRESS5,KitLabelID")
- End Sub
-
- End CLass
-
- '=======================================================================================================================
- ' InkjetRecords Repository
- '=======================================================================================================================
-
- Class InkjetRecordsRepository_Class
-
- Public Function FindByID(ID)
- dim sql : sql = "Select [ID], [KitID], [VOTERID], [LASTNAME], [FIRSTNAME], [MIDDLENAME], [SUFFIX], [PRECINCT], [ADDRESS1], [ADDRESS2], [ADDRESS3], [ADDRESS4], [ADDRESS5], [APPSENT], [APPRETURNED], [BALSENT], [BALRETURNED], [CountingBoard], [UOCAVASTATUS], [EMAILADDRESS], [PHONENUMBER], [BALLOT_NUMBER], [CassADDRESS1], [CassADDRESS2], [CassADDRESS3], [CassADDRESS4], [CassADDRESS5], [KitLabelID] FROM [InkjetRecords] WHERE ID = ?"
- dim rs : set rs = DAL.Query(sql,ID)
- If rs.EOF then
- Err.Raise 1, "InkjetRecordsRepository_Class", InkjetRecordsNotFoundException("ID", ID)
- Else
- set FindByID = Automapper.AutoMap(rs,"InkjetRecordsModel_Class")
- End If
- End Function
-
- Public Function GetAll(orderBy)
- set GetAll = Find(empty,orderBy)
- End Function
-
- Public Function Find(where_kvarray, order_string_or_array)
- dim sql : sql = "Select [ID], [KitID], [VOTERID], [LASTNAME], [FIRSTNAME], [MIDDLENAME], [SUFFIX], [PRECINCT], [ADDRESS1], [ADDRESS2], [ADDRESS3], [ADDRESS4], [ADDRESS5], [APPSENT], [APPRETURNED], [BALSENT], [BALRETURNED], [CountingBoard], [UOCAVASTATUS], [EMAILADDRESS], [PHONENUMBER], [BALLOT_NUMBER], [CassADDRESS1], [CassADDRESS2], [CassADDRESS3], [CassADDRESS4], [CassADDRESS5], [KitLabelID] FROM [InkjetRecords]"
-
- If Not IsEmpty(where_kvarray) then
- sql = sql & " WHERE "
- dim where_keys, where_values
- KVUnzip where_kvarray, where_keys, where_values
-
- dim i
- For i = 0 to UBound(where_keys)
- If i > 0 then sql = sql & " AND "
- sql = sql & " " & where_keys(i) & " "
- Next
- End If
-
- If Not IsEmpty(order_string_or_array) then
- sql = sql & "ORDER BY "
- If IsArray(order_string_or_array) then
- dim order_array : order_array = order_string_or_array
- For i = 0 to UBound(order_array)
- If i > 0 then sql = sql & ", "
- sql = sql & " " & order_array(i)
- Next
- Else
- sql = sql & order_string_or_array & " "
- End If
- End If
-
- dim rs : set rs = DAL.Query(sql, where_values)
- set Find = InkjetRecordsList(rs)
- Destroy rs
- End Function
-
- Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count)
- dim sql : sql = "Select [ID], [KitID], [VOTERID], [LASTNAME], [FIRSTNAME], [MIDDLENAME], [SUFFIX], [PRECINCT], [ADDRESS1], [ADDRESS2], [ADDRESS3], [ADDRESS4], [ADDRESS5], [APPSENT], [APPRETURNED], [BALSENT], [BALRETURNED], [CountingBoard], [UOCAVASTATUS], [EMAILADDRESS], [PHONENUMBER], [BALLOT_NUMBER], [CassADDRESS1], [CassADDRESS2], [CassADDRESS3], [CassADDRESS4], [CassADDRESS5],[KitLabelID] FROM [InkjetRecords]"
-
- If Not IsEmpty(where_kvarray) then
- sql = sql & " WHERE "
- dim where_keys, where_values
- KVUnzip where_kvarray, where_keys, where_values
-
- dim i
- For i = 0 to UBound(where_keys)
- If i > 0 then sql = sql & " AND "
- sql = sql & " " & where_keys(i) & " "
- Next
- End If
-
- If Not IsEmpty(order_string_or_array) then
- sql = sql & "ORDER BY "
- If IsArray(order_string_or_array) then
- dim order_array : order_array = order_string_or_array
- For i = 0 to UBound(order_array)
- If i > 0 then sql = sql & ", "
- sql = sql & " " & order_array(i)
- Next
- Else
- sql = sql & order_string_or_array & " "
- End If
- End If
-
- dim list : set list = new LinkedList_Class
- dim rs : set rs = DAL.PagedQuery(sql, where_values, per_page, page_num)
-
- If Not rs.EOF and Not (IsEmpty(per_page) and IsEmpty(page_num) and IsEmpty(page_count) and IsEmpty(record_count)) then
- rs.PageSize = per_page
- rs.AbsolutePage = page_num
- page_count = rs.PageCount
- record_count = rs.RecordCount
- End If
-
- set FindPaged = PagedInkjetRecordsList(rs, per_page)
- Destroy rs
- End Function
-
- Public Function SearchTablePaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count)
- dim sql : sql = "Select [ID], [KitID], [VOTERID], [LASTNAME], [FIRSTNAME], [MIDDLENAME], [SUFFIX], [PRECINCT], [ADDRESS1], [ADDRESS2], [ADDRESS3], [ADDRESS4], [ADDRESS5], [APPSENT], [APPRETURNED], [BALSENT], [BALRETURNED], [CountingBoard], [UOCAVASTATUS], [EMAILADDRESS], [PHONENUMBER], [BALLOT_NUMBER], [CassADDRESS1], [CassADDRESS2], [CassADDRESS3], [CassADDRESS4], [CassADDRESS5], [KitLabelID] FROM [InkjetRecords]"
-
- If Not IsEmpty(where_kvarray) then
- sql = sql & " WHERE "
- dim where_keys, where_values
- KVUnzip where_kvarray, where_keys, where_values
-
- dim i
- For i = 0 to UBound(where_keys)
- If i > 0 then sql = sql & " OR"
- sql = sql & " " & where_keys(i) & " LIKE ?"
- Next
- End If
-
- If Not IsEmpty(order_string_or_array) then
- sql = sql & " ORDER BY "
- If IsArray(order_string_or_array) then
- dim order_array : order_array = order_string_or_array
- For i = 0 to UBound(order_array)
- If i > 0 then sql = sql & ", "
- sql = sql & " " & order_array(i)
- Next
- Else
- sql = sql & order_string_or_array & " "
- End If
- End If
-
- dim list : set list = new LinkedList_Class
- dim rs : set rs = DAL.PagedQuery(sql, where_values, per_page, page_num)
-
- If Not rs.EOF and Not (IsEmpty(per_page) and IsEmpty(page_num) and IsEmpty(page_count) and IsEmpty(record_count)) then
- rs.PageSize = per_page
- rs.AbsolutePage = page_num
- page_count = rs.PageCount
- record_count = rs.RecordCount
- End If
-
- set SearchTablePaged = PagedInkjetRecordsList(rs, per_page)
- Destroy rs
- End Function
-
- Private Function PagedInkjetRecordsList(rs, per_page)
- dim list : set list = new LinkedList_Class
-
- dim x : x =0
- Do While x < per_page and Not rs.EOF
- list.Push Automapper.AutoMap(rs, new InkjetRecordsModel_Class)
- x = x +1
- rs.MoveNext
- Loop
- set PagedInkjetRecordsList = list
- End Function
-
- Private Function InkjetRecordsNotFoundException(ByVal field_name, ByVal field_val)
- InkjetRecordsNotFoundException = "InkjetRecords was not found with " & field_name & " of '" & field_val & "'."
- End Function
-
- Private Function InkjetRecordsList(rs)
- dim list : set list = new LinkedList_Class
- dim model
-
- Do until rs.EOF
- set model = new InkjetRecordsModel_Class
- list.Push Automapper.AutoMap(rs, model)
- rs.MoveNext
- Loop
- set InkjetRecordsList = list
- End Function
-
- Public Sub AddNew(ByRef model)
- dim sql : sql = "INSERT INTO [InkjetRecords] (" &_
- "[KitID]," &_
- "[VOTERID]," &_
- "[LASTNAME]," &_
- "[FIRSTNAME]," &_
- "[MIDDLENAME]," &_
- "[SUFFIX]," &_
- "[PRECINCT]," &_
- "[ADDRESS1]," &_
- "[ADDRESS2]," &_
- "[ADDRESS3]," &_
- "[ADDRESS4]," &_
- "[ADDRESS5]," &_
- "[APPSENT]," &_
- "[APPRETURNED]," &_
- "[BALSENT]," &_
- "[BALRETURNED]," &_
- "[CountingBoard]," &_
- "[UOCAVASTATUS]," &_
- "[EMAILADDRESS]," &_
- "[PHONENUMBER]," &_
- "[BALLOT_NUMBER]," &_
- "[CassADDRESS1]," &_
- "[CassADDRESS2]," &_
- "[CassADDRESS3]," &_
- "[CassADDRESS4]," &_
- "[CassADDRESS5])" &_
- "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
- DAL.Execute sql, Array(model.KitID, _
- model.VOTERID, _
- model.LASTNAME, _
- model.FIRSTNAME, _
- model.MIDDLENAME, _
- model.SUFFIX, _
- model.PRECINCT, _
- model.ADDRESS1, _
- model.ADDRESS2, _
- model.ADDRESS3, _
- model.ADDRESS4, _
- model.ADDRESS5, _
- model.APPSENT, _
- model.APPRETURNED, _
- model.BALSENT, _
- model.BALRETURNED, _
- model.CountingBoard, _
- model.UOCAVASTATUS, _
- model.EMAILADDRESS, _
- model.PHONENUMBER, _
- model.BALLOT_NUMBER, _
- model.CassADDRESS1, _
- model.CassADDRESS2, _
- model.CassADDRESS3, _
- model.CassADDRESS4, _
- model.CassADDRESS5)
- sql = "SELECT TOP 1 ID FROM [InkjetRecords] ORDER BY ID DESC"
- dim rs : set rs = DAL.Query(sql, empty)
- model.ID = rs("ID")
- Destroy rs
- End Sub
-
- Public Sub Update(model)
- dim sql : sql = "UPDATE [InkjetRecords] SET [KitID] = ?," &_
- "[VOTERID] = ?," &_
- "[LASTNAME] = ?," &_
- "[FIRSTNAME] = ?," &_
- "[MIDDLENAME] = ?," &_
- "[SUFFIX] = ?," &_
- "[PRECINCT] = ?," &_
- "[ADDRESS1] = ?," &_
- "[ADDRESS2] = ?," &_
- "[ADDRESS3] = ?," &_
- "[ADDRESS4] = ?," &_
- "[ADDRESS5] = ?," &_
- "[APPSENT] = ?," &_
- "[APPRETURNED] = ?," &_
- "[BALSENT] = ?," &_
- "[BALRETURNED] = ?," &_
- "[CountingBoard] = ?," &_
- "[UOCAVASTATUS] = ?," &_
- "[EMAILADDRESS] = ?," &_
- "[PHONENUMBER] = ?," &_
- "[BALLOT_NUMBER] = ?," &_
- "[CassADDRESS1] = ?," &_
- "[CassADDRESS2] = ?," &_
- "[CassADDRESS3] = ?," &_
- "[CassADDRESS4] = ?," &_
- "[CassADDRESS5] = ?" &_
- " WHERE [ID] = ?"
-
- DAL.Execute sql, Array(model.KitID, _
- model.VOTERID, _
- model.LASTNAME, _
- model.FIRSTNAME, _
- model.MIDDLENAME, _
- model.SUFFIX, _
- model.PRECINCT, _
- model.ADDRESS1, _
- model.ADDRESS2, _
- model.ADDRESS3, _
- model.ADDRESS4, _
- model.ADDRESS5, _
- model.APPSENT, _
- model.APPRETURNED, _
- model.BALSENT, _
- model.BALRETURNED, _
- model.CountingBoard, _
- model.UOCAVASTATUS, _
- model.EMAILADDRESS, _
- model.PHONENUMBER, _
- model.BALLOT_NUMBER, _
- model.CassADDRESS1, _
- model.CassADDRESS2, _
- model.CassADDRESS3, _
- model.CassADDRESS4, _
- model.CassADDRESS5, _
- model.ID)
- End Sub
-
- Public Sub Delete(id)
- dim sql : sql = "DELETE FROM [InkjetRecords] WHERE [ID] = ?"
- DAL.Execute sql, id
- End Sub
- End Class
-
- dim InkjetRecordsRepository__Singleton
- Function InkjetRecordsRepository()
- If IsEmpty(InkjetRecordsRepository__Singleton) then
- set InkjetRecordsRepository__Singleton = new InkjetRecordsRepository_Class
- End If
- set InkjetRecordsRepository = InkjetRecordsRepository__Singleton
- End Function
- %>
|