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.
 
 
 
 
 
 

239 lines
8.2 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. 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-05-15 10:33
  14. /// 描 述:选修课课程
  15. /// </summary>
  16. public class StuSelectLessonListOfElectivePreController : MvcControllerBase
  17. {
  18. private StuSelectLessonListOfElectivePreIBLL stuSelectLessonListOfElectivePreIBLL = new StuSelectLessonListOfElectivePreBLL();
  19. private OpenLessonPlanOfElectiveIBLL openLessonPlanOfElectiveIBLL = new OpenLessonPlanOfElectiveBLL();
  20. #region 视图功能
  21. /// <summary>
  22. /// 主页面
  23. /// <summary>
  24. /// <returns></returns>
  25. [HttpGet]
  26. public ActionResult Index()
  27. {
  28. return View();
  29. }
  30. [HttpGet]
  31. public ActionResult QueryStuSelectResult()
  32. {
  33. return View();
  34. }
  35. /// <summary>
  36. /// 教务-审核表单页
  37. /// <summary>
  38. /// <returns></returns>
  39. [HttpGet]
  40. public ActionResult AuditForm()
  41. {
  42. return View();
  43. }
  44. /// <summary>
  45. /// 教务-审核页面
  46. /// <summary>
  47. /// <returns></returns>
  48. [HttpGet]
  49. public ActionResult AuditIndex()
  50. {
  51. return View();
  52. }
  53. /// <summary>
  54. /// 教务-报名结果页面
  55. /// <summary>
  56. /// <returns></returns>
  57. [HttpGet]
  58. public ActionResult FinishIndex()
  59. {
  60. return View();
  61. }
  62. #endregion
  63. #region 获取数据
  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 = stuSelectLessonListOfElectivePreIBLL.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. [HttpGet]
  85. [AjaxOnly]
  86. public ActionResult GetQueryStuSelectResultList(string pagination, string queryJson)
  87. {
  88. Pagination paginationobj = pagination.ToObject<Pagination>();
  89. var data = stuSelectLessonListOfElectivePreIBLL.GetQueryStuSelectResultList(paginationobj, queryJson);
  90. var jsonData = new
  91. {
  92. rows = data,
  93. total = paginationobj.total,
  94. page = paginationobj.page,
  95. records = paginationobj.records
  96. };
  97. return Success(jsonData);
  98. }
  99. /// <summary>
  100. /// 获取表单数据
  101. /// <summary>
  102. /// <returns></returns>
  103. [HttpGet]
  104. [AjaxOnly]
  105. public ActionResult GetFormData(string keyValue)
  106. {
  107. var StuSelectLessonListOfElectivePreData = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreEntity(keyValue);
  108. var jsonData = new
  109. {
  110. StuSelectLessonListOfElectivePre = StuSelectLessonListOfElectivePreData,
  111. };
  112. return Success(jsonData);
  113. }
  114. #endregion
  115. #region 提交数据
  116. /// <summary>
  117. /// 删除实体数据
  118. /// <param name="keyValue">主键</param>
  119. /// <summary>
  120. /// <returns></returns>
  121. [HttpPost]
  122. [AjaxOnly]
  123. public ActionResult DeleteForm(string keyValue)
  124. {
  125. stuSelectLessonListOfElectivePreIBLL.DeleteEntity(keyValue);
  126. return Success("删除成功!");
  127. }
  128. [HttpPost]
  129. [AjaxOnly]
  130. public ActionResult Pass(string keyValue, string OLPEId)
  131. {
  132. var stulist = keyValue.Split(',');
  133. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  134. if (olpentity != null)
  135. {
  136. var bb = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreListByOLPEId(olpentity.Id);
  137. var bbb = bb.Where(x => x.Status == 2).Count();
  138. if (bbb + stulist.Length > olpentity.StuNumMax)
  139. {
  140. return Fail("当前选课人数已超出限制,请减少审批量!");
  141. }
  142. //if (olpentity.StuNum + stulist.Length > olpentity.StuNumMax)
  143. //{
  144. // return Fail("当前选课人数已超出限制,请减少审批量!");
  145. //}
  146. else
  147. {
  148. stuSelectLessonListOfElectivePreIBLL.Pass(stulist, olpentity);
  149. }
  150. }
  151. else
  152. {
  153. return Fail("当前选课数据不存在!");
  154. }
  155. return Success("操作成功!");
  156. }
  157. [HttpPost]
  158. [AjaxOnly]
  159. public ActionResult UnPass(string keyValue, string OLPEId)
  160. {
  161. var stulist = keyValue.Split(',');
  162. var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId);
  163. if (olpentity != null)
  164. {
  165. stuSelectLessonListOfElectivePreIBLL.UnPass(stulist, olpentity);
  166. }
  167. else
  168. {
  169. return Fail("当前选课数据不存在!");
  170. }
  171. return Success("操作成功!");
  172. }
  173. /// <summary>
  174. /// 保存实体数据(新增、修改)
  175. /// <param name="keyValue">主键</param>
  176. /// <summary>
  177. /// <returns></returns>
  178. [HttpPost]
  179. [ValidateAntiForgeryToken]
  180. [AjaxOnly]
  181. public ActionResult SaveForm(string keyValue, string strEntity)
  182. {
  183. var sslleEntity = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreEntity(keyValue);
  184. if (sslleEntity == null)
  185. {
  186. return Fail("当前选课数据不存在!");
  187. }
  188. var olpeEntity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(sslleEntity.OLPEId);
  189. if (olpeEntity == null)
  190. {
  191. return Fail("当前选课的课程不存在!");
  192. }
  193. StuSelectLessonListOfElectivePreEntity entity = strEntity.ToObject<StuSelectLessonListOfElectivePreEntity>();
  194. var aa = entity.Status;
  195. if (aa == 1)//是
  196. {
  197. //判断选课的课程的报名人数是否已满
  198. //if (olpeEntity.StuNum >= olpeEntity.StuNumMax)
  199. //{
  200. // return Fail("当前选课的课程人数已满!");
  201. //}
  202. var bb = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreListByOLPEId(olpeEntity.Id);
  203. var bbb = bb.Where(x => x.Status == 2).Count();
  204. if (bbb >= olpeEntity.StuNumMax)
  205. {
  206. return Fail("当前选课的课程人数已满!");
  207. }
  208. //选课的课程报名人数加1
  209. //olpeEntity.StuNum = olpeEntity.StuNum + 1;
  210. //openLessonPlanOfElectiveIBLL.SaveEntity(olpeEntity.Id, olpeEntity);
  211. //报名成功
  212. sslleEntity.Status = 2;
  213. sslleEntity.Remark = entity.Remark;
  214. }
  215. else
  216. {
  217. //报名失败
  218. sslleEntity.Status = 3;
  219. sslleEntity.Remark = entity.Remark;
  220. }
  221. stuSelectLessonListOfElectivePreIBLL.SaveEntity(keyValue, sslleEntity);
  222. return Success("保存成功!");
  223. }
  224. #endregion
  225. }
  226. }