No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

CustomOfficeCopyJobRepository.asp 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <%
  2. '=======================================================================================================================
  3. ' CustomOfficeCopyJob Model
  4. '=======================================================================================================================
  5. Class CustomOfficeCopyJobModel_Class
  6. Public Validator
  7. Public Class_Get_Properties
  8. Public ID '90
  9. Public Jcode '106
  10. Public Precinct '106
  11. Public StartingBallotNumber '122
  12. Public Amount '122
  13. Public Status '106
  14. Public Donedate '122
  15. Private Sub Class_Initialize
  16. 'ValidateExitsts Me, "",""
  17. Class_Get_Properties = Array("ID, Jcode, Precinct, StartingBallotNumber, Amount, Status, Donedate")
  18. End Sub
  19. End CLass
  20. '=======================================================================================================================
  21. ' CustomOfficeCopyJob Repository
  22. '=======================================================================================================================
  23. Class CustomOfficeCopyJobRepository_Class
  24. Public Function FindByID(ID)
  25. dim sql : sql = "Select [ID], [Jcode], [Precinct], [StartingBallotNumber], [Amount], [Status], [Donedate] FROM [CustomOfficeCopyJob] WHERE ID = ?"
  26. dim rs : set rs = DAL.Query(sql,ID)
  27. If rs.EOF then
  28. Err.Raise 1, "CustomOfficeCopyJobRepository_Class", CustomOfficeCopyJobNotFoundException("ID", ID)
  29. Else
  30. set FindByID = Automapper.AutoMap(rs,"CustomOfficeCopyJobModel_Class")
  31. End If
  32. End Function
  33. Public Function GetAll(orderBy)
  34. set GetAll = Find(empty,orderBy)
  35. End Function
  36. Public Function Find(where_kvarray, order_string_or_array)
  37. dim sql : sql = "Select [ID], [Jcode], [Precinct], [StartingBallotNumber], [Amount], [Status], [Donedate] FROM [CustomOfficeCopyJob]"
  38. If Not IsEmpty(where_kvarray) then
  39. sql = sql & " WHERE "
  40. dim where_keys, where_values
  41. KVUnzip where_kvarray, where_keys, where_values
  42. dim i
  43. For i = 0 to UBound(where_keys)
  44. If i > 0 then sql = sql & " AND "
  45. sql = sql & " " & where_keys(i) & " "
  46. Next
  47. End If
  48. If Not IsEmpty(order_string_or_array) then
  49. sql = sql & "ORDER BY "
  50. If IsArray(order_string_or_array) then
  51. dim order_array : order_array = order_string_or_array
  52. For i = 0 to UBound(order_array)
  53. If i > 0 then sql = sql & ", "
  54. sql = sql & " " & order_array(i)
  55. Next
  56. Else
  57. sql = sql & order_string_or_array & " "
  58. End If
  59. End If
  60. dim rs : set rs = DAL.Query(sql, where_values)
  61. set Find = CustomOfficeCopyJobList(rs)
  62. Destroy rs
  63. End Function
  64. Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count)
  65. dim sql : sql = "Select [ID], [Jcode], [Precinct], [StartingBallotNumber], [Amount], [Status], [Donedate] FROM [CustomOfficeCopyJob]"
  66. If Not IsEmpty(where_kvarray) then
  67. sql = sql & " WHERE "
  68. dim where_keys, where_values
  69. KVUnzip where_kvarray, where_keys, where_values
  70. dim i
  71. For i = 0 to UBound(where_keys)
  72. If i > 0 then sql = sql & " AND "
  73. sql = sql & " " & where_keys(i) & " "
  74. Next
  75. End If
  76. If Not IsEmpty(order_string_or_array) then
  77. sql = sql & "ORDER BY "
  78. If IsArray(order_string_or_array) then
  79. dim order_array : order_array = order_string_or_array
  80. For i = 0 to UBound(order_array)
  81. If i > 0 then sql = sql & ", "
  82. sql = sql & " " & order_array(i)
  83. Next
  84. Else
  85. sql = sql & order_string_or_array & " "
  86. End If
  87. End If
  88. dim list : set list = new LinkedList_Class
  89. dim rs : set rs = DAL.PagedQuery(sql, where_values, per_page, page_num)
  90. If Not rs.EOF and Not (IsEmpty(per_page) and IsEmpty(page_num) and IsEmpty(page_count) and IsEmpty(record_count)) then
  91. rs.PageSize = per_page
  92. rs.AbsolutePage = page_num
  93. page_count = rs.PageCount
  94. record_count = rs.RecordCount
  95. End If
  96. set FindPaged = PagedCustomOfficeCopyJobList(rs, per_page)
  97. Destroy rs
  98. End Function
  99. Public Function SearchTablePaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count)
  100. dim sql : sql = "Select [ID], [Jcode], [Precinct], [StartingBallotNumber], [Amount], [Status], [Donedate] FROM [CustomOfficeCopyJob]"
  101. If Not IsEmpty(where_kvarray) then
  102. sql = sql & " WHERE "
  103. dim where_keys, where_values
  104. KVUnzip where_kvarray, where_keys, where_values
  105. dim i
  106. For i = 0 to UBound(where_keys)
  107. If i > 0 then sql = sql & " OR"
  108. sql = sql & " " & where_keys(i) & " LIKE ?"
  109. Next
  110. End If
  111. If Not IsEmpty(order_string_or_array) then
  112. sql = sql & " ORDER BY "
  113. If IsArray(order_string_or_array) then
  114. dim order_array : order_array = order_string_or_array
  115. For i = 0 to UBound(order_array)
  116. If i > 0 then sql = sql & ", "
  117. sql = sql & " " & order_array(i)
  118. Next
  119. Else
  120. sql = sql & order_string_or_array & " "
  121. End If
  122. End If
  123. dim list : set list = new LinkedList_Class
  124. dim rs : set rs = DAL.PagedQuery(sql, where_values, per_page, page_num)
  125. If Not rs.EOF and Not (IsEmpty(per_page) and IsEmpty(page_num) and IsEmpty(page_count) and IsEmpty(record_count)) then
  126. rs.PageSize = per_page
  127. rs.AbsolutePage = page_num
  128. page_count = rs.PageCount
  129. record_count = rs.RecordCount
  130. End If
  131. set SearchTablePaged = PagedCustomOfficeCopyJobList(rs, per_page)
  132. Destroy rs
  133. End Function
  134. Private Function PagedCustomOfficeCopyJobList(rs, per_page)
  135. dim list : set list = new LinkedList_Class
  136. dim x : x =0
  137. Do While x < per_page and Not rs.EOF
  138. list.Push Automapper.AutoMap(rs, new CustomOfficeCopyJobModel_Class)
  139. x = x +1
  140. rs.MoveNext
  141. Loop
  142. set PagedCustomOfficeCopyJobList = list
  143. End Function
  144. Private Function CustomOfficeCopyJobNotFoundException(ByVal field_name, ByVal field_val)
  145. CustomOfficeCopyJobNotFoundException = "CustomOfficeCopyJob was not found with " & field_name & " of '" & field_val & "'."
  146. End Function
  147. Private Function CustomOfficeCopyJobList(rs)
  148. dim list : set list = new LinkedList_Class
  149. dim model
  150. Do until rs.EOF
  151. set model = new CustomOfficeCopyJobModel_Class
  152. list.Push Automapper.AutoMap(rs, model)
  153. rs.MoveNext
  154. Loop
  155. set CustomOfficeCopyJobList = list
  156. End Function
  157. Public Sub AddNew(ByRef model)
  158. dim sql : sql = "INSERT INTO [CustomOfficeCopyJob] (" &_
  159. "[Jcode]," &_
  160. "[Precinct]," &_
  161. "[StartingBallotNumber]," &_
  162. "[Amount]," &_
  163. "[Status])" &_
  164. "VALUES (?,?,?,?,?)"
  165. DAL.Execute sql, Array(model.Jcode, _
  166. model.Precinct, _
  167. model.StartingBallotNumber, _
  168. model.Amount, _
  169. "Ready")
  170. sql = "SELECT TOP 1 ID FROM [CustomOfficeCopyJob] ORDER BY ID DESC"
  171. dim rs : set rs = DAL.Query(sql, empty)
  172. model.ID = rs("ID")
  173. Destroy rs
  174. End Sub
  175. Public Sub Update(model)
  176. dim sql : sql = "UPDATE [CustomOfficeCopyJob] SET [Jcode] = ?," &_
  177. "[Precinct] = ?," &_
  178. "[StartingBallotNumber] = ?," &_
  179. "[Amount] = ?," &_
  180. "[Status] = ?," &_
  181. "[Donedate] = ?" &_
  182. " WHERE [ID] = ?"
  183. DAL.Execute sql, Array(model.Jcode, _
  184. model.Precinct, _
  185. model.StartingBallotNumber, _
  186. model.Amount, _
  187. model.Status, _
  188. model.Donedate, _
  189. model.ID)
  190. End Sub
  191. Public Sub Delete(id)
  192. dim sql : sql = "DELETE FROM [CustomOfficeCopyJob] WHERE [ID] = ?"
  193. DAL.Execute sql, id
  194. End Sub
  195. End Class
  196. dim CustomOfficeCopyJobRepository__Singleton
  197. Function CustomOfficeCopyJobRepository()
  198. If IsEmpty(CustomOfficeCopyJobRepository__Singleton) then
  199. set CustomOfficeCopyJobRepository__Singleton = new CustomOfficeCopyJobRepository_Class
  200. End If
  201. set CustomOfficeCopyJobRepository = CustomOfficeCopyJobRepository__Singleton
  202. End Function
  203. %>

Powered by TurnKey Linux.