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.

201 lines
5.6 KiB

3 weeks 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. [HandlerAjaxOnly]
  71. [ValidateAntiForgeryToken]
  72. public ActionResult SubmitForm(UserEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue)
  73. {
  74. try
  75. {
  76. userApp.SubmitForm(userEntity, userLogOnEntity, keyValue);
  77. return Success("操作成功。");
  78. //SqlHelper.UserPwdValid("", userLogOnEntity.F_UserPassword);
  79. }
  80. catch (Exception ex)
  81. {
  82. return Content(new AjaxResult { state = ResultType.error.ToString(), message = ex.Message }.ToJson());
  83. }
  84. }
  85. [HttpPost]
  86. [HandlerAuthorize]
  87. [HandlerAjaxOnly]
  88. [ValidateAntiForgeryToken]
  89. public ActionResult DeleteForm(string keyValue)
  90. {
  91. userApp.DeleteForm(keyValue);
  92. return Success("删除成功。");
  93. }
  94. public ActionResult IsF_RoleID(string keyValue)
  95. {
  96. var data = app.IsF_RoleID(keyValue);
  97. return Content(data.ToJson());
  98. }
  99. [HttpGet]
  100. public ActionResult RevisePassword()
  101. {
  102. return View();
  103. }
  104. [HttpPost]
  105. [HandlerAjaxOnly]
  106. [HandlerAuthorize]
  107. [ValidateAntiForgeryToken]
  108. public ActionResult SubmitRevisePassword(string userPassword, string keyValue)
  109. {
  110. userLogOnApp.RevisePassword(userPassword, keyValue);
  111. return Success("重置密码成功。");
  112. }
  113. [HttpPost]
  114. [HandlerAjaxOnly]
  115. public ActionResult SubmitRevisePassword2(string userPassword, string keyValue)
  116. {
  117. userLogOnApp.RevisePassword(userPassword, keyValue);
  118. return Success("重置密码成功。");
  119. }
  120. [HttpPost]
  121. [HandlerAjaxOnly]
  122. [HandlerAuthorize]
  123. [ValidateAntiForgeryToken]
  124. public ActionResult DisabledAccount(string keyValue)
  125. {
  126. UserEntity userEntity = new UserEntity();
  127. userEntity.F_Id = keyValue;
  128. userEntity.F_EnabledMark = false;
  129. userApp.UpdateForm(userEntity);
  130. return Success("账户禁用成功。");
  131. }
  132. [HttpPost]
  133. [HandlerAjaxOnly]
  134. [HandlerAuthorize]
  135. [ValidateAntiForgeryToken]
  136. public ActionResult EnabledAccount(string keyValue)
  137. {
  138. UserEntity userEntity = new UserEntity();
  139. userEntity.F_Id = keyValue;
  140. userEntity.F_EnabledMark = true;
  141. userApp.UpdateForm(userEntity);
  142. return Success("账户启用成功。");
  143. }
  144. [HttpGet]
  145. public ActionResult Info()
  146. {
  147. return View();
  148. }
  149. public ActionResult RevisePasswordNew()
  150. {
  151. return View();
  152. }
  153. [HttpPost]
  154. [HandlerAjaxOnly]
  155. public ActionResult SubmitRevisePassword3(string userPassword, string keyValue)
  156. {
  157. try
  158. {
  159. //Modify Lacy.xu by 2022-11-17
  160. SqlHelper.UserPwdValid("", userPassword);
  161. userLogOnApp.RevisePassword3(userPassword, keyValue);
  162. return Success("重置密码成功。");
  163. }
  164. catch (Exception ex)
  165. {
  166. return Content(new AjaxResult { state = ResultType.error.ToString(), message = ex.Message }.ToJson());
  167. }
  168. }
  169. }
  170. }