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.
 
 
 
 
 
 

208 lines
6.8 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-14 09:49
  14. /// 描 述:监考老师
  15. /// </summary>
  16. public class Exam_InvigilateTeacherController : MvcControllerBase
  17. {
  18. private Exam_InvigilateTeacherIBLL exam_InvigilateTeacherIBLL = new Exam_InvigilateTeacherBLL();
  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_InvigilateTeacherIBLL.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_InvigilateTeacherData = exam_InvigilateTeacherIBLL.GetExam_InvigilateTeacherEntity( keyValue );
  100. var jsonData = new {
  101. Exam_InvigilateTeacher = Exam_InvigilateTeacherData,
  102. };
  103. return Success(jsonData);
  104. }
  105. /// <summary>
  106. /// 获取监考老师数据
  107. /// </summary>
  108. /// <returns></returns>
  109. [HttpGet]
  110. [AjaxOnly]
  111. public ActionResult GetList(string AcademicYearNo, int? Semester)
  112. {
  113. var data = exam_InvigilateTeacherIBLL.GetList(AcademicYearNo, Semester);
  114. return Success(data);
  115. }
  116. #endregion
  117. #region 提交数据
  118. /// <summary>
  119. /// 删除实体数据
  120. /// </summary>
  121. /// <param name="keyValue">主键</param>
  122. /// <returns></returns>
  123. [HttpPost]
  124. [AjaxOnly]
  125. public ActionResult DeleteForm(string keyValue)
  126. {
  127. exam_InvigilateTeacherIBLL.DeleteEntity(keyValue);
  128. return Success("删除成功!");
  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_InvigilateTeacherEntity entity = strEntity.ToObject<Exam_InvigilateTeacherEntity>();
  142. //判断教师编号有无重复
  143. var model = exam_InvigilateTeacherIBLL.GetEntityByWhere(entity.AcademicYearNo, entity.Semester,entity.EmpNo);
  144. if (model != null && string.IsNullOrEmpty(keyValue))
  145. {
  146. return Fail("教师编号重复!");
  147. }
  148. else if (model != null && !string.IsNullOrEmpty(keyValue) && keyValue != model.ITId)
  149. {
  150. return Fail("教师编号重复!");
  151. }
  152. exam_InvigilateTeacherIBLL.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. /// <param name="ITEnabled"></param>
  163. /// <returns></returns>
  164. [HttpPost]
  165. [AjaxOnly]
  166. public ActionResult Lock(string keyValue, int ITEnabled)
  167. {
  168. exam_InvigilateTeacherIBLL.Lock(keyValue, ITEnabled);
  169. return Success("操作成功!");
  170. }
  171. /// <summary>
  172. /// 导入教师基础数据
  173. /// </summary>
  174. /// <returns></returns>
  175. [HttpPost]
  176. [AjaxOnly]
  177. public ActionResult Import(string AcademicYearNo, string Semester, string ImportDeptNo)
  178. {
  179. int res = exam_InvigilateTeacherIBLL.Import(AcademicYearNo, Semester, ImportDeptNo);
  180. return Success("导入" + res + "条数据!");
  181. }
  182. /// <summary>
  183. /// 按条件清空数据
  184. /// </summary>
  185. /// <returns></returns>
  186. [HttpPost]
  187. [AjaxOnly]
  188. public ActionResult DeleteWhere(string AcademicYearNo, string Semester, string ImportDeptNo)
  189. {
  190. int res = exam_InvigilateTeacherIBLL.DeleteWhere(AcademicYearNo, Semester, ImportDeptNo);
  191. return Success("清空" + res + "条数据!");
  192. }
  193. #endregion
  194. }
  195. }