using Learun.Util; using System.Data; using Learun.Application.TwoDevelopment.EducationalAdministration; using System.Web.Mvc; using System.Collections.Generic; namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创 建:超级管理员 /// 日 期:2019-05-15 10:33 /// 描 述:选修课课程 /// public class StuSelectLessonListOfElectiveController : MvcControllerBase { private StuSelectLessonListOfElectiveIBLL stuSelectLessonListOfElectiveIBLL = new StuSelectLessonListOfElectiveBLL(); private OpenLessonPlanOfElectiveIBLL openLessonPlanOfElectiveIBLL = new OpenLessonPlanOfElectiveBLL(); #region 视图功能 /// /// 主页面 /// /// [HttpGet] public ActionResult Index() { return View(); } [HttpGet] public ActionResult QueryStuSelectResult() { return View(); } /// /// 教务-审核表单页 /// /// [HttpGet] public ActionResult AuditForm() { return View(); } /// /// 教务-审核页面 /// /// [HttpGet] public ActionResult AuditIndex() { return View(); } /// /// 教务-报名结果页面 /// /// [HttpGet] public ActionResult FinishIndex() { return View(); } #endregion #region 获取数据 /// /// 获取页面显示列表数据 /// /// 查询参数 /// [HttpGet] [AjaxOnly] public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = stuSelectLessonListOfElectiveIBLL.GetPageList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } [HttpGet] [AjaxOnly] public ActionResult GetQueryStuSelectResultList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = stuSelectLessonListOfElectiveIBLL.GetQueryStuSelectResultList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } /// /// 获取表单数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetFormData(string keyValue) { var StuSelectLessonListOfElectiveData = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntity(keyValue); var jsonData = new { StuSelectLessonListOfElective = StuSelectLessonListOfElectiveData, }; return Success(jsonData); } #endregion #region 提交数据 /// /// 删除实体数据 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { stuSelectLessonListOfElectiveIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } [HttpPost] [AjaxOnly] public ActionResult Pass(string keyValue, string OLPEId) { var stulist = keyValue.Split(','); var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId); if (olpentity != null) { if (olpentity.StuNum + stulist.Length > olpentity.StuNumMax) { return Fail("当前选课人数已超出限制,请减少审批量!"); } else { stuSelectLessonListOfElectiveIBLL.Pass(stulist, olpentity); } } else { return Fail("当前选课数据不存在!"); } return Success("操作成功!"); } /// /// 批量拒绝【审核学生页面】 /// /// /// /// [HttpPost] [AjaxOnly] public ActionResult UnPass(string keyValue, string OLPEId) { var stulist = keyValue.Split(','); var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId); if (olpentity != null) { stuSelectLessonListOfElectiveIBLL.UnPass(stulist, olpentity); } else { return Fail("当前选课数据不存在!"); } return Success("操作成功!"); } /// /// 批量拒绝【已审学生页面】 /// /// /// /// [HttpPost] [AjaxOnly] public ActionResult UnPassOfFinish(string keyValue, string OLPEId) { var stulist = keyValue.Split(','); var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId); if (olpentity != null) { stuSelectLessonListOfElectiveIBLL.UnPassOfFinish(stulist, olpentity); } else { return Fail("当前选课数据不存在!"); } return Success("操作成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, string strEntity) { var sslleEntity = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntity(keyValue); if (sslleEntity == null) { return Fail("当前选课数据不存在!"); } var olpeEntity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(sslleEntity.OLPEId); if (olpeEntity == null) { return Fail("当前选课的课程不存在!"); } StuSelectLessonListOfElectiveEntity entity = strEntity.ToObject(); var aa = entity.Status; if (aa == 1)//是 { //判断选课的课程的报名人数是否已满 if (olpeEntity.StuNum >= olpeEntity.StuNumMax) { return Fail("当前选课的课程人数已满!"); } //选课的课程报名人数加1 olpeEntity.StuNum = olpeEntity.StuNum + 1; openLessonPlanOfElectiveIBLL.SaveEntity(olpeEntity.Id, olpeEntity); //报名成功 sslleEntity.Status = 2; sslleEntity.Remark = entity.Remark; } else { //报名失败 sslleEntity.Status = 3; sslleEntity.Remark = entity.Remark; } stuSelectLessonListOfElectiveIBLL.SaveEntity(keyValue, sslleEntity); return Success("保存成功!"); } #endregion } }