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.

TextBookInfoController.cs 5.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using Learun.Util;
  3. using System.Data;
  4. using Learun.Application.TwoDevelopment.EducationalAdministration;
  5. using System.Web.Mvc;
  6. using System.Collections.Generic;
  7. using NPOI.SS.Util;
  8. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2022-01-24 12:19
  15. /// 描 述:教材信息管理
  16. /// </summary>
  17. public class TextBookInfoController : MvcControllerBase
  18. {
  19. private TextBookInfoIBLL textBookInfoIBLL = new TextBookInfoBLL();
  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="pagination">分页参数</param>
  45. /// <param name="queryJson">查询参数</param>
  46. /// <returns></returns>
  47. [HttpGet]
  48. [AjaxOnly]
  49. public ActionResult GetPageList(string pagination, string queryJson)
  50. {
  51. Pagination paginationobj = pagination.ToObject<Pagination>();
  52. var data = textBookInfoIBLL.GetPageList(paginationobj, queryJson);
  53. var jsonData = new
  54. {
  55. rows = data,
  56. total = paginationobj.total,
  57. page = paginationobj.page,
  58. records = paginationobj.records
  59. };
  60. return Success(jsonData);
  61. }
  62. /// <summary>
  63. /// 获取表单数据
  64. /// </summary>
  65. /// <param name="keyValue">主键</param>
  66. /// <returns></returns>
  67. [HttpGet]
  68. [AjaxOnly]
  69. public ActionResult GetFormData(string keyValue)
  70. {
  71. var TextBookInfoData = textBookInfoIBLL.GetTextBookInfoEntity(keyValue);
  72. var jsonData = new
  73. {
  74. TextBookInfo = TextBookInfoData,
  75. };
  76. return Success(jsonData);
  77. }
  78. #endregion
  79. #region 提交数据
  80. /// <summary>
  81. /// 删除实体数据
  82. /// </summary>
  83. /// <param name="keyValue">主键</param>
  84. /// <returns></returns>
  85. [HttpPost]
  86. [AjaxOnly]
  87. public ActionResult DeleteForm(string keyValue)
  88. {
  89. textBookInfoIBLL.DeleteEntity(keyValue);
  90. return Success("删除成功!");
  91. }
  92. /// <summary>
  93. /// 保存实体数据(新增、修改)
  94. /// </summary>
  95. /// <param name="keyValue">主键</param>
  96. /// <param name="strEntity">实体</param>
  97. /// <returns></returns>
  98. [HttpPost]
  99. [ValidateAntiForgeryToken]
  100. [AjaxOnly]
  101. public ActionResult SaveForm(string keyValue, string strEntity)
  102. {
  103. TextBookInfoEntity entity = strEntity.ToObject<TextBookInfoEntity>();
  104. if (string.IsNullOrEmpty(keyValue))
  105. {
  106. entity.IsValid = true;
  107. entity.IsDel = 0;
  108. }
  109. else
  110. {
  111. entity.UpdateUserID = LoginUserInfo.Get().userId;
  112. entity.Updatetime = DateTime.Now;
  113. }
  114. var RepetitionList = textBookInfoIBLL.GetRepetitions(keyValue, entity.TextBookNo, entity.TextBookName, entity.PublishNo, entity.DeptNo, entity.Publisher, entity.TextBookNature, entity.TextBookType, entity.Edition, entity.Impression);
  115. if (RepetitionList != null)
  116. {
  117. return Fail("保存失败请检查数据有重复项!");
  118. }
  119. else
  120. {
  121. textBookInfoIBLL.SaveEntity(keyValue, entity);
  122. return Success("保存成功!");
  123. }
  124. }
  125. #endregion
  126. #region 扩展数据
  127. /// <summary>
  128. /// 启用
  129. /// </summary>
  130. /// <param name="keyValue">主键</param>
  131. /// <returns></returns>
  132. [HttpPost]
  133. [AjaxOnly]
  134. public ActionResult EnableEntity(string keyValue, string IsValid)
  135. {
  136. textBookInfoIBLL.EnabOrDisabEntity(keyValue, IsValid);
  137. return Success("启用成功!");
  138. }
  139. /// <summary>
  140. /// 禁用
  141. /// </summary>
  142. /// <param name="keyValue">主键</param>
  143. /// <returns></returns>
  144. [HttpPost]
  145. [AjaxOnly]
  146. public ActionResult DisableEntity(string keyValue, string IsValid)
  147. {
  148. textBookInfoIBLL.EnabOrDisabEntity(keyValue, IsValid);
  149. return Success("禁用成功!");
  150. }
  151. #endregion
  152. }
  153. }