NewStudentEnterController.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. using System.IO;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. using Bowin.Common.Utility;
  10. using Bowin.Common.Data;
  11. using Bowin.Web.Controls.Mvc;
  12. using EMIS.Utility;
  13. using EMIS.Web.Controls;
  14. using EMIS.ViewModel;
  15. using EMIS.ViewModel.EnrollManage.NewStudentManage;
  16. using EMIS.CommonLogic.EnrollManage.NewStudentManage;
  17. using EMIS.CommonLogic.StudentManage.StudentProfile;
  18. namespace EMIS.Web.Controllers.EnrollManage.NewStudentManage
  19. {
  20. [Authorization]
  21. public class NewStudentEnterController : Controller
  22. {
  23. public INewStudentEnterServices newStudentEnterServices { get; set; }
  24. public Lazy<IStudentServices> StudentServices { get; set; }
  25. /// <summary>
  26. /// 录取名单页面
  27. /// </summary>
  28. /// <returns></returns>
  29. public ActionResult List()
  30. {
  31. return View();
  32. }
  33. /// <summary>
  34. /// 录取名单页面列表查询
  35. /// </summary>
  36. /// <param name="pararms"></param>
  37. /// <returns></returns>
  38. [HttpPost]
  39. public ActionResult List(QueryParamsModel pararms)
  40. {
  41. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  42. var campusID = pararms.getExtraGuid("CampusDropdown");
  43. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  44. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  45. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  46. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  47. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  48. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  49. var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
  50. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  51. var generalPurpose = pararms.getExtraInt("DictionaryGeneralPurpose") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGeneralPurpose");
  52. var generalExist = pararms.getExtraInt("DictionaryGeneralExist") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGeneralExist");
  53. var newStudentEnterStatus = pararms.getExtraInt("DictionaryNewStudentEnterStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryNewStudentEnterStatus");
  54. return base.Json(newStudentEnterServices.GetNewStudentEnterViewGrid(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID,
  55. learnSystem, grademajorID, classmajorID, generalPurpose, generalExist, newStudentEnterStatus, (int)pararms.page, (int)pararms.rows));
  56. }
  57. /// <summary>
  58. /// 复制新增
  59. /// </summary>
  60. /// <param name="newStudentID"></param>
  61. /// <returns></returns>
  62. public ActionResult CopyAdd(Guid newStudentID)
  63. {
  64. NewStudentView newStudentView = new NewStudentView();
  65. newStudentView = newStudentEnterServices.GetNewStudentEnterView(newStudentID);
  66. return View("Edit", newStudentView);
  67. }
  68. /// <summary>
  69. /// 复制新增
  70. /// </summary>
  71. /// <param name="newStudentView"></param>
  72. /// <returns></returns>
  73. [HttpPost]
  74. public ActionResult CopyAdd(NewStudentView newStudentView)
  75. {
  76. newStudentView.NewStudentID = Guid.Empty;
  77. return this.Edit(newStudentView);
  78. }
  79. /// <summary>
  80. /// 编辑(新增、修改,业务主键:考生号唯一)
  81. /// 注:需对相应的业务进行处理,如:学号等
  82. /// </summary>
  83. /// <param name="newNewStudentID"></param>
  84. /// <param name="type"></param>
  85. /// <returns></returns>
  86. [HttpGet]
  87. public ActionResult Edit(Guid? newNewStudentID, string type)
  88. {
  89. NewStudentView newStudentView = new NewStudentView();
  90. if (newNewStudentID.HasValue && newNewStudentID != Guid.Empty)
  91. {
  92. newStudentView = newStudentEnterServices.GetNewStudentEnterView(newNewStudentID);
  93. if (type == "copyAdd")
  94. {
  95. newStudentView.NewStudentID = Guid.Empty;
  96. //newStudentView.ExamineeNum = null;
  97. //newStudentView.AdmissionTicketNo = null;
  98. //newStudentView.Name = null;
  99. //newStudentView.IDNumber = null;
  100. newStudentView.RecruitPictureUrl = null;
  101. }
  102. }
  103. else
  104. {
  105. newStudentView.NationID = (int)CF_Nation.Han;
  106. newStudentView.PoliticsID = (int)CF_Politics.YouthLeague;
  107. newStudentView.CertificatesType = (int)CF_CertificatesType.IdCrad;
  108. newStudentView.GradeID = BaseExtensions.GetCurrentYearID();
  109. newStudentView.SemesterID = BaseExtensions.GetEntranceSemesterID();
  110. newStudentView.AssignStatus = (int)CF_AssignStatus.Assigned;
  111. }
  112. return View(newStudentView);
  113. }
  114. /// <summary>
  115. /// 编辑(新增、修改,业务主键:考生号唯一)
  116. /// 注:需对相应的业务进行处理,如:学号等
  117. /// </summary>
  118. /// <param name="newStudentView"></param>
  119. /// <returns></returns>
  120. [HttpPost]
  121. public ActionResult Edit(NewStudentView newStudentView)
  122. {
  123. try
  124. {
  125. var accepts = new List<string> { ".jpg", ".jpeg", ".png", ".bmp" };
  126. var postedFile = Request.Files["RecruitPictureUrl"];
  127. if (!string.IsNullOrEmpty(postedFile.FileName) && !accepts.Contains(Path.GetExtension(postedFile.FileName).ToLower()))
  128. {
  129. throw new Exception("只允许上传.jpg、.jpeg、.png、.bmp格式的文件。");
  130. }
  131. string photoUrl = FileUploadHelper.UploadFile(postedFile);
  132. newStudentEnterServices.NewStudentEnterEdit(newStudentView, photoUrl);
  133. return RedirectToAction("MsgShow", "Common", new
  134. {
  135. WindowID = Request["WindowID"],
  136. msg = "保存成功。",
  137. url = Url.Action("List").AddMenuParameter()
  138. });
  139. }
  140. catch (Exception ex)
  141. {
  142. return RedirectToAction("MsgShowAndOpen", "Common", new
  143. {
  144. WindowID = Request["WindowID"],
  145. msg = "保存失败,原因:" + ex.Message
  146. });
  147. }
  148. }
  149. /// <summary>
  150. /// 删除
  151. /// </summary>
  152. /// <param name="newStudentIDs"></param>
  153. /// <returns></returns>
  154. [HttpPost]
  155. public ActionResult Delete(string newStudentIDs)
  156. {
  157. try
  158. {
  159. List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  160. newStudentEnterServices.NewStudentEnterDelete(list);
  161. return Json(new ReturnMessage()
  162. {
  163. IsSuccess = true,
  164. Message = "删除成功。"
  165. });
  166. }
  167. catch (Exception ex)
  168. {
  169. return Json(new ReturnMessage()
  170. {
  171. IsSuccess = false,
  172. Message = "删除失败,原因:" + ex.Message
  173. });
  174. }
  175. }
  176. /// <summary>
  177. /// 删除照片(单个删除)
  178. /// </summary>
  179. /// <param name="newStudentID"></param>
  180. /// <returns></returns>
  181. [HttpPost]
  182. public ActionResult DeletePhoto(Guid? newStudentID)
  183. {
  184. try
  185. {
  186. this.newStudentEnterServices.DeletePhoto(newStudentID);
  187. return Json(new ReturnMessage()
  188. {
  189. IsSuccess = true,
  190. Message = "删除照片成功。"
  191. });
  192. }
  193. catch (Exception ex)
  194. {
  195. return Json(new ReturnMessage()
  196. {
  197. IsSuccess = false,
  198. Message = "删除照片失败:" + ex.Message
  199. });
  200. }
  201. }
  202. /// <summary>
  203. /// 删除照片(批量删除)
  204. /// </summary>
  205. /// <param name="newStudentIDs"></param>
  206. /// <returns></returns>
  207. [HttpPost]
  208. public ActionResult PicDelete(string newStudentIDs)
  209. {
  210. try
  211. {
  212. List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  213. this.newStudentEnterServices.PicDelete(list);
  214. return Json(new ReturnMessage()
  215. {
  216. IsSuccess = true,
  217. Message = "删除照片成功。"
  218. });
  219. }
  220. catch (Exception ex)
  221. {
  222. return Json(new ReturnMessage()
  223. {
  224. IsSuccess = false,
  225. Message = "删除照片失败:" + ex.Message
  226. });
  227. }
  228. }
  229. /// <summary>
  230. /// 取消分配
  231. /// </summary>
  232. /// <param name="newStudentIDs"></param>
  233. /// <returns></returns>
  234. [HttpPost]
  235. public ActionResult CancelAssignCollege(string newStudentIDs)
  236. {
  237. try
  238. {
  239. List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  240. string result = newStudentEnterServices.NewStudentEnterCancelAssignCollege(list);
  241. return Json(new ReturnMessage()
  242. {
  243. IsSuccess = true,
  244. Message = "取消分配成功" + result + "。"
  245. });
  246. }
  247. catch (Exception ex)
  248. {
  249. return Json(new ReturnMessage()
  250. {
  251. IsSuccess = false,
  252. Message = "取消分配失败,原因:" + ex.Message
  253. });
  254. }
  255. }
  256. /// <summary>
  257. /// 导入照片
  258. /// </summary>
  259. /// <param name="errorFile"></param>
  260. /// <param name="operationTips"></param>
  261. /// <returns></returns>
  262. [HttpGet]
  263. public ActionResult PicImport(string errorFile, string operationTips)
  264. {
  265. ViewBag.ErrorFile = errorFile;
  266. if (string.IsNullOrEmpty(operationTips))
  267. {
  268. operationTips = "点击查看失败原因...";
  269. }
  270. ViewBag.operationTips = operationTips;
  271. return View();
  272. }
  273. /// <summary>
  274. /// 导入照片
  275. /// </summary>
  276. /// <param name="file"></param>
  277. /// <param name="importPicType"></param>
  278. /// <returns></returns>
  279. [HttpPost]
  280. public ActionResult PicImport(HttpPostedFileBase file, string importPicType)
  281. {
  282. try
  283. {
  284. if (file.ContentLength <= 0)
  285. {
  286. throw new Exception("请选择你要上传的照片(注:格式为zip或rar的压缩包文件)。");
  287. }
  288. var acceptFileExtensions = new[] { ".zip", ".rar" };
  289. var fileExtensionName = Path.GetExtension(file.FileName);
  290. if (!acceptFileExtensions.Contains(fileExtensionName))
  291. {
  292. throw new Exception("格式错误,只允许上传zip或rar格式的压缩包文件。");
  293. }
  294. string fileSourceWebPath = null;
  295. string errorSourceWebPath = null;
  296. var photoPathList = FileUploadHelper.UploadFileAndExtractFile(file, out fileSourceWebPath, out errorSourceWebPath);
  297. System.IO.File.Delete(Server.MapPath(fileSourceWebPath));
  298. if (photoPathList == null || photoPathList.Count <= 0)
  299. {
  300. throw new Exception("压缩包中文件为空。");
  301. }
  302. var acceptPicExtensions = new[] { ".jpg", ".jpeg", ".png", ".bmp" };
  303. List<string> newPhotoPathList = new List<string>();
  304. foreach (var photoPath in photoPathList)
  305. {
  306. string photoExtensionName = Path.GetExtension(photoPath).ToLower();
  307. if (acceptPicExtensions.Contains(photoExtensionName))
  308. {
  309. newPhotoPathList.Add(photoPath);
  310. }
  311. else
  312. {
  313. throw new Exception("压缩包中含有不支持的照片格式。");
  314. }
  315. }
  316. int? inCount = 0;
  317. int? errCount = 0;
  318. var errDataTable = new DataTable();
  319. newStudentEnterServices.NewStudentEnterPicImport(newPhotoPathList, importPicType, out inCount, out errCount, out errDataTable);
  320. if (errDataTable != null && errDataTable.Rows.Count > 0)
  321. {
  322. NpoiExcelHelper npoiExcelHelper = new NpoiExcelHelper();
  323. npoiExcelHelper.SaveInServer(errDataTable, Server.MapPath(errorSourceWebPath));
  324. string errorWebPath = string.Format("{0}", errorSourceWebPath);
  325. ViewBag.ErrorFile = errorWebPath;
  326. string Errinfo = string.Format("提示:{0}个照片导入成功,{1}个照片导入失败,点击查看。", inCount, errCount);
  327. ViewBag.operationTips = Errinfo;
  328. return RedirectToAction("MsgShow", "Common", new
  329. {
  330. WindowID = "none",
  331. msg = Errinfo,
  332. url = Url.Action("PicImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"]
  333. });
  334. }
  335. else
  336. {
  337. string successInfo = string.Format("提示:{0}个照片导入成功。", inCount);
  338. return RedirectToAction("MsgShow", "Common", new
  339. {
  340. WindowID = Request["WindowID"],
  341. msg = successInfo,
  342. url = Url.Action("List").AddMenuParameter()
  343. });
  344. }
  345. }
  346. catch (Exception ex)
  347. {
  348. return RedirectToAction("MsgShow", "Common", new
  349. {
  350. WindowID = "none",
  351. msg = "导入照片失败,原因:" + ex.Message,
  352. url = Url.Action("PicImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
  353. });
  354. }
  355. }
  356. /// <summary>
  357. /// 导入标识
  358. /// </summary>
  359. /// <param name="errorFile"></param>
  360. /// <param name="operationTips"></param>
  361. /// <returns></returns>
  362. [HttpGet]
  363. public ActionResult DoubtImport(string errorFile, string operationTips)
  364. {
  365. ViewBag.ErrorFile = errorFile;
  366. if (string.IsNullOrEmpty(operationTips))
  367. {
  368. operationTips = "点击查看失败原因...";
  369. }
  370. ViewBag.operationTips = operationTips;
  371. return View();
  372. }
  373. /// <summary>
  374. /// 导入标识
  375. /// </summary>
  376. /// <param name="file"></param>
  377. /// <returns></returns>
  378. [HttpPost]
  379. public ActionResult DoubtImport(HttpPostedFileBase file)
  380. {
  381. try
  382. {
  383. if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
  384. {
  385. throw new Exception("格式错误,只允许导入xls或xlsx格式的Excel文件。");
  386. }
  387. //注:只获取Excel模板中的有效列
  388. Dictionary<string, string> cellheader = new Dictionary<string, string>
  389. {
  390. { "Name", "姓名" }, //姓名
  391. { "IDNumber", "身份证号" }, //身份证号
  392. { "ErrorMessage", "未导入原因" }
  393. };
  394. StringBuilder errorMsg = new StringBuilder(); // 错误信息
  395. string sourceWebPath = FileUploadHelper.UploadFile(file);
  396. var sourcePhysicalPath = Server.MapPath(sourceWebPath);
  397. List<NewStudentView> errList = new List<NewStudentView>();
  398. List<NewStudentView> dataList = new List<NewStudentView>();
  399. int? inCount = 0; //导入个数
  400. int? upCount = 0; //更新个数
  401. int? errCount = 0; //失败个数
  402. //导入
  403. newStudentEnterServices.NewStudentEnterDoubtImport(cellheader, out inCount, out upCount, out errList, out errCount, sourcePhysicalPath);
  404. System.IO.File.Delete(sourcePhysicalPath);//删除本地缓存文件
  405. if (errList.Count() > 0)
  406. {
  407. //获取错误数据文件路径
  408. string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, errList, "名单标记导入失败文件", sourcePhysicalPath));
  409. ViewBag.ErrorFile = errorWebPath;
  410. string Errinfo = string.Format("提示:{0}个名单标记成功,{1}个名单标记更新成功,{2}个名单标记失败,点击查看。", inCount, upCount, errCount);
  411. ViewBag.operationTips = Errinfo;
  412. return RedirectToAction("MsgShow", "Common", new
  413. {
  414. WindowID = "none",
  415. msg = Errinfo,
  416. url = Url.Action("DoubtImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&WindowID=" + Request["WindowID"]
  417. });
  418. }
  419. else
  420. {
  421. string successInfo = string.Format("提示:{0}个名单标记成功,{1}个名单标记更新成功。", inCount, upCount);
  422. return RedirectToAction("MsgShow", "Common", new
  423. {
  424. WindowID = Request["WindowID"],
  425. msg = successInfo,
  426. url = Url.Action("List").AddMenuParameter()
  427. });
  428. }
  429. }
  430. catch (Exception ex)
  431. {
  432. return RedirectToAction("MsgShow", "Common", new
  433. {
  434. WindowID = "none",
  435. msg = "导入失败,原因:" + ex.Message,
  436. url = Url.Action("DoubtImport").AddMenuParameter() + "&WindowID=" + Request["WindowID"]
  437. });
  438. }
  439. }
  440. /// <summary>
  441. /// 标识名单
  442. /// </summary>
  443. /// <returns></returns>
  444. public ActionResult DoubtList()
  445. {
  446. return View();
  447. }
  448. /// <summary>
  449. /// 标识名单
  450. /// </summary>
  451. /// <param name="newStudentIDs"></param>
  452. /// <param name="newStudentView"></param>
  453. /// <returns></returns>
  454. [HttpPost]
  455. public ActionResult DoubtList(string newStudentIDs, NewStudentView newStudentView)
  456. {
  457. try
  458. {
  459. List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  460. string result = newStudentEnterServices.NewStudentEnterDoubtApprove(list);
  461. return Json(new ReturnMessage()
  462. {
  463. IsSuccess = true,
  464. Message = "成功" + result + "。"
  465. });
  466. }
  467. catch (Exception ex)
  468. {
  469. return Json(new ReturnMessage()
  470. {
  471. IsSuccess = false,
  472. Message = "失败,原因:" + ex.Message
  473. });
  474. }
  475. }
  476. /// <summary>
  477. /// 标识名单列表查询
  478. /// </summary>
  479. /// <param name="pararms"></param>
  480. /// <returns></returns>
  481. [HttpPost]
  482. public ActionResult NewStudentEnterDoubtList(QueryParamsModel pararms)
  483. {
  484. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  485. var campusID = pararms.getExtraGuid("CampusDropdown");
  486. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  487. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  488. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  489. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  490. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  491. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  492. var isPhotoUrl = pararms.getExtraInt("IsPhotoUrlDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoUrlDropdown");
  493. return base.Json(newStudentEnterServices.GetNewStudentEnterDoubtViewGrid(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, isPhotoUrl, (int)pararms.page, (int)pararms.rows));
  494. }
  495. /// <summary>
  496. /// Excel标识名单导出
  497. /// </summary>
  498. /// <returns></returns>
  499. [HttpPost]
  500. public ActionResult Excel_NewStudentEnterDoubt()
  501. {
  502. NpoiExcelHelper neh = new NpoiExcelHelper();
  503. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  504. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  505. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  506. var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  507. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  508. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  509. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  510. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  511. var isPhotoUrl = Request.Form["IsPhotoUrlDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsPhotoUrlDropdown"].ParseStrTo<int>();
  512. var dt = newStudentEnterServices.GetNewStudentEnterDoubtViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID, learnSystem, isPhotoUrl)
  513. .Select(x => new
  514. {
  515. x.ExamineeNum,
  516. x.AdmissionTicketNo,
  517. x.Name,
  518. x.SexName,
  519. x.NationName,
  520. x.PoliticsName,
  521. BirthDate = x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : "",
  522. x.CertificatesTypeName,
  523. x.IDNumber,
  524. x.GradeID,
  525. x.SemesterName,
  526. x.StandardCode,
  527. x.StandardID,
  528. x.StandardName,
  529. x.EducationName,
  530. x.LearningformName,
  531. LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : null,
  532. EntranceDate = x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyy-MM-dd") : "",
  533. x.Score,
  534. x.Telephone,
  535. x.Address,
  536. x.Dormitory,
  537. x.RecruitPictureUrl,
  538. x.CollegeNo,
  539. x.CollegeName,
  540. x.GrademajorCode,
  541. x.GrademajorName,
  542. x.ClassmajorNo,
  543. x.ClassmajorName,
  544. x.StudentNo,
  545. x.EnrollmentNo,
  546. x.IsDoubtName,
  547. x.AssignStatusName,
  548. x.RecordStatusName,
  549. x.Remark
  550. }).ToTable();
  551. string[] liststring = {
  552. "考生号", "准考证号","姓名", "性别", "民族", "政治面貌", "出生日期", "证件类型", "身份证号",
  553. "年级", "学期", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式", "学制",
  554. "入学日期", "总分", "联系电话", "通讯地址", "宿舍地址", "照片Url", RSL.Get("CollegeCode"),
  555. RSL.Get("CollegeName"), "年级专业代码", "年级专业名称", "班级编号", "班级名称", "学号",
  556. "录取通知书编号", "标识状态", "分配状态", "状态", "备注"
  557. };
  558. neh.Export(dt, liststring, "标识名单信息" + DateTime.Now.ToString("yyyyMMdd"));
  559. return Json(new ReturnMessage()
  560. {
  561. IsSuccess = true,
  562. Message = "导出成功。"
  563. });
  564. }
  565. /// <summary>
  566. /// 初始化(班级信息、学号)
  567. /// </summary>
  568. /// <param name="newStudentIDs"></param>
  569. /// <returns></returns>
  570. [HttpPost]
  571. public ActionResult Init(string newStudentIDs)
  572. {
  573. try
  574. {
  575. List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  576. string result = newStudentEnterServices.NewStudentEnterInit(list);
  577. return Json(new ReturnMessage()
  578. {
  579. IsSuccess = true,
  580. Message = "初始化成功" + result + "。"
  581. });
  582. }
  583. catch (Exception ex)
  584. {
  585. return Json(new ReturnMessage()
  586. {
  587. IsSuccess = false,
  588. Message = "初始化学号失败,原因:" + ex.Message
  589. });
  590. }
  591. }
  592. /// <summary>
  593. /// 手动分配班级和生成学号(此为默认规则,初始学号为:班级编号+流水号,下一位学号为:对应的最大学号+1)
  594. /// 注:个性化配置
  595. /// </summary>
  596. /// <returns></returns>
  597. public ActionResult AssignClass()
  598. {
  599. return View();
  600. }
  601. /// <summary>
  602. /// 手动分配班级和生成学号(此为默认规则,初始学号为:班级编号+流水号,下一位学号为:对应的最大学号+1)
  603. /// 注:个性化配置
  604. /// </summary>
  605. /// <param name="newStudentIDs"></param>
  606. /// <param name="newStudentView"></param>
  607. /// <returns></returns>
  608. [HttpPost]
  609. public ActionResult AssignClass(string newStudentIDs, NewStudentView newStudentView)
  610. {
  611. try
  612. {
  613. var newStudentIDList = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  614. string result = newStudentEnterServices.NewStudentEnterAssignClass(newStudentIDList, newStudentView.ClassmajorID);
  615. return Json(new ReturnMessage()
  616. {
  617. IsSuccess = true,
  618. Message = "生成成功" + result + "。"
  619. });
  620. }
  621. catch (Exception ex)
  622. {
  623. return Json(new ReturnMessage()
  624. {
  625. IsSuccess = false,
  626. Message = "生成失败,原因:" + ex.Message
  627. });
  628. }
  629. }
  630. /// <summary>
  631. /// 自动分配班级和生成学号
  632. /// 注:个性化配置
  633. /// 此为默认规则,初始学号为:班级编号+流水号,下一位学号为:对应的最大学号+1)
  634. /// 目前只支持,学号=班级编号+流水号的情况,针对学号生成规则不同、专业分方向、有两个班以上等等情况,需要进行扩展-普教版本
  635. /// </summary>
  636. /// <param name="newStudentIDs"></param>
  637. /// <returns></returns>
  638. [HttpPost]
  639. public ActionResult AutoAssignClass(string newStudentIDs)
  640. {
  641. try
  642. {
  643. List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  644. string result = newStudentEnterServices.NewStudentEnterAutoAssignClass(list);
  645. return Json(new ReturnMessage()
  646. {
  647. IsSuccess = true,
  648. Message = "生成成功" + result + "。"
  649. });
  650. }
  651. catch (Exception ex)
  652. {
  653. return Json(new ReturnMessage()
  654. {
  655. IsSuccess = false,
  656. Message = "生成失败,原因:" + ex.Message
  657. });
  658. }
  659. }
  660. /// <summary>
  661. /// 录取通知书打印
  662. /// </summary>
  663. /// <returns></returns>
  664. public ActionResult AdmissionLetterReport()
  665. {
  666. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  667. ViewBag.LoginUserID = curUser.UserID.ToString();
  668. var dataRangeID = StudentServices.Value.GetDataRangeID();
  669. ViewBag.DataRangeID = dataRangeID;
  670. return View();
  671. }
  672. /// <summary>
  673. /// 提交
  674. /// </summary>
  675. /// <param name="newStudentIDs"></param>
  676. /// <returns></returns>
  677. [HttpPost]
  678. public ActionResult Submit(string newStudentIDs)
  679. {
  680. try
  681. {
  682. List<Guid?> list = newStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  683. string result = newStudentEnterServices.NewStudentEnterSubmit(list);
  684. return Json(new ReturnMessage()
  685. {
  686. IsSuccess = true,
  687. Message = "提交成功" + result + "。"
  688. });
  689. }
  690. catch (Exception ex)
  691. {
  692. return Json(new ReturnMessage()
  693. {
  694. IsSuccess = false,
  695. Message = "提交失败,原因:" + ex.Message
  696. });
  697. }
  698. }
  699. /// <summary>
  700. /// Excel导出
  701. /// </summary>
  702. /// <returns></returns>
  703. [HttpPost]
  704. public ActionResult Excel()
  705. {
  706. NpoiExcelHelper neh = new NpoiExcelHelper();
  707. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  708. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  709. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  710. var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  711. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  712. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  713. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  714. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  715. var grademajorID = Request.Form["GrademajorComboGrid"].ParseStrTo<Guid>();
  716. var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo<Guid>();
  717. var generalPurpose = Request.Form["DictionaryGeneralPurpose"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGeneralPurpose"].ParseStrTo<int>();
  718. var generalExist = Request.Form["DictionaryGeneralExist"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGeneralExist"].ParseStrTo<int>();
  719. var newStudentEnterStatus = Request.Form["DictionaryNewStudentEnterStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryNewStudentEnterStatus"].ParseStrTo<int>();
  720. var dt = newStudentEnterServices.GetNewStudentEnterViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID,
  721. learnSystem, grademajorID, classmajorID, generalPurpose, generalExist, newStudentEnterStatus)
  722. .Select(x => new
  723. {
  724. x.ExamineeNum,
  725. x.AdmissionTicketNo,
  726. x.Name,
  727. x.SexName,
  728. x.NationName,
  729. x.PoliticsName,
  730. BirthDate = x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : "",
  731. x.CertificatesTypeName,
  732. x.IDNumber,
  733. x.GradeID,
  734. x.SemesterName,
  735. x.StandardCode,
  736. x.StandardID,
  737. x.StandardName,
  738. x.EducationName,
  739. x.LearningformName,
  740. LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : null,
  741. EntranceDate = x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyy-MM-dd") : "",
  742. x.Score,
  743. x.Telephone,
  744. x.Address,
  745. x.Dormitory,
  746. x.RecruitPictureUrl,
  747. x.CollegeNo,
  748. x.CollegeName,
  749. x.GrademajorCode,
  750. x.GrademajorName,
  751. x.ClassmajorNo,
  752. x.ClassmajorName,
  753. x.StudentNo,
  754. x.EnrollmentNo,
  755. x.IsDoubtName,
  756. x.AssignStatusName,
  757. x.RecordStatusName,
  758. x.Remark
  759. }).ToTable();
  760. string[] liststring = {
  761. "考生号", "准考证号","姓名", "性别", "民族", "政治面貌", "出生日期", "证件类型", "身份证号",
  762. "年级", "学期", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式", "学制",
  763. "入学日期", "总分", "联系电话", "通讯地址", "宿舍地址", "照片Url", RSL.Get("CollegeCode"),
  764. RSL.Get("CollegeName"), "年级专业代码", "年级专业名称", "班级编号", "班级名称", "学号",
  765. "录取通知书编号", "标识状态", "分配状态", "状态", "备注"
  766. };
  767. neh.Export(dt, liststring, "录取名单信息" + DateTime.Now.ToString("yyyyMMdd"));
  768. return Json(new ReturnMessage()
  769. {
  770. IsSuccess = true,
  771. Message = "导出成功。"
  772. });
  773. }
  774. }
  775. }