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.
 
 
 
 
 
 

260 lines
8.5 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. [HttpGet]
  35. public ActionResult QueryStuSelectResultForTeacher()
  36. {
  37. return View();
  38. }
  39. /// <summary>
  40. /// 教务-审核表单页
  41. /// <summary>
  42. /// <returns></returns>
  43. [HttpGet]
  44. public ActionResult AuditForm()
  45. {
  46. return View();
  47. }
  48. /// <summary>
  49. /// 教务-审核页面
  50. /// <summary>
  51. /// <returns></returns>
  52. [HttpGet]
  53. public ActionResult AuditIndex()
  54. {
  55. return View();
  56. }
  57. /// <summary>
  58. /// 教务-报名结果页面
  59. /// <summary>
  60. /// <returns></returns>
  61. [HttpGet]
  62. public ActionResult FinishIndex()
  63. {
  64. return View();
  65. }
  66. #endregion
  67. #region 获取数据
  68. /// <summary>
  69. /// 获取页面显示列表数据
  70. /// <summary>
  71. /// <param name="queryJson">查询参数</param>
  72. /// <returns></returns>
  73. [HttpGet]
  74. [AjaxOnly]
  75. public ActionResult GetPageList(string pagination, string queryJson)
  76. {
  77. Pagination paginationobj = pagination.ToObject<Pagination>();
  78. var data = stuSelectLessonListOfElectiveIBLL.GetPageList(paginationobj, queryJson);
  79. var jsonData = new
  80. {
  81. rows = data,
  82. total = paginationobj.total,
  83. page = paginationobj.page,
  84. records = paginationobj.records
  85. };
  86. return Success(jsonData);
  87. }
  88. [HttpGet]
  89. [AjaxOnly]
  90. public ActionResult GetQueryStuSelectResultList(string pagination, string queryJson)
  91. {
  92. Pagination paginationobj = pagination.ToObject<Pagination>();
  93. var data = stuSelectLessonListOfElectiveIBLL.GetQueryStuSelectResultList(paginationobj, queryJson);
  94. var jsonData = new
  95. {
  96. rows = data,
  97. total = paginationobj.total,
  98. page = paginationobj.page,
  99. records = paginationobj.records
  100. };
  101. return Success(jsonData);
  102. }
  103. /// <summary>
  104. /// 获取表单数据
  105. /// <summary>
  106. /// <returns></returns>
  107. [HttpGet]
  108. [AjaxOnly]
  109. public ActionResult GetFormData(string keyValue)
  110. {
  111. var StuSelectLessonListOfElectiveData = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntity(keyValue);
  112. var jsonData = new
  113. {
  114. StuSelectLessonListOfElective = StuSelectLessonListOfElectiveData,
  115. };
  116. return Success(jsonData);
  117. }
  118. #endregion
  119. #region 提交数据
  120. /// <summary>
  121. /// 删除实体数据
  122. /// <param name="keyValue">主键</param>
  123. /// <summary>
  124. /// <returns></returns>
  125. [HttpPost]
  126. [AjaxOnly]
  127. public ActionResult DeleteForm(string keyValue)
  128. {
  129. stuSelectLessonListOfElectiveIBLL.DeleteEntity(keyValue);
  130. return Success("删除成功!");
  131. }
  132. [HttpPost]
  133. [AjaxOnly]
  134. public ActionResult Pass(string keyValue, string OLPEId)
  135. {
  136. var stulist = keyValue.Split(',');
  137. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  138. if (olpentity != null)
  139. {
  140. if (olpentity.StuNum + stulist.Length > olpentity.StuNumMax)
  141. {
  142. return Fail("当前选课人数已超出限制,请减少审批量!");
  143. }
  144. else
  145. {
  146. stuSelectLessonListOfElectiveIBLL.Pass(stulist, olpentity);
  147. }
  148. }
  149. else
  150. {
  151. return Fail("当前选课数据不存在!");
  152. }
  153. return Success("操作成功!");
  154. }
  155. /// <summary>
  156. /// 批量拒绝【审核学生页面】
  157. /// </summary>
  158. /// <param name="keyValue"></param>
  159. /// <param name="OLPEId"></param>
  160. /// <returns></returns>
  161. [HttpPost]
  162. [AjaxOnly]
  163. public ActionResult UnPass(string keyValue, string OLPEId)
  164. {
  165. var stulist = keyValue.Split(',');
  166. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  167. if (olpentity != null)
  168. {
  169. stuSelectLessonListOfElectiveIBLL.UnPass(stulist, olpentity);
  170. }
  171. else
  172. {
  173. return Fail("当前选课数据不存在!");
  174. }
  175. return Success("操作成功!");
  176. }
  177. /// <summary>
  178. /// 批量拒绝【已审学生页面】
  179. /// </summary>
  180. /// <param name="keyValue"></param>
  181. /// <param name="OLPEId"></param>
  182. /// <returns></returns>
  183. [HttpPost]
  184. [AjaxOnly]
  185. public ActionResult UnPassOfFinish(string keyValue, string OLPEId)
  186. {
  187. var stulist = keyValue.Split(',');
  188. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  189. if (olpentity != null)
  190. {
  191. stuSelectLessonListOfElectiveIBLL.UnPassOfFinish(stulist, olpentity);
  192. }
  193. else
  194. {
  195. return Fail("当前选课数据不存在!");
  196. }
  197. return Success("操作成功!");
  198. }
  199. /// <summary>
  200. /// 保存实体数据(新增、修改)
  201. /// <param name="keyValue">主键</param>
  202. /// <summary>
  203. /// <returns></returns>
  204. [HttpPost]
  205. [ValidateAntiForgeryToken]
  206. [AjaxOnly]
  207. public ActionResult SaveForm(string keyValue, string strEntity)
  208. {
  209. var sslleEntity = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntity(keyValue);
  210. if (sslleEntity == null)
  211. {
  212. return Fail("当前选课数据不存在!");
  213. }
  214. var olpeEntity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(sslleEntity.OLPEId);
  215. if (olpeEntity == null)
  216. {
  217. return Fail("当前选课的课程不存在!");
  218. }
  219. StuSelectLessonListOfElectiveEntity entity = strEntity.ToObject<StuSelectLessonListOfElectiveEntity>();
  220. var aa = entity.Status;
  221. if (aa == 1)//是
  222. {
  223. //判断选课的课程的报名人数是否已满
  224. if (olpeEntity.StuNum >= olpeEntity.StuNumMax)
  225. {
  226. return Fail("当前选课的课程人数已满!");
  227. }
  228. //选课的课程报名人数加1
  229. olpeEntity.StuNum = olpeEntity.StuNum + 1;
  230. openLessonPlanOfElectiveIBLL.SaveEntity(olpeEntity.Id, olpeEntity);
  231. //报名成功
  232. sslleEntity.Status = 2;
  233. sslleEntity.Remark = entity.Remark;
  234. }
  235. else
  236. {
  237. //报名失败
  238. sslleEntity.Status = 3;
  239. sslleEntity.Remark = entity.Remark;
  240. }
  241. stuSelectLessonListOfElectiveIBLL.SaveEntity(keyValue, sslleEntity);
  242. return Success("保存成功!");
  243. }
  244. #endregion
  245. }
  246. }