CheckingApproveServices.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using System.Transactions;
  7. using Bowin.Common.Linq;
  8. using Bowin.Common.Linq.Entity;
  9. using EMIS.Entities;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.StudentManage.OnlineChecking;
  12. using EMIS.DataLogic.StudentManage.OnlineChecking;
  13. using EMIS.CommonLogic.SystemServices;
  14. namespace EMIS.CommonLogic.StudentManage.OnlineChecking
  15. {
  16. public class CheckingApproveServices : BaseWorkflowServices<CF_StudentContrast>, ICheckingApproveServices
  17. {
  18. public Lazy<CheckingApproveDAL> CheckingApproveDAL { get; set; }
  19. /// <summary>
  20. /// 数据范围
  21. /// </summary>
  22. public CheckingApproveServices()
  23. {
  24. DataRangeUserFunc = ((x, y) => this.IsUserInDataRangeByCollege<CF_StudentContrast>(x, y, (w => w.Sys_User.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID)));
  25. }
  26. /// <summary>
  27. /// 查询对应的校对审核信息CheckingApproveView
  28. /// </summary>
  29. /// <param name="configuretView"></param>
  30. /// <param name="campusID"></param>
  31. /// <param name="collegeID"></param>
  32. /// <param name="gradeID"></param>
  33. /// <param name="standardID"></param>
  34. /// <param name="educationID"></param>
  35. /// <param name="learningformID"></param>
  36. /// <param name="learnSystem"></param>
  37. /// <param name="approvalStatus"></param>
  38. /// <param name="pageIndex"></param>
  39. /// <param name="pageSize"></param>
  40. /// <returns></returns>
  41. public IGridResultSet<CheckingContrastView> GetCheckingApproveViewGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID,
  42. int? educationID, int? learningformID, string learnSystem, int? approvalStatus, int pageIndex, int pageSize)
  43. {
  44. var approveStatusList = this.GetApproveStatusViewList();
  45. var approveStatusIDList = approveStatusList.Select(x => x.ID).ToList();
  46. Expression<Func<CF_StudentContrast, bool>> expStudentContrast = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  47. expStudentContrast = expStudentContrast.And(x => approveStatusIDList.Contains(x.ApprovalStatus));
  48. if (approvalStatus.HasValue)
  49. {
  50. expStudentContrast = expStudentContrast.And(x => x.ApprovalStatus == approvalStatus);
  51. }
  52. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  53. Expression<Func<CF_StudentRecordChangeHistory, bool>> expStudentRecordChangeHistory = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  54. //expStudentRecordChangeHistory = expStudentRecordChangeHistory.And(x => x.CheckingTypeID == (int)CF_CheckingType.OpenApprove);
  55. var query = CheckingApproveDAL.Value.GetCheckingApproveViewQueryable(expStudentContrast, expStudent, expStudentRecordChangeHistory);
  56. if (campusID.HasValue)
  57. {
  58. query = query.Where(x => x.CampusID == campusID);
  59. }
  60. if (collegeID.HasValue)
  61. {
  62. query = query.Where(x => x.CollegeID == collegeID);
  63. }
  64. if (gradeID.HasValue)
  65. {
  66. query = query.Where(x => x.GradeID == gradeID);
  67. }
  68. if (standardID.HasValue)
  69. {
  70. query = query.Where(x => x.StandardID == standardID);
  71. }
  72. if (educationID.HasValue)
  73. {
  74. query = query.Where(x => x.EducationID == educationID);
  75. }
  76. if (learningformID.HasValue)
  77. {
  78. query = query.Where(x => x.LearningformID == learningformID);
  79. }
  80. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  81. {
  82. var LearnSystems = Convert.ToDecimal(learnSystem);
  83. query = query.Where(x => x.LearnSystem == LearnSystems);
  84. }
  85. //查询条件
  86. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  87. {
  88. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  89. }
  90. var result = this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query))
  91. .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo).ThenBy(x => x.GradeID)
  92. .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).OrderByDescending(x => x.ModifyTime)
  93. .ToGridResultSet<CheckingContrastView>(pageIndex, pageSize);
  94. result.rows.ForEach(x => x.ApprovalStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
  95. return result;
  96. }
  97. /// <summary>
  98. /// 查询对应的校对审核信息List
  99. /// </summary>
  100. /// <param name="configuretView"></param>
  101. /// <param name="campusID"></param>
  102. /// <param name="collegeID"></param>
  103. /// <param name="gradeID"></param>
  104. /// <param name="standardID"></param>
  105. /// <param name="educationID"></param>
  106. /// <param name="learningformID"></param>
  107. /// <param name="learnSystem"></param>
  108. /// <param name="approvalStatus"></param>
  109. /// <returns></returns>
  110. public IList<CheckingContrastView> GetCheckingApproveViewList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID,
  111. int? educationID, int? learningformID, string learnSystem, int? approvalStatus)
  112. {
  113. var approveStatusList = this.GetApproveStatusViewList();
  114. var approveStatusIDList = approveStatusList.Select(x => x.ID).ToList();
  115. Expression<Func<CF_StudentContrast, bool>> expStudentContrast = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  116. expStudentContrast = expStudentContrast.And(x => approveStatusIDList.Contains(x.ApprovalStatus));
  117. if (approvalStatus.HasValue)
  118. {
  119. expStudentContrast = expStudentContrast.And(x => x.ApprovalStatus == approvalStatus);
  120. }
  121. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  122. Expression<Func<CF_StudentRecordChangeHistory, bool>> expStudentRecordChangeHistory = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  123. //expStudentRecordChangeHistory = expStudentRecordChangeHistory.And(x => x.CheckingTypeID == (int)CF_CheckingType.OpenApprove);
  124. var query = CheckingApproveDAL.Value.GetCheckingApproveViewQueryable(expStudentContrast, expStudent, expStudentRecordChangeHistory);
  125. if (campusID.HasValue)
  126. {
  127. query = query.Where(x => x.CampusID == campusID);
  128. }
  129. if (collegeID.HasValue)
  130. {
  131. query = query.Where(x => x.CollegeID == collegeID);
  132. }
  133. if (gradeID.HasValue)
  134. {
  135. query = query.Where(x => x.GradeID == gradeID);
  136. }
  137. if (standardID.HasValue)
  138. {
  139. query = query.Where(x => x.StandardID == standardID);
  140. }
  141. if (educationID.HasValue)
  142. {
  143. query = query.Where(x => x.EducationID == educationID);
  144. }
  145. if (learningformID.HasValue)
  146. {
  147. query = query.Where(x => x.LearningformID == learningformID);
  148. }
  149. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  150. {
  151. var LearnSystems = Convert.ToDecimal(learnSystem);
  152. query = query.Where(x => x.LearnSystem == LearnSystems);
  153. }
  154. //查询条件
  155. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  156. {
  157. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  158. }
  159. var result = this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query))
  160. .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo).ThenBy(x => x.GradeID)
  161. .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).OrderByDescending(x => x.ModifyTime).ToList();
  162. result.ForEach(x => x.ApprovalStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
  163. return result;
  164. }
  165. /// <summary>
  166. /// 查询对应的校对审核信息CheckingContrastView
  167. /// </summary>
  168. /// <param name="studentContrastID"></param>
  169. /// <returns></returns>
  170. public CheckingContrastView GetStudentContrastView(Guid? studentContrastID)
  171. {
  172. try
  173. {
  174. Expression<Func<CF_StudentContrast, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  175. exp = exp.And(x => x.StudentContrastID == studentContrastID);
  176. var query = CheckingApproveDAL.Value.GetCheckingApproveViewQueryable(exp).SingleOrDefault();
  177. return query;
  178. }
  179. catch (Exception ex)
  180. {
  181. throw new Exception(ex.Message);
  182. }
  183. }
  184. /// <summary>
  185. /// 删除
  186. /// </summary>
  187. /// <param name="studentContrastIDs"></param>
  188. /// <returns></returns>
  189. public bool StudentContrastDelete(List<Guid?> studentContrastIDs)
  190. {
  191. try
  192. {
  193. using (TransactionScope ts = new TransactionScope())
  194. {
  195. UnitOfWork.Delete<CF_RecruitstudentsSource>(x => studentContrastIDs.Contains(x.StudentContrastID));
  196. UnitOfWork.Delete<CF_RecruitstudentsContrast>(x => studentContrastIDs.Contains(x.StudentContrastID));
  197. UnitOfWork.Delete<CF_StudentAccountSource>(x => studentContrastIDs.Contains(x.StudentContrastID));
  198. UnitOfWork.Delete<CF_StudentAccountContrast>(x => studentContrastIDs.Contains(x.StudentContrastID));
  199. UnitOfWork.Delete<CF_StudentContactSource>(x => studentContrastIDs.Contains(x.StudentContrastID));
  200. UnitOfWork.Delete<CF_StudentContactContrast>(x => studentContrastIDs.Contains(x.StudentContrastID));
  201. UnitOfWork.Delete<CF_StudentProfileSource>(x => studentContrastIDs.Contains(x.StudentContrastID));
  202. UnitOfWork.Delete<CF_StudentProfileContrast>(x => studentContrastIDs.Contains(x.StudentContrastID));
  203. UnitOfWork.Delete<Sys_UserSource>(x => studentContrastIDs.Contains(x.StudentContrastID));
  204. UnitOfWork.Delete<Sys_UserContrast>(x => studentContrastIDs.Contains(x.StudentContrastID));
  205. UnitOfWork.Delete<CF_StudentRecordChangeHistory>(x => studentContrastIDs.Contains(x.StudentContrastID));
  206. UnitOfWork.Delete<CF_StudentSource>(x => studentContrastIDs.Contains(x.StudentContrastID));
  207. UnitOfWork.Delete<CF_StudentContrast>(x => studentContrastIDs.Contains(x.StudentContrastID));
  208. ts.Complete();
  209. return true;
  210. }
  211. }
  212. catch (Exception)
  213. {
  214. throw;
  215. }
  216. }
  217. /// <summary>
  218. /// 查询对应的校对数明细CheckingHistoryView
  219. /// </summary>
  220. /// <param name="configuretView"></param>
  221. /// <param name="studentContrastID"></param>
  222. /// <param name="pageIndex"></param>
  223. /// <param name="pageSize"></param>
  224. /// <returns></returns>
  225. public IGridResultSet<CheckingHistoryView> GetCheckingDetailViewGrid(ConfiguretView configuretView, Guid? studentContrastID, int pageIndex, int pageSize)
  226. {
  227. Expression<Func<CF_StudentContrast, bool>> expStudentContrast = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  228. expStudentContrast = expStudentContrast.And(x => x.StudentContrastID == studentContrastID);
  229. var query = CheckingApproveDAL.Value.GetCheckingHistoryViewQueryable(expStudentContrast);
  230. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  231. {
  232. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  233. }
  234. return query.OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ThenBy(x => x.ColumnName.Length)
  235. .ThenBy(x => x.ColumnName).ToGridResultSet<CheckingHistoryView>(pageIndex, pageSize);
  236. }
  237. /// <summary>
  238. /// 查询对应的校对数明细List
  239. /// </summary>
  240. /// <param name="configuretView"></param>
  241. /// <param name="studentContrastID"></param>
  242. /// <returns></returns>
  243. public IList<CheckingHistoryView> GetCheckingDetailViewList(ConfiguretView configuretView, Guid? studentContrastID)
  244. {
  245. Expression<Func<CF_StudentContrast, bool>> expStudentContrast = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  246. expStudentContrast = expStudentContrast.And(x => x.StudentContrastID == studentContrastID);
  247. var query = CheckingApproveDAL.Value.GetCheckingHistoryViewQueryable(expStudentContrast);
  248. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  249. {
  250. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  251. }
  252. return query.OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ThenBy(x => x.ColumnName.Length)
  253. .ThenBy(x => x.ColumnName).ToList();
  254. }
  255. /// <summary>
  256. /// 审核确定(批量)
  257. /// </summary>
  258. /// <param name="studentContrastIDs"></param>
  259. /// <param name="userID"></param>
  260. /// <param name="actionID"></param>
  261. /// <param name="comment"></param>
  262. public void CheckingApproveConfirm(List<Guid?> studentContrastIDs, Guid userID, Guid actionID, string comment)
  263. {
  264. try
  265. {
  266. var studentContrastList = CheckingApproveDAL.Value.StudentContrastRepository.GetList(x => studentContrastIDs.Contains(x.StudentContrastID)).ToList();
  267. foreach (var studentContrastID in studentContrastIDs)
  268. {
  269. var studentContrast = studentContrastList.Where(x => x.StudentContrastID == studentContrastID).SingleOrDefault();
  270. if (studentContrast == null)
  271. {
  272. throw new Exception("数据有误,请核查");
  273. }
  274. }
  275. this.Approve(studentContrastIDs.Select(x => x.Value).ToList(), userID, actionID, comment);
  276. }
  277. catch (Exception ex)
  278. {
  279. throw new Exception(ex.Message);
  280. }
  281. }
  282. /// <summary>
  283. /// 查询对应列名称及值ColumnNameValue
  284. /// </summary>
  285. /// <typeparam name="T"></typeparam>
  286. /// <param name="t"></param>
  287. /// <returns></returns>
  288. public Dictionary<string, object> GetColumnNameValue<T>(T t)
  289. {
  290. try
  291. {
  292. var columnNameValueList = new Dictionary<string, object>();
  293. System.Reflection.PropertyInfo[] properties = t.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
  294. foreach (System.Reflection.PropertyInfo item in properties)
  295. {
  296. if (item.PropertyType.IsValueType || item.PropertyType.Name.StartsWith("String"))
  297. {
  298. columnNameValueList.Add(item.Name, item.GetValue(t, null));
  299. }
  300. }
  301. return columnNameValueList;
  302. }
  303. catch (Exception ex)
  304. {
  305. throw new Exception(ex.Message);
  306. }
  307. }
  308. /// <summary>
  309. /// 流程结束跳转函数(工作流平台中配置)
  310. /// 注:需对网上校对信息进行处理
  311. /// </summary>
  312. /// <param name="studentContrastIDList"></param>
  313. /// <param name="userID"></param>
  314. public void OnApproveEnd(List<Guid> studentContrastIDList, Guid? userID)
  315. {
  316. try
  317. {
  318. var studentContrastList = CheckingApproveDAL.Value.StudentContrastRepository.GetList(x => studentContrastIDList.Contains(x.StudentContrastID)).ToList();
  319. var userIDList = studentContrastList.Select(x => x.UserID).ToList();
  320. var studentList = CheckingApproveDAL.Value.StudentRepository.GetList(x => userIDList.Contains(x.UserID), (x => x.CF_StudentProfile), (x => x.CF_StudentContact), (x => x.CF_StudentAccount), (x => x.CF_Recruitstudents), (x => x.Sys_User)).ToList();
  321. var checkingHistoryViewList = CheckingApproveDAL.Value.GetCheckingHistoryViewQueryable(x => studentContrastIDList.Contains(x.StudentContrastID)).ToList();
  322. bool isUserCheck = false;
  323. bool isStudentCheck = false;
  324. bool isStuProfileCheck = false;
  325. bool isStuContactCheck = false;
  326. bool isStuAccountCheck = false;
  327. bool isStuRecruitCheck = false;
  328. List<Sys_User> userUpList = new List<Sys_User>();
  329. List<CF_Student> studentUpList = new List<CF_Student>();
  330. List<CF_StudentProfile> studentProfileUpList = new List<CF_StudentProfile>();
  331. List<CF_StudentContact> studentContactUpList = new List<CF_StudentContact>();
  332. List<CF_StudentAccount> studentAccountUpList = new List<CF_StudentAccount>();
  333. List<CF_Recruitstudents> recruitstudentsUpList = new List<CF_Recruitstudents>();
  334. foreach (var studentContrast in studentContrastList)
  335. {
  336. isUserCheck = false;
  337. isStudentCheck = false;
  338. isStuProfileCheck = false;
  339. isStuContactCheck = false;
  340. isStuAccountCheck = false;
  341. isStuRecruitCheck = false;
  342. var keyValuePairList = checkingHistoryViewList.Where(x => x.StudentContrastID == studentContrast.StudentContrastID).ToDictionary(x => x.ColumnName, x => x.CheckingAfterValue);
  343. var student = studentList.Where(x => x.UserID == studentContrast.UserID).SingleOrDefault();
  344. foreach (var keyValuePair in keyValuePairList)
  345. {
  346. var userProperty = typeof(Sys_User).GetProperties().Where(x => x.Name.ToLower() == keyValuePair.Key.ToLower()).SingleOrDefault();
  347. if (userProperty != null)
  348. {
  349. if (!(userProperty.GetValue(student.Sys_User, null) ?? "").Equals((keyValuePairList[keyValuePair.Key] ?? "")))
  350. {
  351. userProperty.SetValue(student.Sys_User, keyValuePairList[keyValuePair.Key], null);
  352. isUserCheck = true;
  353. }
  354. }
  355. var studentProperty = typeof(CF_Student).GetProperties().Where(x => x.Name.ToLower() == keyValuePair.Key.ToLower()).SingleOrDefault();
  356. if (studentProperty != null)
  357. {
  358. if (!(studentProperty.GetValue(student, null) ?? "").Equals((keyValuePairList[keyValuePair.Key] ?? "")))
  359. {
  360. studentProperty.SetValue(student, keyValuePairList[keyValuePair.Key], null);
  361. isStudentCheck = true;
  362. }
  363. }
  364. var studentProfileProperty = typeof(CF_StudentProfile).GetProperties().Where(x => x.Name.ToLower() == keyValuePair.Key.ToLower()).SingleOrDefault();
  365. if (studentProfileProperty != null)
  366. {
  367. if (!(studentProfileProperty.GetValue(student.CF_StudentProfile, null) ?? "").Equals((keyValuePairList[keyValuePair.Key] ?? "")))
  368. {
  369. studentProfileProperty.SetValue(student.CF_StudentProfile, keyValuePairList[keyValuePair.Key], null);
  370. isStuProfileCheck = true;
  371. }
  372. }
  373. var studentContactProperty = typeof(CF_StudentContact).GetProperties().Where(x => x.Name.ToLower() == keyValuePair.Key.ToLower()).SingleOrDefault();
  374. if (studentContactProperty != null)
  375. {
  376. if (!(studentContactProperty.GetValue(student.CF_StudentContact, null) ?? "").Equals((keyValuePairList[keyValuePair.Key] ?? "")))
  377. {
  378. studentContactProperty.SetValue(student.CF_StudentContact, keyValuePairList[keyValuePair.Key], null);
  379. isStuContactCheck = true;
  380. }
  381. }
  382. var studentAccountProperty = typeof(CF_StudentAccount).GetProperties().Where(x => x.Name.ToLower() == keyValuePair.Key.ToLower()).SingleOrDefault();
  383. if (studentAccountProperty != null)
  384. {
  385. if (!(studentAccountProperty.GetValue(student.CF_StudentAccount, null) ?? "").Equals((keyValuePairList[keyValuePair.Key] ?? "")))
  386. {
  387. studentAccountProperty.SetValue(student.CF_StudentAccount, keyValuePairList[keyValuePair.Key], null);
  388. isStuAccountCheck = true;
  389. }
  390. }
  391. var recruitstudentsProperty = typeof(CF_Recruitstudents).GetProperties().Where(x => x.Name.ToLower() == keyValuePair.Key.ToLower()).SingleOrDefault();
  392. if (recruitstudentsProperty != null)
  393. {
  394. if (!(recruitstudentsProperty.GetValue(student.CF_Recruitstudents, null) ?? "").Equals((keyValuePairList[keyValuePair.Key] ?? "")))
  395. {
  396. recruitstudentsProperty.SetValue(student.CF_Recruitstudents, keyValuePairList[keyValuePair.Key], null);
  397. isStuRecruitCheck = true;
  398. }
  399. }
  400. }
  401. if (isUserCheck)
  402. {
  403. student.Sys_User.ModifyUserID = userID;
  404. student.Sys_User.ModifyTime = DateTime.Now;
  405. userUpList.Add(student.Sys_User);
  406. }
  407. if (isStudentCheck)
  408. {
  409. student.ModifyUserID = userID;
  410. student.ModifyTime = DateTime.Now;
  411. studentUpList.Add(student);
  412. }
  413. if (isStuProfileCheck)
  414. {
  415. student.CF_StudentProfile.ModifyUserID = userID;
  416. student.CF_StudentProfile.ModifyTime = DateTime.Now;
  417. studentProfileUpList.Add(student.CF_StudentProfile);
  418. }
  419. if (isStuContactCheck)
  420. {
  421. student.CF_StudentContact.ModifyUserID = userID;
  422. student.CF_StudentContact.ModifyTime = DateTime.Now;
  423. studentContactUpList.Add(student.CF_StudentContact);
  424. }
  425. if (isStuAccountCheck)
  426. {
  427. student.CF_StudentAccount.ModifyUserID = userID;
  428. student.CF_StudentAccount.ModifyTime = DateTime.Now;
  429. studentAccountUpList.Add(student.CF_StudentAccount);
  430. }
  431. if (isStuRecruitCheck)
  432. {
  433. student.CF_Recruitstudents.ModifyUserID = userID;
  434. student.CF_Recruitstudents.ModifyTime = DateTime.Now;
  435. recruitstudentsUpList.Add(student.CF_Recruitstudents);
  436. }
  437. }
  438. TransactionOptions transactionOption = new TransactionOptions();
  439. transactionOption.IsolationLevel = System.Transactions.IsolationLevel.Serializable;
  440. transactionOption.Timeout = new TimeSpan(0, 3, 0);
  441. using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOption))
  442. {
  443. if (userUpList != null && userUpList.Count() > 0)
  444. {
  445. UnitOfWork.BatchUpdate(userUpList);
  446. }
  447. if (studentUpList != null && studentUpList.Count() > 0)
  448. {
  449. UnitOfWork.BatchUpdate(studentUpList);
  450. }
  451. if (studentProfileUpList != null && studentProfileUpList.Count() > 0)
  452. {
  453. UnitOfWork.BatchUpdate(studentProfileUpList);
  454. }
  455. if (studentContactUpList != null && studentContactUpList.Count() > 0)
  456. {
  457. UnitOfWork.BatchUpdate(studentContactUpList);
  458. }
  459. if (studentAccountUpList != null && studentAccountUpList.Count() > 0)
  460. {
  461. UnitOfWork.BatchUpdate(studentAccountUpList);
  462. }
  463. if (recruitstudentsUpList != null && recruitstudentsUpList.Count() > 0)
  464. {
  465. UnitOfWork.BatchUpdate(recruitstudentsUpList);
  466. }
  467. ts.Complete();
  468. }
  469. }
  470. catch (Exception ex)
  471. {
  472. throw new Exception(ex.Message);
  473. }
  474. }
  475. }
  476. }