您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

130 行
5.0KB

  1. <% Option Explicit %>
  2. <!--#include file="../../include_all.asp"-->
  3. <!--#include file="../../ViewModels/CustomOfficeCopyJobViewModels.asp"-->
  4. <%
  5. Class CustomOfficeCopyJobController
  6. Public Model
  7. Public Sub Index
  8. dim page_size : page_size = 10
  9. dim page_num : page_num = Choice(Len(Request.Querystring("page_num")) > 0, Request.Querystring("page_num"), 1)
  10. dim page_count, record_count
  11. set Model = new PagedIndex_ViewModel_Class
  12. Model.Title = "CustomOfficeCopyJob"
  13. set Model.CustomOfficeCopyJob = CustomOfficeCopyJobRepository.FindPaged(empty, "ID", page_size, page_num, page_count, record_count)
  14. Model.CurrentPageNumber = page_num
  15. Model.PageSize = page_size
  16. Model.PageCount = page_count
  17. Model.RecordCount = record_count
  18. %> <!--#include file="../../Views/CustomOfficeCopyJob/Index.asp"--> <%
  19. End Sub
  20. Public Sub Search
  21. dim searchValue:searchValue = Choice(Request.Form.Count = 0,Request.QueryString("q"),Request.Form("q"))
  22. dim page_size : page_size = 10
  23. dim page_num : page_num = Choice(Len(Request.Querystring("page_num")) > 0, Request.Querystring("page_num"), 1)
  24. dim page_count, record_count
  25. set Model = new PagedIndex_ViewModel_Class
  26. Model.Title = "CustomOfficeCopyJob"
  27. set Model.CustomOfficeCopyJob = CustomOfficeCopyJobRepository.SearchTablePaged(Array("ID","%" & searchValue & "%","Jcode","%" & searchValue & "%","Precinct","%" & searchValue & "%","StartingBallotNumber","%" & searchValue & "%","Amount","%" & searchValue & "%","Status","%" & searchValue & "%","Donedate","%" & searchValue & "%"),"ID", page_size, page_num, page_count, record_count)
  28. Model.CurrentPageNumber = page_num
  29. Model.PageSize = page_size
  30. Model.PageCount = page_count
  31. Model.RecordCount = record_count
  32. %> <!--#include file="../../Views/CustomOfficeCopyJob/Index.asp"--> <%
  33. End Sub
  34. Public Sub Edit
  35. dim id : id = Request.QueryString("Id")
  36. set Model = new Edit_ViewModel_Class
  37. set Model.CustomOfficeCopyJob = CustomOfficeCopyJobRepository.FindByID(id)
  38. Model.Title = "Edit CustomOfficeCopyJob"
  39. HTMLSecurity.SetAntiCSRFToken "CustomOfficeCopyJobEditForm"
  40. %> <!--#include file="../../Views/CustomOfficeCopyJob/Edit.asp"--> <%
  41. Flash.Success = "CustomOfficeCopyJob Updated."
  42. End Sub
  43. Public Sub EditPost
  44. MVC.RequirePost
  45. HTMLSecurity.OnInvalidAntiCsrfTokenRedirectToActionExt "CustomOfficeCopyJobEditForm", Request.Form("nonce"), "Edit", Array("Id", Request.Form("Id"))
  46. dim ID : ID = Request.Form("Id")
  47. dim model : set model = CustomOfficeCopyJobRepository.FindByID(ID)
  48. set model = Automapper.AutoMap(Request.Form, model)
  49. 'model.Validate
  50. 'If model.Validator.HasErrors then
  51. FormCache.SerializeForm "EditCustomOfficeCopyJob", Request.Form
  52. ' Flash.Errors = model.Validator.Errors
  53. ' MVC.RedirectToActionExt "Edit", Array("Id",ID)
  54. 'Else
  55. CustomOfficeCopyJobRepository.Update model
  56. FormCache.ClearForm "EditCustomOfficeCopyJob"
  57. Flash.Success = "CustomOfficeCopyJob updated."
  58. MVC.RedirectToAction "Index"
  59. 'End If
  60. End Sub
  61. Public Sub Create
  62. dim form_params : set form_params = FormCache.DeserializeForm("NewCustomOfficeCopyJob")
  63. If Not form_params Is Nothing then
  64. set Model = Automapper.AutoMap(form_params, New Create_ViewModel_Class)
  65. Else
  66. set Model = new Create_ViewModel_Class
  67. End If
  68. HTMLSecurity.SetAntiCSRFToken "CustomOfficeCopyJobCreateForm"
  69. %> <!--#include file="../../Views/CustomOfficeCopyJob/Create.asp"--> <%
  70. End Sub
  71. Public Sub CreatePost
  72. MVC.RequirePost
  73. HtmlSecurity.OnInvalidAntiCSRFTokenRedirectToAction "CustomOfficeCopyJobCreateForm", Request.Form("nonce"), "Create"
  74. dim new_CustomOfficeCopyJob_model : set new_CustomOfficeCopyJob_model = Automapper.AutoMap(Request.Form, new CustomOfficeCopyJobModel_Class)
  75. 'new_CustomOfficeCopyJob_model.Validator.Validate
  76. 'If new_CustomOfficeCopyJob_model.Validator.HasErrors then
  77. ' FormCache.SerializeForm "NewCustomOfficeCopyJob", Request.Form
  78. ' Flash.Errors = new_CustomOfficeCopyJob_model.Validator.Errors
  79. ' MVC.RedirectToAction "Create"
  80. 'Else
  81. CustomOfficeCopyJobRepository.AddNew new_CustomOfficeCopyJob_model
  82. ' FormCache.ClearForm "NewCustomOfficeCopyJob"
  83. Flash.Success = "CustomOfficeCopyJob added."
  84. MVC.RedirectToAction "Index"
  85. 'End If
  86. End Sub
  87. Public Sub Delete
  88. dim id : id = Request.QueryString("Id")
  89. set Model = new Delete_ViewModel_Class
  90. set Model.CustomOfficeCopyJob = CustomOfficeCopyJobRepository.FindByID(id)
  91. Model.Title = "Delete CustomOfficeCopyJob"
  92. HTMLSecurity.SetAntiCSRFToken "CustomOfficeCopyJobDeleteForm"
  93. %> <!--#include file="../../Views/CustomOfficeCopyJob/Delete.asp"--> <%
  94. End Sub
  95. Public Sub DeletePost
  96. MVC.RequirePost
  97. HtmlSecurity.OnInvalidAntiCSRFTokenRedirectToAction "CustomOfficeCopyJobDeleteForm", Request.Form("nonce"), "Create"
  98. dim id : id = Request.Form("Id")
  99. CustomOfficeCopyJobRepository.Delete id
  100. Flash.Success = "CustomOfficeCopyJob deleted."
  101. MVC.RedirectToAction "Index"
  102. End Sub
  103. End Class
  104. MVC.Dispatch
  105. %>

Powered by TurnKey Linux.