SOCScoreController.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.DQPSystem;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Common.Data;
  10. using Bowin.Web.Controls.Mvc;
  11. using Bowin.Common.Utility;
  12. using EMIS.Utility;
  13. namespace EMIS.Web.Controllers.DQPSystem
  14. {
  15. [Authorization]
  16. public class SOCScoreController : Controller
  17. {
  18. public ISOCScoreServices SOCScoreServices { get; set; }
  19. public ActionResult CourseList()
  20. {
  21. return View();
  22. }
  23. [HttpPost]
  24. public ActionResult CourseList(QueryParamsModel pararms)
  25. {
  26. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  27. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  28. var collegeID = pararms.getExtraGuid("cgbCollege");
  29. var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  30. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  31. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  32. var coursematerialID = pararms.getExtraGuid("cgbCourse");
  33. return base.Json(SOCScoreServices.GetSOCCourseScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
  34. coursematerialID, (int)pararms.page, (int)pararms.rows));
  35. }
  36. [HttpPost]
  37. public ActionResult CourseExcel()
  38. {
  39. NpoiExcelHelper neh = new NpoiExcelHelper();
  40. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  41. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  42. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  43. var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  44. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  45. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  46. var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
  47. var dt = SOCScoreServices.GetSOCCourseScoreViewList(configuretView, schoolyearID, collegeID, yearID,
  48. standardID, classmajorID, coursematerialID)
  49. .Select(x => new
  50. {
  51. x.SchoolyearCode,
  52. x.CourseCode,
  53. x.CourseName,
  54. TotalCredit = x.TotalCredit.HasValue ? x.TotalCredit.Value.ToString("#.#") : null,
  55. x.CollegeName,
  56. x.Gradeyear,
  57. x.StandardDesc,
  58. x.ClassmajorName,
  59. x.LoginID,
  60. x.Name,
  61. TotalScore = x.TotalScore.HasValue ? x.TotalScore.Value.ToString("#.#") : null,
  62. Credit = x.Credit.HasValue ? x.Credit.Value.ToString("#.#") : null
  63. }).ToTable();
  64. string[] liststring = {
  65. "学年学期", "课程代码", "课程名称", "课程学分", RSL.Get("College"), "年级", "专业",
  66. "班级", "学号", "姓名", "总成绩", "学分"
  67. };
  68. neh.Export(dt, liststring, "SOC课程成绩表" + DateTime.Now.ToString("yyyyMMdd"));
  69. return Json(new ReturnMessage()
  70. {
  71. IsSuccess = true,
  72. Message = "导出成功。"
  73. });
  74. }
  75. }
  76. }