TeacherEvaluationCountController.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.TeacherEvaluationCount
  16. {
  17. [Authorization]
  18. public class TeacherEvaluationCountController : Controller
  19. {
  20. public ITeacherEvaluationCountServices TeacherEvaluationCountServices { get; set; }
  21. public ISchoolYearServices SchoolYearServices { get; set; }
  22. //
  23. // GET: /TeacherEvaluationCount/
  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 departmentID = pararms.getExtraGuid("DepartmentDropdown"); //教研室
  36. var typeID = pararms.getExtraGuid("EvaluationTypeDropdown");//评价类型
  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 = TeacherEvaluationCountServices.GetTeacherView(configuretView, collegeID, schoolyearID, typeID, departmentID, (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 typeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo<Guid>();
  57. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  58. //var SchoolyearNumID = Request.Form["ddlYear"].ParseStrTo<int>() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  59. //var standardID = Request.Form["ddlStandard"].ParseStrTo<int>() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["ddlStandard"].ParseStrTo<int>();
  60. var dt = TeacherEvaluationCountServices.GetTeacherView(configuretView, collegeID, schoolyearID, typeID, departmentID).Select(x => new
  61. {
  62. x.SchoolyearCode,
  63. x.TeacherNo,
  64. x.TeacherName,
  65. x.NeedEvaluationCount,
  66. x.CompleteCount,
  67. x.UncompletedCount
  68. }).ToTable();
  69. string[] liststring = { "学年学期", "教师工号", "教师名称", "需评人次", "已评人次", "未评人次" };
  70. //string[] liststring = { "评价编号", "课程名称", "评价类型 ", "被评教师号", "被评教师", "任务班名称", "参评类型 ", "已评次数" };
  71. neh.Export(dt, liststring, "教师评价人次");
  72. return RedirectToAction("MsgShow", "Common", new
  73. {
  74. msg = "导出成功!",
  75. url = Url.Content("~/TeacherEvaluationCount/List").AddMenuParameter()
  76. });
  77. }
  78. catch (Exception ex)
  79. {
  80. return RedirectToAction("MsgShow", "Common", new
  81. {
  82. msg = "导出失败,原因:" + ex.Message + "!",
  83. url = Url.Content("~/TeacherEvaluationCount/List").AddMenuParameter()
  84. });
  85. }
  86. }
  87. #endregion
  88. }
  89. }