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.
 
 
 
 
 
 

168 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 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. #endregion
  96. #region 提交数据
  97. /// <summary>
  98. /// 删除实体数据
  99. /// </summary>
  100. /// <param name="keyValue">主键</param>
  101. /// <returns></returns>
  102. [HttpPost]
  103. [AjaxOnly]
  104. public ActionResult DeleteForm(string keyValue)
  105. {
  106. scholarshipIBLL.DeleteEntity(keyValue);
  107. return Success("删除成功!");
  108. }
  109. /// <summary>
  110. /// 保存实体数据(新增、修改)
  111. /// </summary>
  112. /// <param name="keyValue">主键</param>
  113. /// <param name="strEntity">实体</param>
  114. /// <returns></returns>
  115. [HttpPost]
  116. [ValidateAntiForgeryToken]
  117. [AjaxOnly]
  118. public ActionResult SaveForm(string keyValue, string strEntity)
  119. {
  120. ScholarshipEntity entity = strEntity.ToObject<ScholarshipEntity>();
  121. var Lists = scholarshipIBLL.NameOrCode(entity.ItemName, entity.ItemCode, entity.IsValid);
  122. if (string.IsNullOrEmpty(keyValue))
  123. {
  124. if (Lists != null)
  125. {
  126. return Fail("添加失败!名称或编码已存在");
  127. }
  128. }
  129. else
  130. {
  131. if (!Lists.Id.Contains(keyValue))
  132. {
  133. return Fail("添加失败!名称或编码已存在");
  134. }
  135. }
  136. scholarshipIBLL.SaveEntity(keyValue, entity);
  137. return Success("保存成功!");
  138. }
  139. #endregion
  140. #region 扩展数据
  141. /// <summary>
  142. /// 启用/禁用
  143. /// </summary>
  144. /// <param name="keyValue"></param>
  145. /// <param name="status"></param>
  146. /// <returns></returns>
  147. [HttpPost]
  148. [AjaxOnly]
  149. public ActionResult EnableDisable(string keyValue, string status)
  150. {
  151. scholarshipIBLL.EnableDisable(keyValue, status);
  152. return Success("操作成功!");
  153. }
  154. #endregion
  155. }
  156. }