EvaluationTeacherScoreController.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Bowin.Common.Exceptions;
  7. using Bowin.Common.Utility;
  8. using Bowin.Web.Controls.Mvc;
  9. using EMIS.CommonLogic.EvaluationManage;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.EvaluationManage;
  12. using EMIS.Web.Controls;
  13. using Bowin.Common.Data;
  14. using EMIS.CommonLogic.CalendarManage;
  15. using EMIS.CommonLogic.EducationManagement;
  16. using EMIS.ViewModel.EvaluationManage.EvaluationEnter;
  17. using System.Text;
  18. using System.Collections;
  19. using EMIS.Utility;
  20. using Bowin.Common.JSON;
  21. using EMIS.Entities;
  22. using System.Text.RegularExpressions;
  23. namespace EMIS.Web.Controllers.EvaluationManage.EvaluationTeacherScore
  24. {
  25. [Authorization]
  26. public class EvaluationTeacherScoreController : Controller
  27. {
  28. //
  29. // GET: /EvaluationTeacherScore/教师评价
  30. public IEvaluationTeacherScoreServices EvaluationTeacherScoreServices { get; set; }
  31. public ISchoolYearServices SchoolYearServices { get; set; }
  32. public IEvaluationTypeServices EvaluationTypeServices { get; set; }
  33. [HttpGet]
  34. public ActionResult List()
  35. {
  36. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  37. var EvaluationType = EvaluationTeacherScoreServices.GetEvaluaitonTableTypeID();
  38. ViewBag.EvaluationType = EvaluationType;
  39. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  40. return View();
  41. }
  42. [HttpPost]
  43. public ActionResult List(QueryParamsModel pararms)
  44. {
  45. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  46. //var classmajorID = pararms.getExtraGuid("ClassmajorDropdown"); //班级名称
  47. //var schoolyearCodeID = pararms.getExtraInt("SchoolyearDictionaryDropDown");//年级
  48. //var campusID = pararms.getExtraGuid("CampusDropdown");//校区
  49. var collegeID = pararms.getExtraGuid("CollegeDropdown");//院系所
  50. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  51. //var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");//专业名称
  52. //var staffID = pararms.getExtraGuid("StaffComboGrid");//被评教师
  53. var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
  54. var evaluationTableID = pararms.getExtraGuid("EvaluationTypeDropdown"); //参评类型
  55. var evaluationIntTypeID = pararms.getExtraGuid("EvaluationIntTypeDropdown"); //评价类型
  56. var result = EvaluationTeacherScoreServices.GetEvaluationTeacherScoreViewGrid(configuretView, schoolYearID, evaluationIntTypeID, evaluationTableID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows);
  57. return Json(result);
  58. }
  59. [HttpPost]
  60. public ActionResult EvaluationTypeDropdownListBanid(DropdownListBindType? bindType)
  61. {
  62. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  63. List<DropdownListItem> list = EvaluationTypeServices.GetEvaluationTypeViewList(configuretView, null, null).OrderByDescending(o => o.CreateTime).Select(x => new DropdownListItem { Value = x.IsStudent.ToString(), Text = x.Name }).ToList();
  64. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  65. DropdownList.FormatDropdownItemList(dbt, list);
  66. return base.Json(list);
  67. }
  68. #region 2.0 列表信息导出
  69. [HttpPost]
  70. public ActionResult Excel()
  71. {
  72. try
  73. {
  74. NpoiExcelHelper neh = new NpoiExcelHelper();
  75. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  76. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();//院系所
  77. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  78. var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>(); //学年学期
  79. var evaluationTableID = Request.Form["EvaluationTypeDropdown"].ParseStrTo<Guid>(); //参评类型
  80. var evaluationIntTypeID = Request.Form["EvaluationIntTypeDropdown"].ParseStrTo<Guid>(); //评价类型
  81. var dt = EvaluationTeacherScoreServices.GetEvaluationTeacherScoreViewList(configuretView, schoolYearID, evaluationIntTypeID, evaluationTableID, collegeID, departmentID).Select(x => new
  82. {
  83. x.TeacherNo,
  84. x.TeacherName,
  85. x.CourseName,
  86. x.CommentCount,
  87. x.Average,
  88. x.EducationMissionClassName,
  89. x.EvaluationTableTypeName,
  90. x.EvaluationIntTypeName,
  91. x.CollegeRanking,
  92. x.DepartmentRanking
  93. }).ToTable();
  94. string[] liststring = { "教师工号", "教师名称", "课程名称", "参评人次", "平均分", "任务班名称", "参评类型", "评价类型", RSL.Get("College")+"排名", "教研室排名" };
  95. //string[] liststring = { "评价编号", "课程名称", "评价类型 ", "被评教师号", "被评教师", "任务班名称", "参评类型 ", "已评次数" };
  96. neh.Export(dt, liststring, "教师评分");
  97. return RedirectToAction("MsgShow", "Common", new
  98. {
  99. msg = "导出成功!",
  100. url = Url.Content("~/EvaluationTeacherScore/List").AddMenuParameter()
  101. });
  102. }
  103. catch (Exception ex)
  104. {
  105. return RedirectToAction("MsgShow", "Common", new
  106. {
  107. msg = "导出失败,原因:" + ex.Message + "!",
  108. url = Url.Content("~/EvaluationTeacherScore/List").AddMenuParameter()
  109. });
  110. }
  111. }
  112. #endregion
  113. }
  114. }