JobController.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using Lottomat.Application.Busines.BaseManage;
  2. using Lottomat.Application.Cache;
  3. using Lottomat.Application.Code;
  4. using Lottomat.Application.Entity.BaseManage;
  5. using Lottomat.Util;
  6. using Lottomat.Util.WebControl;
  7. using System.Web.Mvc;
  8. using Lottomat.Util.Extension;
  9. namespace Lottomat.Application.Admin.Areas.BaseManage.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本
  13. /// Copyright (c) 2016-2017
  14. /// 创建人:赵轶
  15. /// 日 期:2015.11.4 14:31
  16. /// 描 述:职位管理
  17. /// </summary>
  18. public class JobController : MvcControllerBase
  19. {
  20. private JobBLL jobBLL = new JobBLL();
  21. private JobCache jobCache = new JobCache();
  22. #region 视图功能
  23. /// <summary>
  24. /// 职位管理
  25. /// </summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. [HandlerAuthorize(PermissionMode.Enforce)]
  29. public ActionResult Index()
  30. {
  31. return View();
  32. }
  33. /// <summary>
  34. /// 职位表单
  35. /// </summary>
  36. /// <returns></returns>
  37. [HttpGet]
  38. [HandlerAuthorize(PermissionMode.Enforce)]
  39. public ActionResult Form()
  40. {
  41. return View();
  42. }
  43. #endregion
  44. #region 获取数据
  45. /// <summary>
  46. /// 职位列表
  47. /// </summary>
  48. /// <param name="pagination">分页参数</param>
  49. /// <param name="queryJson">查询参数</param>
  50. /// <returns>返回分页列表Json</returns>
  51. [HttpGet]
  52. public ActionResult GetPageListJson(Pagination pagination, string queryJson)
  53. {
  54. var watch = CommonHelper.TimerStart();
  55. var data = jobBLL.GetPageList(pagination, queryJson);
  56. var JsonData = new
  57. {
  58. rows = data,
  59. total = pagination.total,
  60. page = pagination.page,
  61. records = pagination.records,
  62. costtime = CommonHelper.TimerEnd(watch)
  63. };
  64. return Content(JsonData.ToJson());
  65. }
  66. /// <summary>
  67. /// 职位列表
  68. /// </summary>
  69. /// <param name="organizeId">机构Id</param>
  70. /// <returns>返回列表Json</returns>
  71. [HttpGet]
  72. public ActionResult GetListJson(string organizeId)
  73. {
  74. var data = jobCache.GetList(organizeId);
  75. return Content(data.ToJson());
  76. }
  77. /// <summary>
  78. /// 职位实体
  79. /// </summary>
  80. /// <param name="keyValue">主键值</param>
  81. /// <returns>返回对象Json</returns>
  82. [HttpGet]
  83. public ActionResult GetFormJson(string keyValue)
  84. {
  85. var data = jobBLL.GetEntity(keyValue);
  86. return Content(data.ToJson());
  87. }
  88. #endregion
  89. #region 验证数据
  90. /// <summary>
  91. /// 职位编号不能重复
  92. /// </summary>
  93. /// <param name="enCode">编号</param>
  94. /// <param name="keyValue">主键</param>
  95. /// <returns></returns>
  96. [HttpGet]
  97. public ActionResult ExistEnCode(string enCode, string keyValue)
  98. {
  99. bool IsOk = jobBLL.ExistEnCode(enCode, keyValue);
  100. return Content(IsOk.ToString());
  101. }
  102. /// <summary>
  103. /// 职位名称不能重复
  104. /// </summary>
  105. /// <param name="FullName">名称</param>
  106. /// <param name="keyValue">主键</param>
  107. /// <returns></returns>
  108. [HttpGet]
  109. public ActionResult ExistFullName(string FullName, string keyValue)
  110. {
  111. bool IsOk = jobBLL.ExistFullName(FullName, keyValue);
  112. return Content(IsOk.ToString());
  113. }
  114. #endregion
  115. #region 提交数据
  116. /// <summary>
  117. /// 删除职位
  118. /// </summary>
  119. /// <param name="keyValue">主键值</param>
  120. /// <returns></returns>
  121. [HttpPost]
  122. [ValidateAntiForgeryToken]
  123. [AjaxOnly]
  124. [HandlerAuthorize(PermissionMode.Enforce)]
  125. public ActionResult RemoveForm(string keyValue)
  126. {
  127. jobBLL.RemoveForm(keyValue);
  128. return Success("删除成功。");
  129. }
  130. /// <summary>
  131. /// 保存职位表单(新增、修改)
  132. /// </summary>
  133. /// <param name="keyValue">主键值</param>
  134. /// <param name="jobEntity">职位实体</param>
  135. /// <returns></returns>
  136. [HttpPost]
  137. [ValidateAntiForgeryToken]
  138. [AjaxOnly]
  139. public ActionResult SaveForm(string keyValue, RoleEntity jobEntity)
  140. {
  141. jobBLL.SaveForm(keyValue, jobEntity);
  142. return Success("操作成功。");
  143. }
  144. #endregion
  145. }
  146. }