纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
4.1 KiB

3 years ago
  1. using NFine.Application;
  2. using NFine.Application.SystemManage;
  3. using NFine.Code;
  4. using NFine.Domain.Entity.SystemManage;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Web.Mvc;
  9. namespace NFine.Web.Areas.SystemManage.Controllers
  10. {
  11. public class UserController : ControllerBase
  12. {
  13. private UserApp userApp = new UserApp();
  14. private UserLogOnApp userLogOnApp = new UserLogOnApp();
  15. private UserWorkPointApp app = new UserWorkPointApp();
  16. [HttpGet]
  17. [HandlerAjaxOnly]
  18. public ActionResult GetGridJson(Pagination pagination, string keyword)
  19. {
  20. userApp.AgentUserAndVenCode();
  21. var data = new
  22. {
  23. rows = userApp.GetList(pagination, keyword),
  24. total = pagination.total,
  25. page = pagination.page,
  26. records = pagination.records
  27. };
  28. return Content(data.ToJson());
  29. }
  30. [HttpGet]
  31. [HandlerAjaxOnly]
  32. public ActionResult GetWorkPoint(string keyword)
  33. {
  34. DataTable ListData = app.GetWorkPoint(keyword);
  35. //var JsonData = new
  36. //{
  37. // rows = ListData,
  38. //};
  39. return Content(ListData.ToJson());
  40. }
  41. [HttpGet]
  42. [HandlerAjaxOnly]
  43. public ActionResult GetFormJson(string keyValue)
  44. {
  45. var data = userApp.GetForm(keyValue);
  46. return Content(data.ToJson());
  47. }
  48. [HttpGet]
  49. [HandlerAjaxOnly]
  50. public ActionResult GetCurrentRole(string keyValue)
  51. {
  52. string RoleFullName = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  53. var data = new
  54. {
  55. RoleName = RoleFullName
  56. };
  57. return Content(data.ToJson());
  58. }
  59. [HttpPost]
  60. [HandlerAjaxOnly]
  61. [ValidateAntiForgeryToken]
  62. public ActionResult SubmitForm(UserEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue)
  63. {
  64. userApp.SubmitForm(userEntity, userLogOnEntity, keyValue);
  65. return Success("操作成功。");
  66. }
  67. [HttpPost]
  68. [HandlerAuthorize]
  69. [HandlerAjaxOnly]
  70. [ValidateAntiForgeryToken]
  71. public ActionResult DeleteForm(string keyValue)
  72. {
  73. userApp.DeleteForm(keyValue);
  74. return Success("删除成功。");
  75. }
  76. [HttpGet]
  77. public ActionResult RevisePassword()
  78. {
  79. return View();
  80. }
  81. [HttpPost]
  82. [HandlerAjaxOnly]
  83. [HandlerAuthorize]
  84. [ValidateAntiForgeryToken]
  85. public ActionResult SubmitRevisePassword(string userPassword, string keyValue)
  86. {
  87. userLogOnApp.RevisePassword(userPassword, keyValue);
  88. return Success("重置密码成功。");
  89. }
  90. [HttpPost]
  91. [HandlerAjaxOnly]
  92. public ActionResult SubmitRevisePassword2(string userPassword, string keyValue)
  93. {
  94. userLogOnApp.RevisePassword(userPassword, keyValue);
  95. return Success("重置密码成功。");
  96. }
  97. [HttpPost]
  98. [HandlerAjaxOnly]
  99. [HandlerAuthorize]
  100. [ValidateAntiForgeryToken]
  101. public ActionResult DisabledAccount(string keyValue)
  102. {
  103. UserEntity userEntity = new UserEntity();
  104. userEntity.F_Id = keyValue;
  105. userEntity.F_EnabledMark = false;
  106. userApp.UpdateForm(userEntity);
  107. return Success("账户禁用成功。");
  108. }
  109. [HttpPost]
  110. [HandlerAjaxOnly]
  111. [HandlerAuthorize]
  112. [ValidateAntiForgeryToken]
  113. public ActionResult EnabledAccount(string keyValue)
  114. {
  115. UserEntity userEntity = new UserEntity();
  116. userEntity.F_Id = keyValue;
  117. userEntity.F_EnabledMark = true;
  118. userApp.UpdateForm(userEntity);
  119. return Success("账户启用成功。");
  120. }
  121. [HttpGet]
  122. public ActionResult Info()
  123. {
  124. return View();
  125. }
  126. }
  127. }