using Bowin.Common.Utility; using Bowin.Common.Data; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.ScoreManage; using EMIS.Utility; using EMIS.ViewModel; using EMIS.Web.Controls; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace EMIS.Web.Controllers.ScoreManage { [Authorization] public class ResitController : Controller { public IResitServices ResitServices { get; set; } public ActionResult List() { return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms); var schoolyearID = pararms.getExtraGuid("ddlSchoolyear"); var examinationBatchID = pararms.getExtraGuid("ddlExaminationBatch"); var examinationTypeID = pararms.getExtraGuid("ddlExaminationType"); var examinationProjectID = pararms.getExtraGuid("ddlExaminationProject"); var examinationSubjectID = pararms.getExtraInt("ddlExaminationSubject") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationSubject"); var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea"); var collegeID = pararms.getExtraGuid("ddlCollege"); var standardID = pararms.getExtraInt("cgbStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cgbStandard"); var classmajorID = pararms.getExtraGuid("cgbClassmajor"); return base.Json(ResitServices.GetResitViewGrid(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID, examinationSubjectID, schoolAreaID, collegeID, null, standardID, classmajorID, (int)pararms.page, (int)pararms.rows)); } /// /// Excel导出 /// /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(null); var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo(); var examinationBatchID = Request.Form["dllExaminationBatch"].ParseStrTo(); var examinationTypeID = Request.Form["dllExaminationType"].ParseStrTo(); var examinationProjectID = Request.Form["dllExaminationProject"].ParseStrTo(); var examinationSubjectID = Request.Form["ddlExaminationSubject"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationSubject"].ParseStrTo(); var schoolAreaID = Request.Form["ddlSchoolArea"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlSchoolArea"].ParseStrTo(); var collegeID = Request.Form["ddlCollege"].ParseStrTo(); var standardID = Request.Form["cgbStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cgbStandard"].ParseStrTo(); var classmajorID = Request.Form["ddlClassmajor"].ParseStrTo(); var dt = ResitServices.GetResitViewList(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID, examinationSubjectID, schoolAreaID, collegeID, null, standardID, classmajorID).Select(x => new { x.SchoolyearCode, x.ExaminationBatchName, x.ExaminationTypeName, x.ExaminationProjectName, x.ExaminationSubjectName, x.SchoolAreaName, x.CollegeName, x.Year, x.StandardName, x.ClassmajorName, x.UserName, x.CertificatesTypeName, x.IDNumber, x.Score, Expire = x.Expire.HasValue ? x.Expire.Value.ToString("yyyy-MM-dd") : "" }).ToTable(); string[] liststring = { "学年学期", "考试批次", "考试类型", "项目名称", "科目", "校区", RSL.Get("College"), "年级", "专业", "班级", "姓名", "证件类型", "证件号码", "成绩", "有效期" }; neh.Export(dt, liststring, "项目补考名单" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }