MinorPlanApproveController.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.Web.Controls;
  8. using Bowin.Web.Controls.Mvc;
  9. using EMIS.CommonLogic.MinorManage.MinorPlanManage;
  10. using EMIS.Utility.FormValidate;
  11. using Bowin.Common.Utility;
  12. using Bowin.Common.Data;
  13. using EMIS.Utility;
  14. namespace EMIS.Web.Controllers.MinorManage.MinorPlanManage
  15. {
  16. [Authorization]
  17. public class MinorPlanApproveController : Controller
  18. {
  19. //
  20. // GET: /MinorPlanApprove/
  21. public IMinorPlanApproveServices MinorPlanApproveServices { get; set; }
  22. public ActionResult List()
  23. {
  24. return View();
  25. }
  26. [HttpPost]
  27. public ActionResult List(QueryParamsModel pararms)
  28. {
  29. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  30. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  31. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  32. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  33. var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
  34. return this.Json(MinorPlanApproveServices.GetMinorPlanApplyViewGrid(configuretView, yearID, standardID, collegeID, approvalStatus, (int)pararms.page, (int)pararms.rows));
  35. }
  36. /// <summary>
  37. /// 审批确定(批量)
  38. /// </summary>
  39. /// <param name="planApplicationIDs"></param>
  40. /// <param name="actionID"></param>
  41. /// <param name="comment"></param>
  42. /// <returns></returns>
  43. [HttpPost]
  44. public ActionResult Approve(string GradeMinorApplicationIDs, Guid actionID, string comment)
  45. {
  46. var GradeMinorApplicationIDList = GradeMinorApplicationIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  47. var curUserID = CustomPrincipal.Current.UserID;
  48. if (GradeMinorApplicationIDList.Count == 0)
  49. {
  50. return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行审核。" });
  51. }
  52. try
  53. {
  54. MinorPlanApproveServices.Approve(GradeMinorApplicationIDList, curUserID, actionID, comment);
  55. return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
  56. }
  57. catch (Exception ex)
  58. {
  59. return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message });
  60. }
  61. }
  62. /// <summary>
  63. /// 导出Excel
  64. /// </summary>
  65. /// <returns></returns>
  66. [HttpPost]
  67. public ActionResult Excel()
  68. {
  69. NpoiExcelHelper neh = new NpoiExcelHelper();
  70. var GradeMinorApplicationID = Request.Form["GradeMinorApplicationID"];
  71. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  72. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  73. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  74. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  75. var approvalStatus = Request.Form["GrademinorStatusDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["GrademinorStatusDictionaryDropDown"].ParseStrTo<int>();
  76. List<Guid?> GradeMinorApplicationIDList = new List<Guid?>();
  77. if (GradeMinorApplicationID != "")
  78. {
  79. GradeMinorApplicationIDList = GradeMinorApplicationID.SplitIDString();
  80. }
  81. else
  82. {
  83. GradeMinorApplicationIDList = null;
  84. }
  85. var dt = MinorPlanApproveServices.GetMinorPlanApplyViewList(configuretView, yearID, standardID, collegeID, approvalStatus, GradeMinorApplicationIDList).Select(x => new
  86. {
  87. x.YearID,
  88. x.StandardCode,
  89. x.StandardName,
  90. x.CollegeName,
  91. x.StudentLimit,
  92. x.CreateTime,
  93. x.CreateUserName,
  94. x.ApprovalStatusName
  95. }).ToTable();
  96. string[] liststring = { "年级", "专业代码", "专业名称", RSL.Get("College"), "人数上限","申请时间",
  97. "申请人","状态"};
  98. neh.Export(dt, liststring, "辅修申请审核信息");
  99. return Json(new ReturnMessage()
  100. {
  101. IsSuccess = true,
  102. Message = "导出成功。"
  103. });
  104. }
  105. }
  106. }