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.
 
 
 
 
 
 

130 lines
3.9 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 Newtonsoft.Json;
  7. using System.Linq;
  8. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2019-08-29 16:50
  15. /// 描 述:选课专业
  16. /// </summary>
  17. public class ElectiveMajorController : MvcControllerBase
  18. {
  19. private ElectiveMajorIBLL electiveMajorIBLL = new ElectiveMajorBLL();
  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="queryJson">查询参数</param>
  45. /// <returns></returns>
  46. [HttpGet]
  47. [AjaxOnly]
  48. public ActionResult GetPageList(string pagination, string queryJson)
  49. {
  50. Pagination paginationobj = pagination.ToObject<Pagination>();
  51. var data = electiveMajorIBLL.GetPageList(paginationobj, queryJson).OrderBy(x => x.MajorNo).ThenBy(x => x.Grade);
  52. var jsonData = new
  53. {
  54. rows = data,
  55. total = paginationobj.total,
  56. page = paginationobj.page,
  57. records = paginationobj.records
  58. };
  59. return Success(jsonData);
  60. }
  61. /// <summary>
  62. /// 获取表单数据
  63. /// <summary>
  64. /// <returns></returns>
  65. [HttpGet]
  66. [AjaxOnly]
  67. public ActionResult GetFormData(string keyValue)
  68. {
  69. var ElectiveMajorData = electiveMajorIBLL.GetElectiveMajorEntity(keyValue);
  70. var jsonData = new
  71. {
  72. ElectiveMajor = ElectiveMajorData,
  73. };
  74. return Success(jsonData);
  75. }
  76. #endregion
  77. #region 提交数据
  78. /// <summary>
  79. /// 删除实体数据
  80. /// <param name="keyValue">主键</param>
  81. /// <summary>
  82. /// <returns></returns>
  83. [HttpPost]
  84. [AjaxOnly]
  85. public ActionResult DeleteForm(string keyValue)
  86. {
  87. electiveMajorIBLL.DeleteEntity(keyValue);
  88. return Success("删除成功!");
  89. }
  90. /// <summary>
  91. /// 保存实体数据(新增、修改)
  92. /// <param name="keyValue">主键</param>
  93. /// <summary>
  94. /// <returns></returns>
  95. [HttpPost]
  96. [ValidateAntiForgeryToken]
  97. [AjaxOnly]
  98. public ActionResult SaveForm(string keyValue, string strEntity)
  99. {
  100. ElectiveMajorEntity entity = strEntity.ToObject<ElectiveMajorEntity>();
  101. electiveMajorIBLL.SaveEntity(keyValue, entity);
  102. return Success("保存成功!");
  103. }
  104. /// <summary>
  105. /// 设置选课专业
  106. /// <param name="keyValue">主键</param>
  107. /// <summary>
  108. /// <returns></returns>
  109. [HttpPost]
  110. [AjaxOnly]
  111. public ActionResult SetElectiveMajor(string keyValue, string olpoeId)
  112. {
  113. //electiveMajorIBLL.SetElectiveMajor(keyValue, olpoeId);
  114. var dataList = JsonConvert.DeserializeObject<List<CdMajorEntity>>(keyValue);
  115. electiveMajorIBLL.SetElectiveMajor(dataList, olpoeId);
  116. return Success("设置成功!");
  117. }
  118. #endregion
  119. }
  120. }