using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Common.Data; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.EvaluationManage; using Bowin.Common.Utility; namespace EMIS.Web.Controllers.EvaluationManage.EvaluationReport { [Authorization] public class SatisfyRateReportController : Controller { public ISatisfyRateServices SatisfyRateServices { get; set; } public ActionResult Index() { return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var collegeID = pararms.getExtraGuid("cbgCollege"); var evaluationTypeID = pararms.getExtraGuid("ddlEvaluationType"); var teacherTypeID = pararms.getExtraInt("ddlTeacherType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlTeacherType"); var result = SatisfyRateServices.GetSatisfyRateViewList(configuretView, evaluationTypeID, collegeID, teacherTypeID, (int)pararms.page, (int)pararms.rows); return Json(result); } [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var collegeID = Request.Form["cbgCollege"].ParseStrTo(); var evaluationTypeID = Request.Form["ddlEvaluationType"].ParseStrTo(); var teacherTypeID = Request.Form["ddlTeacherType"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlTeacherType"].ParseStrTo(); if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = ""; var dt = SatisfyRateServices.GetSatisfyRateViewList(configuretView, evaluationTypeID, collegeID, teacherTypeID).Select(x => new { x.LoginID, x.Name, x.TeacherTypeDesc, x.CollegeName, SatisfyRate = string.Format("{0:#.0}", x.SatisfyRate) }).ToTable(); string[] liststring = { "教师工号", "教师姓名", "教师类型", "所在教学点", "满意率" }; neh.Export(dt, liststring, "教师满意率信息"); return RedirectToAction("MsgShow", "Common", new { msg = "导出成功。", url = Url.Content("~/SatisfyRateReport/Index").AddMenuParameter() }); } } }