SatisfyRateReportController.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.Web.Controls;
  8. using Bowin.Common.Data;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.CommonLogic.EvaluationManage;
  11. using Bowin.Common.Utility;
  12. namespace EMIS.Web.Controllers.EvaluationManage.EvaluationReport
  13. {
  14. [Authorization]
  15. public class SatisfyRateReportController : Controller
  16. {
  17. public ISatisfyRateServices SatisfyRateServices { get; set; }
  18. public ActionResult Index()
  19. {
  20. return View();
  21. }
  22. [HttpPost]
  23. public ActionResult List(QueryParamsModel pararms)
  24. {
  25. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  26. var collegeID = pararms.getExtraGuid("cbgCollege");
  27. var evaluationTypeID = pararms.getExtraGuid("ddlEvaluationType");
  28. var teacherTypeID = pararms.getExtraInt("ddlTeacherType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlTeacherType");
  29. var result = SatisfyRateServices.GetSatisfyRateViewList(configuretView, evaluationTypeID, collegeID, teacherTypeID, (int)pararms.page, (int)pararms.rows);
  30. return Json(result);
  31. }
  32. [HttpPost]
  33. public ActionResult Excel()
  34. {
  35. NpoiExcelHelper neh = new NpoiExcelHelper();
  36. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  37. var collegeID = Request.Form["cbgCollege"].ParseStrTo<Guid>();
  38. var evaluationTypeID = Request.Form["ddlEvaluationType"].ParseStrTo<Guid>();
  39. var teacherTypeID = Request.Form["ddlTeacherType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlTeacherType"].ParseStrTo<int>();
  40. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  41. var dt = SatisfyRateServices.GetSatisfyRateViewList(configuretView, evaluationTypeID, collegeID, teacherTypeID).Select(x => new
  42. {
  43. x.LoginID,
  44. x.Name,
  45. x.TeacherTypeDesc,
  46. x.CollegeName,
  47. SatisfyRate = string.Format("{0:#.0}", x.SatisfyRate)
  48. }).ToTable();
  49. string[] liststring = { "教师工号", "教师姓名", "教师类型", "所在教学点", "满意率" };
  50. neh.Export(dt, liststring, "教师满意率信息");
  51. return RedirectToAction("MsgShow", "Common", new
  52. {
  53. msg = "导出成功。",
  54. url = Url.Content("~/SatisfyRateReport/Index").AddMenuParameter()
  55. });
  56. }
  57. }
  58. }