using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.DQPSystem; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Common.Data; using Bowin.Web.Controls.Mvc; using Bowin.Common.Utility; using EMIS.Utility; namespace EMIS.Web.Controllers.DQPSystem { [Authorization] public class SOCScoreController : Controller { public ISOCScoreServices SOCScoreServices { get; set; } public ActionResult CourseList() { return View(); } [HttpPost] public ActionResult CourseList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var schoolyearID = pararms.getExtraGuid("ddlSchoolyear"); var collegeID = pararms.getExtraGuid("cgbCollege"); var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear"); var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard"); var classmajorID = pararms.getExtraGuid("cbgClassmajor"); var coursematerialID = pararms.getExtraGuid("cgbCourse"); return base.Json(SOCScoreServices.GetSOCCourseScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerialID, (int)pararms.page, (int)pararms.rows)); } [HttpPost] public ActionResult CourseExcel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo(); var collegeID = Request.Form["cgbCollege"].ParseStrTo(); var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo(); var standardID = Request.Form["cbgStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo(); var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo(); var coursematerialID = Request.Form["cgbCourse"].ParseStrTo(); var dt = SOCScoreServices.GetSOCCourseScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerialID) .Select(x => new { x.SchoolyearCode, x.CourseCode, x.CourseName, TotalCredit = x.TotalCredit.HasValue ? x.TotalCredit.Value.ToString("#.#") : null, x.CollegeName, x.Gradeyear, x.StandardDesc, x.ClassmajorName, x.LoginID, x.Name, TotalScore = x.TotalScore.HasValue ? x.TotalScore.Value.ToString("#.#") : null, Credit = x.Credit.HasValue ? x.Credit.Value.ToString("#.#") : null }).ToTable(); string[] liststring = { "学年学期", "课程代码", "课程名称", "课程学分", RSL.Get("College"), "年级", "专业", "班级", "学号", "姓名", "总成绩", "学分" }; neh.Export(dt, liststring, "SOC课程成绩表" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }