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.

170 lines
4.7 KiB

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