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.
 
 
 
 
 
 

178 lines
5.2 KiB

  1. using System;
  2. using Learun.Util;
  3. using System.Data;
  4. using Learun.Application.TwoDevelopment.LR_LGManager;
  5. using System.Web.Mvc;
  6. using System.Collections.Generic;
  7. namespace Learun.Application.Web.Areas.LR_LGManager.Controllers
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  11. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2019-12-13 11:01
  14. /// 描 述:印章使用
  15. /// </summary>
  16. public class StampApplyController : MvcControllerBase
  17. {
  18. private StampApplyIBLL stampApplyIBLL = new StampApplyBLL();
  19. private CorporateMaterialItemIBLL corporateMaterialItemIbll = new CorporateMaterialItemBLL();
  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. [HttpGet]
  40. public ActionResult FormView()
  41. {
  42. return View();
  43. }
  44. #endregion
  45. #region 获取数据
  46. /// <summary>
  47. /// 获取页面显示列表数据
  48. /// <summary>
  49. /// <param name="queryJson">查询参数</param>
  50. /// <returns></returns>
  51. [HttpGet]
  52. [AjaxOnly]
  53. public ActionResult GetPageList(string pagination, string queryJson)
  54. {
  55. Pagination paginationobj = pagination.ToObject<Pagination>();
  56. var data = stampApplyIBLL.GetPageList(paginationobj, queryJson);
  57. var jsonData = new
  58. {
  59. rows = data,
  60. total = paginationobj.total,
  61. page = paginationobj.page,
  62. records = paginationobj.records
  63. };
  64. return Success(jsonData);
  65. }
  66. /// <summary>
  67. /// 获取表单数据
  68. /// <summary>
  69. /// <returns></returns>
  70. [HttpGet]
  71. [AjaxOnly]
  72. public ActionResult GetFormData(string keyValue)
  73. {
  74. var StampApplyData = stampApplyIBLL.GetStampApplyEntity(keyValue);
  75. var listItem = corporateMaterialItemIbll.GetCorporateMaterialItemList(keyValue);
  76. var jsonData = new
  77. {
  78. StampApply = StampApplyData,
  79. ItemList = listItem
  80. };
  81. return Success(jsonData);
  82. }
  83. /// <summary>
  84. /// 获取表单数据
  85. /// <summary>
  86. /// <returns></returns>
  87. [HttpGet]
  88. [AjaxOnly]
  89. public ActionResult GetFormDataByProcessId(string processId)
  90. {
  91. var StampApplyData = stampApplyIBLL.GetEntityByProcessId(processId);
  92. var listItem = corporateMaterialItemIbll.GetCorporateMaterialItemList(StampApplyData.ID);
  93. var jsonData = new
  94. {
  95. StampApply = StampApplyData,
  96. ItemList = listItem
  97. };
  98. return Success(jsonData);
  99. }
  100. #endregion
  101. #region 提交数据
  102. /// <summary>
  103. /// 删除实体数据
  104. /// <param name="keyValue">主键</param>
  105. /// <summary>
  106. /// <returns></returns>
  107. [HttpPost]
  108. [AjaxOnly]
  109. public ActionResult DeleteForm(string keyValue)
  110. {
  111. stampApplyIBLL.DeleteEntity(keyValue);
  112. return Success("删除成功!");
  113. }
  114. /// <summary>
  115. /// 保存实体数据(新增、修改)
  116. /// <param name="keyValue">主键</param>
  117. /// <summary>
  118. /// <returns></returns>
  119. [HttpPost]
  120. [ValidateAntiForgeryToken]
  121. [AjaxOnly]
  122. public ActionResult SaveForm(string keyValue, string strEntity, string strJson)
  123. {
  124. var guidId = keyValue;
  125. StampApplyEntity entity = strEntity.ToObject<StampApplyEntity>();
  126. if (string.IsNullOrEmpty(guidId))
  127. {
  128. guidId = Guid.NewGuid().ToString();
  129. entity.ID = guidId;
  130. stampApplyIBLL.SaveEntity(guidId, entity, true);
  131. }
  132. else
  133. {
  134. stampApplyIBLL.SaveEntity(guidId, entity);
  135. }
  136. var allList = corporateMaterialItemIbll.GetList(keyValue);
  137. foreach (var item in allList)
  138. {
  139. corporateMaterialItemIbll.DeleteEntity(item.ID);
  140. }
  141. if (!string.IsNullOrEmpty(strJson))
  142. {
  143. var itemList = strJson.ToList<CorporateMaterialItemEntity>();
  144. foreach (var item in itemList)
  145. {
  146. item.CMAID = guidId;
  147. corporateMaterialItemIbll.SaveEntity("", item);
  148. }
  149. }
  150. return Success("保存成功!");
  151. }
  152. public ActionResult ModifyStatus(string keyValue, int pastatus, string processId)
  153. {
  154. stampApplyIBLL.ModifyStatus(keyValue, pastatus, processId);
  155. return Success("提交成功!");
  156. }
  157. #endregion
  158. }
  159. }