|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- <%
- '=======================================================================================================================
- ' 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
- %>
|