選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

226 行
7.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. [HttpPost]
  151. [AjaxOnly]
  152. public ActionResult UnPass(string keyValue, string OLPEId)
  153. {
  154. var stulist = keyValue.Split(',');
  155. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  156. if (olpentity != null)
  157. {
  158. stuSelectLessonListOfElectiveIBLL.UnPass(stulist, olpentity);
  159. }
  160. else
  161. {
  162. return Fail("当前选课数据不存在!");
  163. }
  164. return Success("操作成功!");
  165. }
  166. /// <summary>
  167. /// 保存实体数据(新增、修改)
  168. /// <param name="keyValue">主键</param>
  169. /// <summary>
  170. /// <returns></returns>
  171. [HttpPost]
  172. [ValidateAntiForgeryToken]
  173. [AjaxOnly]
  174. public ActionResult SaveForm(string keyValue, string strEntity)
  175. {
  176. var sslleEntity = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntity(keyValue);
  177. if (sslleEntity == null)
  178. {
  179. return Fail("当前选课数据不存在!");
  180. }
  181. var olpeEntity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(sslleEntity.OLPEId);
  182. if (olpeEntity == null)
  183. {
  184. return Fail("当前选课的课程不存在!");
  185. }
  186. StuSelectLessonListOfElectiveEntity entity = strEntity.ToObject<StuSelectLessonListOfElectiveEntity>();
  187. var aa = entity.Status;
  188. if (aa == 1)//是
  189. {
  190. //判断选课的课程的报名人数是否已满
  191. if (olpeEntity.StuNum >= olpeEntity.StuNumMax)
  192. {
  193. return Fail("当前选课的课程人数已满!");
  194. }
  195. //选课的课程报名人数加1
  196. olpeEntity.StuNum = olpeEntity.StuNum + 1;
  197. openLessonPlanOfElectiveIBLL.SaveEntity(olpeEntity.Id, olpeEntity);
  198. //报名成功
  199. sslleEntity.Status = 2;
  200. sslleEntity.Remark = entity.Remark;
  201. }
  202. else
  203. {
  204. //报名失败
  205. sslleEntity.Status = 3;
  206. sslleEntity.Remark = entity.Remark;
  207. }
  208. stuSelectLessonListOfElectiveIBLL.SaveEntity(keyValue, sslleEntity);
  209. return Success("保存成功!");
  210. }
  211. #endregion
  212. }
  213. }