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.
 
 
 
 
 
 

182 lines
5.2 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 V7.0.6 力软敏捷开发框架
  11. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2021-09-27 10:33
  14. /// 描 述:学金类型
  15. /// </summary>
  16. public class ScholarshipController : MvcControllerBase
  17. {
  18. private ScholarshipIBLL scholarshipIBLL = new ScholarshipBLL();
  19. #region 视图功能
  20. /// <summary>
  21. /// 主页面
  22. /// <summary>
  23. /// <returns></returns>
  24. [HttpGet]
  25. public ActionResult Index()
  26. {
  27. return View();
  28. }
  29. /// <summary>
  30. /// 表单页
  31. /// <summary>
  32. /// <returns></returns>
  33. [HttpGet]
  34. public ActionResult Form()
  35. {
  36. return View();
  37. }
  38. /// <summary>
  39. /// 主页面
  40. /// <summary>
  41. /// <returns></returns>
  42. [HttpGet]
  43. public ActionResult Indexzxj()
  44. {
  45. return View();
  46. }
  47. /// <summary>
  48. /// 表单页
  49. /// <summary>
  50. /// <returns></returns>
  51. [HttpGet]
  52. public ActionResult Formzxj()
  53. {
  54. return View();
  55. }
  56. #endregion
  57. #region 获取数据
  58. /// <summary>
  59. /// 获取页面显示列表数据
  60. /// </summary>
  61. /// <param name="pagination">分页参数</param>
  62. /// <param name="queryJson">查询参数</param>
  63. /// <returns></returns>
  64. [HttpGet]
  65. [AjaxOnly]
  66. public ActionResult GetPageList(string pagination, string queryJson)
  67. {
  68. Pagination paginationobj = pagination.ToObject<Pagination>();
  69. var data = scholarshipIBLL.GetPageList(paginationobj, queryJson);
  70. var jsonData = new
  71. {
  72. rows = data,
  73. total = paginationobj.total,
  74. page = paginationobj.page,
  75. records = paginationobj.records
  76. };
  77. return Success(jsonData);
  78. }
  79. /// <summary>
  80. /// 获取表单数据
  81. /// </summary>
  82. /// <param name="keyValue">主键</param>
  83. /// <returns></returns>
  84. [HttpGet]
  85. [AjaxOnly]
  86. public ActionResult GetFormData(string keyValue)
  87. {
  88. var ScholarshipData = scholarshipIBLL.GetScholarshipEntity(keyValue);
  89. var jsonData = new
  90. {
  91. Scholarship = ScholarshipData,
  92. };
  93. return Success(jsonData);
  94. }
  95. /// <summary>
  96. /// 获取页面显示列表数据
  97. /// </summary>
  98. /// <param name="queryJson">查询参数</param>
  99. /// <returns></returns>
  100. [HttpGet]
  101. [AjaxOnly]
  102. public ActionResult GetList(string queryJson)
  103. {
  104. var data = scholarshipIBLL.GetList(queryJson);
  105. return Success(data);
  106. }
  107. #endregion
  108. #region 提交数据
  109. /// <summary>
  110. /// 删除实体数据
  111. /// </summary>
  112. /// <param name="keyValue">主键</param>
  113. /// <returns></returns>
  114. [HttpPost]
  115. [AjaxOnly]
  116. public ActionResult DeleteForm(string keyValue)
  117. {
  118. scholarshipIBLL.DeleteEntity(keyValue);
  119. return Success("删除成功!");
  120. }
  121. /// <summary>
  122. /// 保存实体数据(新增、修改)
  123. /// </summary>
  124. /// <param name="keyValue">主键</param>
  125. /// <param name="strEntity">实体</param>
  126. /// <returns></returns>
  127. [HttpPost]
  128. [ValidateAntiForgeryToken]
  129. [AjaxOnly]
  130. public ActionResult SaveForm(string keyValue, string strEntity)
  131. {
  132. ScholarshipEntity entity = strEntity.ToObject<ScholarshipEntity>();
  133. var Lists = scholarshipIBLL.NameOrCode(entity.ItemName, entity.ItemCode, entity.IsType);
  134. if (string.IsNullOrEmpty(keyValue))
  135. {
  136. if (Lists != null)
  137. {
  138. return Fail("添加失败!名称或编码已存在");
  139. }
  140. }
  141. else
  142. {
  143. if (Lists != null && !Lists.Id.Equals(keyValue))
  144. {
  145. return Fail("添加失败!名称或编码已存在");
  146. }
  147. }
  148. scholarshipIBLL.SaveEntity(keyValue, entity);
  149. return Success("保存成功!");
  150. }
  151. #endregion
  152. #region 扩展数据
  153. /// <summary>
  154. /// 启用/禁用
  155. /// </summary>
  156. /// <param name="keyValue"></param>
  157. /// <param name="status"></param>
  158. /// <returns></returns>
  159. [HttpPost]
  160. [AjaxOnly]
  161. public ActionResult EnableDisable(string keyValue, string status)
  162. {
  163. scholarshipIBLL.EnableDisable(keyValue, status);
  164. return Success("操作成功!");
  165. }
  166. #endregion
  167. }
  168. }