123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.IO;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using Bowin.Web.Controls.Mvc;
- using EMIS.Utility;
- using EMIS.Web.Controls;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EnrollManage.NewStudentManage;
- using EMIS.CommonLogic.EnrollManage.NewStudentManage;
- using EMIS.CommonLogic.StudentManage.StudentProfile;
- namespace EMIS.Web.Controllers.EnrollManage.NewStudentManage
- {
- [Authorization]
- public class NewStudentEnterController : Controller
- {
- public INewStudentEnterServices newStudentEnterServices { get; set; }
- 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 grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
- var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
- var generalPurpose = pararms.getExtraInt("DictionaryGeneralPurpose") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGeneralPurpose");
- var generalExist = pararms.getExtraInt("DictionaryGeneralExist") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGeneralExist");
- var newStudentEnterStatus = pararms.getExtraInt("DictionaryNewStudentEnterStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryNewStudentEnterStatus");
- return base.Json(newStudentEnterServices.GetNewStudentEnterViewGrid(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID,
- learnSystem, grademajorID, classmajorID, generalPurpose, generalExist, newStudentEnterStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="newStudentID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid newStudentID)
- {
- NewStudentView newStudentView = new NewStudentView();
- newStudentView = newStudentEnterServices.GetNewStudentEnterView(newStudentID);
- return View("Edit", newStudentView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="newStudentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(NewStudentView newStudentView)
- {
- newStudentView.NewStudentID = Guid.Empty;
- return this.Edit(newStudentView);
- }
- /// <summary>
- /// 编辑(新增、修改,业务主键:考生号唯一)
- /// 注:需对相应的业务进行处理,如:学号等
- /// </summary>
- /// <param name="newNewStudentID"></param>
- /// <param name="type"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? newNewStudentID, string type)
- {
- NewStudentView newStudentView = new NewStudentView();
- if (newNewStudentID.HasValue && newNewStudentID != Guid.Empty)
- {
- newStudentView = newStudentEnterServices.GetNewStudentEnterView(newNewStudentID);
- if (type == "copyAdd")
- {
- newStudentView.NewStudentID = Guid.Empty;
- //newStudentView.ExamineeNum = null;
- //newStudentView.AdmissionTicketNo = null;
- //newStudentView.Name = null;
- //newStudentView.IDNumber = null;
- newStudentView.RecruitPictureUrl = null;
- }
- }
- else
- {
- newStudentView.NationID = (int)CF_Nation.Han;
- newStudentView.PoliticsID = (int)CF_Politics.YouthLeague;
- newStudentView.CertificatesType = (int)CF_CertificatesType.IdCrad;
- newStudentView.GradeID = BaseExtensions.GetCurrentYearID();
- newStudentView.SemesterID = BaseExtensions.GetEntranceSemesterID();
- newStudentView.AssignStatus = (int)CF_AssignStatus.Assigned;
- }
- return View(newStudentView);
- }
- /// <summary>
- /// 编辑(新增、修改,业务主键:考生号唯一)
- /// 注:需对相应的业务进行处理,如:学号等
- /// </summary>
- /// <param name="newStudentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(NewStudentView newStudentView)
- {
- try
- {
- var accepts = new List<string> { ".jpg", ".jpeg", ".png", ".bmp" };
- var postedFile = Request.Files["RecruitPictureUrl"];
- if (!string.IsNullOrEmpty(postedFile.FileName) && !accepts.Contains(Path.GetExtension(postedFile.FileName).ToLower()))
- {
- throw new Exception("只允许上传.jpg、.jpeg、.png、.bmp格式的文件。");
- }
- string photoUrl = FileUploadHelper.UploadFile(postedFile);
- newStudentEnterServices.NewStudentEnterEdit(newStudentView, 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="newStudentIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string newStudentIDs)
- {
- try
- {
- List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- newStudentEnterServices.NewStudentEnterDelete(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除照片(单个删除)
- /// </summary>
- /// <param name="newStudentID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DeletePhoto(Guid? newStudentID)
- {
- try
- {
- this.newStudentEnterServices.DeletePhoto(newStudentID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除照片成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除照片失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除照片(批量删除)
- /// </summary>
- /// <param name="newStudentIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PicDelete(string newStudentIDs)
- {
- try
- {
- List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- this.newStudentEnterServices.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="newStudentIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CancelAssignCollege(string newStudentIDs)
- {
- try
- {
- List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- string result = newStudentEnterServices.NewStudentEnterCancelAssignCollege(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="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();
- newStudentEnterServices.NewStudentEnterPicImport(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 DoubtImport(string errorFile, string operationTips)
- {
- ViewBag.ErrorFile = errorFile;
- if (string.IsNullOrEmpty(operationTips))
- {
- operationTips = "点击查看失败原因...";
- }
- ViewBag.operationTips = operationTips;
- return View();
- }
- /// <summary>
- /// 导入标识
- /// </summary>
- /// <param name="file"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DoubtImport(HttpPostedFileBase file)
- {
- try
- {
- if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
- {
- throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。");
- }
- //注:只获取Excel模板中的有效列
- Dictionary<string, string> cellheader = new Dictionary<string, string>
- {
- { "Name", "姓名" }, //姓名
- { "IDNumber", "身份证号" }, //身份证号
- { "ErrorMessage", "未导入原因" }
- };
- StringBuilder errorMsg = new StringBuilder(); // 错误信息
- string sourceWebPath = FileUploadHelper.UploadFile(file);
- var sourcePhysicalPath = Server.MapPath(sourceWebPath);
- List<NewStudentView> errList = new List<NewStudentView>();
- List<NewStudentView> dataList = new List<NewStudentView>();
- int? inCount = 0; //导入个数
- int? upCount = 0; //更新个数
- int? errCount = 0; //失败个数
- //导入
- newStudentEnterServices.NewStudentEnterDoubtImport(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("DoubtImport").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("DoubtImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
- });
- }
- }
- /// <summary>
- /// 标识名单
- /// </summary>
- /// <returns></returns>
- public ActionResult DoubtList()
- {
- return View();
- }
- /// <summary>
- /// 标识名单
- /// </summary>
- /// <param name="newStudentIDs"></param>
- /// <param name="newStudentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DoubtList(string newStudentIDs, NewStudentView newStudentView)
- {
- try
- {
- List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- string result = newStudentEnterServices.NewStudentEnterDoubtApprove(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="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult NewStudentEnterDoubtList(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 isPhotoUrl = pararms.getExtraInt("IsPhotoUrlDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoUrlDropdown");
- return base.Json(newStudentEnterServices.GetNewStudentEnterDoubtViewGrid(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, isPhotoUrl, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// Excel标识名单导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel_NewStudentEnterDoubt()
- {
- 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 isPhotoUrl = Request.Form["IsPhotoUrlDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoUrlDropdown"].ParseStrTo<int>();
- var dt = newStudentEnterServices.GetNewStudentEnterDoubtViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, isPhotoUrl)
- .Select(x => new
- {
- x.ExamineeNum,
- x.AdmissionTicketNo,
- x.Name,
- x.SexName,
- x.NationName,
- x.PoliticsName,
- BirthDate = x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : "",
- x.CertificatesTypeName,
- x.IDNumber,
- x.GradeID,
- x.SemesterName,
- x.StandardCode,
- x.StandardID,
- x.StandardName,
- x.EducationName,
- x.LearningformName,
- LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : null,
- EntranceDate = x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyy-MM-dd") : "",
- x.Score,
- x.Telephone,
- x.Address,
- x.Dormitory,
- x.RecruitPictureUrl,
- x.CollegeNo,
- x.CollegeName,
- x.GrademajorCode,
- x.GrademajorName,
- x.ClassmajorNo,
- x.ClassmajorName,
- x.StudentNo,
- x.EnrollmentNo,
- x.IsDoubtName,
- x.AssignStatusName,
- x.RecordStatusName,
- x.Remark
- }).ToTable();
- string[] liststring = {
- "考生号", "准考证号","姓名", "性别", "民族", "政治面貌", "出生日期", "证件类型", "身份证号",
- "年级", "学期", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式", "学制",
- "入学日期", "总分", "联系电话", "通讯地址", "宿舍地址", "照片Url", RSL.Get("CollegeCode"),
- RSL.Get("CollegeName"), "年级专业代码", "年级专业名称", "班级编号", "班级名称", "学号",
- "录取通知书编号", "标识状态", "分配状态", "状态", "备注"
- };
- neh.Export(dt, liststring, "标识名单信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- /// <summary>
- /// 初始化(班级信息、学号)
- /// </summary>
- /// <param name="newStudentIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Init(string newStudentIDs)
- {
- try
- {
- List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- string result = newStudentEnterServices.NewStudentEnterInit(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "初始化成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "初始化学号失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 手动分配班级和生成学号(此为默认规则,初始学号为:班级编号+流水号,下一位学号为:对应的最大学号+1)
- /// 注:个性化配置
- /// </summary>
- /// <returns></returns>
- public ActionResult AssignClass()
- {
- return View();
- }
- /// <summary>
- /// 手动分配班级和生成学号(此为默认规则,初始学号为:班级编号+流水号,下一位学号为:对应的最大学号+1)
- /// 注:个性化配置
- /// </summary>
- /// <param name="newStudentIDs"></param>
- /// <param name="newStudentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult AssignClass(string newStudentIDs, NewStudentView newStudentView)
- {
- try
- {
- var newStudentIDList = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- string result = newStudentEnterServices.NewStudentEnterAssignClass(newStudentIDList, newStudentView.ClassmajorID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 自动分配班级和生成学号
- /// 注:个性化配置
- /// 此为默认规则,初始学号为:班级编号+流水号,下一位学号为:对应的最大学号+1)
- /// 目前只支持,学号=班级编号+流水号的情况,针对学号生成规则不同、专业分方向、有两个班以上等等情况,需要进行扩展-普教版本
- /// </summary>
- /// <param name="newStudentIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult AutoAssignClass(string newStudentIDs)
- {
- try
- {
- List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- string result = newStudentEnterServices.NewStudentEnterAutoAssignClass(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 录取通知书打印
- /// </summary>
- /// <returns></returns>
- public ActionResult AdmissionLetterReport()
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- ViewBag.LoginUserID = curUser.UserID.ToString();
- var dataRangeID = StudentServices.Value.GetDataRangeID();
- ViewBag.DataRangeID = dataRangeID;
- return View();
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="newStudentIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Submit(string newStudentIDs)
- {
- try
- {
- List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- string result = newStudentEnterServices.NewStudentEnterSubmit(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 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 grademajorID = Request.Form["GrademajorComboGrid"].ParseStrTo<Guid>();
- var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo<Guid>();
- var generalPurpose = Request.Form["DictionaryGeneralPurpose"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGeneralPurpose"].ParseStrTo<int>();
- var generalExist = Request.Form["DictionaryGeneralExist"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGeneralExist"].ParseStrTo<int>();
- var newStudentEnterStatus = Request.Form["DictionaryNewStudentEnterStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryNewStudentEnterStatus"].ParseStrTo<int>();
- var dt = newStudentEnterServices.GetNewStudentEnterViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID,
- learnSystem, grademajorID, classmajorID, generalPurpose, generalExist, newStudentEnterStatus)
- .Select(x => new
- {
- x.ExamineeNum,
- x.AdmissionTicketNo,
- x.Name,
- x.SexName,
- x.NationName,
- x.PoliticsName,
- BirthDate = x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : "",
- x.CertificatesTypeName,
- x.IDNumber,
- x.GradeID,
- x.SemesterName,
- x.StandardCode,
- x.StandardID,
- x.StandardName,
- x.EducationName,
- x.LearningformName,
- LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : null,
- EntranceDate = x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyy-MM-dd") : "",
- x.Score,
- x.Telephone,
- x.Address,
- x.Dormitory,
- x.RecruitPictureUrl,
- x.CollegeNo,
- x.CollegeName,
- x.GrademajorCode,
- x.GrademajorName,
- x.ClassmajorNo,
- x.ClassmajorName,
- x.StudentNo,
- x.EnrollmentNo,
- x.IsDoubtName,
- x.AssignStatusName,
- x.RecordStatusName,
- x.Remark
- }).ToTable();
- string[] liststring = {
- "考生号", "准考证号","姓名", "性别", "民族", "政治面貌", "出生日期", "证件类型", "身份证号",
- "年级", "学期", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式", "学制",
- "入学日期", "总分", "联系电话", "通讯地址", "宿舍地址", "照片Url", RSL.Get("CollegeCode"),
- RSL.Get("CollegeName"), "年级专业代码", "年级专业名称", "班级编号", "班级名称", "学号",
- "录取通知书编号", "标识状态", "分配状态", "状态", "备注"
- };
- neh.Export(dt, liststring, "录取名单信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|