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.

CommunityMemberController.cs 4.2 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. using System;
  7. using Learun.Application.TwoDevelopment.EducationalAdministration;
  8. namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2020-01-04 15:23
  15. /// 描 述:社团会员
  16. /// </summary>
  17. public class CommunityMemberController : MvcControllerBase
  18. {
  19. private CommunityMemberIBLL communityMemberIBLL = new CommunityMemberBLL();
  20. private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
  21. #region 视图功能
  22. /// <summary>
  23. /// 主页面
  24. /// <summary>
  25. /// <returns></returns>
  26. [HttpGet]
  27. public ActionResult Index()
  28. {
  29. return View();
  30. }
  31. /// <summary>
  32. /// 表单页
  33. /// <summary>
  34. /// <returns></returns>
  35. [HttpGet]
  36. public ActionResult Form()
  37. {
  38. return View();
  39. }
  40. #endregion
  41. #region 获取数据
  42. /// <summary>
  43. /// 获取页面显示列表数据
  44. /// <summary>
  45. /// <param name="queryJson">查询参数</param>
  46. /// <returns></returns>
  47. [HttpGet]
  48. [AjaxOnly]
  49. public ActionResult GetPageList(string pagination, string queryJson)
  50. {
  51. Pagination paginationobj = pagination.ToObject<Pagination>();
  52. var data = communityMemberIBLL.GetPageList(paginationobj, queryJson, string.Empty);
  53. var jsonData = new
  54. {
  55. rows = data,
  56. total = paginationobj.total,
  57. page = paginationobj.page,
  58. records = paginationobj.records
  59. };
  60. return Success(jsonData);
  61. }
  62. /// <summary>
  63. /// 获取页面显示列表数据
  64. /// <summary>
  65. /// <param name="queryJson">查询参数</param>
  66. /// <returns></returns>
  67. [HttpGet]
  68. [AjaxOnly]
  69. public ActionResult GetList(string communityId)
  70. {
  71. var data = communityMemberIBLL.GetList(communityId);
  72. return Success(data);
  73. }
  74. /// <summary>
  75. /// 获取表单数据
  76. /// <summary>
  77. /// <returns></returns>
  78. [HttpGet]
  79. [AjaxOnly]
  80. public ActionResult GetFormData(string keyValue)
  81. {
  82. var CommunityMemberData = communityMemberIBLL.GetCommunityMemberEntity(keyValue);
  83. var jsonData = new
  84. {
  85. CommunityMember = CommunityMemberData,
  86. };
  87. return Success(jsonData);
  88. }
  89. #endregion
  90. #region 提交数据
  91. /// <summary>
  92. /// 删除实体数据
  93. /// <param name="keyValue">主键</param>
  94. /// <summary>
  95. /// <returns></returns>
  96. [HttpPost]
  97. [AjaxOnly]
  98. public ActionResult DeleteForm(string keyValue)
  99. {
  100. communityMemberIBLL.DeleteEntity(keyValue);
  101. return Success("删除成功!");
  102. }
  103. /// <summary>
  104. /// 保存实体数据(新增、修改)
  105. /// <param name="keyValue">主键</param>
  106. /// <summary>
  107. /// <returns></returns>
  108. [HttpPost]
  109. [ValidateAntiForgeryToken]
  110. [AjaxOnly]
  111. public ActionResult SaveForm(string keyValue, string strEntity)
  112. {
  113. var loginInfo = LoginUserInfo.Get();
  114. CommunityMemberEntity entity = strEntity.ToObject<CommunityMemberEntity>();
  115. var stuEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(entity.StuNo);
  116. if (stuEntity == null)
  117. {
  118. return Fail("学生不存在!");
  119. }
  120. entity.StuName = stuEntity.StuName;
  121. entity.CreateTime = DateTime.Now;
  122. entity.CreateUserId = loginInfo.userId;
  123. entity.CreateUserName = loginInfo.realName;
  124. communityMemberIBLL.SaveEntity(keyValue, entity);
  125. return Success("保存成功!");
  126. }
  127. #endregion
  128. }
  129. }