using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.IO; using System.Text; using System.Data; using Bowin.Web.Controls.Mvc; using Bowin.Common.Data; using Bowin.Common.Utility; using Bowin.Common.Exceptions; using EMIS.Utility; using EMIS.Web.Controls; using EMIS.ViewModel; using EMIS.ViewModel.StudentManage.OnlineChecking; using EMIS.CommonLogic.StudentWeb.InfoCenter; namespace EMIS.Web.Controllers.StudentWeb.InfoCenter { [Authorization] public class CheckingResultController : Controller { public Lazy CheckingResultServices { get; set; } /// /// 校对结果(学生)页面 /// /// public ActionResult List() { return View(); } /// /// 校对结果(学生)页面列表查询 /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var user = EMIS.Utility.FormValidate.CustomPrincipal.Current; var checkingTypeID = pararms.getExtraInt("DictionaryCheckingType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCheckingType"); var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus"); return base.Json(CheckingResultServices.Value.GetStudentCheckingResultViewGrid(configuretView, user.UserID, checkingTypeID, approvalStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 编辑 /// /// /// [HttpGet] public ActionResult Edit(Guid? studentRecordChangeHistoryID) { CheckingHistoryView checkingHistoryView = new CheckingHistoryView(); if (studentRecordChangeHistoryID.HasValue && studentRecordChangeHistoryID != Guid.Empty) { checkingHistoryView = CheckingResultServices.Value.GetStudentCheckingResultView(studentRecordChangeHistoryID); } return View(checkingHistoryView); } /// /// 编辑 /// /// /// [HttpPost] public ActionResult Edit(CheckingHistoryView checkingHistoryView) { try { //CheckingResultServices.Value.CheckingResultEdit(checkingHistoryView); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败,原因:" + ex.Message }); } } /// /// 撤消 /// /// /// [HttpPost] public ActionResult Cancel(string studentRecordChangeHistoryIDs) { try { var user = EMIS.Utility.FormValidate.CustomPrincipal.Current; List list = studentRecordChangeHistoryIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); CheckingResultServices.Value.StudentCheckingResultCancel(list, user.UserID); return base.Json(new ReturnMessage { IsSuccess = true, Message = "撤消成功。" }); } catch (Exception ex) { return base.Json(new ReturnMessage { IsSuccess = false, Message = "撤消失败,原因:" + ex.Message }); } } /// /// Excel导出 /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var user = EMIS.Utility.FormValidate.CustomPrincipal.Current; var checkingTypeID = Request.Form["DictionaryCheckingType"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCheckingType"].ParseStrTo(); var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo(); var dt = CheckingResultServices.Value.GetStudentCheckingResultViewList(configuretView, user.UserID, checkingTypeID, approvalStatus) .Select(x => new { x.StudentNo, x.Name, x.SexName, BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""), x.NationName, x.PoliticsName, x.ClassmajorName, x.Description, x.CheckingTypeName, x.CheckingBeforeContent, x.CheckingAfterContent, x.IP, x.ApprovalStatusName, x.Comment, ApprovalTime = (x.ApprovalTime.HasValue ? x.ApprovalTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "") }).ToTable(); string[] liststring = { "学号", "姓名", "性别", "出生日期", "民族", "政治面貌", "班级名称", "校对名称", "校对类型", "校对前内容", "校对后内容", "IP地址", "状态", "处理意见", "审核时间" }; neh.Export(dt, liststring, "校对结果信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }