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.
 
 
 
 
 
 

156 lines
4.6 KiB

  1. using System;
  2. using Learun.Application.TwoDevelopment.EducationalAdministration;
  3. using Learun.Util;
  4. using System.Data;
  5. using System.Web.Mvc;
  6. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  10. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  11. /// 创 建:超级管理员
  12. /// 日 期:2022-03-02 10:37
  13. /// 描 述:教材库存表
  14. /// </summary>
  15. public class TextBookInOutController : MvcControllerBase
  16. {
  17. private TextBookInOutIBLL textbookInOutIBLL = new TextbookInOutBLL();
  18. #region 视图功能
  19. /// <summary>
  20. /// 主页面
  21. /// </summary>
  22. /// <returns></returns>
  23. [HttpGet]
  24. public ActionResult Index()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 表单页
  30. /// </summary>
  31. /// <returns></returns>
  32. [HttpGet]
  33. public ActionResult Form()
  34. {
  35. ViewBag.BookCode = "KC" + DateTime.Now.ToString("yyyyMMddHHmmss");
  36. return View();
  37. }
  38. #endregion
  39. #region 获取数据
  40. /// <summary>
  41. /// 获取列表数据
  42. /// </summary>
  43. /// <param name="queryJson">查询参数</param>
  44. /// <returns></returns>
  45. [HttpGet]
  46. [AjaxOnly]
  47. public ActionResult GetList(string queryJson)
  48. {
  49. var data = textbookInOutIBLL.GetList(queryJson);
  50. return Success(data);
  51. }
  52. /// <summary>
  53. /// 获取列表分页数据
  54. /// </summary>
  55. /// <param name="pagination">分页参数</param>
  56. /// <param name="queryJson">查询参数</param>
  57. /// <returns></returns>
  58. [HttpGet]
  59. [AjaxOnly]
  60. public ActionResult GetPageList(string pagination, string queryJson)
  61. {
  62. Pagination paginationobj = pagination.ToObject<Pagination>();
  63. var data = textbookInOutIBLL.GetPageList(paginationobj, queryJson);
  64. var jsonData = new
  65. {
  66. rows = data,
  67. total = paginationobj.total,
  68. page = paginationobj.page,
  69. records = paginationobj.records
  70. };
  71. return Success(jsonData);
  72. }
  73. /// <summary>
  74. /// 获取表单数据
  75. /// </summary>
  76. /// <param name="keyValue">主键</param>
  77. /// <returns></returns>
  78. [HttpGet]
  79. [AjaxOnly]
  80. public ActionResult GetFormData(string keyValue)
  81. {
  82. var TextBookInOutData = textbookInOutIBLL.GetEntity(keyValue);
  83. var jsonData = new
  84. {
  85. TextBookInOut = TextBookInOutData,
  86. };
  87. return Success(jsonData);
  88. }
  89. #endregion
  90. #region 提交数据
  91. /// <summary>
  92. /// 删除实体数据
  93. /// </summary>
  94. /// <param name="keyValue">主键</param>
  95. /// <returns></returns>
  96. [HttpPost]
  97. [AjaxOnly]
  98. public ActionResult DeleteForm(string keyValue)
  99. {
  100. textbookInOutIBLL.DeleteEntity(keyValue);
  101. return Success("删除成功!");
  102. }
  103. /// <summary>
  104. /// 保存实体数据(新增、修改)
  105. /// </summary>
  106. /// <param name="keyValue">主键</param>
  107. /// <param name="entity">实体</param>
  108. /// <returns></returns>
  109. [HttpPost]
  110. [ValidateAntiForgeryToken]
  111. [AjaxOnly]
  112. public ActionResult SaveForm(string keyValue, string strEntity)
  113. {
  114. var loginUserInfo = LoginUserInfo.Get();
  115. TextbookInOutEntity entity = strEntity.ToObject<TextbookInOutEntity>();
  116. if (string.IsNullOrEmpty(keyValue))
  117. {
  118. entity.IsDel = 0;
  119. entity.IsSubmit = 0;
  120. entity.FinallyNum = 0;
  121. entity.CreateTime = DateTime.Now;
  122. entity.CrateUserID = loginUserInfo.userId;
  123. }
  124. else
  125. {
  126. entity.UpTime = DateTime.Now;
  127. entity.UpUserID = loginUserInfo.userId;
  128. }
  129. textbookInOutIBLL.SaveEntity(keyValue, entity);
  130. return Success("保存成功!");
  131. }
  132. /// <summary>
  133. /// 提交
  134. /// </summary>
  135. /// <param name="keyValue"></param>
  136. /// <returns></returns>
  137. [HttpPost]
  138. [AjaxOnly]
  139. public ActionResult SubmitForm(string keyValue)
  140. {
  141. textbookInOutIBLL.SubmitEntity(keyValue);
  142. return Success("删除成功!");
  143. }
  144. #endregion
  145. }
  146. }