RecruitSpecialtyServices.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Transactions;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel;
  8. using EMIS.ViewModel.CacheManage;
  9. using EMIS.CommonLogic.SystemServices;
  10. namespace EMIS.ExtensionLogic.ServiceLogic.EnrollManage
  11. {
  12. public class RecruitSpecialtyServices : EMIS.CommonLogic.EnrollManage.SpecialtyManage.RecruitSpecialtyServices
  13. {
  14. /// <summary>
  15. /// 流水号生成Services
  16. /// </summary>
  17. public Lazy<ISerialNumberServices> SerialNumberServices { get; set; }
  18. /// <summary>
  19. /// 河北科大专业班级生成规则(由于院系专业、年级专业编码规则的问题,暂时不支持院系专业、年级专业分方向的生成)
  20. /// </summary>
  21. /// <param name="recruitSpecialtyIDs"></param>
  22. /// <returns></returns>
  23. public override string GenerateClass(List<Guid?> recruitSpecialtyIDs)
  24. {
  25. //生成规则如下:
  26. //院系编码:院系所编号+专业名称Value值,拼出来,如:05116
  27. //院系名称:专业名称,如:化工与制药
  28. //年级专业编码:年级后两位+院系所编号+专业名称Value值,拼出来,如:1705116
  29. //年级专业名称:年级后两位+院系所编号+专业名称+学习形式+培养层次
  30. //如:1601化学工程与工艺业余专升本
  31. //班级编码:年级后两位+院系所编号+专业名称Value值+流水号1位或年级专业编号+流水号1位,拼出来,如:17051161
  32. //班级名称:年级后两位+院系所编号+专业名称+学习形式+培养层次+流水号1位+班或年级专业名称+流水号1位+班
  33. //如:1601制药工程函授专升本1班
  34. try
  35. {
  36. //查询招生专业信息
  37. var recruitSpecialtyList = recruitSpecialtyDAL.recruitSpecialtyRepository.GetList(x => recruitSpecialtyIDs.Contains(x.RecruitSpecialtyID), x => x.CF_College, x => x.CF_Specialty).ToList();
  38. //年级ID
  39. var gradeIDList = recruitSpecialtyList.Where(x => !string.IsNullOrEmpty(x.GradeID.ToString())).Select(x => x.GradeID).ToList();
  40. //专业信息ID
  41. var specialtyIDList = recruitSpecialtyList.Where(x => !string.IsNullOrEmpty(x.SpecialtyID.ToString())).Select(x => x.SpecialtyID).ToList();
  42. //院系所ID
  43. var collegeIDList = recruitSpecialtyList.Where(x => !string.IsNullOrEmpty(x.CollegeID.ToString())).Select(x => x.CollegeID).ToList();
  44. //查询专业信息
  45. var specialtyList = recruitSpecialtyDAL.specialtyRepository.GetList(x => specialtyIDList.Contains(x.SpecialtyID)).ToList();
  46. //查询专业分班信息
  47. var specialtyClassSettingList = recruitSpecialtyDAL.SpecialtyClassSettingRepository.GetList(x => specialtyIDList.Contains(x.SpecialtyID)).ToList();
  48. //查询院系所信息
  49. var collegeList = recruitSpecialtyDAL.collegeRepository.Entities.Where(x => collegeIDList.Contains(x.CollegeID)).ToList();
  50. //年级
  51. var gradeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Grade).ToList();
  52. //专业代码、专业名称、专业ID(Value)
  53. var standardList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Standard).ToList();
  54. //培养层次(所修学历)
  55. var educationList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Education).ToList();
  56. //学习形式
  57. var learningFormList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Learningform).ToList();
  58. //查询对应的院系专业信息
  59. var facultymajorList = recruitSpecialtyDAL.GetFacultymajorByRecruitSpecialty(x => recruitSpecialtyIDs.Contains(x.RecruitSpecialtyID)).ToList();
  60. //院系专业ID
  61. var facultymajorIDList = facultymajorList.Where(x => !string.IsNullOrEmpty(x.FacultymajorID.ToString())).Select(x => x.FacultymajorID).ToList();
  62. //查询对应的年级专业信息
  63. var grademajorList = recruitSpecialtyDAL.GetGrademajorByRecruitSpecialty(x => recruitSpecialtyIDs.Contains(x.RecruitSpecialtyID), x => facultymajorIDList.Contains(x.FacultymajorID)).ToList();
  64. //年级专业ID
  65. var grademajorIDList = grademajorList.Where(x => !string.IsNullOrEmpty(x.GrademajorID.ToString())).Select(x => x.GrademajorID).ToList();
  66. //查询对应的班级信息
  67. var classmajorList = recruitSpecialtyDAL.GetClassmajorByRecruitSpecialty(x => recruitSpecialtyIDs.Contains(x.RecruitSpecialtyID), x => facultymajorIDList.Contains(x.FacultymajorID), x => grademajorIDList.Contains(x.GrademajorID)).ToList();
  68. //班级信息ID
  69. var classmajorIDList = classmajorList.Where(x => !string.IsNullOrEmpty(x.ClassmajorID.ToString())).Select(x => x.ClassmajorID).ToList();
  70. //根据年级专业信息查询对应的班级信息MaxCode(年级专业分组查询)
  71. var clMaxCodeList = recruitSpecialtyDAL.GetClassmajorMaxCodeByGrademajor(x => grademajorIDList.Contains(x.GrademajorID)).ToList();
  72. //查询学年学期信息
  73. var schoolyearList = recruitSpecialtyDAL.schoolyearRepository.GetList(x => true).ToList();
  74. var facultymajorCode = "";
  75. var facultymajorName = "";
  76. var grademajorCode = "";
  77. var grademajorName = "";
  78. var classmajorCode = "";
  79. var classmajorName = "";
  80. int facultymajorfail = 0;
  81. int grademajorfail = 0;
  82. int fail = 0;
  83. int success = 0;
  84. string tipMessage = null;
  85. List<CF_RecruitSpecialty> recruitSpecialtyUpList = new List<CF_RecruitSpecialty>();
  86. List<CF_Facultymajor> facultymajorInList = new List<CF_Facultymajor>();
  87. List<CF_Grademajor> grademajorInList = new List<CF_Grademajor>();
  88. List<CF_Classmajor> classmajorInList = new List<CF_Classmajor>();
  89. foreach (var recruitSpecialty in recruitSpecialtyList)
  90. {
  91. //目前只处理招生专业与专业班级对应关系的情况(已存在的情况下,暂时不做处理)
  92. //专业分方向的情况处理有以下3种,按以下方式进行处理:
  93. //院系专业分方向(暂不支持)
  94. //年级专业分方向(暂不支持)
  95. //班级信息分方向(以专业分班设置来处理)
  96. //查询对应的院系所信息
  97. var college = collegeList.Where(x => x.CollegeID == recruitSpecialty.CollegeID).SingleOrDefault();
  98. //查询对应的专业信息
  99. var specialty = specialtyList.Where(x => x.SpecialtyID == recruitSpecialty.SpecialtyID).SingleOrDefault();
  100. //查询对应的专业分班信息
  101. var specialtyClassSetting = specialtyClassSettingList.Where(x => x.SpecialtyID == recruitSpecialty.SpecialtyID).SingleOrDefault();
  102. //对应的班级个数
  103. int classNum = 1;
  104. if (specialtyClassSetting != null)
  105. {
  106. if (specialtyClassSetting.ClassNumber != null)
  107. {
  108. if (specialtyClassSetting.ClassNumber.Value > 1)
  109. {
  110. classNum = specialtyClassSetting.ClassNumber.Value;
  111. }
  112. }
  113. }
  114. //专业名称数据字典
  115. var standard = standardList.Where(x => x.Value == specialty.StandardID).SingleOrDefault();
  116. //培养层次(所修学历)
  117. var education = educationList.Where(x => x.Value == specialty.EducationID).SingleOrDefault();
  118. //学习形式
  119. var learningForm = learningFormList.Where(x => x.Value == specialty.LearningformID).SingleOrDefault();
  120. //计算毕业学年学期Value
  121. var graduateSchoolyearValue = (recruitSpecialty.GradeID * 2) - 1 + (recruitSpecialty.SemesterID - 1)
  122. + Convert.ToInt32(Math.Ceiling(specialty.LearnSystem.Value * 2 - 1));
  123. //查询对应的学年学期信息
  124. var graduateSchoolyear = schoolyearList.Where(x => x.Value == graduateSchoolyearValue).SingleOrDefault();
  125. if (graduateSchoolyear == null)
  126. {
  127. //表示年级专业对应的毕业学期,在学年学期信息中不存在(此时不生成)
  128. fail++;
  129. continue;
  130. }
  131. //院系专业编号(院系所编号+专业名称Value值)
  132. facultymajorCode = college.No.Trim() + standard.Value.ToString().Trim();
  133. //院系专业名称(专业名称)
  134. facultymajorName = standard.Name.Trim();
  135. //年级专业编号(年级后两位+院系所编号+专业名称Value值)
  136. grademajorCode = recruitSpecialty.GradeID.ToString().Substring(recruitSpecialty.GradeID.ToString().Length - 2) + facultymajorCode;
  137. //年级专业名称(年级后两位+院系所编号+专业名称+学习形式+培养层次)
  138. grademajorName = recruitSpecialty.GradeID.ToString().Substring(recruitSpecialty.GradeID.ToString().Length - 2)
  139. + college.No.Trim() + standard.Name.Trim() + learningForm.Name.Trim() + education.Name.Trim();
  140. //注:暂时只取部分命名规则
  141. //班级编号(年级后两位+院系所编号+专业名称Value值+流水号1位或年级专业编号+流水号1位)
  142. classmajorCode = grademajorCode;
  143. //班级名称:年级后两位+院系所编号+专业名称+学习形式+培养层次+流水号1位+班或年级专业名称+流水号1位+班
  144. classmajorName = grademajorName;
  145. //查询对应的院系专业信息
  146. var facultymajorVerifyList = facultymajorList.Where(x => x.RecruitSpecialtyID == recruitSpecialty.RecruitSpecialtyID).ToList();
  147. //判断院系专业
  148. if (facultymajorVerifyList != null && facultymajorVerifyList.Count() > 0)
  149. {
  150. //表示存在对应的院系专业信息且只有一条(一一对应,可在此处,做更新处理:需准确定位院系专业)
  151. if (facultymajorVerifyList.Count() == 1)
  152. {
  153. //表示存在对应的院系专业信息
  154. foreach (var facultymajorVerify in facultymajorVerifyList)
  155. {
  156. //查询对应的年级专业信息
  157. var grademajorVerifyList = grademajorList.Where(x => x.FacultymajorID == facultymajorVerify.FacultymajorID).ToList();
  158. //判断年级专业
  159. if (grademajorVerifyList != null && grademajorVerifyList.Count() > 0)
  160. {
  161. //表示存在对应的年级专业信息且只有一条(一一对应,可在此处,做更新处理:需准确定位年级专业)
  162. if (grademajorVerifyList.Count() == 1)
  163. {
  164. //表示存在对应的年级专业信息
  165. foreach (var grademajorVerify in grademajorVerifyList)
  166. {
  167. //查询对应的班级信息
  168. var classmajorVerifyList = classmajorList.Where(x => x.GrademajorID == grademajorVerify.GrademajorID).ToList();
  169. //判断班级信息
  170. if (classmajorVerifyList != null && classmajorVerifyList.Count() > 0)
  171. {
  172. //表示存在对应的班级信息(需处理专业分班信息中班级个数的问题)
  173. //表示存在的班级个数大于专业分班的班级个数
  174. if (classmajorVerifyList.Count() >= classNum)
  175. {
  176. if (classmajorVerifyList.Count() == 1)
  177. {
  178. //查询对应的班级信息(只有一条班级信息可在此处做更新处理)
  179. var classmajorEntity = classmajorVerifyList.Where(x => x.GrademajorID == grademajorVerify.GrademajorID).SingleOrDefault();
  180. //(暂时不做更新处理)
  181. }
  182. else
  183. {
  184. //表示存在多个班级个数(可在此做其它处理)
  185. }
  186. //更新招生专业信息生成状态
  187. recruitSpecialty.isGenerated = true;
  188. recruitSpecialtyUpList.Add(recruitSpecialty);
  189. success++;
  190. }
  191. else
  192. {
  193. //表示存在的班级个数不足
  194. //查询对应的班级信息Max编号(年级专业分组查询)
  195. var clMaxCode = clMaxCodeList.Where(x => x.GrademajorID == grademajorVerify.GrademajorID).SingleOrDefault();
  196. var clNum = Convert.ToInt32(clMaxCode.No.Trim().Substring(clMaxCode.No.Trim().Length - 1));
  197. //生成剩余的班级个数(暂时以MaxCode+1形式生成)
  198. for (int i = 1; i <= classNum - classmajorVerifyList.Count(); i++)
  199. {
  200. CF_Classmajor newClassmajor = new CF_Classmajor();
  201. newClassmajor.ClassmajorID = Guid.NewGuid();
  202. newClassmajor.GrademajorID = grademajorVerify.GrademajorID;
  203. newClassmajor.No = classmajorCode + (clNum + i).ToString();
  204. newClassmajor.Name = classmajorName + (clNum + i).ToString() + "班";
  205. newClassmajor.Abbreviation = newClassmajor.Name;
  206. newClassmajor.EnglishName = null;
  207. newClassmajor.ClassNum = (clNum + i);
  208. newClassmajor.UserID = null;
  209. newClassmajor.AssistantUserID = null;
  210. newClassmajor.Fixedclassroom = null;
  211. newClassmajor.Remark = null;
  212. SetNewStatus(newClassmajor);
  213. classmajorInList.Add(newClassmajor);
  214. }
  215. //更新招生专业信息生成状态
  216. recruitSpecialty.isGenerated = true;
  217. recruitSpecialtyUpList.Add(recruitSpecialty);
  218. success++;
  219. }
  220. }
  221. else
  222. {
  223. //表示对应的班级信息不存在(需根据专业分班信息生成对应的班级个数)
  224. if (classNum > 1)
  225. {
  226. for (int i = 1; i <= classNum; i++)
  227. {
  228. CF_Classmajor newClassmajor = new CF_Classmajor();
  229. newClassmajor.ClassmajorID = Guid.NewGuid();
  230. newClassmajor.GrademajorID = grademajorVerify.GrademajorID;
  231. newClassmajor.No = classmajorCode + i.ToString();
  232. newClassmajor.Name = classmajorName + i.ToString() + "班";
  233. newClassmajor.Abbreviation = newClassmajor.Name;
  234. newClassmajor.EnglishName = null;
  235. newClassmajor.ClassNum = i;
  236. newClassmajor.UserID = null;
  237. newClassmajor.AssistantUserID = null;
  238. newClassmajor.Fixedclassroom = null;
  239. newClassmajor.Remark = null;
  240. SetNewStatus(newClassmajor);
  241. classmajorInList.Add(newClassmajor);
  242. }
  243. }
  244. else
  245. {
  246. //表示只生成一个对应的班级信息(默认)
  247. CF_Classmajor newClassmajor = new CF_Classmajor();
  248. newClassmajor.ClassmajorID = Guid.NewGuid();
  249. newClassmajor.GrademajorID = grademajorVerify.GrademajorID;
  250. newClassmajor.No = classmajorCode + "1";
  251. newClassmajor.Name = classmajorName + "1班";
  252. newClassmajor.Abbreviation = newClassmajor.Name;
  253. newClassmajor.EnglishName = null;
  254. newClassmajor.ClassNum = 1;
  255. newClassmajor.UserID = null;
  256. newClassmajor.AssistantUserID = null;
  257. newClassmajor.Fixedclassroom = null;
  258. newClassmajor.Remark = null;
  259. SetNewStatus(newClassmajor);
  260. classmajorInList.Add(newClassmajor);
  261. }
  262. //更新招生专业信息生成状态
  263. recruitSpecialty.isGenerated = true;
  264. recruitSpecialtyUpList.Add(recruitSpecialty);
  265. success++;
  266. }
  267. }
  268. }
  269. else
  270. {
  271. //表示存在多个年级专业信息的情况
  272. grademajorfail++;
  273. continue;
  274. }
  275. }
  276. else
  277. {
  278. //表示对应的年级专业信息不存在
  279. //注:根据院系专业信息生成年级专业信息、专业分班信息生成对应的班级个数
  280. CF_Grademajor newGrademajor = new CF_Grademajor();
  281. newGrademajor.GrademajorID = Guid.NewGuid();
  282. newGrademajor.FacultymajorID = facultymajorVerify.FacultymajorID;
  283. newGrademajor.Code = grademajorCode;
  284. newGrademajor.Name = grademajorName;
  285. newGrademajor.Abbreviation = newGrademajor.Name;
  286. newGrademajor.GradeID = recruitSpecialty.GradeID;
  287. newGrademajor.SemesterID = recruitSpecialty.SemesterID;
  288. newGrademajor.GraduateSchoolyearID = graduateSchoolyear.SchoolyearID;
  289. newGrademajor.Professional = null;
  290. newGrademajor.Remark = null;
  291. SetNewStatus(newGrademajor);
  292. grademajorInList.Add(newGrademajor);
  293. //表示对应的班级信息不存在(需根据专业分班信息生成对应的班级信息)
  294. if (classNum > 1)
  295. {
  296. for (int i = 1; i <= classNum; i++)
  297. {
  298. CF_Classmajor newClassmajor = new CF_Classmajor();
  299. newClassmajor.ClassmajorID = Guid.NewGuid();
  300. newClassmajor.GrademajorID = newGrademajor.GrademajorID;
  301. newClassmajor.No = classmajorCode + i.ToString();
  302. newClassmajor.Name = classmajorName + i.ToString() + "班";
  303. newClassmajor.Abbreviation = newClassmajor.Name;
  304. newClassmajor.EnglishName = null;
  305. newClassmajor.ClassNum = i;
  306. newClassmajor.UserID = null;
  307. newClassmajor.AssistantUserID = null;
  308. newClassmajor.Fixedclassroom = null;
  309. newClassmajor.Remark = null;
  310. SetNewStatus(newClassmajor);
  311. classmajorInList.Add(newClassmajor);
  312. }
  313. }
  314. else
  315. {
  316. //表示只生成一个对应的班级信息(默认)
  317. CF_Classmajor newClassmajor = new CF_Classmajor();
  318. newClassmajor.ClassmajorID = Guid.NewGuid();
  319. newClassmajor.GrademajorID = newGrademajor.GrademajorID;
  320. newClassmajor.No = classmajorCode + "1";
  321. newClassmajor.Name = classmajorName + "1班";
  322. newClassmajor.Abbreviation = newClassmajor.Name;
  323. newClassmajor.EnglishName = null;
  324. newClassmajor.ClassNum = 1;
  325. newClassmajor.UserID = null;
  326. newClassmajor.AssistantUserID = null;
  327. newClassmajor.Fixedclassroom = null;
  328. newClassmajor.Remark = null;
  329. SetNewStatus(newClassmajor);
  330. classmajorInList.Add(newClassmajor);
  331. }
  332. //更新招生专业信息生成状态
  333. recruitSpecialty.isGenerated = true;
  334. recruitSpecialtyUpList.Add(recruitSpecialty);
  335. success++;
  336. }
  337. }
  338. }
  339. else
  340. {
  341. //表示存在多个院系专业信息的情况
  342. facultymajorfail++;
  343. continue;
  344. }
  345. }
  346. else
  347. {
  348. //表示对应的院系专业信息不存在
  349. //注:默认生成一条院系专业信息、一条年级专业信息、专业分班信息生成对应的班级个数
  350. CF_Facultymajor newFacultymajor = new CF_Facultymajor();
  351. newFacultymajor.FacultymajorID = Guid.NewGuid();
  352. newFacultymajor.CollegeID = recruitSpecialty.CollegeID;
  353. newFacultymajor.Code = facultymajorCode;
  354. newFacultymajor.Name = facultymajorName;
  355. newFacultymajor.Abbreviation = newFacultymajor.Name;
  356. newFacultymajor.EnglishName = null;
  357. newFacultymajor.StandardID = specialty.StandardID;
  358. newFacultymajor.EducationID = specialty.EducationID;
  359. newFacultymajor.LearningformID = specialty.LearningformID;
  360. newFacultymajor.LearnSystem = specialty.LearnSystem;
  361. newFacultymajor.ScienceclassID = specialty.ScienceclassID;
  362. newFacultymajor.SetTime = DateTime.Now;
  363. newFacultymajor.Remark = null;
  364. SetNewStatus(newFacultymajor);
  365. facultymajorInList.Add(newFacultymajor);
  366. //表示对应的年级专业信息不存在
  367. CF_Grademajor newGrademajor = new CF_Grademajor();
  368. newGrademajor.GrademajorID = Guid.NewGuid();
  369. newGrademajor.FacultymajorID = newFacultymajor.FacultymajorID;
  370. newGrademajor.Code = grademajorCode;
  371. newGrademajor.Name = grademajorName;
  372. newGrademajor.Abbreviation = newGrademajor.Name;
  373. newGrademajor.GradeID = recruitSpecialty.GradeID;
  374. newGrademajor.SemesterID = recruitSpecialty.SemesterID;
  375. newGrademajor.GraduateSchoolyearID = graduateSchoolyear.SchoolyearID;
  376. newGrademajor.Professional = null;
  377. newGrademajor.Remark = null;
  378. SetNewStatus(newGrademajor);
  379. grademajorInList.Add(newGrademajor);
  380. //表示对应的班级信息不存在(需根据专业分班信息生成对应的班级信息)
  381. if (classNum > 1)
  382. {
  383. for (int i = 1; i <= classNum; i++)
  384. {
  385. CF_Classmajor newClassmajor = new CF_Classmajor();
  386. newClassmajor.ClassmajorID = Guid.NewGuid();
  387. newClassmajor.GrademajorID = newGrademajor.GrademajorID;
  388. newClassmajor.No = classmajorCode + i.ToString();
  389. newClassmajor.Name = classmajorName + i.ToString() + "班";
  390. newClassmajor.Abbreviation = newClassmajor.Name;
  391. newClassmajor.EnglishName = null;
  392. newClassmajor.ClassNum = i;
  393. newClassmajor.UserID = null;
  394. newClassmajor.AssistantUserID = null;
  395. newClassmajor.Fixedclassroom = null;
  396. newClassmajor.Remark = null;
  397. SetNewStatus(newClassmajor);
  398. classmajorInList.Add(newClassmajor);
  399. }
  400. }
  401. else
  402. {
  403. //表示只生成一个对应的班级信息(默认)
  404. CF_Classmajor newClassmajor = new CF_Classmajor();
  405. newClassmajor.ClassmajorID = Guid.NewGuid();
  406. newClassmajor.GrademajorID = newGrademajor.GrademajorID;
  407. newClassmajor.No = classmajorCode + "1";
  408. newClassmajor.Name = classmajorName + "1班";
  409. newClassmajor.Abbreviation = newClassmajor.Name;
  410. newClassmajor.EnglishName = null;
  411. newClassmajor.ClassNum = 1;
  412. newClassmajor.UserID = null;
  413. newClassmajor.AssistantUserID = null;
  414. newClassmajor.Fixedclassroom = null;
  415. newClassmajor.Remark = null;
  416. SetNewStatus(newClassmajor);
  417. classmajorInList.Add(newClassmajor);
  418. }
  419. //更新招生专业信息生成状态
  420. recruitSpecialty.isGenerated = true;
  421. recruitSpecialtyUpList.Add(recruitSpecialty);
  422. success++;
  423. }
  424. }
  425. using (TransactionScope ts = new TransactionScope())
  426. {
  427. if (facultymajorInList != null && facultymajorInList.Count() > 0)
  428. {
  429. UnitOfWork.BulkInsert(facultymajorInList);
  430. }
  431. if (grademajorInList != null && grademajorInList.Count() > 0)
  432. {
  433. UnitOfWork.BulkInsert(grademajorInList);
  434. }
  435. if (classmajorInList != null && classmajorInList.Count() > 0)
  436. {
  437. UnitOfWork.BulkInsert(classmajorInList);
  438. }
  439. if (recruitSpecialtyUpList != null && recruitSpecialtyUpList.Count() > 0)
  440. {
  441. UnitOfWork.BatchUpdate(recruitSpecialtyUpList);
  442. }
  443. ts.Complete();
  444. }
  445. if (success > 0 && facultymajorfail <= 0 && grademajorfail <= 0 && fail <= 0)
  446. {
  447. tipMessage = success + "条";
  448. }
  449. else
  450. {
  451. if (facultymajorfail <= 0 && grademajorfail <= 0 && fail > 0)
  452. {
  453. tipMessage = success + "条," + fail + "条失败,原因:年级专业对应的毕业学期不存在,请核查";
  454. }
  455. else if (facultymajorfail > 0 && grademajorfail <= 0 && fail <= 0)
  456. {
  457. tipMessage = success + "条," + facultymajorfail + "条由于院系专业信息的原因无法生成,请核查";
  458. }
  459. else if (facultymajorfail <= 0 && grademajorfail > 0 && fail <= 0)
  460. {
  461. tipMessage = success + "条," + grademajorfail + "条由于年级专业信息的原因无法生成,请核查";
  462. }
  463. else if (facultymajorfail > 0 && grademajorfail > 0 && fail <= 0)
  464. {
  465. tipMessage = success + "条," + facultymajorfail + "条由于院系专业信息的原因无法生成," + grademajorfail + "条由于年级专业信息的原因无法生成";
  466. }
  467. else
  468. {
  469. tipMessage = success + "条," + fail + "条由于年级专业对应的毕业学期不存在的原因无法生成,"
  470. + facultymajorfail + "条由于院系专业信息的原因无法生成," + grademajorfail + "条由于年级专业信息的原因无法生成";
  471. }
  472. }
  473. return tipMessage;
  474. }
  475. catch (Exception ex)
  476. {
  477. throw new Exception(ex.Message);
  478. }
  479. }
  480. }
  481. }