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.

173 lines
5.0 KiB

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