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.StudentProfile; using EMIS.CommonLogic.StudentManage.StudentProfile; namespace EMIS.Web.Controllers.StudentManage.StudentProfile { [Authorization] public class StudentController : Controller { public Lazy StudentServices { get; set; } /// /// 学生信息页面 /// /// public ActionResult List() { return View(); } /// /// 学生信息列表查询 /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var campusID = pararms.getExtraGuid("CampusDropdown"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade"); var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard"); var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform"); var learnSystem = pararms.getExtraString("DictionaryLearnSystem"); var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid"); var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown"); var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus"); var planningGraduateDate = pararms.getExtraString("PlanningGraduateDateDropDown"); var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); return base.Json(StudentServices.Value.GetStudentViewGrid(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 查询对应的学生信息StudentBaseView(全部) /// /// /// [HttpPost] public ActionResult StudentBaseAllList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var userID = Request["userID"].ParseStrTo(); var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); return base.Json(StudentServices.Value.GetStudentBaseViewGrid(configuretView, userID, inSchoolStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 查询对应的学生信息StudentBaseView(在校) /// /// /// [HttpPost] public ActionResult StudentBaseInSchoolList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var userID = Request["userID"].ParseStrTo(); var inSchoolStatus = (int)CF_INOrOutSchoolStatus.Yes; return base.Json(StudentServices.Value.GetStudentBaseViewGrid(configuretView, userID, inSchoolStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 查询对应的学生信息StudentBaseView(非在校) /// /// /// [HttpPost] public ActionResult StudentBaseNotInSchoolList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var userID = Request["userID"].ParseStrTo(); var inSchoolStatus = (int)CF_INOrOutSchoolStatus.No; return base.Json(StudentServices.Value.GetStudentBaseViewGrid(configuretView, userID, inSchoolStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 预计毕业日期列表 /// /// /// [HttpPost] public ActionResult PlanningGraduateDateList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); return base.Json(StudentServices.Value.GetStudentPlanningGraduateDateGrid(configuretView, (int)pararms.page, (int)pararms.rows)); } /// /// 查询对应的预计毕业日期 /// /// /// [HttpPost] public ActionResult GetPlanningGraduateDate(Guid? grademajorID) { string planningGraduateDate = StudentServices.Value.GetPlanningGraduateDate(grademajorID); return base.Json(planningGraduateDate); } /// /// 查询对应的毕业学期中的毕业日期 /// /// /// [HttpPost] public ActionResult GetGraduateDate(Guid? grademajorID) { string graduateDate = StudentServices.Value.GetGraduateDate(grademajorID); return base.Json(graduateDate); } /// /// 复制新增 /// /// /// public ActionResult CopyAdd(Guid userID) { StudentView studentView = new StudentView(); studentView = StudentServices.Value.GetStudentView(userID); return View("Edit", studentView); } /// /// 复制新增 /// /// /// [HttpPost] public ActionResult CopyAdd(StudentView studentView) { studentView.UserID = Guid.Empty; return this.Edit(studentView); } /// /// 编辑、复制新增(新增、修改,业务主键:学号或考生号唯一) /// /// /// /// [HttpGet] public ActionResult Edit(Guid? newUserID, string type) { StudentView studentView = new StudentView(); if (newUserID.HasValue && newUserID != Guid.Empty) { studentView = StudentServices.Value.GetStudentView(newUserID); if (type == "copyAdd") { studentView.UserID = Guid.Empty; studentView.RecruitPictureUrl = null; studentView.PhotoUrl = null; studentView.GraduationPictureUrl = null; studentView.IsPhotoComparison = false; studentView.IsProofread = false; } } else { studentView.NationID = (int)CF_Nation.Han; studentView.PoliticsID = (int)CF_Politics.YouthLeague; studentView.CertificatesType = (int)CF_CertificatesType.IdCrad; studentView.StudentType = (int)CF_STUDENTTYPE.DefaultType; studentView.InSchoolStatusID = (int)CF_InschoolStatus.InSchool; studentView.StudentStatus = (int)CF_StudentStatus.Registration; studentView.HealthStateID = (int)CF_HealthState.Healthy; studentView.IsPhotoComparison = false; studentView.IsProofread = false; } return View(studentView); } /// /// 编辑、复制新增(新增、修改,业务主键:学号或考生号唯一) /// /// /// [HttpPost] public ActionResult Edit(StudentView studentView) { try { var accepts = new List { ".jpg", ".jpeg", ".png", ".bmp" }; var postedFile = Request.Files["PhotoUrl"]; if (postedFile != null && !string.IsNullOrEmpty(postedFile.FileName) && !accepts.Contains(Path.GetExtension(postedFile.FileName).ToLower())) { throw new Exception("只允许上传.jpg、.jpeg、.png、.bmp格式的文件。"); } string photoUrl = FileUploadHelper.UploadFile(postedFile); StudentServices.Value.StudentEdit(studentView, photoUrl); return RedirectToAction("MsgShow", "Common", new { WindowID = Request["WindowID"], msg = "保存成功。", url = Url.Action("List").AddMenuParameter() }); } catch (Exception ex) { return RedirectToAction("MsgShowAndOpen", "Common", new { WindowID = Request["WindowID"], msg = "保存失败,原因:" + ex.Message }); } } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string userIDs) { try { List list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); StudentServices.Value.StudentDelete(list); return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" }); } catch (Exception ex) { string mge = ex.Message; System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex); if (num != null) { if (num.Number == 547) { mge = "请先删除与其关联的数据,如:学期注册、异动申请、教学任务、学生成绩等。"; } } return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + mge }); } } /// /// Excel导入 /// /// /// /// [HttpGet] public ActionResult Import(string errorFile, string operationTips) { ViewBag.ErrorFile = errorFile; if (string.IsNullOrEmpty(operationTips)) { operationTips = "点击查看失败原因..."; } ViewBag.operationTips = operationTips; return View(); } /// /// Excel导入 /// /// /// [HttpPost] public ActionResult Import(HttpPostedFileBase file) { try { if (!NpoiExcelHelper.GetIsCompatible(file.FileName)) { throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。"); } Dictionary cellheader = new Dictionary { { "ExamineeNum", "考生号" }, { "AdmissionTicketNo", "准考证号" }, { "StudentNo", "学号" }, { "Name", "姓名" }, { "UsedName", "曾用名" }, { "SexStr", "性别" }, { "BirthDateStr", "出生日期" }, { "NationStr", "民族" }, { "PoliticsStr", "政治面貌" }, { "StudentTypeStr", "学生类别" }, { "CertificatesTypeStr", "证件类型" }, { "IDNumber", "证件号码" }, { "InSchoolStatusStr", "在校状态" }, { "StudentStatusStr", "学籍状态" }, { "ClassmajorNo", "班级编号" }, { "ClassmajorName", "班级名称" }, { "LiteracyLevelStr", "文化程度" }, { "CultureModelStr", "培养方式" }, { "ExamineeTypeStr", "考生类别" }, { "EntranceDateStr", "入学日期" }, { "ScoreStr", "总分" }, { "EntranceWayStr", "入学方式" }, { "FeaturesStr", "考生特征" }, { "TerritorialStr", "生源所属地" }, { "Area", "来源地区" }, { "Country", "国籍" }, { "Place", "籍贯" }, { "BornPlace", "出生地" }, { "Email", "电子邮箱" }, { "Mobile", "移动电话" }, { "Telephone", "家庭电话" }, { "ZIPCode", "邮政编码" }, { "HealthStateStr", "健康状况" }, { "BloodGroupStr", "血型" }, { "Specialty", "特长" }, { "Height", "身高(cm)" }, { "Weight", "体重(kg)" }, { "WeChatNum", "微信号" }, { "QQ", "QQ" }, { "HomeAddress", "家庭住址" }, { "WorkUnit", "工作单位" }, { "Address", "通信地址" }, { "Dormitory", "宿舍地址" }, { "Recipient", "收件人" }, { "IsDreamProjectStr", "圆梦计划" }, { "DirectorName", "导师姓名" }, { "BankName", "开户银行" }, { "CardNo", "银行卡号" }, { "StudentCardNo", "学籍卡编号" }, { "GraduateCardNo", "毕结业证书编号" }, { "DegreeStatusStr", "学位有无" }, { "Career", "在校经历" }, { "Remark", "备注" }, { "ErrorMessage", "未导入原因" } }; int? inCount = 0; int? upCount = 0; int? errCount = 0; List errList = new List(); string sourceWebPath = FileUploadHelper.UploadFile(file); var sourcePhysicalPath = Server.MapPath(sourceWebPath); StudentServices.Value.StudentImport(cellheader, out inCount, out upCount, out errList, out errCount, sourcePhysicalPath); System.IO.File.Delete(sourcePhysicalPath); if (errList.Count() > 0) { string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, errList, "学生信息导入失败文件", sourcePhysicalPath)); ViewBag.ErrorFile = errorWebPath; string Errinfo = string.Format("提示:{0}条学生信息导入成功,{1}条学生信息更新成功,{2}条学生信息导入失败,点击查看。", inCount, upCount, errCount); ViewBag.operationTips = Errinfo; return RedirectToAction("MsgShow", "Common", new { WindowID = "none", msg = Errinfo, url = Url.Action("Import").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"] }); } else { string successInfo = string.Format("提示:{0}条学生信息导入成功,{1}条学生信息更新成功。", inCount, upCount); return RedirectToAction("MsgShow", "Common", new { WindowID = Request["WindowID"], msg = successInfo, url = Url.Action("List").AddMenuParameter() }); } } catch (Exception ex) { return RedirectToAction("MsgShow", "Common", new { WindowID = "none", msg = "导入失败,原因:" + ex.Message, url = Url.Action("Import").AddMenuParameter() + "&WindowID=" + Request["WindowID"] }); } } /// /// 删除照片(单个删除) /// /// /// [HttpPost] public ActionResult DeletePhoto(Guid? userID) { try { this.StudentServices.Value.DeletePhoto(userID); return Json(new ReturnMessage() { IsSuccess = true, Message = "删除照片成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "删除照片失败:" + ex.Message }); } } /// /// 删除照片(批量删除) /// /// /// [HttpPost] public ActionResult PicDelete(string userIDs) { try { List list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); this.StudentServices.Value.PicDelete(list); return Json(new ReturnMessage() { IsSuccess = true, Message = "删除照片成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "删除照片失败:" + ex.Message }); } } /// /// 导入学籍照片 /// /// /// /// [HttpGet] public ActionResult PicImport(string errorFile, string operationTips) { ViewBag.ErrorFile = errorFile; if (string.IsNullOrEmpty(operationTips)) { operationTips = "点击查看失败原因..."; } ViewBag.operationTips = operationTips; return View(); } /// /// 导入学籍照片 /// /// /// /// [HttpPost] public ActionResult PicImport(HttpPostedFileBase file, string importPicType) { try { if (file.ContentLength <= 0) { throw new Exception("请选择你要上传的照片(注:格式为zip或rar的压缩包文件)。"); } var acceptFileExtensions = new[] { ".zip", ".rar" }; var fileExtensionName = Path.GetExtension(file.FileName); if (!acceptFileExtensions.Contains(fileExtensionName)) { throw new Exception("格式错误,只允许上传zip或rar格式的压缩包文件。"); } string fileSourceWebPath = null; string errorSourceWebPath = null; var photoPathList = FileUploadHelper.UploadFileAndExtractFile(file, out fileSourceWebPath, out errorSourceWebPath); System.IO.File.Delete(Server.MapPath(fileSourceWebPath)); if (photoPathList == null || photoPathList.Count <= 0) { throw new Exception("压缩包中文件为空。"); } var acceptPicExtensions = new[] { ".jpg", ".jpeg", ".png", ".bmp" }; List newPhotoPathList = new List(); foreach (var photoPath in photoPathList) { string photoExtensionName = Path.GetExtension(photoPath).ToLower(); if (acceptPicExtensions.Contains(photoExtensionName)) { newPhotoPathList.Add(photoPath); } else { throw new Exception("压缩包中含有不支持的照片格式。"); } } int? inCount = 0; int? errCount = 0; var errDataTable = new DataTable(); StudentServices.Value.StudentPicImport(newPhotoPathList, importPicType, out inCount, out errCount, out errDataTable); if (errDataTable != null && errDataTable.Rows.Count > 0) { NpoiExcelHelper npoiExcelHelper = new NpoiExcelHelper(); npoiExcelHelper.SaveInServer(errDataTable, Server.MapPath(errorSourceWebPath)); string errorWebPath = string.Format("{0}", errorSourceWebPath); ViewBag.ErrorFile = errorWebPath; string Errinfo = string.Format("提示:{0}个照片导入成功,{1}个照片导入失败,点击查看。", inCount, errCount); ViewBag.operationTips = Errinfo; return RedirectToAction("MsgShow", "Common", new { WindowID = "none", msg = Errinfo, url = Url.Action("PicImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"] }); } else { string successInfo = string.Format("提示:{0}个照片导入成功。", inCount); return RedirectToAction("MsgShow", "Common", new { WindowID = Request["WindowID"], msg = successInfo, url = Url.Action("List").AddMenuParameter() }); } } catch (Exception ex) { return RedirectToAction("MsgShow", "Common", new { WindowID = "none", msg = "导入照片失败,原因:" + ex.Message, url = Url.Action("PicImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"] }); } } /// /// 导入学历照片 /// /// /// /// [HttpGet] public ActionResult GraPicImport(string errorFile, string operationTips) { ViewBag.ErrorFile = errorFile; if (string.IsNullOrEmpty(operationTips)) { operationTips = "点击查看失败原因..."; } ViewBag.operationTips = operationTips; return View(); } /// /// 导入学历照片 /// /// /// /// [HttpPost] public ActionResult GraPicImport(HttpPostedFileBase file, string importGraPicType) { try { if (file.ContentLength <= 0) { throw new Exception("请选择你要上传的照片(注:格式为zip或rar的压缩包文件)。"); } var acceptFileExtensions = new[] { ".zip", ".rar" }; var fileExtensionName = Path.GetExtension(file.FileName); if (!acceptFileExtensions.Contains(fileExtensionName)) { throw new Exception("格式错误,只允许上传zip或rar格式的压缩包文件。"); } string fileSourceWebPath = null; string errorSourceWebPath = null; var photoPathList = FileUploadHelper.UploadFileAndExtractFile(file, out fileSourceWebPath, out errorSourceWebPath); System.IO.File.Delete(Server.MapPath(fileSourceWebPath)); if (photoPathList == null || photoPathList.Count <= 0) { throw new Exception("压缩包中文件为空。"); } var acceptPicExtensions = new[] { ".jpg", ".jpeg", ".png", ".bmp" }; List newPhotoPathList = new List(); foreach (var photoPath in photoPathList) { string photoExtensionName = Path.GetExtension(photoPath).ToLower(); if (acceptPicExtensions.Contains(photoExtensionName)) { newPhotoPathList.Add(photoPath); } else { throw new Exception("压缩包中含有不支持的照片格式。"); } } int? inCount = 0; int? errCount = 0; var errDataTable = new DataTable(); StudentServices.Value.StudentGraPicImport(newPhotoPathList, importGraPicType, out inCount, out errCount, out errDataTable); if (errDataTable != null && errDataTable.Rows.Count > 0) { NpoiExcelHelper npoiExcelHelper = new NpoiExcelHelper(); npoiExcelHelper.SaveInServer(errDataTable, Server.MapPath(errorSourceWebPath)); string errorWebPath = string.Format("{0}", errorSourceWebPath); ViewBag.ErrorFile = errorWebPath; string Errinfo = string.Format("提示:{0}个学历照片导入成功,{1}个学历照片导入失败,点击查看。", inCount, errCount); ViewBag.operationTips = Errinfo; return RedirectToAction("MsgShow", "Common", new { WindowID = "none", msg = Errinfo, url = Url.Action("GraPicImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"] }); } else { string successInfo = string.Format("提示:{0}个学历照片导入成功。", inCount); return RedirectToAction("MsgShow", "Common", new { WindowID = Request["WindowID"], msg = successInfo, url = Url.Action("List").AddMenuParameter() }); } } catch (Exception ex) { return RedirectToAction("MsgShow", "Common", new { WindowID = "none", msg = "导入失败,原因:" + ex.Message, url = Url.Action("GraPicImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"] }); } } /// /// 照片比对页面 /// /// public ActionResult PicComparison() { return View(); } /// /// 照片比对页面列表查询 /// /// /// [HttpPost] public ActionResult PicComparison(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var campusID = pararms.getExtraGuid("CampusDropdown"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade"); var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard"); var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform"); var learnSystem = pararms.getExtraString("DictionaryLearnSystem"); var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid"); var isRecruitPhoto = pararms.getExtraInt("IsRecruitPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsRecruitPhotoDropdown"); var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown"); var isGraduationPhoto = pararms.getExtraInt("IsGraduationPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsGraduationPhotoDropdown"); var isPhotoComparison = pararms.getExtraInt("DictionaryIsPhotoComparison") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsPhotoComparison"); var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); return base.Json(StudentServices.Value.GetStudentPicComparisonGrid(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, classmajorID, isRecruitPhoto, isPhoto, isGraduationPhoto, isPhotoComparison, inSchoolStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 照片比对通过 /// /// /// /// [HttpPost] public ActionResult PicComparisonPass(string userIDs, StudentView studentView) { try { List list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); string result = StudentServices.Value.StudentPicComparisonPass(list); return Json(new ReturnMessage() { IsSuccess = true, Message = "比对通过成功" + result + "。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "比对失败,原因:" + ex.Message }); } } /// /// 照片比对驳回 /// /// /// /// [HttpPost] public ActionResult PicComparisonUndo(string userIDs, StudentView studentView) { try { List list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); string result = StudentServices.Value.StudentPicComparisonUndo(list); return Json(new ReturnMessage() { IsSuccess = true, Message = "比对驳回成功" + result + "。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "比对失败,原因:" + ex.Message }); } } /// /// 照片比对Excel导出 /// /// [HttpPost] public ActionResult PicComparison_Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var campusID = Request.Form["CampusDropdown"].ParseStrTo(); var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); var gradeID = Request.Form["DictionaryGrade"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo(); var standardID = Request.Form["DictionaryStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo(); var educationID = Request.Form["DictionaryEducation"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo(); var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo(); var learnSystem = Request.Form["DictionaryLearnSystem"].ToString(); var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo(); var isRecruitPhoto = Request.Form["IsRecruitPhotoDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["IsRecruitPhotoDropdown"].ParseStrTo(); var isPhoto = Request.Form["IsPhotoDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoDropdown"].ParseStrTo(); var isGraduationPhoto = Request.Form["IsGraduationPhotoDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["IsGraduationPhotoDropdown"].ParseStrTo(); var isPhotoComparison = Request.Form["DictionaryIsPhotoComparison"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIsPhotoComparison"].ParseStrTo(); var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo(); var userIDs = Request.Form["UserIDs"]; var userIDList = new List(); if (userIDs == "") { userIDList = null; } else { userIDList = userIDs.SplitIDString(); } var dt = StudentServices.Value.GetStudentPicComparisonList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, classmajorID, isRecruitPhoto, isPhoto, isGraduationPhoto, isPhotoComparison, inSchoolStatus, userIDList) .Select(x => new { x.ExamineeNum, x.StudentNo, x.AdmissionTicketNo, x.Name, x.SexName, BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""), x.NationName, x.PoliticsName, x.CertificatesTypeName, x.IDNumber, x.StandardCode, x.StandardID, x.StandardName, x.EducationName, x.LearningformName, LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : "", x.FacultymajorCode, x.FacultymajorName, x.GradeID, x.GrademajorCode, x.GrademajorName, x.ClassmajorNo, x.ClassmajorName, x.ClassNum, x.StudentTypeName, x.InSchoolStatusName, x.StudentStatusName, x.CollegeNo, x.CollegeName, x.CampusCode, x.CampusName, x.SchoolTypeName, x.UniversityCode, x.UniversityName, x.HeadMasterName, x.SemesterName, x.StartSchoolyearCode, x.GraduateSchoolyearCode, PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyyMMdd") : ""), GraduateDate = (x.GraduateDate.HasValue ? x.GraduateDate.Value.ToString("yyyyMMdd") : ""), x.StudentCardNo, x.GraduateCardNo, x.ReplaceGraduateNo, x.DegreeStatusName, x.UsedName, x.Country, x.Place, x.BornPlace, x.ExamineeType, EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : ""), x.LiteracyLevelName, x.CultureModelName, x.IsDreamProjectName, x.Email, x.Telephone, x.Mobile, x.ZIPCode, x.WeChatNum, x.QQ, x.HealthStateName, x.BloodGroupName, x.Specialty, x.Height, x.Weight, x.DirectorName, x.Score, x.EntranceWayName, x.FeaturesName, x.TerritorialName, x.Area, x.HomeAddress, x.WorkUnit, x.Address, x.Recipient, x.Dormitory, x.BankName, x.CardNo, x.RecruitPictureUrl, x.PhotoUrl, x.GraduationPictureUrl, x.Career, x.IsPhotoComparisonName, x.IsProofreadName, x.ReportStatusName, x.AccountStatusName, x.Remark }).ToTable(); string[] liststring = { "考生号", "学号", "准考证号", "姓名", "性别", "出生日期", "民族", "政治面貌", "证件类型", "证件号码", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "院系专业编号", "院系专业名称", "年级", "年级专业编号", "年级专业名称", "班级编号", "班级名称", "班序", "学生类别", "在校状态", "学籍状态", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("Campus"), "办学类型", "学校代码", "学校名称", "校长名", "入学学期", "入学学年学期", "毕业学期", "预计毕业日期", "毕业日期", "学籍卡编号", "毕结业证书编号", "补证编号", "学位有无", "曾用名", "国籍", "籍贯", "出生地", "考生类别", "入学日期", "文化程度", "培养方式", "圆梦计划", "电子邮箱", "家庭电话", "移动电话", "邮政编码", "微信号", "QQ", "健康状况", "血型", "特长", "身高(cm)", "体重(kg)", "导师姓名", "总分", "入学方式", "考生特征", "生源所属地", "来源地区", "家庭住址", "工作单位", "通信地址", "收件人" , "宿舍地址", "开户银行", "银行卡号", "录取照片Url", "学籍照片Url", "学历照片Url", "在校经历", "照片比对", "是否核对", "注册状态", "帐号状态", "备注" }; neh.Export(dt, liststring, "照片比对信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } /// /// 导出照片 /// /// [HttpGet] public ActionResult PictureExport() { return View(); } /// /// 导出照片 /// /// /// /// /// [HttpPost] public ActionResult PictureExport(QueryParamsModel pararms, string exportPicType, string userIDs) { try { var studentViewList = new List(); if (!string.IsNullOrEmpty(userIDs)) { List list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); studentViewList = StudentServices.Value.GetStudentViewList(list).ToList(); } else { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var campusID = pararms.getExtraGuid("CampusDropdown"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade"); var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard"); var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform"); var learnSystem = pararms.getExtraString("DictionaryLearnSystem"); var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid"); var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown"); var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus"); var planningGraduateDate = pararms.getExtraString("PlanningGraduateDateDropDown"); var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); studentViewList = StudentServices.Value.GetStudentViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus).ToList(); } var remoteFileList = StudentServices.Value.GetStudentPicRemoteFileInfoList(studentViewList, exportPicType); if (remoteFileList != null && remoteFileList.Count() > 0) { var zipFileStream = FileUploadHelper.DownLoadFiles(Guid.NewGuid().ToString(), "学生照片" + DateTime.Now.ToString("yyyyMMdd") + "", remoteFileList); return File(zipFileStream, System.Net.Mime.MediaTypeNames.Application.Zip, "学生照片" + DateTime.Now.ToString("yyyyMMdd") + ".zip"); } else { return RedirectToAction("MsgShowAndOpen", "Common", new { WindowID = Request.UrlReferrer.ToString().Remove(0, Request.UrlReferrer.ToString().LastIndexOf("=") + 1), msg = "导出照片失败,原因:照片不存在。" }); } } catch (Exception ex) { return RedirectToAction("MsgShowAndOpen", "Common", new { WindowID = Request.UrlReferrer.ToString().Remove(0, Request.UrlReferrer.ToString().LastIndexOf("=") + 1), msg = "导出照片失败,原因:" + ex.Message }); } } /// /// 照片信息 /// /// /// public ActionResult PhotoDetail(Guid? userID) { StudentView studentView = new StudentView(); if (userID.HasValue && userID != Guid.Empty) { studentView = StudentServices.Value.GetStudentView(userID); } return View(studentView); } /// /// 学籍异动信息 /// /// public ActionResult ChangeDetail() { return View(); } /// /// 学籍异动信息 /// /// /// [HttpPost] public ActionResult ChangeDetail(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var userID = Request["userID"].ParseStrTo(); var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown"); var changeTypeID = pararms.getExtraInt("DictionaryChangeTypeID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryChangeTypeID"); return Json(StudentServices.Value.GetStudentChangeViewGrid(configuretView, userID, schoolyearID, changeTypeID, (int)pararms.page, (int)pararms.rows)); } /// /// 学籍注册信息 /// /// public ActionResult ReportDetail() { return View(); } /// /// 学籍注册信息 /// /// /// [HttpPost] public ActionResult ReportDetail(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var userID = Request["userID"].ParseStrTo(); var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown"); var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus"); return Json(StudentServices.Value.GetStudentReportViewGrid(configuretView, userID, schoolyearID, reportStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 上报导出 /// /// public ActionResult ReportExport() { return View(); } /// /// 上报导出DBF /// /// /// /// /// /// [HttpPost] public ActionResult ReportDBFExport(QueryParamsModel pararms, string userIDs, string colnames, string shownames) { try { List userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); List colnameList = colnames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList(); List shownameList = shownames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList(); NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var campusID = pararms.getExtraGuid("CampusDropdown"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade"); var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard"); var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform"); var learnSystem = pararms.getExtraString("DictionaryLearnSystem"); var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid"); var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown"); var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus"); var planningGraduateDate = pararms.getExtraString("PlanningGraduateDateDropDown"); var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); var dt = StudentServices.Value.GetStudentViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus, userIDList) .Select(x => new { x.ExamineeNum, x.UserName, x.SexName, BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""), x.IDNumber, x.UniversityCode, x.UniversityName, x.StandardCode, x.StandardName, x.FacultymajorName, LearnSystem = (x.LearnSystem.HasValue ? (x.LearnSystem.Value % 1 == 0 ? x.LearnSystem.Value.ToString("0") : x.LearnSystem.Value.ToString("0.0")) : ""), x.LearningformName, x.EducationName, EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : ""), GraduateDate = (x.GraduateDate.HasValue ? x.GraduateDate.Value.ToString("yyyyMMdd") : ""), x.GraduationResultName, x.GraduateCardNo, x.HeadMasterName, TerritorialID = (x.TerritorialID.HasValue ? x.TerritorialID.ToString() : ""), x.StudentNo, x.PoliticsName, x.NationName, x.CampusName, x.CollegeName, x.ClassmajorNo, x.ClassmajorName, PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyyMMdd") : ""), x.Remark }).ToTable(shownameList); var physicalFileName = StudentServices.Value.CreateDBFFile(dt, colnameList, "StudentDBFFile"); return File(physicalFileName, "application/x-dbf", "学生信息(上报DBF)" + DateTime.Now.ToString("yyyyMMdd") + ".dbf"); } catch (Exception ex) { return RedirectToAction("MsgShowAndOpen", "Common", new { WindowID = Request.UrlReferrer.ToString().Remove(0, Request.UrlReferrer.ToString().LastIndexOf("=") + 1), msg = "DBF导出失败,原因:" + ex.Message }); } } /// /// 上报导出Excel /// /// /// /// /// /// [HttpPost] public ActionResult ReportExcelExport(QueryParamsModel pararms, string userIDs, string colnames, string shownames) { try { List userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); List colnameList = colnames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList(); List shownameList = shownames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList(); NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var campusID = pararms.getExtraGuid("CampusDropdown"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade"); var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard"); var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform"); var learnSystem = pararms.getExtraString("DictionaryLearnSystem"); var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid"); var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown"); var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus"); var planningGraduateDate = pararms.getExtraString("PlanningGraduateDateDropDown"); var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus"); var dt = StudentServices.Value.GetStudentViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus, userIDList) .Select(x => new { x.ExamineeNum, x.UserName, x.SexName, BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""), x.IDNumber, x.UniversityCode, x.UniversityName, x.StandardCode, x.StandardName, x.FacultymajorName, LearnSystem = (x.LearnSystem.HasValue ? (x.LearnSystem.Value % 1 == 0 ? x.LearnSystem.Value.ToString("0") : x.LearnSystem.Value.ToString("0.0")) : ""), x.LearningformName, x.EducationName, EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : ""), GraduateDate = (x.GraduateDate.HasValue ? x.GraduateDate.Value.ToString("yyyyMMdd") : ""), x.GraduationResultName, x.GraduateCardNo, x.HeadMasterName, TerritorialID = (x.TerritorialID.HasValue ? x.TerritorialID.ToString() : ""), x.StudentNo, x.PoliticsName, x.NationName, x.CampusName, x.CollegeName, x.ClassmajorNo, x.ClassmajorName, PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyyMMdd") : ""), x.Remark }).ToTable(shownameList); string[] liststring = colnameList.ToArray(); neh.Export(dt, liststring, "学生信息(上报Excel)" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "Excel导出成功。" }); } catch (Exception ex) { return RedirectToAction("MsgShowAndOpen", "Common", new { WindowID = Request.UrlReferrer.ToString().Remove(0, Request.UrlReferrer.ToString().LastIndexOf("=") + 1), msg = "Excel导出失败,原因:" + ex.Message }); } } /// /// 操行录入 /// /// public ActionResult ConductInput() { return View(); } /// /// 操行录入 /// /// /// /// [HttpPost] public ActionResult ConductInput(string userIDs, StudentConductView studentConductView) { try { List list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); var result = StudentServices.Value.StudentConductInput(list, studentConductView); return Json(new ReturnMessage() { IsSuccess = true, Message = "录入成功" + result + "。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "录入失败,原因:" + ex.Message }); } } /// /// 毕业证书编号Excel导入 /// /// /// /// [HttpGet] public ActionResult GraduateNoImport(string errorFile, string operationTips) { ViewBag.ErrorFile = errorFile; if (string.IsNullOrEmpty(operationTips)) { operationTips = "点击查看失败原因..."; } ViewBag.operationTips = operationTips; return View(); } /// /// 毕业证书编号Excel导入 /// /// /// [HttpPost] public ActionResult GraduateNoImport(HttpPostedFileBase file) { try { if (!NpoiExcelHelper.GetIsCompatible(file.FileName)) { throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。"); } Dictionary cellheader = new Dictionary { { "IDNumber", "身份证号" }, { "GraduateCardNo", "毕业证书编号" }, { "ErrorMessage", "未导入原因" } }; StringBuilder errorMsg = new StringBuilder(); string sourceWebPath = FileUploadHelper.UploadFile(file); var sourcePhysicalPath = Server.MapPath(sourceWebPath); List errList = new List(); List dataList = new List(); int? inCount = 0; //导入个数 int? upCount = 0; //更新个数 int? errCount = 0; //失败个数 StudentServices.Value.GraduateNoImport(cellheader, out inCount, out upCount, out errList, out errCount, sourcePhysicalPath); System.IO.File.Delete(sourcePhysicalPath); if (errList.Count() > 0) { //获取错误数据文件路径 string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, errList, "毕业证书编号导入失败文件", sourcePhysicalPath)); ViewBag.ErrorFile = errorWebPath; string Errinfo = string.Format("提示:{0}条毕业证书编号导入成功,{1}条毕业证书编号导入失败,点击查看。", upCount, errCount); ViewBag.operationTips = Errinfo; return RedirectToAction("MsgShow", "Common", new { WindowID = "none", msg = Errinfo, url = Url.Action("GraduateNoImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"] }); } else { string successInfo = string.Format("提示:{0}条毕业证书编号导入成功。", upCount); return RedirectToAction("MsgShow", "Common", new { WindowID = Request["WindowID"], msg = successInfo, url = Url.Action("List").AddMenuParameter() }); } } catch (Exception ex) { return RedirectToAction("MsgShow", "Common", new { WindowID = "none", msg = "导入失败,原因:" + ex.Message, url = Url.Action("GraduateNoImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"] }); } } /// /// 学生证明报表 /// /// public ActionResult ProveReport() { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; ViewBag.LoginUserID = curUser.UserID.ToString(); var dataRangeID = StudentServices.Value.GetDataRangeID(); ViewBag.DataRangeID = dataRangeID; return View(); } /// /// 学生学籍报表 /// /// public ActionResult CradReport() { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; ViewBag.LoginUserID = curUser.UserID.ToString(); var dataRangeID = StudentServices.Value.GetDataRangeID(); ViewBag.DataRangeID = dataRangeID; return View(); } /// /// 学生鉴定报表 /// /// public ActionResult AppraiseReport() { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; ViewBag.LoginUserID = curUser.UserID.ToString(); var dataRangeID = StudentServices.Value.GetDataRangeID(); ViewBag.DataRangeID = dataRangeID; return View(); } /// /// Excel导出 /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var campusID = Request.Form["CampusDropdown"].ParseStrTo(); var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); var gradeID = Request.Form["DictionaryGrade"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo(); var standardID = Request.Form["DictionaryStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo(); var educationID = Request.Form["DictionaryEducation"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo(); var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo(); var learnSystem = Request.Form["DictionaryLearnSystem"].ToString(); var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo(); var isPhoto = Request.Form["IsPhotoDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoDropdown"].ParseStrTo(); var reportStatus = Request.Form["DictionaryReportStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryReportStatus"].ParseStrTo(); var planningGraduateDate = Request.Form["PlanningGraduateDateDropDown"].ToString(); var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo(); var userIDs = Request.Form["UserIDs"]; var userIDList = new List(); if (userIDs == "") { userIDList = null; } else { userIDList = userIDs.SplitIDString(); } var dt = StudentServices.Value.GetStudentViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus, userIDList) .Select(x => new { x.ExamineeNum, x.AdmissionTicketNo, x.StudentNo, x.Name, x.UsedName, x.SexName, BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""), x.NationName, x.PoliticsName, x.StudentTypeName, x.CertificatesTypeName, x.IDNumber, x.StandardCode, x.StandardID, x.StandardName, x.EducationName, x.LearningformName, LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : "", x.FacultymajorCode, x.FacultymajorName, x.GradeID, x.GrademajorCode, x.GrademajorName, x.InSchoolStatusName, x.StudentStatusName, x.ClassmajorNo, x.ClassmajorName, x.ClassNum, x.CollegeNo, x.CollegeName, x.CampusCode, x.CampusName, x.SchoolTypeName, x.UniversityCode, x.UniversityName, x.HeadMasterName, x.SemesterName, x.StartSchoolyearCode, x.GraduateSchoolyearCode, PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyyMMdd") : ""), GraduateDate = (x.GraduateDate.HasValue ? x.GraduateDate.Value.ToString("yyyyMMdd") : ""), x.LiteracyLevelName, x.CultureModelName, x.ExamineeTypeName, EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : ""), x.Score, x.EntranceWayName, x.FeaturesName, x.TerritorialName, x.Area, x.Country, x.Place, x.BornPlace, x.Email, x.Mobile, x.Telephone, x.ZIPCode, x.HealthStateName, x.BloodGroupName, x.Specialty, x.Height, x.Weight, x.WeChatNum, x.QQ, x.HomeAddress, x.WorkUnit, x.Address, x.Dormitory, x.Recipient, x.IsDreamProjectName, x.DirectorName, x.BankName, x.CardNo, x.StudentCardNo, x.GraduateCardNo, x.ReplaceGraduateNo, x.DegreeStatusName, x.Career, PhotoUrlNo = x.StudentNo, x.IsPhotoComparisonName, x.IsProofreadName, x.ChangeCount, x.ReportStatusName, x.AccountStatusName, x.Remark }).ToTable(); string[] liststring = { "考生号", "准考证号", "学号", "姓名", "曾用名", "性别", "出生日期", "民族", "政治面貌", "学生类别", "证件类型", "证件号码", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "院系专业编号", "院系专业名称", "年级", "年级专业编号", "年级专业名称", "在校状态", "学籍状态", "班级编号", "班级名称", "班序", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("Campus"), "办学类型", "学校代码", "学校名称", "校长名", "入学学期", "入学学年学期", "毕业学期", "预计毕业日期", "毕业日期", "文化程度", "培养方式", "考生类别", "入学日期", "总分", "入学方式", "考生特征", "生源所属地", "来源地区", "国籍", "籍贯", "出生地", "电子邮箱", "移动电话", "家庭电话", "邮政编码", "健康状况", "血型", "特长", "身高(cm)", "体重(kg)", "微信号", "QQ", "家庭住址", "工作单位", "通信地址", "宿舍地址", "收件人", "圆梦计划", "导师姓名", "开户银行", "银行卡号", "学籍卡编号", "毕结业证书编号", "补证编号", "学位有无", "在校经历", "照片编号", "照片比对", "是否核对", "异动数", "注册状态", "帐号状态", "备注" }; neh.Export(dt, liststring, "学生信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }