Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

220 строки
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. using System;
  7. using System.Linq;
  8. using DocumentFormat.OpenXml.Office.CustomUI;
  9. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2019-08-21 17:28
  16. /// 描 述:成绩比例设置
  17. /// </summary>
  18. public class ClassPlanController : MvcControllerBase
  19. {
  20. private ClassPlanIBLL classPlanIBLL = new ClassPlanBLL();
  21. private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
  22. private TeachClassIBLL teachClassIBLL = new TeachClassBLL();
  23. #region 视图功能
  24. /// <summary>
  25. /// 主页面
  26. /// <summary>
  27. /// <returns></returns>
  28. [HttpGet]
  29. public ActionResult Index()
  30. {
  31. return View();
  32. }
  33. /// <summary>
  34. /// 表单页
  35. /// <summary>
  36. /// <returns></returns>
  37. [HttpGet]
  38. public ActionResult Form()
  39. {
  40. return View();
  41. }
  42. /// <summary>
  43. /// 全校开课计划
  44. /// <summary>
  45. /// <returns></returns>
  46. [HttpGet]
  47. public ActionResult IndexSchool()
  48. {
  49. return View();
  50. }
  51. #endregion
  52. #region 获取数据
  53. /// <summary>
  54. /// 获取页面显示列表数据
  55. /// </summary>
  56. /// <param name="pagination">分页参数</param>
  57. /// <param name="queryJson">查询参数</param>
  58. /// <returns></returns>
  59. [HttpGet]
  60. [AjaxOnly]
  61. public ActionResult GetPageList(string pagination, string queryJson)
  62. {
  63. Pagination paginationobj = pagination.ToObject<Pagination>();
  64. var data = classPlanIBLL.GetPageList(paginationobj, queryJson);
  65. var jsonData = new
  66. {
  67. rows = data,
  68. total = paginationobj.total,
  69. page = paginationobj.page,
  70. records = paginationobj.records
  71. };
  72. return Success(jsonData);
  73. }
  74. /// <summary>
  75. /// 全校开课计划
  76. /// </summary>
  77. /// <param name="pagination"></param>
  78. /// <param name="queryJson"></param>
  79. /// <returns></returns>
  80. [HttpGet]
  81. [AjaxOnly]
  82. public ActionResult GetPageListForSchool(string pagination, string queryJson)
  83. {
  84. Pagination paginationobj = pagination.ToObject<Pagination>();
  85. var data = classPlanIBLL.GetPageListForSchool(paginationobj, queryJson);
  86. var jsonData = new
  87. {
  88. rows = data,
  89. total = paginationobj.total,
  90. page = paginationobj.page,
  91. records = paginationobj.records
  92. };
  93. return Success(jsonData);
  94. }
  95. /// <summary>
  96. /// 获取表单数据
  97. /// </summary>
  98. /// <param name="keyValue">主键</param>
  99. /// <returns></returns>
  100. [HttpGet]
  101. [AjaxOnly]
  102. public ActionResult GetFormData(string keyValue)
  103. {
  104. var ClassPlanData = classPlanIBLL.GetClassPlanEntity(keyValue);
  105. var jsonData = new
  106. {
  107. ClassPlan = ClassPlanData,
  108. };
  109. return Success(jsonData);
  110. }
  111. #endregion
  112. #region 提交数据
  113. /// <summary>
  114. /// 删除实体数据
  115. /// </summary>
  116. /// <param name="keyValue">主键</param>
  117. /// <returns></returns>
  118. [HttpPost]
  119. [AjaxOnly]
  120. public ActionResult DeleteForm(string keyValue)
  121. {
  122. classPlanIBLL.DeleteEntity(keyValue);
  123. return Success("删除成功!");
  124. }
  125. /// <summary>
  126. /// 保存实体数据(新增、修改)
  127. /// </summary>
  128. /// <param name="keyValue">主键</param>
  129. /// <param name="strEntity">实体</param>
  130. /// <returns></returns>
  131. [HttpPost]
  132. [ValidateAntiForgeryToken]
  133. [AjaxOnly]
  134. public ActionResult SaveForm(string keyValue, string strEntity)
  135. {
  136. OpenLessonPlanEntity entity = strEntity.ToObject<OpenLessonPlanEntity>();
  137. if (!string.IsNullOrEmpty(keyValue))
  138. {
  139. entity.AmendDate = DateTime.Now;
  140. }
  141. entity.State = 0;
  142. entity.IsAllowEdit = true;
  143. entity.LessonSortNo = "1";
  144. entity.CheckMark = "1";
  145. entity.MakeDate = DateTime.Now;
  146. var model = classPlanIBLL.GetRepetitions(entity.F_SchoolId, entity.AcademicYearNo, entity.Semester, entity.DeptNo, entity.MajorNo, entity.Grade, entity.LessonNo);
  147. if (model != null)
  148. {
  149. if (keyValue != model.ID.ToString())
  150. {
  151. return Fail("此课程已重复!不可再次添加此课程");
  152. }
  153. }
  154. classPlanIBLL.SaveEntity(keyValue, entity);
  155. return Success("保存成功!");
  156. }
  157. #endregion
  158. #region 扩展数据
  159. /// <summary>
  160. /// 排课
  161. /// </summary>
  162. /// <param name="keyValue">主键</param>
  163. /// <returns></returns>
  164. [HttpPost]
  165. [AjaxOnly]
  166. public ActionResult CourseArranging(string keyValue)
  167. {
  168. var entity = classPlanIBLL.GetListById(keyValue);
  169. List<TeachClassEntity> TeachList = new List<TeachClassEntity>();
  170. for (int i = 0; i < entity.Count; i++)
  171. {
  172. var lessonList = classInfoIBLL.GetAllClass().
  173. Where(x => x.DeptNo == entity[i].DeptNo && x.MajorNo == entity[i].MajorNo && x.Grade == entity[i].Grade)
  174. .OrderBy(x => x.ClassNo).Select(field1 => new { field1.ClassNo, field1.ClassName }).ToList();
  175. if (lessonList.Count > 0)
  176. {
  177. for (int j = 0; j < lessonList.Count; j++)
  178. {
  179. TeachClassEntity TeachEntity = new TeachClassEntity();
  180. TeachEntity.TeachClassNo = lessonList[j].ClassNo;
  181. TeachEntity.AcademicYearNo = entity[i].AcademicYearNo;
  182. TeachEntity.DeptNo = entity[i].DeptNo;
  183. TeachEntity.MajorNo = entity[i].MajorNo;
  184. TeachEntity.Grade = entity[i].Grade;
  185. TeachEntity.Semester = entity[i].Semester;
  186. TeachEntity.LessonNo = entity[i].LessonNo;
  187. TeachEntity.StuNum = entity[i].StuNum;
  188. TeachEntity.LessonSortNo = entity[i].LessonSortNo;
  189. TeachEntity.F_SchoolId = entity[i].F_SchoolId;
  190. TeachList.Add(TeachEntity);
  191. }
  192. }
  193. else
  194. {
  195. return Fail("排课失败!暂无排课班级");
  196. }
  197. }
  198. teachClassIBLL.SaveEntityList(TeachList);
  199. classPlanIBLL.SaveEntityList(keyValue, entity);
  200. return Success("排课成功");
  201. }
  202. #endregion
  203. }
  204. }