123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515 |
- 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<IStudentServices> StudentServices { get; set; }
- /// <summary>
- /// 学生信息页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 学生信息列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [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));
- }
- /// <summary>
- /// 查询对应的学生信息StudentBaseView(全部)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentBaseAllList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var userID = Request["userID"].ParseStrTo<Guid>();
- 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));
- }
- /// <summary>
- /// 查询对应的学生信息StudentBaseView(在校)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentBaseInSchoolList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var userID = Request["userID"].ParseStrTo<Guid>();
- var inSchoolStatus = (int)CF_INOrOutSchoolStatus.Yes;
- return base.Json(StudentServices.Value.GetStudentBaseViewGrid(configuretView, userID, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 查询对应的学生信息StudentBaseView(非在校)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentBaseNotInSchoolList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var userID = Request["userID"].ParseStrTo<Guid>();
- var inSchoolStatus = (int)CF_INOrOutSchoolStatus.No;
- return base.Json(StudentServices.Value.GetStudentBaseViewGrid(configuretView, userID, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
-
- }
- /// <summary>
- /// 预计毕业日期列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PlanningGraduateDateList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- return base.Json(StudentServices.Value.GetStudentPlanningGraduateDateGrid(configuretView, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 查询对应的预计毕业日期
- /// </summary>
- /// <param name="grademajorID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetPlanningGraduateDate(Guid? grademajorID)
- {
- string planningGraduateDate = StudentServices.Value.GetPlanningGraduateDate(grademajorID);
- return base.Json(planningGraduateDate);
- }
- /// <summary>
- /// 查询对应的毕业学期中的毕业日期
- /// </summary>
- /// <param name="grademajorID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetGraduateDate(Guid? grademajorID)
- {
- string graduateDate = StudentServices.Value.GetGraduateDate(grademajorID);
- return base.Json(graduateDate);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid userID)
- {
- StudentView studentView = new StudentView();
- studentView = StudentServices.Value.GetStudentView(userID);
- return View("Edit", studentView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="studentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(StudentView studentView)
- {
- studentView.UserID = Guid.Empty;
- return this.Edit(studentView);
- }
- /// <summary>
- /// 编辑、复制新增(新增、修改,业务主键:学号或考生号唯一)
- /// </summary>
- /// <param name="newUserID"></param>
- /// <param name="type"></param>
- /// <returns></returns>
- [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);
- }
- /// <summary>
- /// 编辑、复制新增(新增、修改,业务主键:学号或考生号唯一)
- /// </summary>
- /// <param name="studentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(StudentView studentView)
- {
- try
- {
- var accepts = new List<string> { ".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
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="userIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string userIDs)
- {
- try
- {
- List<Guid?> 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 });
- }
- }
- /// <summary>
- /// Excel导入
- /// </summary>
- /// <param name="errorFile"></param>
- /// <param name="operationTips"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Import(string errorFile, string operationTips)
- {
- ViewBag.ErrorFile = errorFile;
- if (string.IsNullOrEmpty(operationTips))
- {
- operationTips = "点击查看失败原因...";
- }
- ViewBag.operationTips = operationTips;
- return View();
- }
- /// <summary>
- /// Excel导入
- /// </summary>
- /// <param name="file"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Import(HttpPostedFileBase file)
- {
- try
- {
- if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
- {
- throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。");
- }
- Dictionary<string, string> cellheader = new Dictionary<string, string>
- {
- { "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<StudentView> errList = new List<StudentView>();
- 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"]
- });
- }
- }
- /// <summary>
- /// 删除照片(单个删除)
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- [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
- });
- }
- }
- /// <summary>
- /// 删除照片(批量删除)
- /// </summary>
- /// <param name="userIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PicDelete(string userIDs)
- {
- try
- {
- List<Guid?> 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
- });
- }
- }
- /// <summary>
- /// 导入学籍照片
- /// </summary>
- /// <param name="errorFile"></param>
- /// <param name="operationTips"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult PicImport(string errorFile, string operationTips)
- {
- ViewBag.ErrorFile = errorFile;
- if (string.IsNullOrEmpty(operationTips))
- {
- operationTips = "点击查看失败原因...";
- }
- ViewBag.operationTips = operationTips;
- return View();
- }
- /// <summary>
- /// 导入学籍照片
- /// </summary>
- /// <param name="file"></param>
- /// <param name="importPicType"></param>
- /// <returns></returns>
- [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<string> newPhotoPathList = new List<string>();
- 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"]
- });
- }
- }
- /// <summary>
- /// 导入学历照片
- /// </summary>
- /// <param name="errorFile"></param>
- /// <param name="operationTips"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult GraPicImport(string errorFile, string operationTips)
- {
- ViewBag.ErrorFile = errorFile;
- if (string.IsNullOrEmpty(operationTips))
- {
- operationTips = "点击查看失败原因...";
- }
- ViewBag.operationTips = operationTips;
- return View();
- }
- /// <summary>
- /// 导入学历照片
- /// </summary>
- /// <param name="file"></param>
- /// <param name="importGraPicType"></param>
- /// <returns></returns>
- [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<string> newPhotoPathList = new List<string>();
- 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"]
- });
- }
- }
- /// <summary>
- /// 照片比对页面
- /// </summary>
- /// <returns></returns>
- public ActionResult PicComparison()
- {
- return View();
- }
- /// <summary>
- /// 照片比对页面列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [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));
- }
- /// <summary>
- /// 照片比对通过
- /// </summary>
- /// <param name="userIDs"></param>
- /// <param name="studentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PicComparisonPass(string userIDs, StudentView studentView)
- {
- try
- {
- List<Guid?> 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
- });
- }
- }
- /// <summary>
- /// 照片比对驳回
- /// </summary>
- /// <param name="userIDs"></param>
- /// <param name="studentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PicComparisonUndo(string userIDs, StudentView studentView)
- {
- try
- {
- List<Guid?> 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
- });
- }
- }
- /// <summary>
- /// 照片比对Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PicComparison_Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
- var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
- var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
- var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
- var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
- var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo<Guid>();
- var isRecruitPhoto = Request.Form["IsRecruitPhotoDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsRecruitPhotoDropdown"].ParseStrTo<int>();
- var isPhoto = Request.Form["IsPhotoDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoDropdown"].ParseStrTo<int>();
- var isGraduationPhoto = Request.Form["IsGraduationPhotoDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsGraduationPhotoDropdown"].ParseStrTo<int>();
- var isPhotoComparison = Request.Form["DictionaryIsPhotoComparison"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIsPhotoComparison"].ParseStrTo<int>();
- var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
- var userIDs = Request.Form["UserIDs"];
- var userIDList = new List<Guid?>();
- 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 = "导出成功。"
- });
- }
- /// <summary>
- /// 导出照片
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult PictureExport()
- {
- return View();
- }
- /// <summary>
- /// 导出照片
- /// </summary>
- /// <param name="pararms"></param>
- /// <param name="exportPicType"></param>
- /// <param name="userIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PictureExport(QueryParamsModel pararms, string exportPicType, string userIDs)
- {
- try
- {
- var studentViewList = new List<StudentView>();
- if (!string.IsNullOrEmpty(userIDs))
- {
- List<Guid?> 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
- });
- }
- }
- /// <summary>
- /// 照片信息
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- public ActionResult PhotoDetail(Guid? userID)
- {
- StudentView studentView = new StudentView();
- if (userID.HasValue && userID != Guid.Empty)
- {
- studentView = StudentServices.Value.GetStudentView(userID);
- }
- return View(studentView);
- }
- /// <summary>
- /// 学籍异动信息
- /// </summary>
- /// <returns></returns>
- public ActionResult ChangeDetail()
- {
- return View();
- }
- /// <summary>
- /// 学籍异动信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ChangeDetail(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var userID = Request["userID"].ParseStrTo<Guid>();
- 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));
- }
- /// <summary>
- /// 学籍注册信息
- /// </summary>
- /// <returns></returns>
- public ActionResult ReportDetail()
- {
- return View();
- }
- /// <summary>
- /// 学籍注册信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ReportDetail(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var userID = Request["userID"].ParseStrTo<Guid>();
- 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));
- }
- /// <summary>
- /// 上报导出
- /// </summary>
- /// <returns></returns>
- public ActionResult ReportExport()
- {
- return View();
- }
- /// <summary>
- /// 上报导出DBF
- /// </summary>
- /// <param name="pararms"></param>
- /// <param name="userIDs"></param>
- /// <param name="colnames"></param>
- /// <param name="shownames"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ReportDBFExport(QueryParamsModel pararms, string userIDs, string colnames, string shownames)
- {
- try
- {
- List<Guid?> userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- List<string> colnameList = colnames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList();
- List<string> 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
- });
- }
- }
- /// <summary>
- /// 上报导出Excel
- /// </summary>
- /// <param name="pararms"></param>
- /// <param name="userIDs"></param>
- /// <param name="colnames"></param>
- /// <param name="shownames"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ReportExcelExport(QueryParamsModel pararms, string userIDs, string colnames, string shownames)
- {
- try
- {
- List<Guid?> userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- List<string> colnameList = colnames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList();
- List<string> 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
- });
- }
- }
- /// <summary>
- /// 操行录入
- /// </summary>
- /// <returns></returns>
- public ActionResult ConductInput()
- {
- return View();
- }
- /// <summary>
- /// 操行录入
- /// </summary>
- /// <param name="userIDs"></param>
- /// <param name="studentConductView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ConductInput(string userIDs, StudentConductView studentConductView)
- {
- try
- {
- List<Guid?> 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
- });
- }
- }
- /// <summary>
- /// 毕业证书编号Excel导入
- /// </summary>
- /// <param name="errorFile"></param>
- /// <param name="operationTips"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult GraduateNoImport(string errorFile, string operationTips)
- {
- ViewBag.ErrorFile = errorFile;
- if (string.IsNullOrEmpty(operationTips))
- {
- operationTips = "点击查看失败原因...";
- }
- ViewBag.operationTips = operationTips;
- return View();
- }
- /// <summary>
- /// 毕业证书编号Excel导入
- /// </summary>
- /// <param name="file"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GraduateNoImport(HttpPostedFileBase file)
- {
- try
- {
- if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
- {
- throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。");
- }
- Dictionary<string, string> cellheader = new Dictionary<string, string>
- {
- { "IDNumber", "身份证号" },
- { "GraduateCardNo", "毕业证书编号" },
- { "ErrorMessage", "未导入原因" }
- };
- StringBuilder errorMsg = new StringBuilder();
- string sourceWebPath = FileUploadHelper.UploadFile(file);
- var sourcePhysicalPath = Server.MapPath(sourceWebPath);
- List<StudentView> errList = new List<StudentView>();
- List<StudentView> dataList = new List<StudentView>();
- 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"]
- });
- }
- }
- /// <summary>
- /// 学生证明报表
- /// </summary>
- /// <returns></returns>
- 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();
- }
- /// <summary>
- /// 学生学籍报表
- /// </summary>
- /// <returns></returns>
- 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();
- }
- /// <summary>
- /// 学生鉴定报表
- /// </summary>
- /// <returns></returns>
- 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();
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
- var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
- var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
- var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
- var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
- var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo<Guid>();
- var isPhoto = Request.Form["IsPhotoDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoDropdown"].ParseStrTo<int>();
- var reportStatus = Request.Form["DictionaryReportStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryReportStatus"].ParseStrTo<int>();
- var planningGraduateDate = Request.Form["PlanningGraduateDateDropDown"].ToString();
- var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
- var userIDs = Request.Form["UserIDs"];
- var userIDList = new List<Guid?>();
- 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 = "导出成功。"
- });
- }
- }
- }
|