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.
 
 
 
 
 
 

155 lines
4.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 System.Linq;
  7. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  11. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2019-01-28 17:30
  14. /// 描 述:教室信息管理
  15. /// </summary>
  16. public class ClassroomInfoController : MvcControllerBase
  17. {
  18. private ClassroomInfoIBLL classroomInfoIBLL = new ClassroomInfoBLL();
  19. private ArrangeLessonSyncIBLL arrangeLessonSyncIBLL = new ArrangeLessonSyncBLL();
  20. #region 视图功能
  21. /// <summary>
  22. /// 主页面
  23. /// <summary>
  24. /// <returns></returns>
  25. [HttpGet]
  26. public ActionResult Index()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 表单页
  32. /// <summary>
  33. /// <returns></returns>
  34. [HttpGet]
  35. public ActionResult Form()
  36. {
  37. return View();
  38. }
  39. #endregion
  40. #region 获取数据
  41. /// <summary>
  42. /// 获取页面显示列表数据
  43. /// <summary>
  44. /// <param name="queryJson">查询参数</param>
  45. /// <returns></returns>
  46. [HttpGet]
  47. [AjaxOnly]
  48. public ActionResult GetPageList(string pagination, string queryJson)
  49. {
  50. Pagination paginationobj = pagination.ToObject<Pagination>();
  51. var data = classroomInfoIBLL.GetPageList(paginationobj, queryJson);
  52. var jsonData = new
  53. {
  54. rows = data,
  55. total = paginationobj.total,
  56. page = paginationobj.page,
  57. records = paginationobj.records
  58. };
  59. return Success(jsonData);
  60. }
  61. /// <summary>
  62. /// 获取表单数据
  63. /// <summary>
  64. /// <returns></returns>
  65. [HttpGet]
  66. [AjaxOnly]
  67. public ActionResult GetFormData(string keyValue)
  68. {
  69. var ClassroomInfoData = classroomInfoIBLL.GetClassroomInfoEntity(keyValue);
  70. var jsonData = new
  71. {
  72. ClassroomInfo = ClassroomInfoData,
  73. };
  74. return Success(jsonData);
  75. }
  76. #endregion
  77. #region 提交数据
  78. [HttpPost]
  79. [AjaxOnly]
  80. public ActionResult Lock(string keyValue)
  81. {
  82. classroomInfoIBLL.Lock(keyValue);
  83. return Success("审核成功!");
  84. }
  85. [HttpPost]
  86. [AjaxOnly]
  87. public ActionResult UnLock(string keyValue)
  88. {
  89. classroomInfoIBLL.UnLock(keyValue);
  90. return Success("去审成功!");
  91. }
  92. /// <summary>
  93. /// 删除实体数据
  94. /// <param name="keyValue">主键</param>
  95. /// <summary>
  96. /// <returns></returns>
  97. [HttpPost]
  98. [AjaxOnly]
  99. public ActionResult DeleteForm(string keyValue)
  100. {
  101. classroomInfoIBLL.DeleteEntity(keyValue);
  102. return Success("删除成功!");
  103. }
  104. /// <summary>
  105. /// 保存实体数据(新增、修改)
  106. /// <param name="keyValue">主键</param>
  107. /// <summary>
  108. /// <returns></returns>
  109. [HttpPost]
  110. [ValidateAntiForgeryToken]
  111. [AjaxOnly]
  112. public ActionResult SaveForm(string keyValue, string strEntity)
  113. {
  114. ClassroomInfoEntity entity = strEntity.ToObject<ClassroomInfoEntity>();
  115. entity.SyncFlag = false;
  116. var model = classroomInfoIBLL.GetClassroomInfoEntityByNo(entity.ClassroomNo);
  117. if (string.IsNullOrEmpty(keyValue))
  118. {
  119. if (model != null)
  120. {
  121. return Fail("教室编号已存在!");
  122. }
  123. }
  124. else
  125. {
  126. if (model != null && model.ClassroomId != keyValue)
  127. {
  128. return Fail("教室编号已存在!");
  129. }
  130. entity.SyncFlag = true;
  131. //判断排课同步数据是否存在:若存在,清除同步数据;
  132. var arrangeLessonSyncList = arrangeLessonSyncIBLL.GetArrangeLessonSyncListByTableId(keyValue);
  133. if (arrangeLessonSyncList.Any())
  134. {
  135. arrangeLessonSyncIBLL.DeleteEntityByTableId(keyValue);
  136. }
  137. else
  138. {
  139. entity.SyncFlag = false;
  140. }
  141. }
  142. classroomInfoIBLL.SaveEntity(keyValue, entity);
  143. return Success("保存成功!");
  144. }
  145. #endregion
  146. }
  147. }