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.

Exam_ExamStudentController.cs 5.9 KiB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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_ExamStudentController : MvcControllerBase
  16. {
  17. private Exam_ExamStudentIBLL exam_ExamStudentIBLL = new Exam_ExamStudentBLL();
  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 FormImport()
  43. {
  44. return View();
  45. }
  46. /// <summary>
  47. /// 按条件清空
  48. /// </summary>
  49. /// <returns></returns>
  50. [HttpGet]
  51. public ActionResult FormClear()
  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_ExamStudentIBLL.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_ExamStudentData = exam_ExamStudentIBLL.GetExam_ExamStudentEntity(keyValue);
  88. var jsonData = new
  89. {
  90. Exam_ExamStudent = Exam_ExamStudentData,
  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_ExamStudentIBLL.DeleteEntity(keyValue);
  106. return Success("删除成功!");
  107. }
  108. /// <summary>
  109. /// 保存实体数据(新增、修改)
  110. /// </summary>
  111. /// <param name="keyValue">主键</param>
  112. /// <param name="strEntity">实体</param>
  113. /// <returns></returns>
  114. [HttpPost]
  115. [ValidateAntiForgeryToken]
  116. [AjaxOnly]
  117. public ActionResult SaveForm(string keyValue, string strEntity)
  118. {
  119. Exam_ExamStudentEntity entity = strEntity.ToObject<Exam_ExamStudentEntity>();
  120. #region 去重
  121. var model = exam_ExamStudentIBLL.GetExam_ExamStudentbyStuNo(entity.StuNo);
  122. if (string.IsNullOrEmpty(keyValue))
  123. {
  124. if (model != null && model.AcademicYearNo == entity.AcademicYearNo && model.Semester == entity.Semester && model.ESType == entity.ESType)
  125. {
  126. return Fail("此学生考试数据已存在!");
  127. }
  128. }
  129. else
  130. {
  131. if (model != null && model.ESId != keyValue && model.AcademicYearNo == entity.AcademicYearNo && model.Semester == entity.Semester && model.ESType == entity.ESType)
  132. {
  133. return Fail("此学生考试数据已存在!");
  134. }
  135. }
  136. #endregion
  137. exam_ExamStudentIBLL.SaveEntity(keyValue, entity);
  138. return Success("保存成功!");
  139. }
  140. /// <summary>
  141. /// 启用/停用
  142. /// </summary>
  143. /// <param name="keyValue"></param>
  144. /// <param name="ESEnabled"></param>
  145. /// <returns></returns>
  146. [HttpPost]
  147. [AjaxOnly]
  148. public ActionResult Lock(string keyValue, int ESEnabled)
  149. {
  150. exam_ExamStudentIBLL.Lock(keyValue, ESEnabled);
  151. return Success("操作成功!");
  152. }
  153. /// <summary>
  154. /// 清空数据
  155. /// </summary>
  156. /// <param name="AcademicYearNo"></param>
  157. /// <param name="Semester"></param>
  158. /// <param name="ESType"></param>
  159. /// <returns></returns>
  160. [HttpPost]
  161. [AjaxOnly]
  162. [ValidateAntiForgeryToken]
  163. public ActionResult ClearTable(string AcademicYearNo, string Semester, string ESType)
  164. {
  165. int res = exam_ExamStudentIBLL.ClaerForm(AcademicYearNo, Semester, ESType);
  166. return Success("清空(" + res + ")条数据成功!");
  167. }
  168. public ActionResult ImportTable(string AcademicYearNo, int Semester, string ESType)
  169. {
  170. int res = exam_ExamStudentIBLL.ImportForm(AcademicYearNo, Semester, ESType);
  171. return Success("同步(" + res + ")条数据成功!");
  172. }
  173. #endregion
  174. }
  175. }