StudentEvaluationCountController.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.EvaluationManage;
  7. using EMIS.CommonLogic.CalendarManage;
  8. using EMIS.ViewModel;
  9. using Bowin.Common.Data;
  10. using Bowin.Common.Utility;
  11. using EMIS.Web.Controls;
  12. using Bowin.Web.Controls.Mvc;
  13. using System.Linq.Expressions;
  14. using EMIS.Entities;
  15. namespace EMIS.Web.Controllers.EvaluationManage.StudentEvaluationCount
  16. {
  17. [Authorization]
  18. public class StudentEvaluationCountController : Controller
  19. {
  20. //
  21. // GET: /StudentEvaluationCount/
  22. public IStudentEvaluationCountServices StudentEvaluationCountServices { get; set; }
  23. public ISchoolYearServices SchoolYearServices { get; set; }
  24. [HttpGet]
  25. public ActionResult List()
  26. {
  27. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  28. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  29. return View();
  30. }
  31. [HttpPost]
  32. public ActionResult List(QueryParamsModel pararms)
  33. {
  34. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  35. var classID = pararms.getExtraGuid("cgClassmajor"); //班级名称
  36. var standardID = pararms.getExtraInt("ddlStandard");//专业名称
  37. var SchoolyearNumID = pararms.getExtraInt("ddlYear") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");//年级
  38. var collegeID = pararms.getExtraGuid("cgCollege");//院系所
  39. var schoolyearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
  40. var result = StudentEvaluationCountServices.GetStudentView(configuretView, SchoolyearNumID, collegeID, schoolyearID, standardID, classID, (int)pararms.page, (int)pararms.rows);
  41. return Json(result);
  42. }
  43. #region 2.0 列表信息导出
  44. [HttpPost]
  45. public ActionResult Excel()
  46. {
  47. try
  48. {
  49. NpoiExcelHelper neh = new NpoiExcelHelper();
  50. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  51. //var subjectID = Request.Form["ddlExaminationSubject"].ParseStrTo<Guid>();
  52. var collegeID = Request.Form["cgCollege"].ParseStrTo<Guid>();
  53. var schoolyearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>();
  54. var classID = Request.Form["cgClassmajor"].ParseStrTo<Guid>();
  55. //var examinationTypeID = Request.Form["cgExamination"].ParseStrTo<Guid>();
  56. var SchoolyearNumID = Request.Form["ddlYear"].ParseStrTo<int>() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  57. var standardID = Request.Form["ddlStandard"].ParseStrTo<int>() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["ddlStandard"].ParseStrTo<int>();
  58. var dt = StudentEvaluationCountServices.GetStudentView(configuretView, SchoolyearNumID, collegeID, schoolyearID, standardID, classID).Select(x => new
  59. {
  60. x.StudentNo,
  61. x.Name,
  62. x.ClassmajorName,
  63. x.NeedEvaluationCount,
  64. x.CompleteCount,
  65. x.UncompletedCount
  66. }).ToTable();
  67. string[] liststring = { "学号", "姓名", "班级名称", "需评人次", "已评人次", "未评人次" };
  68. //string[] liststring = { "评价编号", "课程名称", "评价类型 ", "被评教师号", "被评教师", "任务班名称", "参评类型 ", "已评次数" };
  69. neh.Export(dt, liststring, "学生评价人次");
  70. return RedirectToAction("MsgShow", "Common", new
  71. {
  72. msg = "导出成功!",
  73. url = Url.Content("~/StudentEvaluationCount/List").AddMenuParameter()
  74. });
  75. }
  76. catch (Exception ex)
  77. {
  78. return RedirectToAction("MsgShow", "Common", new
  79. {
  80. msg = "导出失败,原因:" + ex.Message + "!",
  81. url = Url.Content("~/StudentEvaluationCount/List").AddMenuParameter()
  82. });
  83. }
  84. }
  85. #endregion
  86. }
  87. }