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.
 
 
 
 
 
 

197 lines
6.0 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 V7.0.6 力软敏捷开发框架
  10. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  11. /// 创 建:超级管理员
  12. /// 日 期:2022-04-12 15:47
  13. /// 描 述:考试课程表
  14. /// </summary>
  15. public class Exam_ExamLessonController : MvcControllerBase
  16. {
  17. private Exam_ExamLessonIBLL exam_ExamLessonIBLL = new Exam_ExamLessonBLL();
  18. #region 视图功能
  19. /// <summary>
  20. /// 主页面
  21. /// <summary>
  22. /// <returns></returns>
  23. [HttpGet]
  24. public ActionResult Index()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 表单页
  30. /// <summary>
  31. /// <returns></returns>
  32. [HttpGet]
  33. public ActionResult Form()
  34. {
  35. return View();
  36. }
  37. /// <summary>
  38. /// 导入/清空数据
  39. /// </summary>
  40. /// <returns></returns>
  41. [HttpGet]
  42. public ActionResult FormYearSemester()
  43. {
  44. return View();
  45. }
  46. /// <summary>
  47. /// 设置考试时长
  48. /// </summary>
  49. /// <returns></returns>
  50. [HttpGet]
  51. public ActionResult FormExamTime()
  52. {
  53. return View();
  54. }
  55. #endregion
  56. #region 获取数据
  57. /// <summary>
  58. /// 获取页面显示列表数据
  59. /// </summary>
  60. /// <param name="pagination">分页参数</param>
  61. /// <param name="queryJson">查询参数</param>
  62. /// <returns></returns>
  63. [HttpGet]
  64. [AjaxOnly]
  65. public ActionResult GetPageList(string pagination, string queryJson)
  66. {
  67. Pagination paginationobj = pagination.ToObject<Pagination>();
  68. var data = exam_ExamLessonIBLL.GetPageList(paginationobj, queryJson);
  69. var jsonData = new
  70. {
  71. rows = data,
  72. total = paginationobj.total,
  73. page = paginationobj.page,
  74. records = paginationobj.records
  75. };
  76. return Success(jsonData);
  77. }
  78. /// <summary>
  79. /// 获取表单数据
  80. /// </summary>
  81. /// <param name="keyValue">主键</param>
  82. /// <returns></returns>
  83. [HttpGet]
  84. [AjaxOnly]
  85. public ActionResult GetFormData(string keyValue)
  86. {
  87. var Exam_ExamLessonData = exam_ExamLessonIBLL.GetExam_ExamLessonEntity(keyValue);
  88. var jsonData = new
  89. {
  90. Exam_ExamLesson = Exam_ExamLessonData,
  91. };
  92. return Success(jsonData);
  93. }
  94. #endregion
  95. #region 提交数据
  96. /// <summary>
  97. /// 删除实体数据
  98. /// </summary>
  99. /// <param name="keyValue">主键</param>
  100. /// <returns></returns>
  101. [HttpPost]
  102. [AjaxOnly]
  103. public ActionResult DeleteForm(string keyValue)
  104. {
  105. exam_ExamLessonIBLL.DeleteEntity(keyValue);
  106. return Success("删除成功!");
  107. }
  108. /// <summary>
  109. /// 导入开课计划
  110. /// </summary>
  111. /// <returns></returns>
  112. [HttpPost]
  113. [AjaxOnly]
  114. public ActionResult Import(string AcademicYearNo, string Semester,string ExamTime)
  115. {
  116. int res = exam_ExamLessonIBLL.Import(AcademicYearNo, Semester, ExamTime);
  117. return Success("导入" + res + "条数据!");
  118. }
  119. /// <summary>
  120. /// 按条件清空数据
  121. /// </summary>
  122. /// <returns></returns>
  123. [HttpPost]
  124. [AjaxOnly]
  125. public ActionResult DeleteWhere(string AcademicYearNo, string Semester)
  126. {
  127. int res = exam_ExamLessonIBLL.DeleteWhere(AcademicYearNo, Semester);
  128. return Success("清空" + res + "条数据!");
  129. }
  130. /// <summary>
  131. /// 保存实体数据(新增、修改)
  132. /// </summary>
  133. /// <param name="keyValue">主键</param>
  134. /// <param name="strEntity">实体</param>
  135. /// <returns></returns>
  136. [HttpPost]
  137. [ValidateAntiForgeryToken]
  138. [AjaxOnly]
  139. public ActionResult SaveForm(string keyValue, string strEntity)
  140. {
  141. Exam_ExamLessonEntity entity = strEntity.ToObject<Exam_ExamLessonEntity>();
  142. //判断课程编号有无重复
  143. var model = exam_ExamLessonIBLL.GetEntityByLessonNo(entity.LessonNo, entity.AcademicYearNo, entity.Semester);
  144. if (model != null && string.IsNullOrEmpty(keyValue))
  145. {
  146. return Fail("课程编号重复!");
  147. }
  148. else if (model != null && !string.IsNullOrEmpty(keyValue) && keyValue != model.ELId)
  149. {
  150. return Fail("课程编号重复!");
  151. }
  152. exam_ExamLessonIBLL.SaveEntity(keyValue, entity);
  153. if (string.IsNullOrEmpty(keyValue))
  154. {
  155. }
  156. return Success("保存成功!");
  157. }
  158. /// <summary>
  159. /// 设置考试时长
  160. /// </summary>
  161. /// <param name="keyValue"></param>
  162. /// <returns></returns>
  163. [HttpPost]
  164. [AjaxOnly]
  165. public ActionResult SaveExamTime(string keyValue, int ExamTime)
  166. {
  167. exam_ExamLessonIBLL.SaveExamTime(keyValue, ExamTime);
  168. return Success("设置成功!");
  169. }
  170. /// <summary>
  171. /// 启用/停用
  172. /// </summary>
  173. /// <param name="keyValue"></param>
  174. /// <param name="ELEnabled"></param>
  175. /// <returns></returns>
  176. [HttpPost]
  177. [AjaxOnly]
  178. public ActionResult Lock(string keyValue, int ELEnabled)
  179. {
  180. exam_ExamLessonIBLL.Lock(keyValue, ELEnabled);
  181. return Success("操作成功!");
  182. }
  183. #endregion
  184. }
  185. }