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.
 
 
 
 
 
 

254 lines
8.3 KiB

  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. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  10. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  11. /// 创 建:超级管理员
  12. /// 日 期:2019-05-15 10:33
  13. /// 描 述:选修课课程
  14. /// </summary>
  15. public class StuSelectLessonListOfElectiveController : MvcControllerBase
  16. {
  17. private StuSelectLessonListOfElectiveIBLL stuSelectLessonListOfElectiveIBLL = new StuSelectLessonListOfElectiveBLL();
  18. private OpenLessonPlanOfElectiveIBLL openLessonPlanOfElectiveIBLL = new OpenLessonPlanOfElectiveBLL();
  19. #region 视图功能
  20. /// <summary>
  21. /// 主页面
  22. /// <summary>
  23. /// <returns></returns>
  24. [HttpGet]
  25. public ActionResult Index()
  26. {
  27. return View();
  28. }
  29. [HttpGet]
  30. public ActionResult QueryStuSelectResult()
  31. {
  32. return View();
  33. }
  34. /// <summary>
  35. /// 教务-审核表单页
  36. /// <summary>
  37. /// <returns></returns>
  38. [HttpGet]
  39. public ActionResult AuditForm()
  40. {
  41. return View();
  42. }
  43. /// <summary>
  44. /// 教务-审核页面
  45. /// <summary>
  46. /// <returns></returns>
  47. [HttpGet]
  48. public ActionResult AuditIndex()
  49. {
  50. return View();
  51. }
  52. /// <summary>
  53. /// 教务-报名结果页面
  54. /// <summary>
  55. /// <returns></returns>
  56. [HttpGet]
  57. public ActionResult FinishIndex()
  58. {
  59. return View();
  60. }
  61. #endregion
  62. #region 获取数据
  63. /// <summary>
  64. /// 获取页面显示列表数据
  65. /// <summary>
  66. /// <param name="queryJson">查询参数</param>
  67. /// <returns></returns>
  68. [HttpGet]
  69. [AjaxOnly]
  70. public ActionResult GetPageList(string pagination, string queryJson)
  71. {
  72. Pagination paginationobj = pagination.ToObject<Pagination>();
  73. var data = stuSelectLessonListOfElectiveIBLL.GetPageList(paginationobj, queryJson);
  74. var jsonData = new
  75. {
  76. rows = data,
  77. total = paginationobj.total,
  78. page = paginationobj.page,
  79. records = paginationobj.records
  80. };
  81. return Success(jsonData);
  82. }
  83. [HttpGet]
  84. [AjaxOnly]
  85. public ActionResult GetQueryStuSelectResultList(string pagination, string queryJson)
  86. {
  87. Pagination paginationobj = pagination.ToObject<Pagination>();
  88. var data = stuSelectLessonListOfElectiveIBLL.GetQueryStuSelectResultList(paginationobj, queryJson);
  89. var jsonData = new
  90. {
  91. rows = data,
  92. total = paginationobj.total,
  93. page = paginationobj.page,
  94. records = paginationobj.records
  95. };
  96. return Success(jsonData);
  97. }
  98. /// <summary>
  99. /// 获取表单数据
  100. /// <summary>
  101. /// <returns></returns>
  102. [HttpGet]
  103. [AjaxOnly]
  104. public ActionResult GetFormData(string keyValue)
  105. {
  106. var StuSelectLessonListOfElectiveData = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntity(keyValue);
  107. var jsonData = new
  108. {
  109. StuSelectLessonListOfElective = StuSelectLessonListOfElectiveData,
  110. };
  111. return Success(jsonData);
  112. }
  113. #endregion
  114. #region 提交数据
  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. stuSelectLessonListOfElectiveIBLL.DeleteEntity(keyValue);
  125. return Success("删除成功!");
  126. }
  127. [HttpPost]
  128. [AjaxOnly]
  129. public ActionResult Pass(string keyValue, string OLPEId)
  130. {
  131. var stulist = keyValue.Split(',');
  132. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  133. if (olpentity != null)
  134. {
  135. if (olpentity.StuNum + stulist.Length > olpentity.StuNumMax)
  136. {
  137. return Fail("当前选课人数已超出限制,请减少审批量!");
  138. }
  139. else
  140. {
  141. stuSelectLessonListOfElectiveIBLL.Pass(stulist, olpentity);
  142. }
  143. }
  144. else
  145. {
  146. return Fail("当前选课数据不存在!");
  147. }
  148. return Success("操作成功!");
  149. }
  150. /// <summary>
  151. /// 批量拒绝【审核学生页面】
  152. /// </summary>
  153. /// <param name="keyValue"></param>
  154. /// <param name="OLPEId"></param>
  155. /// <returns></returns>
  156. [HttpPost]
  157. [AjaxOnly]
  158. public ActionResult UnPass(string keyValue, string OLPEId)
  159. {
  160. var stulist = keyValue.Split(',');
  161. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  162. if (olpentity != null)
  163. {
  164. stuSelectLessonListOfElectiveIBLL.UnPass(stulist, olpentity);
  165. }
  166. else
  167. {
  168. return Fail("当前选课数据不存在!");
  169. }
  170. return Success("操作成功!");
  171. }
  172. /// <summary>
  173. /// 批量拒绝【已审学生页面】
  174. /// </summary>
  175. /// <param name="keyValue"></param>
  176. /// <param name="OLPEId"></param>
  177. /// <returns></returns>
  178. [HttpPost]
  179. [AjaxOnly]
  180. public ActionResult UnPassOfFinish(string keyValue, string OLPEId)
  181. {
  182. var stulist = keyValue.Split(',');
  183. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  184. if (olpentity != null)
  185. {
  186. stuSelectLessonListOfElectiveIBLL.UnPassOfFinish(stulist, olpentity);
  187. }
  188. else
  189. {
  190. return Fail("当前选课数据不存在!");
  191. }
  192. return Success("操作成功!");
  193. }
  194. /// <summary>
  195. /// 保存实体数据(新增、修改)
  196. /// <param name="keyValue">主键</param>
  197. /// <summary>
  198. /// <returns></returns>
  199. [HttpPost]
  200. [ValidateAntiForgeryToken]
  201. [AjaxOnly]
  202. public ActionResult SaveForm(string keyValue, string strEntity)
  203. {
  204. var sslleEntity = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntity(keyValue);
  205. if (sslleEntity == null)
  206. {
  207. return Fail("当前选课数据不存在!");
  208. }
  209. var olpeEntity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(sslleEntity.OLPEId);
  210. if (olpeEntity == null)
  211. {
  212. return Fail("当前选课的课程不存在!");
  213. }
  214. StuSelectLessonListOfElectiveEntity entity = strEntity.ToObject<StuSelectLessonListOfElectiveEntity>();
  215. var aa = entity.Status;
  216. if (aa == 1)//是
  217. {
  218. //判断选课的课程的报名人数是否已满
  219. if (olpeEntity.StuNum >= olpeEntity.StuNumMax)
  220. {
  221. return Fail("当前选课的课程人数已满!");
  222. }
  223. //选课的课程报名人数加1
  224. olpeEntity.StuNum = olpeEntity.StuNum + 1;
  225. openLessonPlanOfElectiveIBLL.SaveEntity(olpeEntity.Id, olpeEntity);
  226. //报名成功
  227. sslleEntity.Status = 2;
  228. sslleEntity.Remark = entity.Remark;
  229. }
  230. else
  231. {
  232. //报名失败
  233. sslleEntity.Status = 3;
  234. sslleEntity.Remark = entity.Remark;
  235. }
  236. stuSelectLessonListOfElectiveIBLL.SaveEntity(keyValue, sslleEntity);
  237. return Success("保存成功!");
  238. }
  239. #endregion
  240. }
  241. }