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.

ClassInfoController.cs 6.2 KiB

4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.EducationalAdministration;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  11. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2019-01-29 11:08
  14. /// 描 述:班级信息管理
  15. /// </summary>
  16. public class ClassInfoController : MvcControllerBase
  17. {
  18. private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
  19. private ArrangeLessonSyncIBLL arrangeLessonSyncIBLL = new ArrangeLessonSyncBLL();
  20. #region 视图功能
  21. /// <summary>
  22. /// 主页面
  23. /// </summary>
  24. /// <returns></returns>
  25. [HttpGet]
  26. public ActionResult Index()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 表单页
  32. /// </summary>
  33. /// <returns></returns>
  34. [HttpGet]
  35. public ActionResult Form()
  36. {
  37. return View();
  38. }
  39. /// <summary>
  40. /// 班级状态
  41. /// </summary>
  42. /// <returns></returns>
  43. [HttpGet]
  44. public ActionResult FormType()
  45. {
  46. return View();
  47. }
  48. /// <summary>
  49. /// 使用频率统计
  50. /// </summary>
  51. /// <returns></returns>
  52. [HttpGet]
  53. public ActionResult Statictis()
  54. {
  55. return View();
  56. }
  57. #endregion
  58. #region 获取数据
  59. [HttpGet]
  60. public ActionResult GenerateNearByYear()
  61. {
  62. return Success(Learun.Util.WebHelper.GenerateNearByYear2());
  63. }
  64. /// <summary>
  65. /// 获取页面显示列表数据
  66. /// </summary>
  67. /// <param name="queryJson">查询参数</param>
  68. /// <returns></returns>
  69. [HttpGet]
  70. [AjaxOnly]
  71. public ActionResult GetPageList(string pagination, string queryJson)
  72. {
  73. Pagination paginationobj = pagination.ToObject<Pagination>();
  74. var data = classInfoIBLL.GetPageList(paginationobj, queryJson);
  75. var jsonData = new
  76. {
  77. rows = data,
  78. total = paginationobj.total,
  79. page = paginationobj.page,
  80. records = paginationobj.records
  81. };
  82. return Success(jsonData);
  83. }
  84. /// <summary>
  85. /// 获取表单数据
  86. /// </summary>
  87. /// <returns></returns>
  88. [HttpGet]
  89. [AjaxOnly]
  90. public ActionResult GetFormData(string keyValue)
  91. {
  92. var ClassInfoData = classInfoIBLL.GetClassInfoEntity(keyValue);
  93. var jsonData = new
  94. {
  95. ClassInfo = ClassInfoData,
  96. };
  97. return Success(jsonData);
  98. }
  99. #endregion
  100. #region 提交数据
  101. [HttpPost]
  102. [AjaxOnly]
  103. public ActionResult Lock(string keyValue)
  104. {
  105. classInfoIBLL.Lock(keyValue);
  106. return Success("审核成功!");
  107. }
  108. [HttpPost]
  109. [AjaxOnly]
  110. public ActionResult UnLock(string keyValue)
  111. {
  112. classInfoIBLL.UnLock(keyValue);
  113. return Success("去审成功!");
  114. }
  115. /// <summary>
  116. /// 删除实体数据
  117. /// <param name="keyValue">主键</param>
  118. /// </summary>
  119. /// <returns></returns>
  120. [HttpPost]
  121. [AjaxOnly]
  122. public ActionResult DeleteForm(string keyValue)
  123. {
  124. classInfoIBLL.DeleteEntity(keyValue);
  125. return Success("删除成功!");
  126. }
  127. /// <summary>
  128. /// 根据专业获得班级
  129. /// <param name="marjoNo">专业码</param>
  130. /// </summary>
  131. /// <returns></returns>
  132. [HttpGet]
  133. [AjaxOnly]
  134. public ActionResult GetClassByMajorNo(string majorNo)
  135. {
  136. var data = classInfoIBLL.GetClassByMajorNo(majorNo);
  137. return Success(data);
  138. }
  139. /// <summary>
  140. /// 保存实体数据(新增、修改)
  141. /// <param name="keyValue">主键</param>
  142. /// <returns></returns>
  143. /// </summary>
  144. [HttpPost]
  145. [ValidateAntiForgeryToken]
  146. [AjaxOnly]
  147. public ActionResult SaveForm(string keyValue, string strEntity)
  148. {
  149. ClassInfoEntity entity = strEntity.ToObject<ClassInfoEntity>();
  150. entity.SyncFlag = false;
  151. var model = classInfoIBLL.GetClassInfoEntityByClassNo(entity.ClassNo);
  152. if (string.IsNullOrEmpty(keyValue))
  153. {
  154. if (model != null)
  155. {
  156. return Fail("班级代码已存在!");
  157. }
  158. }
  159. else
  160. {
  161. if (model != null && model.ClassId != keyValue)
  162. {
  163. return Fail("班级代码已存在!");
  164. }
  165. entity.SyncFlag = true;
  166. //判断排课同步数据是否存在:若存在,清除同步数据;
  167. var arrangeLessonSyncList = arrangeLessonSyncIBLL.GetArrangeLessonSyncListByTableId(keyValue);
  168. if (arrangeLessonSyncList.Any())
  169. {
  170. arrangeLessonSyncIBLL.DeleteEntityByTableId(keyValue);
  171. }
  172. else
  173. {
  174. entity.SyncFlag = false;
  175. }
  176. }
  177. classInfoIBLL.SaveEntity(keyValue, entity);
  178. return Success("保存成功!");
  179. }
  180. #endregion
  181. #region 扩展
  182. /// <summary>
  183. /// 获取页面显示列表数据
  184. /// </summary>
  185. /// <param name="queryJson">查询参数</param>
  186. /// <returns></returns>
  187. [HttpGet]
  188. [AjaxOnly]
  189. public ActionResult GetStatictisPageList(string pagination, string queryJson)
  190. {
  191. var data = classInfoIBLL.GetStatictisPageList(queryJson);
  192. var jsonData = new
  193. {
  194. rows = data,
  195. };
  196. return Success(data);
  197. }
  198. #endregion
  199. }
  200. }