using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.EvaluationManage; using EMIS.CommonLogic.CalendarManage; using EMIS.ViewModel; using Bowin.Common.Data; using Bowin.Common.Utility; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using System.Linq.Expressions; using EMIS.Entities; namespace EMIS.Web.Controllers.EvaluationManage.TeacherEvaluationCount { [Authorization] public class TeacherEvaluationCountController : Controller { public ITeacherEvaluationCountServices TeacherEvaluationCountServices { get; set; } public ISchoolYearServices SchoolYearServices { get; set; } // // GET: /TeacherEvaluationCount/ [HttpGet] public ActionResult List() { var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true); ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年 return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var departmentID = pararms.getExtraGuid("DepartmentDropdown"); //教研室 var typeID = pararms.getExtraGuid("EvaluationTypeDropdown");//评价类型 //var SchoolyearNumID = pararms.getExtraInt("ddlYear") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");//年级 var collegeID = pararms.getExtraGuid("cgCollege");//院系所 var schoolyearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期 var result = TeacherEvaluationCountServices.GetTeacherView(configuretView, collegeID, schoolyearID, typeID, departmentID, (int)pararms.page, (int)pararms.rows); return Json(result); } #region 2.0 列表信息导出 [HttpPost] public ActionResult Excel() { try { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); //var subjectID = Request.Form["ddlExaminationSubject"].ParseStrTo(); var collegeID = Request.Form["cgCollege"].ParseStrTo(); var schoolyearID = Request.Form["SchoolYearDropdown"].ParseStrTo(); //var classID = Request.Form["cgClassmajor"].ParseStrTo(); //var examinationTypeID = Request.Form["cgExamination"].ParseStrTo(); var typeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo(); var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo(); //var SchoolyearNumID = Request.Form["ddlYear"].ParseStrTo() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo(); //var standardID = Request.Form["ddlStandard"].ParseStrTo() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["ddlStandard"].ParseStrTo(); var dt = TeacherEvaluationCountServices.GetTeacherView(configuretView, collegeID, schoolyearID, typeID, departmentID).Select(x => new { x.SchoolyearCode, x.TeacherNo, x.TeacherName, x.NeedEvaluationCount, x.CompleteCount, x.UncompletedCount }).ToTable(); string[] liststring = { "学年学期", "教师工号", "教师名称", "需评人次", "已评人次", "未评人次" }; //string[] liststring = { "评价编号", "课程名称", "评价类型 ", "被评教师号", "被评教师", "任务班名称", "参评类型 ", "已评次数" }; neh.Export(dt, liststring, "教师评价人次"); return RedirectToAction("MsgShow", "Common", new { msg = "导出成功!", url = Url.Content("~/TeacherEvaluationCount/List").AddMenuParameter() }); } catch (Exception ex) { return RedirectToAction("MsgShow", "Common", new { msg = "导出失败,原因:" + ex.Message + "!", url = Url.Content("~/TeacherEvaluationCount/List").AddMenuParameter() }); } } #endregion } }