MinorGraduationListController.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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.MinorGraduation.MinorGraduationManage;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using Bowin.Common.Utility;
  11. using Bowin.Common.Data;
  12. namespace EMIS.Web.Controllers.MinorGraduation.MinorGraduationManage
  13. {
  14. [Authorization]
  15. public class MinorGraduationListController : Controller
  16. {
  17. //
  18. // GET: /MinorGraduationList/
  19. public IMinorGraduationApplyServices minorGraduationApplyServices { get; set; }
  20. public ActionResult List()
  21. {
  22. return View();
  23. }
  24. [HttpPost]
  25. public ActionResult List(QueryParamsModel pararms)
  26. {
  27. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  28. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  29. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  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. //毕业类型
  33. var graduationTypeID = pararms.getExtraInt("DictionaryGraduationType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGraduationType");
  34. //在校状态
  35. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  36. //毕业结论
  37. var graduationResult = pararms.getExtraInt("DictionaryGraduationResult") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGraduationResult");
  38. //审核状态名单只显示通过的
  39. var approvalStatus = minorGraduationApplyServices.GetCorrectEndStatus();
  40. return base.Json(minorGraduationApplyServices.GetMinorGraduationListGrid(configuretView, gradSchoolyearID, collegeID, yearID,
  41. standardID, graduationTypeID, inSchoolStatus, graduationResult, approvalStatus, (int)pararms.page, (int)pararms.rows));
  42. }
  43. [HttpPost]
  44. public ActionResult Excel()
  45. {
  46. NpoiExcelHelper neh = new NpoiExcelHelper();
  47. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  48. //var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  49. var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  50. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  51. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  52. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  53. //毕业类型
  54. var graduationTypeID = Request.Form["DictionaryGraduationType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGraduationType"].ParseStrTo<int>();
  55. //在校状态
  56. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  57. //毕业结论
  58. var graduationResult = Request.Form["DictionaryGraduationResult"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGraduationResult"].ParseStrTo<int>();
  59. //审核状态
  60. var approvalStatus = minorGraduationApplyServices.GetCorrectEndStatus();
  61. var minorGraduationApplyIDString = Request.Form["SelectedID"];
  62. var minorGraduationApplyIDList = minorGraduationApplyIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  63. var dt = minorGraduationApplyServices.GetMinorGraduationListList(configuretView, gradSchoolyearID, collegeID, yearID,
  64. standardID, graduationTypeID, inSchoolStatus, graduationResult, approvalStatus, minorGraduationApplyIDList)
  65. .Select(x => new
  66. {
  67. x.GraduatingSemesterCode,
  68. x.StudentNo,
  69. x.UserName,
  70. x.SexName,
  71. x.GraduationTypeName,
  72. x.ClassminorName,
  73. x.CollegeName,
  74. x.MinorGraduationResultName,
  75. x.ApprovalResult,
  76. x.Remark,
  77. x.ApprovalStatusName
  78. }).ToTable();
  79. string[] liststring = {
  80. "毕业学期", "学号", "姓名", "性别", "毕业类型", "辅修班级", "院系所", "毕业结论", "预审说明", "备注", "审核状态"
  81. };
  82. neh.Export(dt, liststring, "辅修毕业名单信息" + DateTime.Now.ToString("yyyyMMdd"));
  83. return Json(new ReturnMessage()
  84. {
  85. IsSuccess = true,
  86. Message = "导出成功。"
  87. });
  88. }
  89. [HttpPost]
  90. public ActionResult Delete(string minorGraduationApplyIDs)
  91. {
  92. try
  93. {
  94. List<Guid?> list = minorGraduationApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  95. .Select(x => (Guid?)new Guid(x)).ToList();
  96. minorGraduationApplyServices.MinorGraduationApplyDelete(list);
  97. return base.Json("删除成功。");
  98. }
  99. catch (Exception ex)
  100. {
  101. return base.Json("删除失败,原因:" + ex.Message);
  102. }
  103. }
  104. }
  105. }