MinorControlController.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.MinorManage.MinorSetting;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.ViewModel.MinorManage.MinorSetting;
  11. namespace EMIS.Web.Controllers.MinorManage.MinorSetting
  12. {
  13. [Authorization]
  14. public class MinorControlController : Controller
  15. {
  16. //
  17. // GET: /MinorControl/
  18. public IMinorControlServices minorControlServices { get; set; }
  19. /// <summary>
  20. /// 辅修控制列表查询
  21. /// </summary>
  22. /// <returns></returns>
  23. public ActionResult List()
  24. {
  25. return View();
  26. }
  27. /// <summary>
  28. /// 重修控制列表查询
  29. /// </summary>
  30. /// <param name="pararms"></param>
  31. /// <returns></returns>
  32. [HttpPost]
  33. public ActionResult List(QueryParamsModel pararms)
  34. {
  35. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  36. Guid? schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  37. Guid? collegeID = pararms.getExtraGuid("CollegeComboGrid");
  38. int? gradeID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  39. return base.Json(minorControlServices.GetMinorControlViewList(configuretView, schoolyearID, gradeID, collegeID, (int)pararms.page, (int)pararms.rows));
  40. }
  41. /// <summary>
  42. /// 复制新增
  43. /// </summary>
  44. /// <param name="graduationApplyID"></param>
  45. /// <returns></returns>
  46. public ActionResult CopyAdd(Guid minorControlID)
  47. {
  48. MinorControlView minorControlView = new MinorControlView();
  49. minorControlView = minorControlServices.GetMinorControlView(minorControlID);
  50. return View("Edit", minorControlView);
  51. }
  52. /// <summary>
  53. /// 复制新增
  54. /// </summary>
  55. /// <param name="graduationApplyView"></param>
  56. /// <returns></returns>
  57. [HttpPost]
  58. public ActionResult CopyAdd(MinorControlView minorControlView)
  59. {
  60. minorControlView.MinorControlID = Guid.Empty;
  61. return this.Edit(minorControlView);
  62. }
  63. public ActionResult Edit(Guid? minorControlID)
  64. {
  65. MinorControlView minorControlView = new MinorControlView();
  66. if (minorControlID.HasValue)
  67. {
  68. minorControlView = minorControlServices.GetMinorControlView(minorControlID);
  69. }
  70. return View(minorControlView);
  71. }
  72. /// <summary>
  73. /// 编辑(新增、修改)
  74. /// </summary>
  75. /// <param name="graduationApplyView"></param>
  76. /// <returns></returns>
  77. [HttpPost]
  78. public ActionResult Edit(MinorControlView minorControlView)
  79. {
  80. try
  81. {
  82. minorControlServices.MinorControlEdit(minorControlView);
  83. return Json(new ReturnMessage()
  84. {
  85. IsSuccess = true,
  86. Message = "保存成功。"
  87. });
  88. }
  89. catch (Exception ex)
  90. {
  91. return Json(new ReturnMessage()
  92. {
  93. IsSuccess = false,
  94. Message = "保存失败,原因:" + ex.Message
  95. });
  96. }
  97. }
  98. /// <summary>
  99. /// 删除
  100. /// </summary>
  101. /// <param name="graduationApplyIDs"></param>
  102. /// <returns></returns>
  103. [HttpPost]
  104. public ActionResult Delete(string minorControlIDs)
  105. {
  106. try
  107. {
  108. List<Guid?> list = minorControlIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  109. .Select(x => (Guid?)new Guid(x)).ToList();
  110. minorControlServices.MinorControlDelete(list);
  111. return base.Json("删除成功。");
  112. }
  113. catch (Exception ex)
  114. {
  115. return base.Json("删除失败,原因:" + ex.Message);
  116. }
  117. }
  118. }
  119. }