using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.SupervisionManage; using EMIS.ViewModel; using EMIS.Web.Controls; using EMIS.CommonLogic.SystemServices; using Bowin.Common.Utility; using Bowin.Web.Controls.Mvc; using EMIS.ViewModel.SupervisionManage; using Bowin.Common.Data; using EMIS.Utility; namespace EMIS.Web.Controllers.SupervisionManage { [Authorization] public class SupEvaluationController : Controller { // // GET: /SupEvaluation/ public ISupEvaluationServices SupEvaluationServices { get; set; } public IRoleServices IRoleServices { get; set; } [HttpGet] public ActionResult List() { return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown"); var collegeID = pararms.getExtraGuid("DDCollegeDropdown"); var startTimes = pararms.getExtraDateTime("txtStartDate"); var endTimes = pararms.getExtraDateTime("txtEndDate"); var SupervisionTypeID = pararms.getExtraInt("SupervisionType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SupervisionType"); ; var dataRange = IRoleServices.GetDataRange(); return base.Json(SupEvaluationServices.GetSupEvaluationViewGrid(configuretView,schoolyearID, collegeID, startTimes, endTimes, SupervisionTypeID, dataRange, (int)pararms.page, (int)pararms.rows)); } [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var selectedLessonRecordID = Request.Form["LessonRecordIDs"] ?? ""; var selectedProjectRecordID = Request.Form["ProjectRecordIDs"] ?? ""; var schoolyearID = Request.Form["Schoolyear"].ParseStrTo(); var collegeID = Request.Form["ddlCollege"].ParseStrTo(); var startTimes = Request.Form["txtStartDate"].ParseStrTo(); var endTimes = Request.Form["txtEndDate"].ParseStrTo(); var SupervisionTypeID = Request.Form["SupervisionType"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["SupervisionType"].ParseStrTo(); var dataRange = IRoleServices.GetDataRange(); List result; List LessonRecordIDList = new List(); List ProjectRecordIDList = new List(); if (selectedLessonRecordID!="") { LessonRecordIDList = selectedLessonRecordID.Split(',') .Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); } if (selectedProjectRecordID!="") { ProjectRecordIDList = selectedProjectRecordID.Split(',') .Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); } result = SupEvaluationServices.GetSupEvaluationViewGridList(configuretView,schoolyearID, collegeID, startTimes, endTimes, SupervisionTypeID, dataRange, LessonRecordIDList, ProjectRecordIDList); var dt = result.Select(x => new { x.SchoolyearCode, x.SupervisionCollegeName, x.UserName, x.SupervisionTypeName, x.CourseName, x.LessonDateStr, x.Advise, x.TotalScore }).ToTable(); string[] liststring = { "学年学期", RSL.Get("College"), "督导对象", "督导类型", "课程名称", "评价日期", "评价建议", "评分" }; neh.Export(dt, liststring, "督导评价"); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功!" }); } public ActionResult SupEvaluationReport() { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; var dataRange = IRoleServices.GetDataRange(); ViewBag.DataRange = dataRange; ViewBag.UserID = curUser.UserID.ToString(); return View(); } } }