NewStudentCollegeServices.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Transactions;
  7. using Bowin.Common.Utility;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel;
  10. using EMIS.ViewModel.CacheManage;
  11. using EMIS.ViewModel.EnrollManage.NewStudentManage;
  12. namespace EMIS.ExtensionLogic.ServiceLogic.EnrollManage
  13. {
  14. public class NewStudentCollegeServices : EMIS.CommonLogic.EnrollManage.NewStudentManage.NewStudentCollegeServices
  15. {
  16. /// <summary>
  17. /// 招生信息Excel导入(预分配,需根据省招专业相关信息进行匹配--个性化)
  18. /// 此为东莞理工版本
  19. /// </summary>
  20. /// <param name="cellheader"></param>
  21. /// <param name="inCount"></param>
  22. /// <param name="upCount"></param>
  23. /// <param name="errdataList"></param>
  24. /// <param name="errCount"></param>
  25. /// <param name="sourcePhysicalPath"></param>
  26. public override void NewStudentCollegeImport(Dictionary<string, string> cellheader, out int? inCount, out int? upCount, out List<NewStudentView> errdataList, out int? errCount, string sourcePhysicalPath)
  27. {
  28. /// 招生信息Excel导入(预分配,需根据省招专业相关信息进行匹配--东莞理工版本)
  29. /// 匹配规则:根据Excel文件中录取专业(取后四位)与省招专业信息中省招代码进行匹配
  30. try
  31. {
  32. StringBuilder errorMsg = new StringBuilder(); // 错误信息
  33. List<NewStudentView> errList = new List<NewStudentView>();
  34. // 1.1解析文件,存放到一个List集合里
  35. cellheader.Remove("ErrorMessage");//移除“未导入原因”列(ErrorMessage)
  36. List<NewStudentView> enlist = NpoiExcelHelper.ExcelToEntityList<NewStudentView>(cellheader, sourcePhysicalPath, out errorMsg, out errList);
  37. cellheader.Add("ErrorMessage", "未导入原因");
  38. //对List集合进行有效性校验
  39. if (enlist.Count() <= 0)
  40. {
  41. throw new Exception("Excel文件数据为空,请检查。");
  42. }
  43. Regex reg = null; //正则表达式
  44. DateTime result; //用于返回判断日期字段格式
  45. int isInt; //用于返回判断int列格式
  46. inCount = 0; //导入个数
  47. upCount = 0; //更新个数
  48. errCount = 0; //失败个数
  49. string errorMsgStr = ""; //错误信息
  50. List<CF_NewStudent> newStudentInList = new List<CF_NewStudent>(); //新生信息insert实体List
  51. List<CF_NewStudent> newStudentUpList = new List<CF_NewStudent>(); //新生信息update实体List
  52. //将循环中相关数据库查询统一查询出来进行匹配(尽量避免在循环中进行数据库查询)
  53. //性别
  54. var sexList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Sex).ToList();
  55. //民族
  56. var nationList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Nation).ToList();
  57. //政治面貌
  58. var politicsList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Politics).ToList();
  59. //考生号
  60. var examineeNumList = enlist.Where(x => !string.IsNullOrEmpty(x.ExamineeNum)).Select(x => x.ExamineeNum.Trim()).ToList();
  61. ////准考证号
  62. //var admissionTicketNoList = enlist.Where(x => !string.IsNullOrEmpty(x.AdmissionTicketNo)).Select(x => x.AdmissionTicketNo.Trim()).ToList();
  63. ////身份证号
  64. //var iDNumberList = enlist.Where(x => !string.IsNullOrEmpty(x.IDNumber)).Select(x => x.IDNumber.Trim()).ToList();
  65. //录取专业(省招代码),取后4位
  66. var customStandardCodeList = enlist.Where(x => !string.IsNullOrEmpty(x.Code)).Select(x => x.Code.Trim().Remove(0, x.Code.Length > 4 ? x.Code.Length - 4 : 0)).ToList();
  67. //新生名单
  68. var newStudentAllList = NewStudentDAL.NewStudentRepository.GetList(x => true).ToList();
  69. //对比后的newStudentList
  70. var newStudentList = newStudentAllList.Where(x => examineeNumList.Contains(x.ExamineeNum)).ToList();
  71. //省招专业(注:省招代码唯一或学年、学期、院系所ID、专业信息唯一)
  72. var customStandardList = NewStudentDAL.CustomStandardSettingRepository.GetList(x => customStandardCodeList.Contains(x.Code)).ToList();
  73. //专业信息
  74. var specialtyList = NewStudentDAL.SpecialtyRepository.GetList(x => true).ToList();
  75. //循环检测数据列,对各数据列进行验证(必填、字典项验证、数据格式等)
  76. for (int i = 0; i < enlist.Count; i++)
  77. {
  78. NewStudentView en = enlist[i]; //Excel表数据视图
  79. CF_NewStudent newStudent = new CF_NewStudent(); //新生信息实体
  80. //考生号
  81. if (string.IsNullOrEmpty(en.ExamineeNum))
  82. {
  83. errCount++;
  84. errorMsgStr = "ksh(考生号)不能为空";
  85. en.ErrorMessage = errorMsgStr;
  86. errList.Add(en);
  87. errorMsg.AppendLine(errorMsgStr);
  88. continue;
  89. }
  90. else
  91. {
  92. reg = new Regex(@"^[A-Za-z0-9]+$"); //考生号正则表达式
  93. if (!reg.IsMatch(en.ExamineeNum.Trim()))
  94. {
  95. errCount++;
  96. errorMsgStr = "ksh(考生号)格式不正确,请检查";
  97. en.ErrorMessage = errorMsgStr;
  98. errList.Add(en);
  99. errorMsg.AppendLine(errorMsgStr);
  100. continue;
  101. }
  102. else
  103. {
  104. //考生号
  105. newStudent.ExamineeNum = en.ExamineeNum.Trim();
  106. }
  107. }
  108. //准考证号
  109. if (string.IsNullOrEmpty(en.AdmissionTicketNo))
  110. {
  111. errCount++;
  112. errorMsgStr = "zkzh(准考证号)不能为空";
  113. en.ErrorMessage = errorMsgStr;
  114. errList.Add(en);
  115. errorMsg.AppendLine(errorMsgStr);
  116. continue;
  117. }
  118. else
  119. {
  120. reg = new Regex(@"^[A-Za-z0-9]+$"); //准考证号正则表达式
  121. if (!reg.IsMatch(en.AdmissionTicketNo.Trim()))
  122. {
  123. errCount++;
  124. errorMsgStr = "zkzh(准考证号)格式不正确,请检查";
  125. en.ErrorMessage = errorMsgStr;
  126. errList.Add(en);
  127. errorMsg.AppendLine(errorMsgStr);
  128. continue;
  129. }
  130. else
  131. {
  132. //准考证号
  133. newStudent.AdmissionTicketNo = en.AdmissionTicketNo.Trim();
  134. }
  135. }
  136. //姓名
  137. if (string.IsNullOrEmpty(en.Name))
  138. {
  139. errCount++;
  140. errorMsgStr = "xm(姓名)不能为空";
  141. en.ErrorMessage = errorMsgStr;
  142. errList.Add(en);
  143. errorMsg.AppendLine(errorMsgStr);
  144. continue;
  145. }
  146. else
  147. {
  148. //姓名
  149. newStudent.Name = en.Name.Trim();
  150. }
  151. //性别
  152. if (string.IsNullOrEmpty(en.SexStr))
  153. {
  154. errCount++;
  155. errorMsgStr = "性别不能为空";
  156. en.ErrorMessage = errorMsgStr;
  157. errList.Add(en);
  158. errorMsg.AppendLine(errorMsgStr);
  159. continue;
  160. }
  161. else
  162. {
  163. if (!int.TryParse(en.SexStr.Trim(), out isInt))
  164. {
  165. errCount++;
  166. errorMsgStr = "xbdm(性别代码)格式不正确,请检查";
  167. en.ErrorMessage = errorMsgStr;
  168. errList.Add(en);
  169. errorMsg.AppendLine(errorMsgStr);
  170. continue;
  171. }
  172. else
  173. {
  174. //性别代码
  175. var sex = sexList.Where(x => x.Value == Convert.ToInt32(en.SexStr.Trim())).SingleOrDefault();
  176. if (sex == null)
  177. {
  178. errCount++;
  179. errorMsgStr = "xbdm(性别代码)不存在,请检查";
  180. en.ErrorMessage = errorMsgStr;
  181. errList.Add(en);
  182. errorMsg.AppendLine(errorMsgStr);
  183. continue;
  184. }
  185. else
  186. {
  187. //性别
  188. newStudent.SexID = sex.Value;
  189. }
  190. }
  191. }
  192. //民族
  193. if (!string.IsNullOrEmpty(en.NationStr))
  194. {
  195. if (!int.TryParse(en.NationStr.Trim(), out isInt))
  196. {
  197. errCount++;
  198. errorMsgStr = "mzdm(民族代码)格式不正确,请检查";
  199. en.ErrorMessage = errorMsgStr;
  200. errList.Add(en);
  201. errorMsg.AppendLine(errorMsgStr);
  202. continue;
  203. }
  204. else
  205. {
  206. var nation = nationList.Where(x => x.Value == Convert.ToInt32(en.NationStr.Trim())).SingleOrDefault();
  207. if (nation == null)
  208. {
  209. errCount++;
  210. errorMsgStr = "mzdm(民族代码)不存在,请检查";
  211. en.ErrorMessage = errorMsgStr;
  212. errList.Add(en);
  213. errorMsg.AppendLine(errorMsgStr);
  214. continue;
  215. }
  216. else
  217. {
  218. //民族
  219. newStudent.NationID = nation.Value;
  220. }
  221. }
  222. }
  223. else
  224. {
  225. //为空
  226. }
  227. //政治面貌
  228. if (!string.IsNullOrEmpty(en.PoliticsStr))
  229. {
  230. if (!int.TryParse(en.PoliticsStr.Trim(), out isInt))
  231. {
  232. errCount++;
  233. errorMsgStr = "zzmmdm(政治面貌代码)格式不正确,请检查";
  234. en.ErrorMessage = errorMsgStr;
  235. errList.Add(en);
  236. errorMsg.AppendLine(errorMsgStr);
  237. continue;
  238. }
  239. else
  240. {
  241. var politics = politicsList.Where(x => x.Value == Convert.ToInt32(en.PoliticsStr.Trim())).SingleOrDefault();
  242. if (politics == null)
  243. {
  244. errCount++;
  245. errorMsgStr = "zzmmdm(政治面貌代码)不存在,请检查";
  246. en.ErrorMessage = errorMsgStr;
  247. errList.Add(en);
  248. errorMsg.AppendLine(errorMsgStr);
  249. continue;
  250. }
  251. else
  252. {
  253. //政治面貌
  254. newStudent.PoliticsID = politics.Value;
  255. }
  256. }
  257. }
  258. else
  259. {
  260. //为空
  261. }
  262. //出生日期
  263. if (!string.IsNullOrEmpty(en.BirthDateStr))
  264. {
  265. //reg = new Regex(@"(\d{4})-(\d{1,2})-(\d{1,2})"); //日期正则表达式,2017-12-28
  266. if (!DateTime.TryParse(en.BirthDateStr.Trim(), out result))
  267. {
  268. errCount++;
  269. errorMsgStr = "csrq(出生日期)格式不正确,请检查";
  270. en.ErrorMessage = errorMsgStr;
  271. errList.Add(en);
  272. errorMsg.AppendLine(errorMsgStr);
  273. continue;
  274. }
  275. else
  276. {
  277. //出生日期
  278. newStudent.BirthDate = Convert.ToDateTime(en.BirthDateStr.Trim());
  279. }
  280. }
  281. else
  282. {
  283. //为空
  284. }
  285. //考生特征
  286. if (!string.IsNullOrEmpty(en.FeaturesStr))
  287. {
  288. if (!int.TryParse(en.FeaturesStr.Trim(), out isInt))
  289. {
  290. errCount++;
  291. errorMsgStr = "kstzbz(考生特征标记)格式不正确,请检查";
  292. en.ErrorMessage = errorMsgStr;
  293. errList.Add(en);
  294. errorMsg.AppendLine(errorMsgStr);
  295. continue;
  296. }
  297. else
  298. {
  299. //考生特征标记
  300. newStudent.FeaturesID = Convert.ToInt32(en.FeaturesStr.Trim());
  301. }
  302. }
  303. else
  304. {
  305. //为空
  306. }
  307. //身份证号
  308. if (string.IsNullOrEmpty(en.IDNumber))
  309. {
  310. errCount++;
  311. errorMsgStr = "sfzh(身份证号)不能为空";
  312. en.ErrorMessage = errorMsgStr;
  313. errList.Add(en);
  314. errorMsg.AppendLine(errorMsgStr);
  315. continue;
  316. }
  317. else
  318. {
  319. //reg = new Regex(@"^[A-Za-z0-9]+$"); //身份证号正则表达式
  320. //if (!reg.IsMatch(en.IDNumber.Trim()))
  321. //{
  322. // errCount++;
  323. // errorMsgStr = "sfzh(身份证号)格式不正确,请检查";
  324. // en.ErrorMessage = errorMsgStr;
  325. // errList.Add(en);
  326. // errorMsg.AppendLine(errorMsgStr);
  327. // continue;
  328. //}
  329. //else
  330. //{
  331. // //身份证号
  332. // newStudent.IDNumber = en.IDNumber.Trim();
  333. //}
  334. newStudent.IDNumber = en.IDNumber.Trim();
  335. }
  336. //邮政编码
  337. newStudent.ZIPCode = en.ZIPCode;
  338. //联系电话
  339. newStudent.Telephone = en.Telephone;
  340. //通讯地址
  341. newStudent.Address = en.Address;
  342. //行政区划代码
  343. if (!string.IsNullOrEmpty(en.TerritorialStr))
  344. {
  345. if (!int.TryParse(en.TerritorialStr.Trim(), out isInt))
  346. {
  347. errCount++;
  348. errorMsgStr = "xzqhdm(行政区划代码)格式不正确,请检查";
  349. en.ErrorMessage = errorMsgStr;
  350. errList.Add(en);
  351. errorMsg.AppendLine(errorMsgStr);
  352. continue;
  353. }
  354. else
  355. {
  356. //行政区划代码
  357. newStudent.TerritorialID = Convert.ToInt32(en.TerritorialStr.Trim());
  358. }
  359. }
  360. else
  361. {
  362. //为空
  363. }
  364. //总分
  365. if (!string.IsNullOrEmpty(en.ScoreStr))
  366. {
  367. reg = new Regex(@"^[0-9]+([.]{1}[0-9]+){0,1}$"); //数字正则表达式
  368. if (!reg.IsMatch(en.ScoreStr.Trim()))
  369. {
  370. errCount++;
  371. errorMsgStr = "zf(总分)格式不正确,请检查";
  372. en.ErrorMessage = errorMsgStr;
  373. errList.Add(en);
  374. errorMsg.AppendLine(errorMsgStr);
  375. continue;
  376. }
  377. else
  378. {
  379. //总分
  380. newStudent.Score = Convert.ToDecimal(en.ScoreStr.Trim());
  381. }
  382. }
  383. else
  384. {
  385. //为空
  386. }
  387. //录取专业(省招代码,取后4位)
  388. if (string.IsNullOrEmpty(en.Code))
  389. {
  390. errCount++;
  391. errorMsgStr = "lqzy(录取专业)不能为空";
  392. en.ErrorMessage = errorMsgStr;
  393. errList.Add(en);
  394. errorMsg.AppendLine(errorMsgStr);
  395. continue;
  396. }
  397. else
  398. {
  399. reg = new Regex(@"^[0-9]*$"); //数字正则表达式
  400. if (!reg.IsMatch(en.Code.Trim()))
  401. {
  402. errCount++;
  403. errorMsgStr = "lqzy(录取专业)格式不正确,请检查";
  404. en.ErrorMessage = errorMsgStr;
  405. errList.Add(en);
  406. errorMsg.AppendLine(errorMsgStr);
  407. continue;
  408. }
  409. else
  410. {
  411. //录取专业(省招代码,取后4位)
  412. var customStandardCode = en.Code.Trim().Remove(0, en.Code.Length > 4 ? en.Code.Length - 4 : 0);
  413. var customStandard = customStandardList.Where(x => x.Code == customStandardCode).SingleOrDefault();
  414. if (customStandard == null)
  415. {
  416. errCount++;
  417. errorMsgStr = "对应的省招代码不存在(取lqzy录取专业后四位进行匹配),请检查";
  418. en.ErrorMessage = errorMsgStr;
  419. errList.Add(en);
  420. errorMsg.AppendLine(errorMsgStr);
  421. continue;
  422. }
  423. else
  424. {
  425. var specialty = specialtyList.Where(x => x.SpecialtyID == customStandard.SpecialtyID).SingleOrDefault();
  426. if (specialty == null)
  427. {
  428. errCount++;
  429. errorMsgStr = "省招专业对应的专业信息不存在,请检查";
  430. en.ErrorMessage = errorMsgStr;
  431. errList.Add(en);
  432. errorMsg.AppendLine(errorMsgStr);
  433. continue;
  434. }
  435. else
  436. {
  437. newStudent.SpecialtyID = specialty.SpecialtyID;
  438. newStudent.GradeID = customStandard.YearID;
  439. newStudent.SemesterID = customStandard.SemesterID;
  440. newStudent.CollegeID = customStandard.CollegeID;
  441. }
  442. }
  443. }
  444. }
  445. //备注
  446. newStudent.Remark = en.Remark;
  447. ////Excel表重复性验证(注:当数据表中没有此记录,但是Excel中有重复数据时的去掉)
  448. //for (int j = i + 1; j < enlist.Count; j++)
  449. //{
  450. // NewStudentView enA = enlist[j];
  451. // //根据Excel表中的业务主键进行去重(考生号唯一)
  452. // if (en.ExamineeNum == enA.ExamineeNum)
  453. // {
  454. // //用于标识Excel表中的重复记录(由于是批量进行插入数据表)
  455. // }
  456. //}
  457. //由于新生管理模块中存在新生分配的业务,在进行新生信息新增时,
  458. //需要对新生名单、录取名单中的信息进行提示性验证(业务主键:考生号唯一)
  459. //处理方法:进行Excel导入时,对新生名单更新、录取名单中的信息提示性验证(当错误信息抛出)
  460. //注:(未分配-1,预分配-2,已分配-3)
  461. //数据表重复性验证(考生号唯一)
  462. var examineeNumVerify = newStudentList.Where(x => x.ExamineeNum == newStudent.ExamineeNum).SingleOrDefault();
  463. if (examineeNumVerify == null)
  464. {
  465. //if (!string.IsNullOrEmpty(newStudent.AdmissionTicketNo))
  466. //{
  467. // if (!newStudentUpList.Any(x => x.AdmissionTicketNo == newStudent.AdmissionTicketNo))
  468. // {
  469. // if (!newStudentInList.Any(x => x.AdmissionTicketNo == newStudent.AdmissionTicketNo))
  470. // {
  471. // var admissionTicketNoVerify = newStudentList.Where(x => x.AdmissionTicketNo == newStudent.AdmissionTicketNo).SingleOrDefault();
  472. // if (admissionTicketNoVerify != null)
  473. // {
  474. // if (admissionTicketNoVerify.AssignStatus == (int)CF_AssignStatus.PreAssigned)
  475. // {
  476. // errCount++;
  477. // errorMsgStr = "已存在相同的准考证号(准考证号重复),请核查";
  478. // en.ErrorMessage = errorMsgStr;
  479. // errList.Add(en);
  480. // errorMsg.AppendLine(errorMsgStr);
  481. // continue;
  482. // }
  483. // else if (admissionTicketNoVerify.AssignStatus == (int)CF_AssignStatus.Assigned)
  484. // {
  485. // errCount++;
  486. // errorMsgStr = "录取名单信息中已存在此准考证号(准考证号重复),请核查";
  487. // en.ErrorMessage = errorMsgStr;
  488. // errList.Add(en);
  489. // errorMsg.AppendLine(errorMsgStr);
  490. // continue;
  491. // }
  492. // else
  493. // {
  494. // errCount++;
  495. // errorMsgStr = "新生名单信息中已存在此准考证号(准考证号重复),请核查";
  496. // en.ErrorMessage = errorMsgStr;
  497. // errList.Add(en);
  498. // errorMsg.AppendLine(errorMsgStr);
  499. // continue;
  500. // }
  501. // }
  502. // }
  503. // else
  504. // {
  505. // errCount++;
  506. // errorMsgStr = "准考证号重复(Excel中),请检查";
  507. // en.ErrorMessage = errorMsgStr;
  508. // errList.Add(en);
  509. // errorMsg.AppendLine(errorMsgStr);
  510. // continue;
  511. // }
  512. // }
  513. // else
  514. // {
  515. // errCount++;
  516. // errorMsgStr = "准考证号重复(Excel中),请检查";
  517. // en.ErrorMessage = errorMsgStr;
  518. // errList.Add(en);
  519. // errorMsg.AppendLine(errorMsgStr);
  520. // continue;
  521. // }
  522. //}
  523. //新增
  524. if (!newStudentInList.Any(x => x.ExamineeNum == newStudent.ExamineeNum))
  525. {
  526. newStudent.NewStudentID = Guid.NewGuid();
  527. newStudent.CertificatesType = (int)CF_CertificatesType.IdCrad;
  528. newStudent.IsDoubt = false;
  529. newStudent.AssignStatus = (int)CF_AssignStatus.PreAssigned;
  530. SetNewStatus(newStudent, (int)CF_NewStudentEnterStatus.NotSubmitted);
  531. newStudentInList.Add(newStudent);
  532. inCount++;
  533. }
  534. else
  535. {
  536. //Excel表重复性验证
  537. //(注:当数据表中没有此记录,但是Excel中有重复数据,可在此处进行抛出到失败数据文件中)
  538. errCount++;
  539. errorMsgStr = "考生号重复(Excel中),请检查";
  540. en.ErrorMessage = errorMsgStr;
  541. errList.Add(en);
  542. errorMsg.AppendLine(errorMsgStr);
  543. continue;
  544. }
  545. }
  546. else
  547. {
  548. //由于新生管理模块中存在新生分配的业务,只更新分配状态为:未分配-1、预分配-2
  549. if (examineeNumVerify.AssignStatus == (int)CF_AssignStatus.Assigned)
  550. {
  551. errCount++;
  552. errorMsgStr = "导入失败,录取名单信息中已存在此考生号(考生号重复)";
  553. en.ErrorMessage = errorMsgStr;
  554. errList.Add(en);
  555. errorMsg.AppendLine(errorMsgStr);
  556. continue;
  557. }
  558. else
  559. {
  560. //更新(Excel有重复时,以最后一条记录的更新为准)
  561. //if (!string.IsNullOrEmpty(newStudent.AdmissionTicketNo))
  562. //{
  563. // if (!newStudentInList.Any(x => x.AdmissionTicketNo == newStudent.AdmissionTicketNo))
  564. // {
  565. // if (!newStudentUpList.Any(x => x.AdmissionTicketNo == newStudent.AdmissionTicketNo))
  566. // {
  567. // var admissionTicketNoVerify = newStudentList.Where(x => x.AdmissionTicketNo == newStudent.AdmissionTicketNo).SingleOrDefault();
  568. // if (admissionTicketNoVerify != null)
  569. // {
  570. // if (admissionTicketNoVerify.AssignStatus == (int)CF_AssignStatus.PreAssigned)
  571. // {
  572. // errCount++;
  573. // errorMsgStr = "已存在相同的准考证号(准考证号重复),请核查";
  574. // en.ErrorMessage = errorMsgStr;
  575. // errList.Add(en);
  576. // errorMsg.AppendLine(errorMsgStr);
  577. // continue;
  578. // }
  579. // else if (admissionTicketNoVerify.AssignStatus == (int)CF_AssignStatus.Assigned)
  580. // {
  581. // errCount++;
  582. // errorMsgStr = "录取名单信息中已存在此准考证号(准考证号重复),请核查";
  583. // en.ErrorMessage = errorMsgStr;
  584. // errList.Add(en);
  585. // errorMsg.AppendLine(errorMsgStr);
  586. // continue;
  587. // }
  588. // else
  589. // {
  590. // errCount++;
  591. // errorMsgStr = "新生名单信息中已存在此准考证号(准考证号重复),请核查";
  592. // en.ErrorMessage = errorMsgStr;
  593. // errList.Add(en);
  594. // errorMsg.AppendLine(errorMsgStr);
  595. // continue;
  596. // }
  597. // }
  598. // }
  599. // else
  600. // {
  601. // errCount++;
  602. // errorMsgStr = "准考证号重复(Excel中),请检查";
  603. // en.ErrorMessage = errorMsgStr;
  604. // errList.Add(en);
  605. // errorMsg.AppendLine(errorMsgStr);
  606. // continue;
  607. // }
  608. // }
  609. // else
  610. // {
  611. // errCount++;
  612. // errorMsgStr = "准考证号重复(Excel中),请检查";
  613. // en.ErrorMessage = errorMsgStr;
  614. // errList.Add(en);
  615. // errorMsg.AppendLine(errorMsgStr);
  616. // continue;
  617. // }
  618. //}
  619. examineeNumVerify.ExamineeNum = newStudent.ExamineeNum;
  620. examineeNumVerify.AdmissionTicketNo = newStudent.AdmissionTicketNo;
  621. examineeNumVerify.Name = newStudent.Name;
  622. examineeNumVerify.SexID = newStudent.SexID;
  623. examineeNumVerify.NationID = newStudent.NationID;
  624. examineeNumVerify.PoliticsID = newStudent.PoliticsID;
  625. examineeNumVerify.BirthDate = newStudent.BirthDate;
  626. //examineeNumVerify.CertificatesType = newStudent.CertificatesType;
  627. examineeNumVerify.IDNumber = newStudent.IDNumber;
  628. examineeNumVerify.GradeID = newStudent.GradeID;
  629. examineeNumVerify.SemesterID = newStudent.SemesterID;
  630. examineeNumVerify.SpecialtyID = newStudent.SpecialtyID;
  631. //examineeNumVerify.EntranceDate = newStudent.EntranceDate;
  632. examineeNumVerify.Score = newStudent.Score;
  633. examineeNumVerify.Telephone = newStudent.Telephone;
  634. examineeNumVerify.ZIPCode = newStudent.ZIPCode;
  635. //examineeNumVerify.EntranceWayID = newStudent.EntranceWayID;
  636. examineeNumVerify.FeaturesID = newStudent.FeaturesID;
  637. examineeNumVerify.TerritorialID = newStudent.TerritorialID;
  638. examineeNumVerify.Address = newStudent.Address;
  639. //examineeNumVerify.Dormitory = newStudent.Dormitory;
  640. examineeNumVerify.AssignStatus = (int)CF_AssignStatus.PreAssigned;
  641. examineeNumVerify.CollegeID = newStudent.CollegeID;
  642. examineeNumVerify.Remark = newStudent.Remark;
  643. SetModifyStatus(examineeNumVerify);
  644. newStudentUpList.Add(examineeNumVerify);
  645. upCount++;
  646. }
  647. }
  648. }
  649. using (TransactionScope ts = new TransactionScope())
  650. {
  651. UnitOfWork.BulkInsert(newStudentInList);
  652. if (newStudentUpList != null && newStudentUpList.Count() > 0)
  653. {
  654. UnitOfWork.BatchUpdate(newStudentUpList);
  655. }
  656. ts.Complete();
  657. }
  658. errdataList = errList.Distinct().ToList();
  659. }
  660. catch (Exception)
  661. {
  662. throw;
  663. }
  664. }
  665. }
  666. }