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.
 
 
 
 
 
 

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