MyEvaluationController.cs 5.0 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 EMIS.Web.Controls;
  10. using Bowin.Common.Utility;
  11. using Bowin.Web.Controls.Mvc;
  12. using Bowin.Common.Data;
  13. namespace EMIS.Web.Controllers.EvaluationManage.MyEvaluation
  14. {
  15. [Authorization]
  16. public class MyEvaluationController : Controller
  17. {
  18. //
  19. // GET: /MyEvaluation/
  20. public IEvaluationAdviseServices evaluationAdviseServices { get; set; }
  21. public ISchoolYearServices schoolYearServices { get; set; }
  22. [HttpGet]
  23. public ActionResult List()
  24. {
  25. var schoolYear = schoolYearServices.GetSchoolYearIsCurrent(true);
  26. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();
  27. return View();
  28. }
  29. [HttpPost]
  30. public ActionResult List(QueryParamsModel pararms)
  31. {
  32. var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
  33. var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown"); //评价表
  34. var evaluationTypeID = pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型
  35. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");//课程
  36. var staffID = EMIS.Utility.FormValidate.CustomPrincipal.Current.UserID;//登录教师ID
  37. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  38. var result = evaluationAdviseServices.GetMyEvaluationViewGrid(configuretView, schoolYearID, coursematerialID, evaluationTableID, evaluationTypeID, staffID, (int)pararms.page, (int)pararms.rows);//, collegeID, departmentID
  39. return Json(result);
  40. }
  41. /// <summary>
  42. /// Excel导出
  43. /// </summary>
  44. /// <returns></returns>
  45. [HttpPost]
  46. public ActionResult Excel()
  47. {
  48. try
  49. {
  50. NpoiExcelHelper neh = new NpoiExcelHelper();
  51. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  52. var schoolYearID = Request.Form["SchoolyearDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>(); //学年学期
  53. var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EvaluationTableDropdown"].ParseStrTo<Guid>();//pararms.getExtraGuid("EvaluationTableDropdown"); //评价表
  54. var evaluationTypeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EvaluationTypeDropdown"].ParseStrTo<Guid>();//pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型
  55. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();//pararms.getExtraGuid("CollegeDropdown");//院系所
  56. //var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();//pararms.getExtraGuid("DepartmentDropdown");//教研室
  57. var staffID = EMIS.Utility.FormValidate.CustomPrincipal.Current.UserID;
  58. //var myEvaluationID = Request.Form["MyEvaluationID"];
  59. //List<Guid?> myEvaluationIDList = new List<Guid?>();
  60. //if (myEvaluationID != "")
  61. //{
  62. // myEvaluationIDList = myEvaluationID.SplitIDString();
  63. //}
  64. //else
  65. //{
  66. // myEvaluationIDList = null;
  67. //}
  68. var dt = evaluationAdviseServices.GetMyEvaluationViewList(configuretView, schoolYearID, coursematerialID, evaluationTableID, evaluationTypeID, staffID).Select(x => new
  69. {
  70. x.SchoolyearCode,
  71. x.CourseName,
  72. x.EducationMissionClassName,
  73. x.EvaluationTypeName,
  74. x.EvaluationTableName,
  75. x.Remark
  76. }).ToTable();
  77. string[] liststring = { "学年学期", "课程名称", "任务班名称", "参评类型", "评价表名", "评语建议" };
  78. neh.Export(dt, liststring, "我的评价");
  79. return RedirectToAction("MsgShow", "Common", new
  80. {
  81. msg = "导出成功!",
  82. url = Url.Content("~/MyEvaluation/List").AddMenuParameter()
  83. });
  84. }
  85. catch (Exception ex)
  86. {
  87. return RedirectToAction("MsgShow", "Common", new
  88. {
  89. msg = "导出失败,原因:" + ex.Message + "!",
  90. url = Url.Content("~/MyEvaluation/List").AddMenuParameter()
  91. });
  92. }
  93. }
  94. }
  95. }