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.
 
 
 
 
 
 

218 lines
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 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_ExamStudentController : MvcControllerBase
  17. {
  18. private Exam_ExamStudentIBLL exam_ExamStudentIBLL = new Exam_ExamStudentBLL();
  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 FormImport()
  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 FormClear()
  73. {
  74. if (LoginUserInfo.Get().roleIds.Contains(roleIbll.GetEntityByRoleCode("paikaoerji").F_RoleId))
  75. {
  76. ViewBag.IsTwoDept = true;
  77. var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(LoginUserInfo.Get().account);
  78. if (empinfo != null)
  79. {
  80. ViewBag.DeptNo = empinfo.DeptNo;
  81. }
  82. }
  83. return View();
  84. }
  85. #endregion
  86. #region 获取数据
  87. /// <summary>
  88. /// 获取页面显示列表数据
  89. /// </summary>
  90. /// <param name="pagination">分页参数</param>
  91. /// <param name="queryJson">查询参数</param>
  92. /// <returns></returns>
  93. [HttpGet]
  94. [AjaxOnly]
  95. public ActionResult GetPageList(string pagination, string queryJson)
  96. {
  97. Pagination paginationobj = pagination.ToObject<Pagination>();
  98. var data = exam_ExamStudentIBLL.GetPageList(paginationobj, queryJson);
  99. var jsonData = new
  100. {
  101. rows = data,
  102. total = paginationobj.total,
  103. page = paginationobj.page,
  104. records = paginationobj.records
  105. };
  106. return Success(jsonData);
  107. }
  108. /// <summary>
  109. /// 获取表单数据
  110. /// </summary>
  111. /// <param name="keyValue">主键</param>
  112. /// <returns></returns>
  113. [HttpGet]
  114. [AjaxOnly]
  115. public ActionResult GetFormData(string keyValue)
  116. {
  117. var Exam_ExamStudentData = exam_ExamStudentIBLL.GetExam_ExamStudentEntity(keyValue);
  118. var jsonData = new
  119. {
  120. Exam_ExamStudent = Exam_ExamStudentData,
  121. };
  122. return Success(jsonData);
  123. }
  124. #endregion
  125. #region 提交数据
  126. /// <summary>
  127. /// 删除实体数据
  128. /// </summary>
  129. /// <param name="keyValue">主键</param>
  130. /// <returns></returns>
  131. [HttpPost]
  132. [AjaxOnly]
  133. public ActionResult DeleteForm(string keyValue)
  134. {
  135. exam_ExamStudentIBLL.DeleteEntity(keyValue);
  136. return Success("删除成功!");
  137. }
  138. /// <summary>
  139. /// 保存实体数据(新增、修改)
  140. /// </summary>
  141. /// <param name="keyValue">主键</param>
  142. /// <param name="strEntity">实体</param>
  143. /// <returns></returns>
  144. [HttpPost]
  145. [ValidateAntiForgeryToken]
  146. [AjaxOnly]
  147. public ActionResult SaveForm(string keyValue, string strEntity)
  148. {
  149. Exam_ExamStudentEntity entity = strEntity.ToObject<Exam_ExamStudentEntity>();
  150. #region 去重
  151. var model = exam_ExamStudentIBLL.GetExam_ExamStudentbyStuNo(entity.StuNo);
  152. if (string.IsNullOrEmpty(keyValue))
  153. {
  154. if (model != null && model.AcademicYearNo == entity.AcademicYearNo && model.Semester == entity.Semester && model.ESType == entity.ESType)
  155. {
  156. return Fail("此学生考试数据已存在!");
  157. }
  158. }
  159. else
  160. {
  161. if (model != null && model.ESId != keyValue && model.AcademicYearNo == entity.AcademicYearNo && model.Semester == entity.Semester && model.ESType == entity.ESType)
  162. {
  163. return Fail("此学生考试数据已存在!");
  164. }
  165. }
  166. #endregion
  167. exam_ExamStudentIBLL.SaveEntity(keyValue, entity);
  168. return Success("保存成功!");
  169. }
  170. /// <summary>
  171. /// 启用/停用
  172. /// </summary>
  173. /// <param name="keyValue"></param>
  174. /// <param name="ESEnabled"></param>
  175. /// <returns></returns>
  176. [HttpPost]
  177. [AjaxOnly]
  178. public ActionResult Lock(string keyValue, int ESEnabled)
  179. {
  180. exam_ExamStudentIBLL.Lock(keyValue, ESEnabled);
  181. return Success("操作成功!");
  182. }
  183. /// <summary>
  184. /// 清空数据
  185. /// </summary>
  186. /// <param name="AcademicYearNo"></param>
  187. /// <param name="Semester"></param>
  188. /// <param name="ESType"></param>
  189. /// <returns></returns>
  190. [HttpPost]
  191. [AjaxOnly]
  192. [ValidateAntiForgeryToken]
  193. public ActionResult ClearTable(string AcademicYearNo, string Semester, string ESType, string ImportDeptNo)
  194. {
  195. int res = exam_ExamStudentIBLL.ClaerForm(AcademicYearNo, Semester, ESType, ImportDeptNo);
  196. return Success("清空(" + res + ")条数据成功!");
  197. }
  198. public ActionResult ImportTable(string AcademicYearNo, int Semester, string ESType, string ImportDeptNo)
  199. {
  200. int res = exam_ExamStudentIBLL.ImportForm(AcademicYearNo, Semester, ESType, ImportDeptNo);
  201. return Success("同步(" + res + ")条数据成功!");
  202. }
  203. #endregion
  204. }
  205. }