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.
 
 
 
 
 
 

152 lines
4.4 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.PersonnelManagement;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  10. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  11. /// 创 建:超级管理员
  12. /// 日 期:2020-01-04 11:47
  13. /// 描 述:社团管理
  14. /// </summary>
  15. public class CommunityInfoController : MvcControllerBase
  16. {
  17. private CommunityInfoIBLL communityInfoIBLL = new CommunityInfoBLL();
  18. #region 视图功能
  19. /// <summary>
  20. /// 主页面
  21. /// <summary>
  22. /// <returns></returns>
  23. [HttpGet]
  24. public ActionResult Index()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 表单页
  30. /// <summary>
  31. /// <returns></returns>
  32. [HttpGet]
  33. public ActionResult Form()
  34. {
  35. return View();
  36. }
  37. /// <summary>
  38. /// 签到码表单页
  39. /// <summary>
  40. /// <returns></returns>
  41. [HttpGet]
  42. public ActionResult QrcodeForm()
  43. {
  44. return View();
  45. }
  46. #endregion
  47. #region 获取数据
  48. /// <summary>
  49. /// 获取页面显示列表分页数据
  50. /// <summary>
  51. /// <param name="pagination">分页参数</param>
  52. /// <param name="queryJson">查询参数</param>
  53. /// <returns></returns>
  54. [HttpGet]
  55. [AjaxOnly]
  56. public ActionResult GetPageList(string pagination, string queryJson)
  57. {
  58. Pagination paginationobj = pagination.ToObject<Pagination>();
  59. var data = communityInfoIBLL.GetPageList(paginationobj, queryJson);
  60. var jsonData = new
  61. {
  62. rows = data,
  63. total = paginationobj.total,
  64. page = paginationobj.page,
  65. records = paginationobj.records
  66. };
  67. return Success(jsonData);
  68. }
  69. /// <summary>
  70. /// 获取页面显示列表数据
  71. /// <summary>
  72. /// <param name="queryJson">查询参数</param>
  73. /// <returns></returns>
  74. [HttpGet]
  75. [AjaxOnly]
  76. public ActionResult GetList(string queryJson)
  77. {
  78. var data = communityInfoIBLL.GetList(queryJson);
  79. return Success(data);
  80. }
  81. /// <summary>
  82. /// 获取表单数据
  83. /// <summary>
  84. /// <returns></returns>
  85. [HttpGet]
  86. [AjaxOnly]
  87. public ActionResult GetFormData(string keyValue)
  88. {
  89. var CommunityInfoData = communityInfoIBLL.GetCommunityInfoEntity( keyValue );
  90. var jsonData = new {
  91. CommunityInfo = CommunityInfoData,
  92. };
  93. return Success(jsonData);
  94. }
  95. #endregion
  96. #region 提交数据
  97. /// <summary>
  98. /// 删除实体数据
  99. /// <param name="keyValue">主键</param>
  100. /// <summary>
  101. /// <returns></returns>
  102. [HttpPost]
  103. [AjaxOnly]
  104. public ActionResult DeleteForm(string keyValue)
  105. {
  106. communityInfoIBLL.DeleteEntity(keyValue);
  107. return Success("删除成功!");
  108. }
  109. /// <summary>
  110. /// 保存实体数据(新增、修改)
  111. /// <param name="keyValue">主键</param>
  112. /// <summary>
  113. /// <returns></returns>
  114. [HttpPost]
  115. [ValidateAntiForgeryToken]
  116. [AjaxOnly]
  117. public ActionResult SaveForm(string keyValue, string strEntity)
  118. {
  119. UserInfo userInfo = LoginUserInfo.Get();
  120. CommunityInfoEntity entity = strEntity.ToObject<CommunityInfoEntity>();
  121. //编号不能重复
  122. var model = communityInfoIBLL.GetCommunityInfoEntityByCode(entity.CommunityCode);
  123. if (string.IsNullOrEmpty(keyValue))
  124. {
  125. if (model != null)
  126. {
  127. return Fail("社团编号已存在!");
  128. }
  129. }
  130. else
  131. {
  132. if (model != null && model.Id != keyValue)
  133. {
  134. return Fail("社团编号已存在!");
  135. }
  136. }
  137. communityInfoIBLL.SaveEntity(userInfo,keyValue,entity);
  138. return Success("保存成功!");
  139. }
  140. #endregion
  141. }
  142. }