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.

109 lines
3.0 KiB

3 weeks ago
  1. using NFine.Application.SystemManage;
  2. using NFine.Code;
  3. using NFine.Domain.Entity.SystemManage;
  4. using System;
  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 RoleController : ControllerBase
  12. {
  13. private RoleApp roleApp = new RoleApp();
  14. private RoleAuthorizeApp roleAuthorizeApp = new RoleAuthorizeApp();
  15. private ModuleApp moduleApp = new ModuleApp();
  16. private ModuleButtonApp moduleButtonApp = new ModuleButtonApp();
  17. [HttpGet]
  18. [HandlerAjaxOnly]
  19. public ActionResult GetGridJsonFY(Pagination pagination, string keyword)
  20. {
  21. var data = roleApp.GetList(pagination, keyword);
  22. var JsonData = new
  23. {
  24. total = pagination.total,
  25. page = pagination.page,
  26. records = pagination.records,
  27. rows = data
  28. };
  29. return Content(JsonData.ToJson());
  30. }
  31. [HttpGet]
  32. [HandlerAjaxOnly]
  33. public ActionResult GetGridJson(string keyword)
  34. {
  35. var data = roleApp.GetList(keyword);
  36. return Content(data.ToJson());
  37. }
  38. [HttpGet]
  39. [HandlerAjaxOnly]
  40. public ActionResult GetFormJson(string keyValue)
  41. {
  42. var data = roleApp.GetForm(keyValue);
  43. return Content(data.ToJson());
  44. }
  45. [HttpPost]
  46. [HandlerAjaxOnly]
  47. [ValidateAntiForgeryToken]
  48. public ActionResult SubmitForm(RoleEntity roleEntity, string permissionIds, string dataActionIds, string keyValue)
  49. {
  50. try
  51. {
  52. if (string.IsNullOrEmpty(dataActionIds))
  53. {
  54. roleApp.SubmitForm(roleEntity, permissionIds.Split(','), keyValue);
  55. }
  56. else
  57. {
  58. roleApp.SubmitForm(roleEntity, permissionIds.Split(','), dataActionIds.Split(','), keyValue);
  59. }
  60. return Success("操作成功。");
  61. }
  62. catch (Exception ex)
  63. {
  64. return Error(ex.Message);
  65. }
  66. }
  67. [HttpPost]
  68. [HandlerAjaxOnly]
  69. [HandlerAuthorize]
  70. [ValidateAntiForgeryToken]
  71. public ActionResult DeleteForm(string keyValue)
  72. {
  73. roleApp.DeleteForm(keyValue);
  74. return Success("删除成功。");
  75. }
  76. public ActionResult GetRole()
  77. {
  78. DataTable dt = roleApp.GetRole();
  79. return Content(dt.ToJson());
  80. }
  81. public ActionResult SubmitFormCloneRole(string keyValue)
  82. {
  83. int i = roleApp.SubmitFormCloneRole(keyValue);
  84. if (i > 0)
  85. {
  86. return Success("生成成功!");
  87. }
  88. else
  89. {
  90. return Error("生成失败!");
  91. }
  92. }
  93. }
  94. }