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.StudentEvaluationCount { [Authorization] public class StudentEvaluationCountController : Controller { // // GET: /StudentEvaluationCount/ public IStudentEvaluationCountServices StudentEvaluationCountServices { get; set; } public ISchoolYearServices SchoolYearServices { get; set; } [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 classID = pararms.getExtraGuid("cgClassmajor"); //班级名称 var standardID = pararms.getExtraInt("ddlStandard");//专业名称 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 = StudentEvaluationCountServices.GetStudentView(configuretView, SchoolyearNumID, collegeID, schoolyearID, standardID, classID, (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 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 = StudentEvaluationCountServices.GetStudentView(configuretView, SchoolyearNumID, collegeID, schoolyearID, standardID, classID).Select(x => new { x.StudentNo, x.Name, x.ClassmajorName, x.NeedEvaluationCount, x.CompleteCount, x.UncompletedCount }).ToTable(); string[] liststring = { "学号", "姓名", "班级名称", "需评人次", "已评人次", "未评人次" }; //string[] liststring = { "评价编号", "课程名称", "评价类型 ", "被评教师号", "被评教师", "任务班名称", "参评类型 ", "已评次数" }; neh.Export(dt, liststring, "学生评价人次"); return RedirectToAction("MsgShow", "Common", new { msg = "导出成功!", url = Url.Content("~/StudentEvaluationCount/List").AddMenuParameter() }); } catch (Exception ex) { return RedirectToAction("MsgShow", "Common", new { msg = "导出失败,原因:" + ex.Message + "!", url = Url.Content("~/StudentEvaluationCount/List").AddMenuParameter() }); } } #endregion } }