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.
 
 
 
 
 
 

201 lines
6.5 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_ExamRoomController : MvcControllerBase
  17. {
  18. private Exam_ExamRoomIBLL exam_ExamRoomIBLL = new Exam_ExamRoomBLL();
  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. #endregion
  68. #region 获取数据
  69. /// <summary>
  70. /// 获取页面显示列表数据
  71. /// </summary>
  72. /// <param name="pagination">分页参数</param>
  73. /// <param name="queryJson">查询参数</param>
  74. /// <returns></returns>
  75. [HttpGet]
  76. [AjaxOnly]
  77. public ActionResult GetPageList(string pagination, string queryJson)
  78. {
  79. Pagination paginationobj = pagination.ToObject<Pagination>();
  80. var data = exam_ExamRoomIBLL.GetPageList(paginationobj, queryJson);
  81. var jsonData = new
  82. {
  83. rows = data,
  84. total = paginationobj.total,
  85. page = paginationobj.page,
  86. records = paginationobj.records
  87. };
  88. return Success(jsonData);
  89. }
  90. /// <summary>
  91. /// 获取表单数据
  92. /// </summary>
  93. /// <param name="keyValue">主键</param>
  94. /// <returns></returns>
  95. [HttpGet]
  96. [AjaxOnly]
  97. public ActionResult GetFormData(string keyValue)
  98. {
  99. var Exam_ExamRoomData = exam_ExamRoomIBLL.GetExam_ExamRoomEntity(keyValue);
  100. var jsonData = new
  101. {
  102. Exam_ExamRoom = Exam_ExamRoomData,
  103. };
  104. return Success(jsonData);
  105. }
  106. #endregion
  107. #region 提交数据
  108. /// <summary>
  109. /// 删除实体数据
  110. /// </summary>
  111. /// <param name="keyValue">主键</param>
  112. /// <returns></returns>
  113. [HttpPost]
  114. [AjaxOnly]
  115. public ActionResult DeleteForm(string keyValue)
  116. {
  117. exam_ExamRoomIBLL.DeleteEntity(keyValue);
  118. return Success("删除成功!");
  119. }
  120. /// <summary>
  121. /// 导入教室
  122. /// </summary>
  123. /// <returns></returns>
  124. [HttpPost]
  125. [AjaxOnly]
  126. public ActionResult Import(string AcademicYearNo, string Semester, int SeatRows, int SeatColumns, string ImportDeptNo)
  127. {
  128. int res = exam_ExamRoomIBLL.Import(AcademicYearNo, Semester,SeatRows,SeatColumns, ImportDeptNo);
  129. return Success("导入" + res + "条数据!");
  130. }
  131. /// <summary>
  132. /// 按条件清空数据
  133. /// </summary>
  134. /// <returns></returns>
  135. [HttpPost]
  136. [AjaxOnly]
  137. public ActionResult DeleteWhere(string AcademicYearNo, string Semester, string ImportDeptNo)
  138. {
  139. int res = exam_ExamRoomIBLL.DeleteWhere(AcademicYearNo, Semester, ImportDeptNo);
  140. return Success("清空" + res + "条数据!");
  141. }
  142. /// <summary>
  143. /// 保存实体数据(新增、修改)
  144. /// </summary>
  145. /// <param name="keyValue">主键</param>
  146. /// <param name="strEntity">实体</param>
  147. /// <returns></returns>
  148. [HttpPost]
  149. [ValidateAntiForgeryToken]
  150. [AjaxOnly]
  151. public ActionResult SaveForm(string keyValue, string strEntity)
  152. {
  153. Exam_ExamRoomEntity entity = strEntity.ToObject<Exam_ExamRoomEntity>();
  154. //判断考场编号有无重复
  155. var model = exam_ExamRoomIBLL.GetEntityByClassroomNo(entity.ClassroomNo,entity.AcademicYearNo,entity.Semester);
  156. if (model != null && string.IsNullOrEmpty(keyValue))
  157. {
  158. return Fail("考场编号重复!");
  159. }
  160. else if (model != null && !string.IsNullOrEmpty(keyValue) && keyValue != model.ERId)
  161. {
  162. return Fail("考场编号重复!");
  163. }
  164. //计算考场座位数
  165. entity.SeatCount = entity.SeatRows * entity.SeatColumns;
  166. exam_ExamRoomIBLL.SaveEntity(keyValue, entity);
  167. if (string.IsNullOrEmpty(keyValue))
  168. {
  169. }
  170. return Success("保存成功!");
  171. }
  172. /// <summary>
  173. /// 启用/停用
  174. /// </summary>
  175. /// <param name="keyValue"></param>
  176. /// <param name="EREnabled"></param>
  177. /// <returns></returns>
  178. [HttpPost]
  179. [AjaxOnly]
  180. public ActionResult Lock(string keyValue, int EREnabled)
  181. {
  182. exam_ExamRoomIBLL.Lock(keyValue, EREnabled);
  183. return Success("操作成功!");
  184. }
  185. #endregion
  186. }
  187. }