RecruitSpecialtyServices.cs 35 KB

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