StudentController.cs 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using System.IO;
  7. using System.Text;
  8. using System.Data;
  9. using Bowin.Web.Controls.Mvc;
  10. using Bowin.Common.Data;
  11. using Bowin.Common.Utility;
  12. using Bowin.Common.Exceptions;
  13. using EMIS.Utility;
  14. using EMIS.Web.Controls;
  15. using EMIS.ViewModel;
  16. using EMIS.ViewModel.StudentManage.StudentProfile;
  17. using EMIS.CommonLogic.StudentManage.StudentProfile;
  18. namespace EMIS.Web.Controllers.StudentManage.StudentProfile
  19. {
  20. [Authorization]
  21. public class StudentController : Controller
  22. {
  23. public Lazy<IStudentServices> StudentServices { get; set; }
  24. /// <summary>
  25. /// 学生信息页面
  26. /// </summary>
  27. /// <returns></returns>
  28. public ActionResult List()
  29. {
  30. return View();
  31. }
  32. /// <summary>
  33. /// 学生信息列表查询
  34. /// </summary>
  35. /// <param name="pararms"></param>
  36. /// <returns></returns>
  37. [HttpPost]
  38. public ActionResult List(QueryParamsModel pararms)
  39. {
  40. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  41. var campusID = pararms.getExtraGuid("CampusDropdown");
  42. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  43. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  44. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  45. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  46. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  47. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  48. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  49. var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown");
  50. var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus");
  51. var planningGraduateDate = pararms.getExtraString("PlanningGraduateDateDropDown");
  52. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  53. return base.Json(StudentServices.Value.GetStudentViewGrid(configuretView, campusID, collegeID, gradeID, standardID, educationID,
  54. learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  55. }
  56. /// <summary>
  57. /// 查询对应的学生信息StudentBaseView(全部)
  58. /// </summary>
  59. /// <param name="pararms"></param>
  60. /// <returns></returns>
  61. [HttpPost]
  62. public ActionResult StudentBaseAllList(QueryParamsModel pararms)
  63. {
  64. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  65. var userID = Request["userID"].ParseStrTo<Guid>();
  66. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  67. return base.Json(StudentServices.Value.GetStudentBaseViewGrid(configuretView, userID, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  68. }
  69. /// <summary>
  70. /// 查询对应的学生信息StudentBaseView(在校)
  71. /// </summary>
  72. /// <param name="pararms"></param>
  73. /// <returns></returns>
  74. [HttpPost]
  75. public ActionResult StudentBaseInSchoolList(QueryParamsModel pararms)
  76. {
  77. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  78. var userID = Request["userID"].ParseStrTo<Guid>();
  79. var inSchoolStatus = (int)CF_INOrOutSchoolStatus.Yes;
  80. return base.Json(StudentServices.Value.GetStudentBaseViewGrid(configuretView, userID, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  81. }
  82. /// <summary>
  83. /// 查询对应的学生信息StudentBaseView(非在校)
  84. /// </summary>
  85. /// <param name="pararms"></param>
  86. /// <returns></returns>
  87. [HttpPost]
  88. public ActionResult StudentBaseNotInSchoolList(QueryParamsModel pararms)
  89. {
  90. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  91. var userID = Request["userID"].ParseStrTo<Guid>();
  92. var inSchoolStatus = (int)CF_INOrOutSchoolStatus.No;
  93. return base.Json(StudentServices.Value.GetStudentBaseViewGrid(configuretView, userID, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  94. }
  95. /// <summary>
  96. /// 预计毕业日期列表
  97. /// </summary>
  98. /// <param name="pararms"></param>
  99. /// <returns></returns>
  100. [HttpPost]
  101. public ActionResult PlanningGraduateDateList(QueryParamsModel pararms)
  102. {
  103. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  104. return base.Json(StudentServices.Value.GetStudentPlanningGraduateDateGrid(configuretView, (int)pararms.page, (int)pararms.rows));
  105. }
  106. /// <summary>
  107. /// 查询对应的预计毕业日期
  108. /// </summary>
  109. /// <param name="grademajorID"></param>
  110. /// <returns></returns>
  111. [HttpPost]
  112. public ActionResult GetPlanningGraduateDate(Guid? grademajorID)
  113. {
  114. string planningGraduateDate = StudentServices.Value.GetPlanningGraduateDate(grademajorID);
  115. return base.Json(planningGraduateDate);
  116. }
  117. /// <summary>
  118. /// 查询对应的毕业学期中的毕业日期
  119. /// </summary>
  120. /// <param name="grademajorID"></param>
  121. /// <returns></returns>
  122. [HttpPost]
  123. public ActionResult GetGraduateDate(Guid? grademajorID)
  124. {
  125. string graduateDate = StudentServices.Value.GetGraduateDate(grademajorID);
  126. return base.Json(graduateDate);
  127. }
  128. /// <summary>
  129. /// 复制新增
  130. /// </summary>
  131. /// <param name="userID"></param>
  132. /// <returns></returns>
  133. public ActionResult CopyAdd(Guid userID)
  134. {
  135. StudentView studentView = new StudentView();
  136. studentView = StudentServices.Value.GetStudentView(userID);
  137. return View("Edit", studentView);
  138. }
  139. /// <summary>
  140. /// 复制新增
  141. /// </summary>
  142. /// <param name="studentView"></param>
  143. /// <returns></returns>
  144. [HttpPost]
  145. public ActionResult CopyAdd(StudentView studentView)
  146. {
  147. studentView.UserID = Guid.Empty;
  148. return this.Edit(studentView);
  149. }
  150. /// <summary>
  151. /// 编辑、复制新增(新增、修改,业务主键:学号或考生号唯一)
  152. /// </summary>
  153. /// <param name="newUserID"></param>
  154. /// <param name="type"></param>
  155. /// <returns></returns>
  156. [HttpGet]
  157. public ActionResult Edit(Guid? newUserID, string type)
  158. {
  159. StudentView studentView = new StudentView();
  160. if (newUserID.HasValue && newUserID != Guid.Empty)
  161. {
  162. studentView = StudentServices.Value.GetStudentView(newUserID);
  163. if (type == "copyAdd")
  164. {
  165. studentView.UserID = Guid.Empty;
  166. studentView.RecruitPictureUrl = null;
  167. studentView.PhotoUrl = null;
  168. studentView.GraduationPictureUrl = null;
  169. studentView.IsPhotoComparison = false;
  170. studentView.IsProofread = false;
  171. }
  172. }
  173. else
  174. {
  175. studentView.NationID = (int)CF_Nation.Han;
  176. studentView.PoliticsID = (int)CF_Politics.YouthLeague;
  177. studentView.CertificatesType = (int)CF_CertificatesType.IdCrad;
  178. studentView.StudentType = (int)CF_STUDENTTYPE.DefaultType;
  179. studentView.InSchoolStatusID = (int)CF_InschoolStatus.InSchool;
  180. studentView.StudentStatus = (int)CF_StudentStatus.Registration;
  181. studentView.HealthStateID = (int)CF_HealthState.Healthy;
  182. studentView.IsPhotoComparison = false;
  183. studentView.IsProofread = false;
  184. }
  185. return View(studentView);
  186. }
  187. /// <summary>
  188. /// 编辑、复制新增(新增、修改,业务主键:学号或考生号唯一)
  189. /// </summary>
  190. /// <param name="studentView"></param>
  191. /// <returns></returns>
  192. [HttpPost]
  193. public ActionResult Edit(StudentView studentView)
  194. {
  195. try
  196. {
  197. var accepts = new List<string> { ".jpg", ".jpeg", ".png", ".bmp" };
  198. var postedFile = Request.Files["PhotoUrl"];
  199. if (postedFile != null && !string.IsNullOrEmpty(postedFile.FileName) && !accepts.Contains(Path.GetExtension(postedFile.FileName).ToLower()))
  200. {
  201. throw new Exception("只允许上传.jpg、.jpeg、.png、.bmp格式的文件。");
  202. }
  203. string photoUrl = FileUploadHelper.UploadFile(postedFile);
  204. StudentServices.Value.StudentEdit(studentView, photoUrl);
  205. return RedirectToAction("MsgShow", "Common", new
  206. {
  207. WindowID = Request["WindowID"],
  208. msg = "保存成功。",
  209. url = Url.Action("List").AddMenuParameter()
  210. });
  211. }
  212. catch (Exception ex)
  213. {
  214. return RedirectToAction("MsgShowAndOpen", "Common", new
  215. {
  216. WindowID = Request["WindowID"],
  217. msg = "保存失败,原因:" + ex.Message
  218. });
  219. }
  220. }
  221. /// <summary>
  222. /// 删除
  223. /// </summary>
  224. /// <param name="userIDs"></param>
  225. /// <returns></returns>
  226. [HttpPost]
  227. public ActionResult Delete(string userIDs)
  228. {
  229. try
  230. {
  231. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  232. StudentServices.Value.StudentDelete(list);
  233. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  234. }
  235. catch (Exception ex)
  236. {
  237. string mge = ex.Message;
  238. System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  239. if (num != null)
  240. {
  241. if (num.Number == 547)
  242. {
  243. mge = "请先删除与其关联的数据,如:学期注册、异动申请、教学任务、学生成绩等。";
  244. }
  245. }
  246. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + mge });
  247. }
  248. }
  249. /// <summary>
  250. /// Excel导入
  251. /// </summary>
  252. /// <param name="errorFile"></param>
  253. /// <param name="operationTips"></param>
  254. /// <returns></returns>
  255. [HttpGet]
  256. public ActionResult Import(string errorFile, string operationTips)
  257. {
  258. ViewBag.ErrorFile = errorFile;
  259. if (string.IsNullOrEmpty(operationTips))
  260. {
  261. operationTips = "点击查看失败原因...";
  262. }
  263. ViewBag.operationTips = operationTips;
  264. return View();
  265. }
  266. /// <summary>
  267. /// Excel导入
  268. /// </summary>
  269. /// <param name="file"></param>
  270. /// <returns></returns>
  271. [HttpPost]
  272. public ActionResult Import(HttpPostedFileBase file)
  273. {
  274. try
  275. {
  276. if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
  277. {
  278. throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。");
  279. }
  280. Dictionary<string, string> cellheader = new Dictionary<string, string>
  281. {
  282. { "ExamineeNum", "考生号" },
  283. { "AdmissionTicketNo", "准考证号" },
  284. { "StudentNo", "学号" },
  285. { "Name", "姓名" },
  286. { "UsedName", "曾用名" },
  287. { "SexStr", "性别" },
  288. { "BirthDateStr", "出生日期" },
  289. { "NationStr", "民族" },
  290. { "PoliticsStr", "政治面貌" },
  291. { "StudentTypeStr", "学生类别" },
  292. { "CertificatesTypeStr", "证件类型" },
  293. { "IDNumber", "证件号码" },
  294. { "InSchoolStatusStr", "在校状态" },
  295. { "StudentStatusStr", "学籍状态" },
  296. { "ClassmajorNo", "班级编号" },
  297. { "ClassmajorName", "班级名称" },
  298. { "LiteracyLevelStr", "文化程度" },
  299. { "CultureModelStr", "培养方式" },
  300. { "ExamineeTypeStr", "考生类别" },
  301. { "EntranceDateStr", "入学日期" },
  302. { "ScoreStr", "总分" },
  303. { "EntranceWayStr", "入学方式" },
  304. { "FeaturesStr", "考生特征" },
  305. { "TerritorialStr", "生源所属地" },
  306. { "Area", "来源地区" },
  307. { "Country", "国籍" },
  308. { "Place", "籍贯" },
  309. { "BornPlace", "出生地" },
  310. { "Email", "电子邮箱" },
  311. { "Mobile", "移动电话" },
  312. { "Telephone", "家庭电话" },
  313. { "ZIPCode", "邮政编码" },
  314. { "HealthStateStr", "健康状况" },
  315. { "BloodGroupStr", "血型" },
  316. { "Specialty", "特长" },
  317. { "Height", "身高(cm)" },
  318. { "Weight", "体重(kg)" },
  319. { "WeChatNum", "微信号" },
  320. { "QQ", "QQ" },
  321. { "HomeAddress", "家庭住址" },
  322. { "WorkUnit", "工作单位" },
  323. { "Address", "通信地址" },
  324. { "Dormitory", "宿舍地址" },
  325. { "Recipient", "收件人" },
  326. { "IsDreamProjectStr", "圆梦计划" },
  327. { "DirectorName", "导师姓名" },
  328. { "BankName", "开户银行" },
  329. { "CardNo", "银行卡号" },
  330. { "StudentCardNo", "学籍卡编号" },
  331. { "GraduateCardNo", "毕结业证书编号" },
  332. { "DegreeStatusStr", "学位有无" },
  333. { "Career", "在校经历" },
  334. { "Remark", "备注" },
  335. { "ErrorMessage", "未导入原因" }
  336. };
  337. int? inCount = 0;
  338. int? upCount = 0;
  339. int? errCount = 0;
  340. List<StudentView> errList = new List<StudentView>();
  341. string sourceWebPath = FileUploadHelper.UploadFile(file);
  342. var sourcePhysicalPath = Server.MapPath(sourceWebPath);
  343. StudentServices.Value.StudentImport(cellheader, out inCount, out upCount, out errList, out errCount, sourcePhysicalPath);
  344. System.IO.File.Delete(sourcePhysicalPath);
  345. if (errList.Count() > 0)
  346. {
  347. string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, errList, "学生信息导入失败文件", sourcePhysicalPath));
  348. ViewBag.ErrorFile = errorWebPath;
  349. string Errinfo = string.Format("提示:{0}条学生信息导入成功,{1}条学生信息更新成功,{2}条学生信息导入失败,点击查看。", inCount, upCount, errCount);
  350. ViewBag.operationTips = Errinfo;
  351. return RedirectToAction("MsgShow", "Common", new
  352. {
  353. WindowID = "none",
  354. msg = Errinfo,
  355. url = Url.Action("Import").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"]
  356. });
  357. }
  358. else
  359. {
  360. string successInfo = string.Format("提示:{0}条学生信息导入成功,{1}条学生信息更新成功。", inCount, upCount);
  361. return RedirectToAction("MsgShow", "Common", new
  362. {
  363. WindowID = Request["WindowID"],
  364. msg = successInfo,
  365. url = Url.Action("List").AddMenuParameter()
  366. });
  367. }
  368. }
  369. catch (Exception ex)
  370. {
  371. return RedirectToAction("MsgShow", "Common", new
  372. {
  373. WindowID = "none",
  374. msg = "导入失败,原因:" + ex.Message,
  375. url = Url.Action("Import").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
  376. });
  377. }
  378. }
  379. /// <summary>
  380. /// 删除照片(单个删除)
  381. /// </summary>
  382. /// <param name="userID"></param>
  383. /// <returns></returns>
  384. [HttpPost]
  385. public ActionResult DeletePhoto(Guid? userID)
  386. {
  387. try
  388. {
  389. this.StudentServices.Value.DeletePhoto(userID);
  390. return Json(new ReturnMessage()
  391. {
  392. IsSuccess = true,
  393. Message = "删除照片成功。"
  394. });
  395. }
  396. catch (Exception ex)
  397. {
  398. return Json(new ReturnMessage()
  399. {
  400. IsSuccess = false,
  401. Message = "删除照片失败:" + ex.Message
  402. });
  403. }
  404. }
  405. /// <summary>
  406. /// 删除照片(批量删除)
  407. /// </summary>
  408. /// <param name="userIDs"></param>
  409. /// <returns></returns>
  410. [HttpPost]
  411. public ActionResult PicDelete(string userIDs)
  412. {
  413. try
  414. {
  415. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  416. this.StudentServices.Value.PicDelete(list);
  417. return Json(new ReturnMessage()
  418. {
  419. IsSuccess = true,
  420. Message = "删除照片成功。"
  421. });
  422. }
  423. catch (Exception ex)
  424. {
  425. return Json(new ReturnMessage()
  426. {
  427. IsSuccess = false,
  428. Message = "删除照片失败:" + ex.Message
  429. });
  430. }
  431. }
  432. /// <summary>
  433. /// 导入学籍照片
  434. /// </summary>
  435. /// <param name="errorFile"></param>
  436. /// <param name="operationTips"></param>
  437. /// <returns></returns>
  438. [HttpGet]
  439. public ActionResult PicImport(string errorFile, string operationTips)
  440. {
  441. ViewBag.ErrorFile = errorFile;
  442. if (string.IsNullOrEmpty(operationTips))
  443. {
  444. operationTips = "点击查看失败原因...";
  445. }
  446. ViewBag.operationTips = operationTips;
  447. return View();
  448. }
  449. /// <summary>
  450. /// 导入学籍照片
  451. /// </summary>
  452. /// <param name="file"></param>
  453. /// <param name="importPicType"></param>
  454. /// <returns></returns>
  455. [HttpPost]
  456. public ActionResult PicImport(HttpPostedFileBase file, string importPicType)
  457. {
  458. try
  459. {
  460. if (file.ContentLength <= 0)
  461. {
  462. throw new Exception("请选择你要上传的照片(注:格式为zip或rar的压缩包文件)。");
  463. }
  464. var acceptFileExtensions = new[] { ".zip", ".rar" };
  465. var fileExtensionName = Path.GetExtension(file.FileName);
  466. if (!acceptFileExtensions.Contains(fileExtensionName))
  467. {
  468. throw new Exception("格式错误,只允许上传zip或rar格式的压缩包文件。");
  469. }
  470. string fileSourceWebPath = null;
  471. string errorSourceWebPath = null;
  472. var photoPathList = FileUploadHelper.UploadFileAndExtractFile(file, out fileSourceWebPath, out errorSourceWebPath);
  473. System.IO.File.Delete(Server.MapPath(fileSourceWebPath));
  474. if (photoPathList == null || photoPathList.Count <= 0)
  475. {
  476. throw new Exception("压缩包中文件为空。");
  477. }
  478. var acceptPicExtensions = new[] { ".jpg", ".jpeg", ".png", ".bmp" };
  479. List<string> newPhotoPathList = new List<string>();
  480. foreach (var photoPath in photoPathList)
  481. {
  482. string photoExtensionName = Path.GetExtension(photoPath).ToLower();
  483. if (acceptPicExtensions.Contains(photoExtensionName))
  484. {
  485. newPhotoPathList.Add(photoPath);
  486. }
  487. else
  488. {
  489. throw new Exception("压缩包中含有不支持的照片格式。");
  490. }
  491. }
  492. int? inCount = 0;
  493. int? errCount = 0;
  494. var errDataTable = new DataTable();
  495. StudentServices.Value.StudentPicImport(newPhotoPathList, importPicType, out inCount, out errCount, out errDataTable);
  496. if (errDataTable != null && errDataTable.Rows.Count > 0)
  497. {
  498. NpoiExcelHelper npoiExcelHelper = new NpoiExcelHelper();
  499. npoiExcelHelper.SaveInServer(errDataTable, Server.MapPath(errorSourceWebPath));
  500. string errorWebPath = string.Format("{0}", errorSourceWebPath);
  501. ViewBag.ErrorFile = errorWebPath;
  502. string Errinfo = string.Format("提示:{0}个照片导入成功,{1}个照片导入失败,点击查看。", inCount, errCount);
  503. ViewBag.operationTips = Errinfo;
  504. return RedirectToAction("MsgShow", "Common", new
  505. {
  506. WindowID = "none",
  507. msg = Errinfo,
  508. url = Url.Action("PicImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"]
  509. });
  510. }
  511. else
  512. {
  513. string successInfo = string.Format("提示:{0}个照片导入成功。", inCount);
  514. return RedirectToAction("MsgShow", "Common", new
  515. {
  516. WindowID = Request["WindowID"],
  517. msg = successInfo,
  518. url = Url.Action("List").AddMenuParameter()
  519. });
  520. }
  521. }
  522. catch (Exception ex)
  523. {
  524. return RedirectToAction("MsgShow", "Common", new
  525. {
  526. WindowID = "none",
  527. msg = "导入照片失败,原因:" + ex.Message,
  528. url = Url.Action("PicImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
  529. });
  530. }
  531. }
  532. /// <summary>
  533. /// 导入学历照片
  534. /// </summary>
  535. /// <param name="errorFile"></param>
  536. /// <param name="operationTips"></param>
  537. /// <returns></returns>
  538. [HttpGet]
  539. public ActionResult GraPicImport(string errorFile, string operationTips)
  540. {
  541. ViewBag.ErrorFile = errorFile;
  542. if (string.IsNullOrEmpty(operationTips))
  543. {
  544. operationTips = "点击查看失败原因...";
  545. }
  546. ViewBag.operationTips = operationTips;
  547. return View();
  548. }
  549. /// <summary>
  550. /// 导入学历照片
  551. /// </summary>
  552. /// <param name="file"></param>
  553. /// <param name="importGraPicType"></param>
  554. /// <returns></returns>
  555. [HttpPost]
  556. public ActionResult GraPicImport(HttpPostedFileBase file, string importGraPicType)
  557. {
  558. try
  559. {
  560. if (file.ContentLength <= 0)
  561. {
  562. throw new Exception("请选择你要上传的照片(注:格式为zip或rar的压缩包文件)。");
  563. }
  564. var acceptFileExtensions = new[] { ".zip", ".rar" };
  565. var fileExtensionName = Path.GetExtension(file.FileName);
  566. if (!acceptFileExtensions.Contains(fileExtensionName))
  567. {
  568. throw new Exception("格式错误,只允许上传zip或rar格式的压缩包文件。");
  569. }
  570. string fileSourceWebPath = null;
  571. string errorSourceWebPath = null;
  572. var photoPathList = FileUploadHelper.UploadFileAndExtractFile(file, out fileSourceWebPath, out errorSourceWebPath);
  573. System.IO.File.Delete(Server.MapPath(fileSourceWebPath));
  574. if (photoPathList == null || photoPathList.Count <= 0)
  575. {
  576. throw new Exception("压缩包中文件为空。");
  577. }
  578. var acceptPicExtensions = new[] { ".jpg", ".jpeg", ".png", ".bmp" };
  579. List<string> newPhotoPathList = new List<string>();
  580. foreach (var photoPath in photoPathList)
  581. {
  582. string photoExtensionName = Path.GetExtension(photoPath).ToLower();
  583. if (acceptPicExtensions.Contains(photoExtensionName))
  584. {
  585. newPhotoPathList.Add(photoPath);
  586. }
  587. else
  588. {
  589. throw new Exception("压缩包中含有不支持的照片格式。");
  590. }
  591. }
  592. int? inCount = 0;
  593. int? errCount = 0;
  594. var errDataTable = new DataTable();
  595. StudentServices.Value.StudentGraPicImport(newPhotoPathList, importGraPicType, out inCount, out errCount, out errDataTable);
  596. if (errDataTable != null && errDataTable.Rows.Count > 0)
  597. {
  598. NpoiExcelHelper npoiExcelHelper = new NpoiExcelHelper();
  599. npoiExcelHelper.SaveInServer(errDataTable, Server.MapPath(errorSourceWebPath));
  600. string errorWebPath = string.Format("{0}", errorSourceWebPath);
  601. ViewBag.ErrorFile = errorWebPath;
  602. string Errinfo = string.Format("提示:{0}个学历照片导入成功,{1}个学历照片导入失败,点击查看。", inCount, errCount);
  603. ViewBag.operationTips = Errinfo;
  604. return RedirectToAction("MsgShow", "Common", new
  605. {
  606. WindowID = "none",
  607. msg = Errinfo,
  608. url = Url.Action("GraPicImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"]
  609. });
  610. }
  611. else
  612. {
  613. string successInfo = string.Format("提示:{0}个学历照片导入成功。", inCount);
  614. return RedirectToAction("MsgShow", "Common", new
  615. {
  616. WindowID = Request["WindowID"],
  617. msg = successInfo,
  618. url = Url.Action("List").AddMenuParameter()
  619. });
  620. }
  621. }
  622. catch (Exception ex)
  623. {
  624. return RedirectToAction("MsgShow", "Common", new
  625. {
  626. WindowID = "none",
  627. msg = "导入失败,原因:" + ex.Message,
  628. url = Url.Action("GraPicImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
  629. });
  630. }
  631. }
  632. /// <summary>
  633. /// 照片比对页面
  634. /// </summary>
  635. /// <returns></returns>
  636. public ActionResult PicComparison()
  637. {
  638. return View();
  639. }
  640. /// <summary>
  641. /// 照片比对页面列表查询
  642. /// </summary>
  643. /// <param name="pararms"></param>
  644. /// <returns></returns>
  645. [HttpPost]
  646. public ActionResult PicComparison(QueryParamsModel pararms)
  647. {
  648. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  649. var campusID = pararms.getExtraGuid("CampusDropdown");
  650. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  651. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  652. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  653. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  654. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  655. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  656. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  657. var isRecruitPhoto = pararms.getExtraInt("IsRecruitPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsRecruitPhotoDropdown");
  658. var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown");
  659. var isGraduationPhoto = pararms.getExtraInt("IsGraduationPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsGraduationPhotoDropdown");
  660. var isPhotoComparison = pararms.getExtraInt("DictionaryIsPhotoComparison") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsPhotoComparison");
  661. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  662. return base.Json(StudentServices.Value.GetStudentPicComparisonGrid(configuretView, campusID, collegeID, gradeID, standardID, educationID,
  663. learningformID, learnSystem, classmajorID, isRecruitPhoto, isPhoto, isGraduationPhoto, isPhotoComparison, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  664. }
  665. /// <summary>
  666. /// 照片比对通过
  667. /// </summary>
  668. /// <param name="userIDs"></param>
  669. /// <param name="studentView"></param>
  670. /// <returns></returns>
  671. [HttpPost]
  672. public ActionResult PicComparisonPass(string userIDs, StudentView studentView)
  673. {
  674. try
  675. {
  676. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  677. string result = StudentServices.Value.StudentPicComparisonPass(list);
  678. return Json(new ReturnMessage()
  679. {
  680. IsSuccess = true,
  681. Message = "比对通过成功" + result + "。"
  682. });
  683. }
  684. catch (Exception ex)
  685. {
  686. return Json(new ReturnMessage()
  687. {
  688. IsSuccess = false,
  689. Message = "比对失败,原因:" + ex.Message
  690. });
  691. }
  692. }
  693. /// <summary>
  694. /// 照片比对驳回
  695. /// </summary>
  696. /// <param name="userIDs"></param>
  697. /// <param name="studentView"></param>
  698. /// <returns></returns>
  699. [HttpPost]
  700. public ActionResult PicComparisonUndo(string userIDs, StudentView studentView)
  701. {
  702. try
  703. {
  704. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  705. string result = StudentServices.Value.StudentPicComparisonUndo(list);
  706. return Json(new ReturnMessage()
  707. {
  708. IsSuccess = true,
  709. Message = "比对驳回成功" + result + "。"
  710. });
  711. }
  712. catch (Exception ex)
  713. {
  714. return Json(new ReturnMessage()
  715. {
  716. IsSuccess = false,
  717. Message = "比对失败,原因:" + ex.Message
  718. });
  719. }
  720. }
  721. /// <summary>
  722. /// 照片比对Excel导出
  723. /// </summary>
  724. /// <returns></returns>
  725. [HttpPost]
  726. public ActionResult PicComparison_Excel()
  727. {
  728. NpoiExcelHelper neh = new NpoiExcelHelper();
  729. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  730. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  731. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  732. var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  733. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  734. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  735. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  736. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  737. var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo<Guid>();
  738. var isRecruitPhoto = Request.Form["IsRecruitPhotoDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsRecruitPhotoDropdown"].ParseStrTo<int>();
  739. var isPhoto = Request.Form["IsPhotoDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoDropdown"].ParseStrTo<int>();
  740. var isGraduationPhoto = Request.Form["IsGraduationPhotoDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsGraduationPhotoDropdown"].ParseStrTo<int>();
  741. var isPhotoComparison = Request.Form["DictionaryIsPhotoComparison"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIsPhotoComparison"].ParseStrTo<int>();
  742. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  743. var userIDs = Request.Form["UserIDs"];
  744. var userIDList = new List<Guid?>();
  745. if (userIDs == "")
  746. {
  747. userIDList = null;
  748. }
  749. else
  750. {
  751. userIDList = userIDs.SplitIDString();
  752. }
  753. var dt = StudentServices.Value.GetStudentPicComparisonList(configuretView, campusID, collegeID, gradeID, standardID, educationID,
  754. learningformID, learnSystem, classmajorID, isRecruitPhoto, isPhoto, isGraduationPhoto, isPhotoComparison, inSchoolStatus, userIDList)
  755. .Select(x => new
  756. {
  757. x.ExamineeNum,
  758. x.StudentNo,
  759. x.AdmissionTicketNo,
  760. x.Name,
  761. x.SexName,
  762. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""),
  763. x.NationName,
  764. x.PoliticsName,
  765. x.CertificatesTypeName,
  766. x.IDNumber,
  767. x.StandardCode,
  768. x.StandardID,
  769. x.StandardName,
  770. x.EducationName,
  771. x.LearningformName,
  772. LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : "",
  773. x.FacultymajorCode,
  774. x.FacultymajorName,
  775. x.GradeID,
  776. x.GrademajorCode,
  777. x.GrademajorName,
  778. x.ClassmajorNo,
  779. x.ClassmajorName,
  780. x.ClassNum,
  781. x.StudentTypeName,
  782. x.InSchoolStatusName,
  783. x.StudentStatusName,
  784. x.CollegeNo,
  785. x.CollegeName,
  786. x.CampusCode,
  787. x.CampusName,
  788. x.SchoolTypeName,
  789. x.UniversityCode,
  790. x.UniversityName,
  791. x.HeadMasterName,
  792. x.SemesterName,
  793. x.StartSchoolyearCode,
  794. x.GraduateSchoolyearCode,
  795. PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyyMMdd") : ""),
  796. GraduateDate = (x.GraduateDate.HasValue ? x.GraduateDate.Value.ToString("yyyyMMdd") : ""),
  797. x.StudentCardNo,
  798. x.GraduateCardNo,
  799. x.ReplaceGraduateNo,
  800. x.DegreeStatusName,
  801. x.UsedName,
  802. x.Country,
  803. x.Place,
  804. x.BornPlace,
  805. x.ExamineeType,
  806. EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : ""),
  807. x.LiteracyLevelName,
  808. x.CultureModelName,
  809. x.IsDreamProjectName,
  810. x.Email,
  811. x.Telephone,
  812. x.Mobile,
  813. x.ZIPCode,
  814. x.WeChatNum,
  815. x.QQ,
  816. x.HealthStateName,
  817. x.BloodGroupName,
  818. x.Specialty,
  819. x.Height,
  820. x.Weight,
  821. x.DirectorName,
  822. x.Score,
  823. x.EntranceWayName,
  824. x.FeaturesName,
  825. x.TerritorialName,
  826. x.Area,
  827. x.HomeAddress,
  828. x.WorkUnit,
  829. x.Address,
  830. x.Recipient,
  831. x.Dormitory,
  832. x.BankName,
  833. x.CardNo,
  834. x.RecruitPictureUrl,
  835. x.PhotoUrl,
  836. x.GraduationPictureUrl,
  837. x.Career,
  838. x.IsPhotoComparisonName,
  839. x.IsProofreadName,
  840. x.ReportStatusName,
  841. x.AccountStatusName,
  842. x.Remark
  843. }).ToTable();
  844. string[] liststring = {
  845. "考生号", "学号", "准考证号", "姓名", "性别", "出生日期", "民族", "政治面貌", "证件类型",
  846. "证件号码", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式", "学制",
  847. "院系专业编号", "院系专业名称", "年级", "年级专业编号", "年级专业名称", "班级编号", "班级名称",
  848. "班序", "学生类别", "在校状态", "学籍状态", RSL.Get("CollegeCode"), RSL.Get("College"),
  849. RSL.Get("CampusCode"), RSL.Get("Campus"), "办学类型", "学校代码", "学校名称", "校长名", "入学学期",
  850. "入学学年学期", "毕业学期", "预计毕业日期", "毕业日期", "学籍卡编号", "毕结业证书编号", "补证编号",
  851. "学位有无", "曾用名", "国籍", "籍贯", "出生地", "考生类别", "入学日期", "文化程度", "培养方式",
  852. "圆梦计划", "电子邮箱", "家庭电话", "移动电话", "邮政编码", "微信号", "QQ", "健康状况", "血型",
  853. "特长", "身高(cm)", "体重(kg)", "导师姓名", "总分", "入学方式", "考生特征", "生源所属地", "来源地区",
  854. "家庭住址", "工作单位", "通信地址", "收件人" , "宿舍地址", "开户银行", "银行卡号", "录取照片Url",
  855. "学籍照片Url", "学历照片Url", "在校经历", "照片比对", "是否核对", "注册状态", "帐号状态", "备注"
  856. };
  857. neh.Export(dt, liststring, "照片比对信息" + DateTime.Now.ToString("yyyyMMdd"));
  858. return Json(new ReturnMessage()
  859. {
  860. IsSuccess = true,
  861. Message = "导出成功。"
  862. });
  863. }
  864. /// <summary>
  865. /// 导出照片
  866. /// </summary>
  867. /// <returns></returns>
  868. [HttpGet]
  869. public ActionResult PictureExport()
  870. {
  871. return View();
  872. }
  873. /// <summary>
  874. /// 导出照片
  875. /// </summary>
  876. /// <param name="pararms"></param>
  877. /// <param name="exportPicType"></param>
  878. /// <param name="userIDs"></param>
  879. /// <returns></returns>
  880. [HttpPost]
  881. public ActionResult PictureExport(QueryParamsModel pararms, string exportPicType, string userIDs)
  882. {
  883. try
  884. {
  885. var studentViewList = new List<StudentView>();
  886. if (!string.IsNullOrEmpty(userIDs))
  887. {
  888. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  889. studentViewList = StudentServices.Value.GetStudentViewList(list).ToList();
  890. }
  891. else
  892. {
  893. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  894. var campusID = pararms.getExtraGuid("CampusDropdown");
  895. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  896. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  897. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  898. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  899. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  900. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  901. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  902. var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown");
  903. var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus");
  904. var planningGraduateDate = pararms.getExtraString("PlanningGraduateDateDropDown");
  905. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  906. studentViewList = StudentServices.Value.GetStudentViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID,
  907. learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus).ToList();
  908. }
  909. var remoteFileList = StudentServices.Value.GetStudentPicRemoteFileInfoList(studentViewList, exportPicType);
  910. if (remoteFileList != null && remoteFileList.Count() > 0)
  911. {
  912. var zipFileStream = FileUploadHelper.DownLoadFiles(Guid.NewGuid().ToString(), "学生照片" + DateTime.Now.ToString("yyyyMMdd") + "", remoteFileList);
  913. return File(zipFileStream, System.Net.Mime.MediaTypeNames.Application.Zip, "学生照片" + DateTime.Now.ToString("yyyyMMdd") + ".zip");
  914. }
  915. else
  916. {
  917. return RedirectToAction("MsgShowAndOpen", "Common", new
  918. {
  919. WindowID = Request.UrlReferrer.ToString().Remove(0, Request.UrlReferrer.ToString().LastIndexOf("=") + 1),
  920. msg = "导出照片失败,原因:照片不存在。"
  921. });
  922. }
  923. }
  924. catch (Exception ex)
  925. {
  926. return RedirectToAction("MsgShowAndOpen", "Common", new
  927. {
  928. WindowID = Request.UrlReferrer.ToString().Remove(0, Request.UrlReferrer.ToString().LastIndexOf("=") + 1),
  929. msg = "导出照片失败,原因:" + ex.Message
  930. });
  931. }
  932. }
  933. /// <summary>
  934. /// 照片信息
  935. /// </summary>
  936. /// <param name="userID"></param>
  937. /// <returns></returns>
  938. public ActionResult PhotoDetail(Guid? userID)
  939. {
  940. StudentView studentView = new StudentView();
  941. if (userID.HasValue && userID != Guid.Empty)
  942. {
  943. studentView = StudentServices.Value.GetStudentView(userID);
  944. }
  945. return View(studentView);
  946. }
  947. /// <summary>
  948. /// 学籍异动信息
  949. /// </summary>
  950. /// <returns></returns>
  951. public ActionResult ChangeDetail()
  952. {
  953. return View();
  954. }
  955. /// <summary>
  956. /// 学籍异动信息
  957. /// </summary>
  958. /// <param name="pararms"></param>
  959. /// <returns></returns>
  960. [HttpPost]
  961. public ActionResult ChangeDetail(QueryParamsModel pararms)
  962. {
  963. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  964. var userID = Request["userID"].ParseStrTo<Guid>();
  965. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  966. var changeTypeID = pararms.getExtraInt("DictionaryChangeTypeID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryChangeTypeID");
  967. return Json(StudentServices.Value.GetStudentChangeViewGrid(configuretView, userID, schoolyearID, changeTypeID, (int)pararms.page, (int)pararms.rows));
  968. }
  969. /// <summary>
  970. /// 学籍注册信息
  971. /// </summary>
  972. /// <returns></returns>
  973. public ActionResult ReportDetail()
  974. {
  975. return View();
  976. }
  977. /// <summary>
  978. /// 学籍注册信息
  979. /// </summary>
  980. /// <param name="pararms"></param>
  981. /// <returns></returns>
  982. [HttpPost]
  983. public ActionResult ReportDetail(QueryParamsModel pararms)
  984. {
  985. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  986. var userID = Request["userID"].ParseStrTo<Guid>();
  987. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  988. var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus");
  989. return Json(StudentServices.Value.GetStudentReportViewGrid(configuretView, userID, schoolyearID, reportStatus, (int)pararms.page, (int)pararms.rows));
  990. }
  991. /// <summary>
  992. /// 上报导出
  993. /// </summary>
  994. /// <returns></returns>
  995. public ActionResult ReportExport()
  996. {
  997. return View();
  998. }
  999. /// <summary>
  1000. /// 上报导出DBF
  1001. /// </summary>
  1002. /// <param name="pararms"></param>
  1003. /// <param name="userIDs"></param>
  1004. /// <param name="colnames"></param>
  1005. /// <param name="shownames"></param>
  1006. /// <returns></returns>
  1007. [HttpPost]
  1008. public ActionResult ReportDBFExport(QueryParamsModel pararms, string userIDs, string colnames, string shownames)
  1009. {
  1010. try
  1011. {
  1012. List<Guid?> userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  1013. List<string> colnameList = colnames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList();
  1014. List<string> shownameList = shownames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList();
  1015. NpoiExcelHelper neh = new NpoiExcelHelper();
  1016. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  1017. var campusID = pararms.getExtraGuid("CampusDropdown");
  1018. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  1019. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  1020. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  1021. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  1022. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  1023. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  1024. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  1025. var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown");
  1026. var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus");
  1027. var planningGraduateDate = pararms.getExtraString("PlanningGraduateDateDropDown");
  1028. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  1029. var dt = StudentServices.Value.GetStudentViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID,
  1030. learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus, userIDList)
  1031. .Select(x => new
  1032. {
  1033. x.ExamineeNum,
  1034. x.UserName,
  1035. x.SexName,
  1036. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""),
  1037. x.IDNumber,
  1038. x.UniversityCode,
  1039. x.UniversityName,
  1040. x.StandardCode,
  1041. x.StandardName,
  1042. x.FacultymajorName,
  1043. LearnSystem = (x.LearnSystem.HasValue ? (x.LearnSystem.Value % 1 == 0 ? x.LearnSystem.Value.ToString("0") : x.LearnSystem.Value.ToString("0.0")) : ""),
  1044. x.LearningformName,
  1045. x.EducationName,
  1046. EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : ""),
  1047. GraduateDate = (x.GraduateDate.HasValue ? x.GraduateDate.Value.ToString("yyyyMMdd") : ""),
  1048. x.GraduationResultName,
  1049. x.GraduateCardNo,
  1050. x.HeadMasterName,
  1051. TerritorialID = (x.TerritorialID.HasValue ? x.TerritorialID.ToString() : ""),
  1052. x.StudentNo,
  1053. x.PoliticsName,
  1054. x.NationName,
  1055. x.CampusName,
  1056. x.CollegeName,
  1057. x.ClassmajorNo,
  1058. x.ClassmajorName,
  1059. PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyyMMdd") : ""),
  1060. x.Remark
  1061. }).ToTable(shownameList);
  1062. var physicalFileName = StudentServices.Value.CreateDBFFile(dt, colnameList, "StudentDBFFile");
  1063. return File(physicalFileName, "application/x-dbf", "学生信息(上报DBF)" + DateTime.Now.ToString("yyyyMMdd") + ".dbf");
  1064. }
  1065. catch (Exception ex)
  1066. {
  1067. return RedirectToAction("MsgShowAndOpen", "Common", new
  1068. {
  1069. WindowID = Request.UrlReferrer.ToString().Remove(0, Request.UrlReferrer.ToString().LastIndexOf("=") + 1),
  1070. msg = "DBF导出失败,原因:" + ex.Message
  1071. });
  1072. }
  1073. }
  1074. /// <summary>
  1075. /// 上报导出Excel
  1076. /// </summary>
  1077. /// <param name="pararms"></param>
  1078. /// <param name="userIDs"></param>
  1079. /// <param name="colnames"></param>
  1080. /// <param name="shownames"></param>
  1081. /// <returns></returns>
  1082. [HttpPost]
  1083. public ActionResult ReportExcelExport(QueryParamsModel pararms, string userIDs, string colnames, string shownames)
  1084. {
  1085. try
  1086. {
  1087. List<Guid?> userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  1088. List<string> colnameList = colnames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList();
  1089. List<string> shownameList = shownames.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => x).ToList();
  1090. NpoiExcelHelper neh = new NpoiExcelHelper();
  1091. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  1092. var campusID = pararms.getExtraGuid("CampusDropdown");
  1093. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  1094. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  1095. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  1096. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  1097. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  1098. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  1099. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  1100. var isPhoto = pararms.getExtraInt("IsPhotoDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoDropdown");
  1101. var reportStatus = pararms.getExtraInt("DictionaryReportStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryReportStatus");
  1102. var planningGraduateDate = pararms.getExtraString("PlanningGraduateDateDropDown");
  1103. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  1104. var dt = StudentServices.Value.GetStudentViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID,
  1105. learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus, userIDList)
  1106. .Select(x => new
  1107. {
  1108. x.ExamineeNum,
  1109. x.UserName,
  1110. x.SexName,
  1111. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""),
  1112. x.IDNumber,
  1113. x.UniversityCode,
  1114. x.UniversityName,
  1115. x.StandardCode,
  1116. x.StandardName,
  1117. x.FacultymajorName,
  1118. LearnSystem = (x.LearnSystem.HasValue ? (x.LearnSystem.Value % 1 == 0 ? x.LearnSystem.Value.ToString("0") : x.LearnSystem.Value.ToString("0.0")) : ""),
  1119. x.LearningformName,
  1120. x.EducationName,
  1121. EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : ""),
  1122. GraduateDate = (x.GraduateDate.HasValue ? x.GraduateDate.Value.ToString("yyyyMMdd") : ""),
  1123. x.GraduationResultName,
  1124. x.GraduateCardNo,
  1125. x.HeadMasterName,
  1126. TerritorialID = (x.TerritorialID.HasValue ? x.TerritorialID.ToString() : ""),
  1127. x.StudentNo,
  1128. x.PoliticsName,
  1129. x.NationName,
  1130. x.CampusName,
  1131. x.CollegeName,
  1132. x.ClassmajorNo,
  1133. x.ClassmajorName,
  1134. PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyyMMdd") : ""),
  1135. x.Remark
  1136. }).ToTable(shownameList);
  1137. string[] liststring = colnameList.ToArray();
  1138. neh.Export(dt, liststring, "学生信息(上报Excel)" + DateTime.Now.ToString("yyyyMMdd"));
  1139. return Json(new ReturnMessage()
  1140. {
  1141. IsSuccess = true,
  1142. Message = "Excel导出成功。"
  1143. });
  1144. }
  1145. catch (Exception ex)
  1146. {
  1147. return RedirectToAction("MsgShowAndOpen", "Common", new
  1148. {
  1149. WindowID = Request.UrlReferrer.ToString().Remove(0, Request.UrlReferrer.ToString().LastIndexOf("=") + 1),
  1150. msg = "Excel导出失败,原因:" + ex.Message
  1151. });
  1152. }
  1153. }
  1154. /// <summary>
  1155. /// 操行录入
  1156. /// </summary>
  1157. /// <returns></returns>
  1158. public ActionResult ConductInput()
  1159. {
  1160. return View();
  1161. }
  1162. /// <summary>
  1163. /// 操行录入
  1164. /// </summary>
  1165. /// <param name="userIDs"></param>
  1166. /// <param name="studentConductView"></param>
  1167. /// <returns></returns>
  1168. [HttpPost]
  1169. public ActionResult ConductInput(string userIDs, StudentConductView studentConductView)
  1170. {
  1171. try
  1172. {
  1173. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  1174. var result = StudentServices.Value.StudentConductInput(list, studentConductView);
  1175. return Json(new ReturnMessage()
  1176. {
  1177. IsSuccess = true,
  1178. Message = "录入成功" + result + "。"
  1179. });
  1180. }
  1181. catch (Exception ex)
  1182. {
  1183. return Json(new ReturnMessage()
  1184. {
  1185. IsSuccess = false,
  1186. Message = "录入失败,原因:" + ex.Message
  1187. });
  1188. }
  1189. }
  1190. /// <summary>
  1191. /// 毕业证书编号Excel导入
  1192. /// </summary>
  1193. /// <param name="errorFile"></param>
  1194. /// <param name="operationTips"></param>
  1195. /// <returns></returns>
  1196. [HttpGet]
  1197. public ActionResult GraduateNoImport(string errorFile, string operationTips)
  1198. {
  1199. ViewBag.ErrorFile = errorFile;
  1200. if (string.IsNullOrEmpty(operationTips))
  1201. {
  1202. operationTips = "点击查看失败原因...";
  1203. }
  1204. ViewBag.operationTips = operationTips;
  1205. return View();
  1206. }
  1207. /// <summary>
  1208. /// 毕业证书编号Excel导入
  1209. /// </summary>
  1210. /// <param name="file"></param>
  1211. /// <returns></returns>
  1212. [HttpPost]
  1213. public ActionResult GraduateNoImport(HttpPostedFileBase file)
  1214. {
  1215. try
  1216. {
  1217. if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
  1218. {
  1219. throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。");
  1220. }
  1221. Dictionary<string, string> cellheader = new Dictionary<string, string>
  1222. {
  1223. { "IDNumber", "身份证号" },
  1224. { "GraduateCardNo", "毕业证书编号" },
  1225. { "ErrorMessage", "未导入原因" }
  1226. };
  1227. StringBuilder errorMsg = new StringBuilder();
  1228. string sourceWebPath = FileUploadHelper.UploadFile(file);
  1229. var sourcePhysicalPath = Server.MapPath(sourceWebPath);
  1230. List<StudentView> errList = new List<StudentView>();
  1231. List<StudentView> dataList = new List<StudentView>();
  1232. int? inCount = 0; //导入个数
  1233. int? upCount = 0; //更新个数
  1234. int? errCount = 0; //失败个数
  1235. StudentServices.Value.GraduateNoImport(cellheader, out inCount, out upCount, out errList, out errCount, sourcePhysicalPath);
  1236. System.IO.File.Delete(sourcePhysicalPath);
  1237. if (errList.Count() > 0)
  1238. {
  1239. //获取错误数据文件路径
  1240. string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, errList, "毕业证书编号导入失败文件", sourcePhysicalPath));
  1241. ViewBag.ErrorFile = errorWebPath;
  1242. string Errinfo = string.Format("提示:{0}条毕业证书编号导入成功,{1}条毕业证书编号导入失败,点击查看。", upCount, errCount);
  1243. ViewBag.operationTips = Errinfo;
  1244. return RedirectToAction("MsgShow", "Common", new
  1245. {
  1246. WindowID = "none",
  1247. msg = Errinfo,
  1248. url = Url.Action("GraduateNoImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"]
  1249. });
  1250. }
  1251. else
  1252. {
  1253. string successInfo = string.Format("提示:{0}条毕业证书编号导入成功。", upCount);
  1254. return RedirectToAction("MsgShow", "Common", new
  1255. {
  1256. WindowID = Request["WindowID"],
  1257. msg = successInfo,
  1258. url = Url.Action("List").AddMenuParameter()
  1259. });
  1260. }
  1261. }
  1262. catch (Exception ex)
  1263. {
  1264. return RedirectToAction("MsgShow", "Common", new
  1265. {
  1266. WindowID = "none",
  1267. msg = "导入失败,原因:" + ex.Message,
  1268. url = Url.Action("GraduateNoImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
  1269. });
  1270. }
  1271. }
  1272. /// <summary>
  1273. /// 学生证明报表
  1274. /// </summary>
  1275. /// <returns></returns>
  1276. public ActionResult ProveReport()
  1277. {
  1278. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  1279. ViewBag.LoginUserID = curUser.UserID.ToString();
  1280. var dataRangeID = StudentServices.Value.GetDataRangeID();
  1281. ViewBag.DataRangeID = dataRangeID;
  1282. return View();
  1283. }
  1284. /// <summary>
  1285. /// 学生学籍报表
  1286. /// </summary>
  1287. /// <returns></returns>
  1288. public ActionResult CradReport()
  1289. {
  1290. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  1291. ViewBag.LoginUserID = curUser.UserID.ToString();
  1292. var dataRangeID = StudentServices.Value.GetDataRangeID();
  1293. ViewBag.DataRangeID = dataRangeID;
  1294. return View();
  1295. }
  1296. /// <summary>
  1297. /// 学生鉴定报表
  1298. /// </summary>
  1299. /// <returns></returns>
  1300. public ActionResult AppraiseReport()
  1301. {
  1302. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  1303. ViewBag.LoginUserID = curUser.UserID.ToString();
  1304. var dataRangeID = StudentServices.Value.GetDataRangeID();
  1305. ViewBag.DataRangeID = dataRangeID;
  1306. return View();
  1307. }
  1308. /// <summary>
  1309. /// Excel导出
  1310. /// </summary>
  1311. /// <returns></returns>
  1312. [HttpPost]
  1313. public ActionResult Excel()
  1314. {
  1315. NpoiExcelHelper neh = new NpoiExcelHelper();
  1316. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  1317. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  1318. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  1319. var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  1320. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  1321. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  1322. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  1323. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  1324. var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo<Guid>();
  1325. var isPhoto = Request.Form["IsPhotoDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoDropdown"].ParseStrTo<int>();
  1326. var reportStatus = Request.Form["DictionaryReportStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryReportStatus"].ParseStrTo<int>();
  1327. var planningGraduateDate = Request.Form["PlanningGraduateDateDropDown"].ToString();
  1328. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  1329. var userIDs = Request.Form["UserIDs"];
  1330. var userIDList = new List<Guid?>();
  1331. if (userIDs == "")
  1332. {
  1333. userIDList = null;
  1334. }
  1335. else
  1336. {
  1337. userIDList = userIDs.SplitIDString();
  1338. }
  1339. var dt = StudentServices.Value.GetStudentViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID,
  1340. learningformID, learnSystem, classmajorID, isPhoto, reportStatus, planningGraduateDate, inSchoolStatus, userIDList)
  1341. .Select(x => new
  1342. {
  1343. x.ExamineeNum,
  1344. x.AdmissionTicketNo,
  1345. x.StudentNo,
  1346. x.Name,
  1347. x.UsedName,
  1348. x.SexName,
  1349. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""),
  1350. x.NationName,
  1351. x.PoliticsName,
  1352. x.StudentTypeName,
  1353. x.CertificatesTypeName,
  1354. x.IDNumber,
  1355. x.StandardCode,
  1356. x.StandardID,
  1357. x.StandardName,
  1358. x.EducationName,
  1359. x.LearningformName,
  1360. LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : "",
  1361. x.FacultymajorCode,
  1362. x.FacultymajorName,
  1363. x.GradeID,
  1364. x.GrademajorCode,
  1365. x.GrademajorName,
  1366. x.InSchoolStatusName,
  1367. x.StudentStatusName,
  1368. x.ClassmajorNo,
  1369. x.ClassmajorName,
  1370. x.ClassNum,
  1371. x.CollegeNo,
  1372. x.CollegeName,
  1373. x.CampusCode,
  1374. x.CampusName,
  1375. x.SchoolTypeName,
  1376. x.UniversityCode,
  1377. x.UniversityName,
  1378. x.HeadMasterName,
  1379. x.SemesterName,
  1380. x.StartSchoolyearCode,
  1381. x.GraduateSchoolyearCode,
  1382. PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyyMMdd") : ""),
  1383. GraduateDate = (x.GraduateDate.HasValue ? x.GraduateDate.Value.ToString("yyyyMMdd") : ""),
  1384. x.LiteracyLevelName,
  1385. x.CultureModelName,
  1386. x.ExamineeTypeName,
  1387. EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : ""),
  1388. x.Score,
  1389. x.EntranceWayName,
  1390. x.FeaturesName,
  1391. x.TerritorialName,
  1392. x.Area,
  1393. x.Country,
  1394. x.Place,
  1395. x.BornPlace,
  1396. x.Email,
  1397. x.Mobile,
  1398. x.Telephone,
  1399. x.ZIPCode,
  1400. x.HealthStateName,
  1401. x.BloodGroupName,
  1402. x.Specialty,
  1403. x.Height,
  1404. x.Weight,
  1405. x.WeChatNum,
  1406. x.QQ,
  1407. x.HomeAddress,
  1408. x.WorkUnit,
  1409. x.Address,
  1410. x.Dormitory,
  1411. x.Recipient,
  1412. x.IsDreamProjectName,
  1413. x.DirectorName,
  1414. x.BankName,
  1415. x.CardNo,
  1416. x.StudentCardNo,
  1417. x.GraduateCardNo,
  1418. x.ReplaceGraduateNo,
  1419. x.DegreeStatusName,
  1420. x.Career,
  1421. PhotoUrlNo = x.StudentNo,
  1422. x.IsPhotoComparisonName,
  1423. x.IsProofreadName,
  1424. x.ChangeCount,
  1425. x.ReportStatusName,
  1426. x.AccountStatusName,
  1427. x.Remark
  1428. }).ToTable();
  1429. string[] liststring = {
  1430. "考生号", "准考证号", "学号", "姓名", "曾用名", "性别", "出生日期", "民族", "政治面貌", "学生类别",
  1431. "证件类型", "证件号码", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式",
  1432. "学制", "院系专业编号", "院系专业名称", "年级", "年级专业编号", "年级专业名称", "在校状态", "学籍状态",
  1433. "班级编号", "班级名称", "班序", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("Campus"),
  1434. "办学类型", "学校代码", "学校名称", "校长名", "入学学期", "入学学年学期", "毕业学期", "预计毕业日期", "毕业日期",
  1435. "文化程度", "培养方式", "考生类别", "入学日期", "总分", "入学方式", "考生特征", "生源所属地", "来源地区", "国籍",
  1436. "籍贯", "出生地", "电子邮箱", "移动电话", "家庭电话", "邮政编码", "健康状况", "血型", "特长", "身高(cm)", "体重(kg)",
  1437. "微信号", "QQ", "家庭住址", "工作单位", "通信地址", "宿舍地址", "收件人", "圆梦计划", "导师姓名", "开户银行",
  1438. "银行卡号", "学籍卡编号", "毕结业证书编号", "补证编号", "学位有无", "在校经历", "照片编号", "照片比对", "是否核对",
  1439. "异动数", "注册状态", "帐号状态", "备注"
  1440. };
  1441. neh.Export(dt, liststring, "学生信息" + DateTime.Now.ToString("yyyyMMdd"));
  1442. return Json(new ReturnMessage()
  1443. {
  1444. IsSuccess = true,
  1445. Message = "导出成功。"
  1446. });
  1447. }
  1448. }
  1449. }