ResitController.cs 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using Bowin.Common.Utility;
  2. using Bowin.Common.Data;
  3. using Bowin.Web.Controls.Mvc;
  4. using EMIS.CommonLogic.ScoreManage;
  5. using EMIS.Utility;
  6. using EMIS.ViewModel;
  7. using EMIS.Web.Controls;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Web;
  12. using System.Web.Mvc;
  13. namespace EMIS.Web.Controllers.ScoreManage
  14. {
  15. [Authorization]
  16. public class ResitController : Controller
  17. {
  18. public IResitServices ResitServices { get; set; }
  19. public ActionResult List()
  20. {
  21. return View();
  22. }
  23. [HttpPost]
  24. public ActionResult List(QueryParamsModel pararms)
  25. {
  26. ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  27. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  28. var examinationBatchID = pararms.getExtraGuid("ddlExaminationBatch");
  29. var examinationTypeID = pararms.getExtraGuid("ddlExaminationType");
  30. var examinationProjectID = pararms.getExtraGuid("ddlExaminationProject");
  31. var examinationSubjectID = pararms.getExtraInt("ddlExaminationSubject") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationSubject");
  32. var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
  33. var collegeID = pararms.getExtraGuid("ddlCollege");
  34. var standardID = pararms.getExtraInt("cgbStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cgbStandard");
  35. var classmajorID = pararms.getExtraGuid("cgbClassmajor");
  36. return base.Json(ResitServices.GetResitViewGrid(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  37. examinationSubjectID, schoolAreaID, collegeID, null, standardID, classmajorID, (int)pararms.page, (int)pararms.rows));
  38. }
  39. /// <summary>
  40. /// Excel导出
  41. /// </summary>
  42. /// <param name="pararms"></param>
  43. /// <returns></returns>
  44. [HttpPost]
  45. public ActionResult Excel()
  46. {
  47. NpoiExcelHelper neh = new NpoiExcelHelper();
  48. ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(null);
  49. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  50. var examinationBatchID = Request.Form["dllExaminationBatch"].ParseStrTo<Guid>();
  51. var examinationTypeID = Request.Form["dllExaminationType"].ParseStrTo<Guid>();
  52. var examinationProjectID = Request.Form["dllExaminationProject"].ParseStrTo<Guid>();
  53. var examinationSubjectID = Request.Form["ddlExaminationSubject"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationSubject"].ParseStrTo<int>();
  54. var schoolAreaID = Request.Form["ddlSchoolArea"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlSchoolArea"].ParseStrTo<int>();
  55. var collegeID = Request.Form["ddlCollege"].ParseStrTo<Guid>();
  56. var standardID = Request.Form["cgbStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cgbStandard"].ParseStrTo<int>();
  57. var classmajorID = Request.Form["ddlClassmajor"].ParseStrTo<Guid>();
  58. var dt = ResitServices.GetResitViewList(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  59. examinationSubjectID, schoolAreaID, collegeID, null, standardID, classmajorID).Select(x => new
  60. {
  61. x.SchoolyearCode,
  62. x.ExaminationBatchName,
  63. x.ExaminationTypeName,
  64. x.ExaminationProjectName,
  65. x.ExaminationSubjectName,
  66. x.SchoolAreaName,
  67. x.CollegeName,
  68. x.Year,
  69. x.StandardName,
  70. x.ClassmajorName,
  71. x.UserName,
  72. x.CertificatesTypeName,
  73. x.IDNumber,
  74. x.Score,
  75. Expire = x.Expire.HasValue ? x.Expire.Value.ToString("yyyy-MM-dd") : ""
  76. }).ToTable();
  77. string[] liststring = { "学年学期", "考试批次", "考试类型", "项目名称", "科目", "校区", RSL.Get("College"),
  78. "年级", "专业", "班级", "姓名", "证件类型", "证件号码", "成绩", "有效期" };
  79. neh.Export(dt, liststring, "项目补考名单" + DateTime.Now.ToString("yyyyMMdd"));
  80. return Json(new ReturnMessage()
  81. {
  82. IsSuccess = true,
  83. Message = "导出成功。"
  84. });
  85. }
  86. }
  87. }