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.
 
 
 
 
 
 

197 lines
5.8 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. /// <summary>
  47. /// 主页面
  48. /// <summary>
  49. /// <returns></returns>
  50. [HttpGet]
  51. public ActionResult IndexOfApply()
  52. {
  53. return View();
  54. }
  55. #endregion
  56. #region 获取数据
  57. /// <summary>
  58. /// 获取页面显示列表分页数据
  59. /// <summary>
  60. /// <param name="pagination">分页参数</param>
  61. /// <param name="queryJson">查询参数</param>
  62. /// <returns></returns>
  63. [HttpGet]
  64. [AjaxOnly]
  65. public ActionResult GetPageList(string pagination, string queryJson)
  66. {
  67. Pagination paginationobj = pagination.ToObject<Pagination>();
  68. var data = communityInfoIBLL.GetPageList(paginationobj, queryJson);
  69. var jsonData = new
  70. {
  71. rows = data,
  72. total = paginationobj.total,
  73. page = paginationobj.page,
  74. records = paginationobj.records
  75. };
  76. return Success(jsonData);
  77. }
  78. /// <summary>
  79. /// 获取页面显示列表数据
  80. /// <summary>
  81. /// <param name="queryJson">查询参数</param>
  82. /// <returns></returns>
  83. [HttpGet]
  84. [AjaxOnly]
  85. public ActionResult GetList(string queryJson)
  86. {
  87. var data = communityInfoIBLL.GetList(queryJson);
  88. return Success(data);
  89. }
  90. /// <summary>
  91. /// 获取表单数据
  92. /// <summary>
  93. /// <returns></returns>
  94. [HttpGet]
  95. [AjaxOnly]
  96. public ActionResult GetFormData(string keyValue)
  97. {
  98. var CommunityInfoData = communityInfoIBLL.GetCommunityInfoEntity( keyValue );
  99. var jsonData = new {
  100. CommunityInfo = CommunityInfoData,
  101. };
  102. return Success(jsonData);
  103. }
  104. /// <summary>
  105. /// 获取页面显示列表分页数据
  106. /// <summary>
  107. /// <param name="pagination">分页参数</param>
  108. /// <param name="queryJson">查询参数</param>
  109. /// <returns></returns>
  110. [HttpGet]
  111. [AjaxOnly]
  112. public ActionResult GetPageListOfApply(string pagination, string queryJson)
  113. {
  114. Pagination paginationobj = pagination.ToObject<Pagination>();
  115. var data = communityInfoIBLL.GetPageListOfApply(paginationobj, queryJson);
  116. var jsonData = new
  117. {
  118. rows = data,
  119. total = paginationobj.total,
  120. page = paginationobj.page,
  121. records = paginationobj.records
  122. };
  123. return Success(jsonData);
  124. }
  125. #endregion
  126. #region 提交数据
  127. /// <summary>
  128. /// 删除实体数据
  129. /// <param name="keyValue">主键</param>
  130. /// <summary>
  131. /// <returns></returns>
  132. [HttpPost]
  133. [AjaxOnly]
  134. public ActionResult DeleteForm(string keyValue)
  135. {
  136. communityInfoIBLL.DeleteEntity(keyValue);
  137. return Success("删除成功!");
  138. }
  139. /// <summary>
  140. /// 保存实体数据(新增、修改)
  141. /// <param name="keyValue">主键</param>
  142. /// <summary>
  143. /// <returns></returns>
  144. [HttpPost]
  145. [ValidateAntiForgeryToken]
  146. [AjaxOnly]
  147. public ActionResult SaveForm(string keyValue, string strEntity)
  148. {
  149. UserInfo userInfo = LoginUserInfo.Get();
  150. CommunityInfoEntity entity = strEntity.ToObject<CommunityInfoEntity>();
  151. //编号不能重复
  152. var model = communityInfoIBLL.GetCommunityInfoEntityByCode(entity.CommunityCode);
  153. if (string.IsNullOrEmpty(keyValue))
  154. {
  155. if (model != null)
  156. {
  157. return Fail("社团编号已存在!");
  158. }
  159. }
  160. else
  161. {
  162. if (model != null && model.Id != keyValue)
  163. {
  164. return Fail("社团编号已存在!");
  165. }
  166. }
  167. communityInfoIBLL.SaveEntity(userInfo,keyValue,entity);
  168. return Success("保存成功!");
  169. }
  170. /// <summary>
  171. /// 申请
  172. /// <param name="keyValue">主键</param>
  173. /// <summary>
  174. /// <returns></returns>
  175. [HttpPost]
  176. [AjaxOnly]
  177. public ActionResult DoApply(string keyValue)
  178. {
  179. communityInfoIBLL.DoApply(keyValue);
  180. return Success("操作成功!");
  181. }
  182. #endregion
  183. }
  184. }