StudentRecordServices.cs 100 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.StudentSystem.StudentMaterial;
  6. using EMIS.ViewModel.Students;
  7. using EMIS.ViewModel.CacheManage;
  8. using EMIS.ViewModel;
  9. using EMIS.Entities;
  10. using System.Web;
  11. using EMIS.CommonLogic.CalendarManage;
  12. using EMIS.DataLogic.Common.Students;
  13. using System.ComponentModel;
  14. using EMIS.DataLogic.Common.CalendarManage;
  15. using EMIS.DataLogic.UniversityManage.SpecialtyClassManage;
  16. using EMIS.DataLogic.Repositories;
  17. using EMIS.DataLogic.StudentManage.OnlineChecking;
  18. namespace EMIS.CommonLogic.Students
  19. {
  20. class StudentRecordServices : BaseServices, IStudentRecordServices
  21. {
  22. public OpenObjectDAL openObjectsDAL { get; set; }
  23. public GrademajorDAL GrademajorDAL { get; set; }
  24. public SchoolYearDAL schoolYearDAL { get; set; }
  25. public StudentsDAL StudentsDAL { get; set; }
  26. public StudentRecordDAL studentRecordDAL { get; set; }
  27. public Lazy<ISchoolYearServices> SchoolYearServices { get; set; }
  28. //public Lazy<AuditProcessDAL> AuditProcessDAL { get; set; }
  29. public StudentEditColumnDescriptionRepository studentEditColumnDescriptionRepository { get; set; }
  30. //public StudentProofreadControlRepository studentProofreadControlRepository { get; set; }
  31. public StudentRecordView GetStudentByStudentNo(Guid StudentID)
  32. {
  33. return studentRecordDAL.GetStudentByStudentNo(StudentID);
  34. }
  35. private bool IsCanEdit(Guid studentID)
  36. {
  37. var nowTime = DateTime.Now;
  38. var curSchoolYear = SchoolYearServices.Value.GetCurrentSchoolYear();
  39. var student = studentRecordDAL.StudentRepository.GetSingle(x => x.UserID == studentID,
  40. (x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor));
  41. var schoolyearNum = curSchoolYear.Years - student.CF_Classmajor.CF_Grademajor.GradeID + 1;
  42. var editControl = studentRecordDAL.StudentEditObjectsRepository.GetList(x => x.Starttime <= nowTime && x.Endtime >= nowTime
  43. && x.SchoolyearNumID == schoolyearNum && x.EducationID == student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.EducationID).ToList();
  44. if (editControl.Count > 0)
  45. {
  46. return true;
  47. }
  48. return false;
  49. }
  50. public void ProofreadIsOpen(Guid UserID)
  51. {
  52. //当前学年学期
  53. var nowSchoolYear = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.IsCurrent == true).FirstOrDefault();
  54. //全部学年学期
  55. var schoolYearList = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  56. //学生
  57. var studentclass = this.StudentsDAL.StudentRepository.GetList(x => x.UserID == UserID).Select(x => x.CF_Classmajor).FirstOrDefault();
  58. //学生所在班级
  59. CF_Grademajor grademajor = this.GrademajorDAL.GrademajorRepository.GetSingle(x => x.GrademajorID == studentclass.GrademajorID);
  60. CF_Facultymajor facultymajor = GrademajorDAL.GrademajorRepository.GetList(x => x.GrademajorID == studentclass.GrademajorID).Select(x => x.CF_Facultymajor).FirstOrDefault();
  61. //学生入学学年学期
  62. //schoolYearList.FirstOrDefault(x => x.Value == (grademajor.SchoolyearID + (grademajor.SchoolcodeID - 1)) * 2);
  63. var startSchoolyear = schoolYearList.FirstOrDefault(x => x.Years == grademajor.GradeID && x.SchoolcodeID == grademajor.SemesterID);
  64. //var courseSchoolyear = (startSchoolyear.Value + ((grademajor.SchoolcodeID - 1) * 2)) + (nowSchoolYear.SchoolcodeID == grademajor.SchoolcodeID ? 0 : 1);
  65. var now = (nowSchoolYear.Value - (nowSchoolYear.SchoolcodeID == grademajor.SemesterID ? 0 : 1) - startSchoolyear.Value) / 2 + 1;
  66. //开放学年查询
  67. var open = this.openObjectsDAL.StudentEditObjectsRepository.GetList(x => x.SchoolyearNumID == now && x.EducationID == facultymajor.EducationID).FirstOrDefault();
  68. if (open == null)
  69. {
  70. throw new Exception("没有开放该功能。");
  71. }
  72. else
  73. {
  74. if (open.EducationID != grademajor.CF_Facultymajor.EducationID)
  75. {
  76. throw new Exception("您没有操作权限。");
  77. }
  78. if (open.Starttime > System.DateTime.Now)
  79. {
  80. throw new Exception("当前时间不在开放时间范围内。");
  81. }
  82. if (open.Endtime.Value.AddDays(1) < System.DateTime.Now)
  83. {
  84. throw new Exception("当前时间不在开放时间范围内。");
  85. }
  86. }
  87. }
  88. public void ProofreadStudent(Guid userID)
  89. {
  90. try
  91. {
  92. CF_Student student = StudentsDAL.StudentRepository.GetSingle(x => x.UserID == userID);
  93. student.IsProofread = true;
  94. SetModifyStatus(student);
  95. student.ModifyTime = DateTime.Now;
  96. student.ModifyUserID = userID;
  97. UnitOfWork.Commit();
  98. }
  99. catch (Exception)
  100. {
  101. throw;
  102. }
  103. }
  104. //public List<StudentChangeFeildView> GetStudentChangeFeilds(Guid StudentID)
  105. //{
  106. // ////学生信息
  107. // //var Student = StudentsDAL.GetStudentQueryable(x => x.UserID == StudentID, (x => true), (x => true)).FirstOrDefault();
  108. // //var studentType = typeof(StudentsView);
  109. // List<StudentChangeFeildView> Feilds = new List<StudentChangeFeildView>();
  110. // #region
  111. // //var SexName = IdNameExt.GetDictionaryItem("CF_Sex")
  112. // // .Where(x => x.Value == Student.Sex)
  113. // // .Select(x => x.Name).FirstOrDefault();
  114. // //var NationName = IdNameExt.GetDictionaryItem("CF_Nation")
  115. // // .Where(x => x.Value == Student.Nation)
  116. // // .Select(x => x.Name).FirstOrDefault();
  117. // //var EducationName = IdNameExt.GetDictionaryItem("CF_Education")
  118. // // .Where(x => x.Value == Student.EducationID)
  119. // // .Select(x => x.Name).FirstOrDefault();
  120. // //var LearningformName = IdNameExt.GetDictionaryItem("CF_Learningform")
  121. // // .Where(x => x.Value == Student.LearningformID)
  122. // // .Select(x => x.Name).FirstOrDefault();
  123. // //var LearningstyleName = IdNameExt.GetDictionaryItem("CF_Learningstyle")
  124. // // .Where(x => x.Value == Student.LearningstyleID)
  125. // // .Select(x => x.Name).FirstOrDefault();
  126. // //var CultureModelName = IdNameExt.GetDictionaryItem("CF_CULTUREMODEL")
  127. // // .Where(x => x.Value == Student.CultureModel)
  128. // // .Select(x => x.Name).FirstOrDefault();
  129. // //var StudentTypeName = IdNameExt.GetDictionaryItem("CF_STUDENTTYPE")
  130. // // .Where(x => x.Value == Student.StudentType)
  131. // // .Select(x => x.Name).FirstOrDefault();
  132. // //var StudentStatusName = IdNameExt.GetDictionaryItem("CF_StudentStatus")
  133. // // .Where(x => x.Value == Student.StudentStatus)
  134. // // .Select(x => x.Name).FirstOrDefault();
  135. // //var EntranceWayName = IdNameExt.GetDictionaryItem("CF_EntranceWay")
  136. // // .Where(x => x.Value == Student.EntranceWay)
  137. // // .Select(x => x.Name).FirstOrDefault();
  138. // //var ExamineeTypeName = IdNameExt.GetDictionaryItem("CF_EXAMINEETYPE")
  139. // // .Where(x => x.Value == Student.ExamineeType)
  140. // // .Select(x => x.Name).FirstOrDefault();
  141. // //var HealthyName = IdNameExt.GetDictionaryItem("CF_HealthState")
  142. // // .Where(x => x.Value == Student.Healthy)
  143. // // .Select(x => x.Name).FirstOrDefault();
  144. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "照片", ColumnFeild = "PhotoUrl", OrderBy = 1, Value = Student.PhotoUrl, TypeName = "基本信息" });
  145. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学号", ColumnFeild = "LoginID", OrderBy = 2, Value = Student.LoginID, TypeName = "基本信息" });
  146. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "姓名", ColumnFeild = "UserName", OrderBy = 3, Value = Student.UserName, TypeName = "基本信息" });
  147. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "曾用名", ColumnFeild = "UsedName", OrderBy = 4, Value = Student.UsedName, TypeName = "基本信息" });
  148. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "性别", ColumnFeild = "Sex", OrderBy = 5, Value = SexName, TypeName = "基本信息" });
  149. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "出生日期", ColumnFeild = "BirthDate", OrderBy = 6, Value = Student.BirthDate.HasValue ? Student.BirthDate.Value.ToString("yyyy-MM-dd") : "", TypeName = "基本信息" });
  150. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "民族", ColumnFeild = "Nation", OrderBy = 7, Value = NationName, TypeName = "基本信息" });
  151. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "政治面貌", ColumnFeild = "Politics", OrderBy = 8, Value = Student.Politics, TypeName = "基本信息" });
  152. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "身份证", ColumnFeild = "IDNumber", OrderBy = 9, Value = Student.IDNumber, TypeName = "基本信息" });
  153. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "年级", ColumnFeild = "GradeName", OrderBy = 10, Value = Student.GradeName, TypeName = "专业班级区" });
  154. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "年级专业", ColumnFeild = "GradeCode", OrderBy = 11, Value = Student.GradeCode, TypeName = "专业班级区" });
  155. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "班级名称", ColumnFeild = "ClassName", OrderBy = 12, Value = Student.ClassName, TypeName = "专业班级区" });
  156. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学制", ColumnFeild = "LearnSystem", OrderBy = 13, Value = Student.LearnSystem.HasValue ? Student.LearnSystem.ToString() : "", TypeName = "专业班级区" });
  157. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "班序", ColumnFeild = "No", OrderBy = 14, Value = Student.No, TypeName = "专业班级区" });
  158. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = EMIS.Utility.RSL.Get("EducationID"), ColumnFeild = "EducationID", OrderBy = 15, Value = EducationName, TypeName = "专业班级区" });
  159. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学习形式", ColumnFeild = "LearningformID", OrderBy = 16, Value = LearningformName, TypeName = "专业班级区" });
  160. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学习方式", ColumnFeild = "LearningstyleID", OrderBy = 17, Value = LearningstyleName, TypeName = "专业班级区" });
  161. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "培养方式/办学类型", ColumnFeild = "CultureModel", OrderBy = 18, Value = CultureModelName, TypeName = "补充信息" });
  162. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学生类别", ColumnFeild = "StudentType", OrderBy = 19, Value = StudentTypeName, TypeName = "补充信息" });
  163. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学籍状态", ColumnFeild = "StudentStatus", OrderBy = 20, Value = StudentStatusName, TypeName = "补充信息" });
  164. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "入学日期", ColumnFeild = "EntranceDate", OrderBy = 21, Value = Student.EntranceDate.HasValue ? Student.EntranceDate.Value.ToString("yyyy-MM-dd") : "", TypeName = "高考招生信息" });
  165. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "入学方式", ColumnFeild = "EntranceWay", OrderBy = 22, Value = EntranceWayName, TypeName = "高考招生信息" });
  166. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "教育部考生号", ColumnFeild = "ExamineeNum", OrderBy = 23, Value = Student.ExamineeNum, TypeName = "高考招生信息" });
  167. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "考生类别", ColumnFeild = "ExamineeType", OrderBy = 24, Value = ExamineeTypeName, TypeName = "高考招生信息" });
  168. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "考生特征", ColumnFeild = "Features", OrderBy = 25, Value = Student.Features.HasValue ? Student.Features.ToString() : "", TypeName = "高考招生信息" });
  169. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "高考总分", ColumnFeild = "Score", OrderBy = 26, Value = Student.Score.HasValue ? Student.Score.ToString() : "", TypeName = "高考招生信息" });
  170. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "生源所属地", ColumnFeild = "Territorial", OrderBy = 27, Value = Student.Territorial.HasValue ? Student.Territorial.ToString() : "", TypeName = "高考招生信息" });
  171. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "来源地区", ColumnFeild = "Area", OrderBy = 28, Value = Student.Area, TypeName = "高考招生信息" });
  172. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "籍贯", ColumnFeild = "Place", OrderBy = 29, Value = Student.Place, TypeName = "高考招生信息" });
  173. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "出生地", ColumnFeild = "BornPlace", OrderBy = 30, Value = Student.BornPlace, TypeName = "高考招生信息" });
  174. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "健康状况", ColumnFeild = "Healthy", OrderBy = 31, Value = HealthyName, TypeName = "个人附加信息" });
  175. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "特长", ColumnFeild = "Specialty", OrderBy = 32, Value = Student.Specialty, TypeName = "个人附加信息" });
  176. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "身高(CM)", ColumnFeild = "Height", OrderBy = 33, Value = Student.Height, TypeName = "个人附加信息" });
  177. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "体重(KG)", ColumnFeild = "Weight", OrderBy = 34, Value = Student.Weight, TypeName = "个人附加信息" });
  178. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "Email", ColumnFeild = "Email", OrderBy = 35, Value = Student.Email, TypeName = "联系信息" });
  179. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "QQ", ColumnFeild = "QQ", OrderBy = 36, Value = Student.QQ, TypeName = "联系信息" });
  180. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "宿舍", ColumnFeild = "Dormitory", OrderBy = 37, Value = Student.Dormitory, TypeName = "联系信息" });
  181. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "固定电话", ColumnFeild = "Telephone", OrderBy = 38, Value = Student.Telephone, TypeName = "联系信息" });
  182. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "移动电话", ColumnFeild = "Mobile", OrderBy = 39, Value = Student.Mobile, TypeName = "联系信息" });
  183. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "地址", ColumnFeild = "HomeAddress", OrderBy = 40, Value = Student.HomeAddress, TypeName = "联系信息" });
  184. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "工作单位", ColumnFeild = "WorkUnit", OrderBy = 1, Value = Student.WorkUnit, TypeName = "联系信息" });
  185. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "邮编", ColumnFeild = "Zipcode", OrderBy = 1, Value = Student.Zipcode, TypeName = "联系信息" });
  186. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "收件人", ColumnFeild = "Recipient", OrderBy = 1, Value = Student.Recipient, TypeName = "联系信息" });
  187. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "拟毕业日期", ColumnFeild = "PlanningGraduateDate", OrderBy = 1, Value = Student.PlanningGraduateDate.HasValue ? Student.PlanningGraduateDate.Value.ToString("yyyy-MM-dd") : "", TypeName = "其他信息" });
  188. // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "备注", ColumnFeild = "Remarks", OrderBy = 1, Value = Student.Remarks, TypeName = "其他信息" });
  189. // #endregion
  190. // //var canEdit = this.IsCanEdit(StudentID);
  191. // //字段修改设定
  192. // var Controls = studentRecordDAL.ControlRepository.Entities.ToList().Select(q =>
  193. // new StudentChangeFeildView
  194. // {
  195. // ColumnFeild = q.ColumnName,
  196. // ColumnNmae = q.DisplayColumnName,
  197. // IsChange = (q.CheckingTypeID != (int)CF_CheckingType.Close),
  198. // OrderBy = q.OrderNo ?? 1
  199. // }).ToList();
  200. // //Feilds = Feilds.Where(q => Controls.Contains(q.ColumnFeild)).ToList();
  201. // return Controls;
  202. //}
  203. /// <summary>
  204. /// 修改学生信息
  205. /// </summary>
  206. /// <param name="Data"></param>
  207. /// <param name="UserID"></param>
  208. //public void ChangeStudentInfo(Dictionary<string, object> Data, Guid UserID)
  209. //{
  210. // //当前学年学期
  211. // var nowSchoolYear = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.IsCurrent == true).FirstOrDefault();
  212. // //全部学年学期
  213. // var schoolYearList = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  214. // //学生
  215. // var student = this.StudentsDAL.StudentRepository.GetList(x => x.UserID == UserID, x => x.CF_Classmajor).FirstOrDefault();
  216. // //学生所在班级
  217. // CF_Grademajor grademajor = this.GrademajorDAL.GrademajorRepository.GetSingle(x => x.GrademajorID == student.CF_Classmajor.GrademajorID, x => x.CF_Facultymajor);
  218. // //学生入学学年学期
  219. // //schoolYearList.FirstOrDefault(x => x.Value == (grademajor.SchoolyearID + (grademajor.SchoolcodeID - 1)) * 2);
  220. // var startSchoolyear = schoolYearList.FirstOrDefault(x => x.Years == grademajor.SchoolyearID && x.SchoolcodeID == grademajor.SchoolcodeID);
  221. // var courseSchoolyear = (startSchoolyear.Value + ((grademajor.SchoolcodeID - 1) * 2)) + (nowSchoolYear.SchoolcodeID == grademajor.SchoolcodeID ? 0 : 1);
  222. // var now = (nowSchoolYear.Value - (nowSchoolYear.SchoolcodeID == grademajor.SchoolcodeID ? 0 : 1) - startSchoolyear.Value) / 2 + 1;
  223. // //开放学年查询
  224. // var open = this.openObjectsDAL.StudentEditObjectsRepository.GetList(x => x.SchoolyearNumID == now && x.EducationID == grademajor.CF_Facultymajor.EducationID).FirstOrDefault();
  225. // if (open == null)
  226. // {
  227. // throw new Exception("您没有操作权限。");
  228. // }
  229. // else
  230. // {
  231. // if (open.EducationID != grademajor.CF_Facultymajor.EducationID)
  232. // {
  233. // throw new Exception("您没有操作权限。");
  234. // }
  235. // if (open.Starttime > System.DateTime.Now)
  236. // {
  237. // throw new Exception("当前时间不在开放时间范围内。");
  238. // }
  239. // if (open.Endtime.Value.AddDays(1) < System.DateTime.Now)
  240. // {
  241. // throw new Exception("当前时间不在开放时间范围内。");
  242. // }
  243. // }
  244. // int c = 0;
  245. // //字段修改设定
  246. // var Controls = studentRecordDAL.ControlRepository.Entities.Where(q => q.CheckingTypeID != (int)CF_CheckingType.Close).ToList();
  247. // ////需要记录的字段
  248. // //var RecordFeilds = Controls.Where(q => q.CheckingTypeID == (int)CF_CheckingType.OpenRecord || q.CheckingTypeID == (int)CF_CheckingType.OpenApprove).Select(q => q.ColumnName);
  249. // //先修改不需要记录的,再修改需要记录不需要审核的,再修改需要记录需要审核的
  250. // //直接修改数据的字段
  251. // var NeedFeilds = Controls.Where(q => q.CheckingTypeID == (int)CF_CheckingType.AllOpen).Select(q => q.ColumnName);
  252. // c = UpdateStudent(Data.Where(q => NeedFeilds.Contains(q.Key)).ToDictionary(q => q.Key, q => q.Value), UserID);
  253. // //需要记录日志后修改数据的字段
  254. // var NeedLogFeilds = Controls.Where(q => q.CheckingTypeID == (int)CF_CheckingType.OpenRecord).Select(q => q.ColumnName);
  255. // //var istrue = Data.Where(q => NeedLogFeilds.Contains(q.Key));
  256. // c += UpdateAndRecordStudent(Data.Where(q => NeedLogFeilds.Contains(q.Key)).ToDictionary(q => q.Key, q => q.Value), UserID);
  257. // //检查重复提交,学生提交修改字段时,已提交修改的字段在审批前,不能再提交:邓智荣
  258. // var NeedAuditFeilds = Controls.Where(q => q.CheckingTypeID == (int)CF_CheckingType.OpenApprove).Select(q => q.ColumnName);
  259. // CheckStudentFields(Data.Where(q => NeedAuditFeilds.Contains(q.Key)).ToDictionary(q => q.Key, q => q.Value), UserID, Controls.Where(q => q.CheckingTypeID == (int)CF_CheckingType.OpenApprove).Select(q => q.ColumnName).ToList());
  260. // c += InsertRecord(Data.Where(q => NeedAuditFeilds.Contains(q.Key)).ToDictionary(q => q.Key, q => q.Value), UserID, Controls.Where(q => q.CheckingTypeID == (int)CF_CheckingType.OpenApprove).Select(q => q.ColumnName).ToList());
  261. // if (c == 0)
  262. // {
  263. // throw new Exception("没有修改任何字段!");
  264. // }
  265. //}
  266. public int UpdateStudent(Dictionary<string, object> Data, Guid UserID)
  267. {
  268. var Student = studentRecordDAL.StudentRepository.GetSingle(q => q.UserID == UserID, x => x.CF_StudentAccount, x => x.CF_StudentProfile, x => x.CF_StudentContact, x => x.CF_Recruitstudents, x => x.Sys_User);
  269. List<string> modifiedColumns = new List<string>();
  270. var studentProperties = typeof(CF_Student).GetProperties();
  271. var studentAccountProperties = typeof(CF_StudentAccount).GetProperties();
  272. var studentProfileProperties = typeof(CF_StudentProfile).GetProperties();
  273. var studentContactProperties = typeof(CF_StudentContact).GetProperties();
  274. var recruitStudentsProperties = typeof(CF_Recruitstudents).GetProperties();
  275. var studentUserProperties = typeof(Sys_User).GetProperties();
  276. //Dictionary<string, string> tableAndcol = new Dictionary<string, string>();
  277. //Guid StudentContrastID = ;
  278. #region
  279. foreach (var key in Data.Keys)
  280. {
  281. var studentProperty = studentProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  282. if (studentProperty != null)
  283. {
  284. var oldValue = studentProperty.GetValue(Student, null);
  285. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  286. {
  287. modifiedColumns.Add(key);
  288. }
  289. studentProperty.SetValue(Student, Data[key], null);
  290. }
  291. var studentAccountProperty = studentAccountProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  292. if (studentAccountProperty != null)
  293. {
  294. var oldValue = studentAccountProperty.GetValue(Student.CF_StudentAccount, null);
  295. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  296. {
  297. modifiedColumns.Add(key);
  298. }
  299. studentAccountProperty.SetValue(Student.CF_StudentAccount, Data[key], null);
  300. }
  301. var studentProfileProperty = studentProfileProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  302. if (studentProfileProperty != null)
  303. {
  304. var oldValue = studentProfileProperty.GetValue(Student.CF_StudentProfile, null);
  305. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  306. {
  307. modifiedColumns.Add(key);
  308. }
  309. studentProfileProperty.SetValue(Student.CF_StudentProfile, Data[key], null);
  310. }
  311. var studentContactProperty = studentContactProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  312. if (studentContactProperty != null)
  313. {
  314. var oldValue = studentContactProperty.GetValue(Student.CF_StudentContact, null);
  315. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  316. {
  317. modifiedColumns.Add(key);
  318. }
  319. studentContactProperty.SetValue(Student.CF_StudentContact, Data[key], null);
  320. }
  321. var recruitStudentsProperty = recruitStudentsProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  322. if (recruitStudentsProperty != null)
  323. {
  324. var oldValue = recruitStudentsProperty.GetValue(Student.CF_Recruitstudents, null);
  325. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  326. {
  327. modifiedColumns.Add(key);
  328. }
  329. recruitStudentsProperty.SetValue(Student.CF_Recruitstudents, Data[key], null);
  330. }
  331. if (key.Equals("UserName"))
  332. {
  333. var nameKey = "Name";
  334. var studentUserProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower());
  335. if (studentUserProperty != null)
  336. {
  337. var oldValue = studentUserProperty.GetValue(Student.Sys_User, null);
  338. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  339. {
  340. modifiedColumns.Add(key);
  341. }
  342. studentUserProperty.SetValue(Student.Sys_User, Data[key], null);
  343. }
  344. }
  345. //var studentUserProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  346. //if (studentUserProperty != null)
  347. //{
  348. // var oldValue = studentUserProperty.GetValue(Student.Sys_User, null);
  349. // if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  350. // {
  351. // modifiedColumns.Add(key);
  352. // }
  353. // studentUserProperty.SetValue(Student.Sys_User, Data[key], null);
  354. //}
  355. //string tableNameStr = tableColumnDescriptionRepository.GetList(x => x.ColumnName == key).Select(x => x.TableName).FirstOrDefault();
  356. //tableAndcol.Add(key, tableNameStr);
  357. }
  358. #endregion
  359. studentRecordDAL.StudentRepository.UnitOfWork.Update(Student);
  360. studentRecordDAL.StudentRepository.UnitOfWork.Commit();
  361. //foreach (KeyValuePair<string, string> tablecol in tableAndcol)
  362. //{
  363. // CF_StudentRecordChangeHistory stuRecordChangeHistory = new CF_StudentRecordChangeHistory();
  364. // stuRecordChangeHistory.StudentRecordChangeHistoryID = Guid.NewGuid();
  365. // stuRecordChangeHistory.TableName = tablecol.Value;
  366. // stuRecordChangeHistory.ColumnName = tablecol.Key;
  367. // //stuRecordChangeHistory.StudentContrastID = StudentContrastID;
  368. // stuRecordChangeHistory.ApproveTime = DateTime.Now;
  369. // SetNewStatus(stuRecordChangeHistory);
  370. // UnitOfWork.Add(stuRecordChangeHistory);
  371. // UnitOfWork.Commit();
  372. // //stuRecordChangeHistoryList.Add(stuRecordChangeHistory);
  373. //}
  374. return modifiedColumns.Count;
  375. }
  376. public int UpdateAndRecordStudent(Dictionary<string, object> Data, Guid UserID)
  377. {
  378. var Student = studentRecordDAL.StudentRepository.GetSingle(q => q.UserID == UserID, x => x.CF_StudentAccount, x => x.CF_StudentProfile, x => x.CF_StudentContact, x => x.CF_Recruitstudents, x => x.Sys_User);
  379. var StudentContrast = new CF_StudentContrast();
  380. List<string> modifiedColumns = new List<string>();
  381. #region
  382. StudentContrast.StudentContrastID = Guid.NewGuid();
  383. StudentContrast.UserID = Student.UserID;
  384. StudentContrast.ClassmajorID = Student.ClassmajorID;
  385. StudentContrast.PhotoUrl = Student.PhotoUrl;
  386. StudentContrast.SexID = Student.SexID.Value;
  387. StudentContrast.CertificatesType = Student.CertificatesType;
  388. StudentContrast.IDNumber = Student.IDNumber;
  389. StudentContrast.StudentCardNo = Student.StudentCardNo;
  390. StudentContrast.PlanningGraduateDate = Student.PlanningGraduateDate;
  391. StudentContrast.CF_StudentProfileContrast.CultureModelID = Student.CF_StudentProfile.CultureModelID;
  392. StudentContrast.StudentType = Student.StudentType;
  393. StudentContrast.StudentStatus = Student.StudentStatus;
  394. StudentContrast.InSchoolStatusID = Student.InSchoolStatusID;
  395. StudentContrast.Career = Student.Career;
  396. //this.SetNewStatus(StudentContrast);
  397. StudentContrast.CreateTime = DateTime.Now;
  398. StudentContrast.CreateUserID = UserID;
  399. StudentContrast.IP = HttpContext.Current.Request.UserHostAddress;
  400. StudentContrast.CF_StudentSource = new CF_StudentSource();
  401. StudentContrast.CF_StudentSource.ClassmajorID = Student.ClassmajorID;
  402. StudentContrast.CF_StudentSource.PhotoUrl = Student.PhotoUrl;
  403. StudentContrast.CF_StudentSource.SexID = Student.SexID.Value;
  404. StudentContrast.CF_StudentSource.CertificatesType = Student.CertificatesType;
  405. StudentContrast.CF_StudentSource.IDNumber = Student.IDNumber;
  406. StudentContrast.CF_StudentSource.StudentCardNo = Student.StudentCardNo;
  407. StudentContrast.CF_StudentSource.PlanningGraduateDate = Student.PlanningGraduateDate;
  408. StudentContrast.CF_StudentSource.CF_StudentProfileSource.CultureModelID = Student.CF_StudentProfile.CultureModelID;
  409. StudentContrast.CF_StudentSource.StudentType = Student.StudentType;
  410. StudentContrast.CF_StudentSource.StudentStatus = Student.StudentStatus;
  411. StudentContrast.CF_StudentSource.InSchoolStatusID = Student.InSchoolStatusID;
  412. StudentContrast.CF_StudentSource.Career = Student.Career;
  413. StudentContrast.CF_StudentAccountContrast = new CF_StudentAccountContrast();
  414. StudentContrast.CF_StudentAccountContrast.StudentContrastID = StudentContrast.StudentContrastID;
  415. StudentContrast.CF_StudentAccountContrast.BankName = Student.CF_StudentAccount.BankName;
  416. StudentContrast.CF_StudentAccountContrast.CardNo = Student.CF_StudentAccount.CardNo;
  417. //this.SetNewStatus(StudentContrast.CF_StudentAccountContrast);
  418. StudentContrast.CF_StudentAccountContrast.CreateTime = DateTime.Now;
  419. StudentContrast.CF_StudentAccountContrast.CreateUserID = UserID;
  420. StudentContrast.CF_StudentSource.CF_StudentAccountSource = new CF_StudentAccountSource();
  421. StudentContrast.CF_StudentSource.CF_StudentAccountSource.StudentContrastID = StudentContrast.StudentContrastID;
  422. StudentContrast.CF_StudentSource.CF_StudentAccountSource.BankName = Student.CF_StudentAccount.BankName;
  423. StudentContrast.CF_StudentSource.CF_StudentAccountSource.CardNo = Student.CF_StudentAccount.CardNo;
  424. StudentContrast.CF_RecruitstudentsContrast = new CF_RecruitstudentsContrast();
  425. StudentContrast.CF_RecruitstudentsContrast.StudentContrastID = StudentContrast.StudentContrastID;
  426. StudentContrast.CF_RecruitstudentsContrast.EnteringSchoolYearID = Student.CF_Recruitstudents.EnteringSchoolYearID;
  427. StudentContrast.CF_RecruitstudentsContrast.EntranceDate = Student.CF_Recruitstudents.EntranceDate;
  428. StudentContrast.CF_RecruitstudentsContrast.EntranceWayID = Student.CF_Recruitstudents.EntranceWayID;
  429. StudentContrast.CF_RecruitstudentsContrast.ExamineeNum = Student.CF_Recruitstudents.ExamineeNum;
  430. //StudentContrast.CF_RecruitstudentsContrast.PlaceBirth = Student.CF_Recruitstudents.PlaceBirth;
  431. StudentContrast.CF_RecruitstudentsContrast.ExamineeType = Student.CF_Recruitstudents.ExamineeType;
  432. StudentContrast.CF_RecruitstudentsContrast.FeaturesID = Student.CF_Recruitstudents.FeaturesID;
  433. StudentContrast.CF_RecruitstudentsContrast.Score = Student.CF_Recruitstudents.Score;
  434. StudentContrast.CF_RecruitstudentsContrast.TerritorialID = Student.CF_Recruitstudents.TerritorialID;
  435. StudentContrast.CF_RecruitstudentsContrast.Area = Student.CF_Recruitstudents.Area;
  436. //this.SetNewStatus(StudentContrast.CF_RecruitstudentsContrast);
  437. StudentContrast.CF_RecruitstudentsContrast.CreateTime = DateTime.Now;
  438. StudentContrast.CF_RecruitstudentsContrast.CreateUserID = UserID;
  439. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource = new CF_RecruitstudentsSource();
  440. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.StudentContrastID = StudentContrast.StudentContrastID;
  441. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EnteringSchoolYearID = Student.CF_Recruitstudents.EnteringSchoolYearID;
  442. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EntranceDate = Student.CF_Recruitstudents.EntranceDate;
  443. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EntranceWayID = Student.CF_Recruitstudents.EntranceWayID;
  444. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.ExamineeNum = Student.CF_Recruitstudents.ExamineeNum;
  445. StudentContrast.CF_StudentSource.CF_StudentProfileSource.BornPlace = Student.CF_StudentProfile.BornPlace;
  446. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.ExamineeType = Student.CF_Recruitstudents.ExamineeType;
  447. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.FeaturesID = Student.CF_Recruitstudents.FeaturesID;
  448. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Score = Student.CF_Recruitstudents.Score;
  449. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.TerritorialID = Student.CF_Recruitstudents.TerritorialID;
  450. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Area = Student.CF_Recruitstudents.Area;
  451. StudentContrast.CF_StudentContactContrast = new CF_StudentContactContrast();
  452. StudentContrast.CF_StudentContactContrast.StudentContrastID = StudentContrast.StudentContrastID;
  453. StudentContrast.CF_StudentContactContrast.Email = Student.CF_StudentContact.Email;
  454. StudentContrast.CF_StudentContactContrast.QQ = Student.CF_StudentContact.QQ;
  455. StudentContrast.CF_StudentContactContrast.Mobile = Student.CF_StudentContact.Mobile;
  456. StudentContrast.CF_StudentContactContrast.Telephone = Student.CF_StudentContact.Telephone;
  457. StudentContrast.CF_StudentContactContrast.WeChatNum = Student.CF_StudentContact.WeChatNum;
  458. StudentContrast.CF_StudentContactContrast.ZIPCode = Student.CF_StudentContact.ZIPCode;
  459. StudentContrast.CF_StudentContactContrast.Address = Student.CF_StudentContact.Address;
  460. StudentContrast.CF_StudentContactContrast.WorkUnit = Student.CF_StudentContact.WorkUnit;
  461. StudentContrast.CF_StudentContactContrast.HomeAddress = Student.CF_StudentContact.HomeAddress;
  462. StudentContrast.CF_StudentContactContrast.Recipient = Student.CF_StudentContact.Recipient;
  463. StudentContrast.CF_StudentContactContrast.Dormitory = Student.CF_StudentContact.Dormitory;
  464. //this.SetNewStatus(StudentContrast.CF_StudentContactContrast);
  465. StudentContrast.CF_StudentContactContrast.CreateTime = DateTime.Now;
  466. StudentContrast.CF_StudentContactContrast.CreateUserID = UserID;
  467. StudentContrast.CF_StudentSource.CF_StudentContactSource = new CF_StudentContactSource();
  468. StudentContrast.CF_StudentSource.CF_StudentContactSource.StudentContrastID = StudentContrast.StudentContrastID;
  469. StudentContrast.CF_StudentSource.CF_StudentContactSource.Email = Student.CF_StudentContact.Email;
  470. StudentContrast.CF_StudentSource.CF_StudentContactSource.QQ = Student.CF_StudentContact.QQ;
  471. StudentContrast.CF_StudentSource.CF_StudentContactSource.Mobile = Student.CF_StudentContact.Mobile;
  472. StudentContrast.CF_StudentSource.CF_StudentContactSource.Telephone = Student.CF_StudentContact.Telephone;
  473. StudentContrast.CF_StudentSource.CF_StudentContactSource.WeChatNum = Student.CF_StudentContact.WeChatNum;
  474. StudentContrast.CF_StudentSource.CF_StudentContactSource.ZIPCode = Student.CF_StudentContact.ZIPCode;
  475. StudentContrast.CF_StudentSource.CF_StudentContactSource.Address = Student.CF_StudentContact.Address;
  476. StudentContrast.CF_StudentSource.CF_StudentContactSource.WorkUnit = Student.CF_StudentContact.WorkUnit;
  477. StudentContrast.CF_StudentSource.CF_StudentContactSource.HomeAddress = Student.CF_StudentContact.HomeAddress;
  478. StudentContrast.CF_StudentSource.CF_StudentContactSource.Recipient = Student.CF_StudentContact.Recipient;
  479. StudentContrast.CF_StudentSource.CF_StudentContactSource.Dormitory = Student.CF_StudentContact.Dormitory;
  480. StudentContrast.CF_StudentProfileContrast = new CF_StudentProfileContrast();
  481. StudentContrast.CF_StudentProfileContrast.StudentContrastID = StudentContrast.StudentContrastID;
  482. StudentContrast.CF_StudentProfileContrast.UsedName = Student.CF_StudentProfile.UsedName;
  483. StudentContrast.CF_StudentProfileContrast.DirectorName = Student.CF_StudentProfile.DirectorName;
  484. StudentContrast.BirthDate = Student.BirthDate;
  485. StudentContrast.CF_StudentProfileContrast.Country = Student.CF_StudentProfile.Country;
  486. StudentContrast.PoliticsID = Student.PoliticsID;
  487. StudentContrast.NationID = Student.NationID;
  488. StudentContrast.CF_StudentProfileContrast.Place = Student.CF_StudentProfile.Place;
  489. StudentContrast.CF_StudentProfileContrast.HealthStateID = Student.CF_StudentProfile.HealthStateID;
  490. StudentContrast.CF_StudentProfileContrast.BloodGroup = Student.CF_StudentProfile.BloodGroup;
  491. StudentContrast.CF_StudentProfileContrast.BornPlace = Student.CF_StudentProfile.BornPlace;
  492. StudentContrast.CF_StudentProfileContrast.Specialty = Student.CF_StudentProfile.Specialty;
  493. StudentContrast.CF_StudentProfileContrast.Height = Student.CF_StudentProfile.Height;
  494. StudentContrast.CF_StudentProfileContrast.Weight = Student.CF_StudentProfile.Weight;
  495. StudentContrast.CF_StudentProfileContrast.LiteracyLevelID = Student.CF_StudentProfile.LiteracyLevelID;
  496. StudentContrast.Remark = Student.Remark;
  497. //this.SetNewStatus(StudentContrast.CF_StudentProfileContrast);
  498. StudentContrast.CF_StudentProfileContrast.CreateTime = DateTime.Now;
  499. StudentContrast.CF_StudentProfileContrast.CreateUserID = UserID;
  500. StudentContrast.CF_StudentSource.CF_StudentProfileSource = new CF_StudentProfileSource();
  501. StudentContrast.CF_StudentSource.CF_StudentProfileSource.StudentContrastID = StudentContrast.StudentContrastID;
  502. StudentContrast.CF_StudentSource.CF_StudentProfileSource.UsedName = Student.CF_StudentProfile.UsedName;
  503. StudentContrast.CF_StudentSource.CF_StudentProfileSource.DirectorName = Student.CF_StudentProfile.DirectorName;
  504. StudentContrast.BirthDate = Student.BirthDate;
  505. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Country = Student.CF_StudentProfile.Country;
  506. StudentContrast.CF_StudentSource.PoliticsID = Student.PoliticsID;
  507. StudentContrast.CF_StudentSource.NationID = Student.NationID;
  508. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Place = Student.CF_StudentProfile.Place;
  509. StudentContrast.CF_StudentSource.CF_StudentProfileSource.HealthStateID = Student.CF_StudentProfile.HealthStateID;
  510. StudentContrast.CF_StudentSource.CF_StudentProfileSource.BloodGroup = Student.CF_StudentProfile.BloodGroup;
  511. StudentContrast.CF_StudentSource.CF_StudentProfileSource.BornPlace = Student.CF_StudentProfile.BornPlace;
  512. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Specialty = Student.CF_StudentProfile.Specialty;
  513. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Height = Student.CF_StudentProfile.Height;
  514. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Weight = Student.CF_StudentProfile.Weight;
  515. StudentContrast.CF_StudentSource.CF_StudentProfileSource.LiteracyLevelID = Student.CF_StudentProfile.LiteracyLevelID;
  516. StudentContrast.CF_StudentSource.Remark = Student.Remark;
  517. StudentContrast.Sys_UserContrast = new Sys_UserContrast();
  518. StudentContrast.Sys_UserContrast.Name = Student.Sys_User.Name;
  519. StudentContrast.Sys_UserContrast.LoginID = Student.Sys_User.LoginID;
  520. StudentContrast.CF_StudentSource.Sys_UserSource = new Sys_UserSource();
  521. StudentContrast.CF_StudentSource.Sys_UserSource.Name = Student.Sys_User.Name;
  522. StudentContrast.CF_StudentSource.Sys_UserSource.LoginID = Student.Sys_User.LoginID;
  523. #endregion
  524. var studentProperties = typeof(CF_Student).GetProperties();
  525. var studentAccountProperties = typeof(CF_StudentAccount).GetProperties();
  526. var studentProfileProperties = typeof(CF_StudentProfile).GetProperties();
  527. var studentContactProperties = typeof(CF_StudentContact).GetProperties();
  528. var recruitStudentsProperties = typeof(CF_Recruitstudents).GetProperties();
  529. var userProperties = typeof(Sys_User).GetProperties();
  530. var studentContrastProperties = typeof(CF_StudentContrast).GetProperties();
  531. var studentAccountContrastProperties = typeof(CF_StudentAccountContrast).GetProperties();
  532. var studentProfileContrastProperties = typeof(CF_StudentProfileContrast).GetProperties();
  533. var studentContactContrastProperties = typeof(CF_StudentContactContrast).GetProperties();
  534. var recruitStudentsContrastProperties = typeof(CF_RecruitstudentsContrast).GetProperties();
  535. var studentUserProperties = typeof(Sys_UserContrast).GetProperties();
  536. //var studentContrastProperty = studentContrastProperties.Where();
  537. Guid StudentContrastID = StudentContrast.StudentContrastID;
  538. Dictionary<string, string> tableAndcol = new Dictionary<string, string>();
  539. #region
  540. foreach (var key in Data.Keys)
  541. {
  542. string tableNameStr = studentEditColumnDescriptionRepository.GetList(x => x.ColumnName == key).Select(x => x.TableName).FirstOrDefault();
  543. var studentContrastProperty = studentContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  544. if (studentContrastProperty != null)
  545. {
  546. var studentProperty = studentProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  547. var oldValue = studentProperty.GetValue(Student, null);
  548. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  549. {
  550. modifiedColumns.Add(key);
  551. studentContrastProperty.SetValue(StudentContrast, Data[key], null);
  552. studentProperty.SetValue(Student, Data[key], null);
  553. //记录修改的字段还有对应的表名
  554. tableAndcol.Add(key, tableNameStr);
  555. }
  556. }
  557. var studentAccountContrastProperty = studentAccountContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  558. if (studentAccountContrastProperty != null)
  559. {
  560. var studentAccountProperty = studentAccountProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  561. var oldValue = studentAccountProperty.GetValue(Student.CF_StudentAccount, null);
  562. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  563. {
  564. modifiedColumns.Add(key);
  565. studentAccountContrastProperty.SetValue(StudentContrast.CF_StudentAccountContrast, Data[key], null);
  566. studentAccountProperty.SetValue(Student.CF_StudentAccount, Data[key], null);
  567. //记录修改的字段还有对应的表名
  568. tableAndcol.Add(key, tableNameStr);
  569. }
  570. }
  571. var studentProfileContrastProperty = studentProfileContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  572. if (studentProfileContrastProperty != null)
  573. {
  574. var studentProfileProperty = studentProfileProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  575. var oldValue = studentProfileProperty.GetValue(Student.CF_StudentProfile, null);
  576. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  577. {
  578. modifiedColumns.Add(key);
  579. studentProfileContrastProperty.SetValue(StudentContrast.CF_StudentProfileContrast, Data[key], null);
  580. studentProfileProperty.SetValue(Student.CF_StudentProfile, Data[key], null);
  581. //记录修改的字段还有对应的表名
  582. tableAndcol.Add(key, tableNameStr);
  583. }
  584. }
  585. var studentContactContrastProperty = studentContactContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  586. if (studentContactContrastProperty != null)
  587. {
  588. var studentContactProperty = studentContactProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  589. var oldValue = studentContactProperty.GetValue(Student.CF_StudentContact, null);
  590. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  591. {
  592. modifiedColumns.Add(key);
  593. studentContactContrastProperty.SetValue(StudentContrast.CF_StudentContactContrast, Data[key], null);
  594. studentContactProperty.SetValue(Student.CF_StudentContact, Data[key], null);
  595. //记录修改的字段还有对应的表名
  596. tableAndcol.Add(key, tableNameStr);
  597. }
  598. }
  599. var recruitStudentsContrastProperty = recruitStudentsContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  600. if (recruitStudentsContrastProperty != null)
  601. {
  602. var recruitStudentsProperty = recruitStudentsProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  603. var oldValue = recruitStudentsProperty.GetValue(Student.CF_Recruitstudents, null);
  604. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  605. {
  606. modifiedColumns.Add(key);
  607. recruitStudentsContrastProperty.SetValue(StudentContrast.CF_RecruitstudentsContrast, Data[key], null);
  608. recruitStudentsProperty.SetValue(Student.CF_Recruitstudents, Data[key], null);
  609. //记录修改的字段还有对应的表名
  610. tableAndcol.Add(key, tableNameStr);
  611. }
  612. }
  613. if (key.Equals("UserName"))
  614. {
  615. var nameKey = "Name";
  616. var userStudentsContrastProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower());
  617. if (userStudentsContrastProperty != null)
  618. {
  619. var studentUserProperty = userProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower());
  620. var oldValue = studentUserProperty.GetValue(Student.Sys_User, null);
  621. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  622. {
  623. modifiedColumns.Add(key);
  624. }
  625. userStudentsContrastProperty.SetValue(StudentContrast.Sys_UserContrast, Data[key], null);
  626. studentUserProperty.SetValue(Student.Sys_User, Data[key], null);
  627. //记录修改的字段还有对应的表名
  628. tableAndcol.Add(nameKey, "Sys_UserContrast");
  629. }
  630. }
  631. }
  632. #endregion
  633. StudentContrast.RecordStatus = (int)CF_CheckingType.OpenRecord;
  634. if (modifiedColumns.Count != 0)
  635. {
  636. studentRecordDAL.StudentContrastRepository.UnitOfWork.Add(StudentContrast);
  637. studentRecordDAL.StudentContrastRepository.UnitOfWork.Commit();
  638. studentRecordDAL.StudentRepository.UnitOfWork.Update(Student);
  639. studentRecordDAL.StudentRepository.UnitOfWork.Commit();
  640. }
  641. foreach (KeyValuePair<string, string> tablecol in tableAndcol)
  642. {
  643. CF_StudentRecordChangeHistory stuRecordChangeHistory = new CF_StudentRecordChangeHistory();
  644. stuRecordChangeHistory.StudentRecordChangeHistoryID = Guid.NewGuid();
  645. stuRecordChangeHistory.TableName = tablecol.Value;
  646. stuRecordChangeHistory.ColumnName = tablecol.Key;
  647. stuRecordChangeHistory.StudentContrastID = StudentContrastID;
  648. //stuRecordChangeHistory.ApproveTime = null;//记录不需要审核
  649. //SetNewStatus(stuRecordChangeHistory);
  650. stuRecordChangeHistory.CreateTime = DateTime.Now;
  651. stuRecordChangeHistory.CreateUserID = UserID;
  652. UnitOfWork.Add(stuRecordChangeHistory);
  653. UnitOfWork.Commit();
  654. //stuRecordChangeHistoryList.Add(stuRecordChangeHistory);
  655. }
  656. return modifiedColumns.Count;
  657. }
  658. ///// <summary>
  659. ///// 学生提交修改字段时,已提交修改的字段在审批前,不能再提交
  660. ///// </summary>
  661. ///// <param name="Data"></param>
  662. ///// <param name="UserID"></param>
  663. ///// <param name="needApproveColumns"></param>
  664. //public void CheckStudentFields(Dictionary<string, object> Data, Guid UserID, List<string> needApproveColumns)
  665. //{
  666. // var Student = studentRecordDAL.StudentRepository.GetSingle(q => q.UserID == UserID, x => x.CF_StudentAccount, x => x.CF_StudentProfile, x => x.CF_StudentContact, x => x.CF_Recruitstudents);
  667. // var studentProperties = typeof(CF_Student).GetProperties();
  668. // var studentAccountProperties = typeof(CF_StudentAccount).GetProperties();
  669. // var studentProfileProperties = typeof(CF_StudentProfile).GetProperties();
  670. // var studentContactProperties = typeof(CF_StudentContact).GetProperties();
  671. // var recruitStudentsProperties = typeof(CF_Recruitstudents).GetProperties();
  672. // var result = AuditProcessDAL.Value.GetAuditProcessQuery(w => w.UserID == UserID && w.RecordStatus == (int)CF_CheckingType.OpenRecord).Where(x => x.RecordStatus == (int)CF_CheckingType.OpenRecord).ToList();
  673. // #region
  674. // if (result.Count > 0)
  675. // {
  676. // throw new Exception("您有待审核的修改请求,如需继续修改请在反馈页面撤回!");
  677. // }
  678. // //照片
  679. // if (Data.Where(x => x.Key == "PhotoUrl") != null && needApproveColumns.IndexOf("PhotoUrl") != -1)
  680. // {
  681. // if (Convert.ToString(Data.Where(x => x.Key == "PhotoUrl").FirstOrDefault().Value) != Convert.ToString(Student.PhotoUrl))
  682. // {
  683. // if (result.Where(x => x.PhotoUrl != Student.PhotoUrl).Count() > 0)
  684. // throw new Exception("照片已提交修改,等待老师审批确认,不能重复提交修改");
  685. // }
  686. // }
  687. // //学号
  688. // if (Data.Where(x => x.Key == "StudentCardNo") != null && needApproveColumns.IndexOf("StudentCardNo") != -1)
  689. // {
  690. // if (Convert.ToString(Data.Where(x => x.Key == "StudentCardNo").FirstOrDefault().Value) != Convert.ToString(Student.StudentCardNo))
  691. // {
  692. // if (result.Where(x => x.StudentCardNo != Student.StudentCardNo).Count() > 0)
  693. // throw new Exception("学号已提交修改,等待老师审批确认,不能重复提交修改");
  694. // }
  695. // }
  696. // //姓名
  697. // if (Data.Where(x => x.Key == "UserName") != null && needApproveColumns.IndexOf("UserName") != -1)
  698. // {
  699. // if (Convert.ToString(Data.Where(x => x.Key == "UserName").FirstOrDefault().Value) != Convert.ToString(Student.Sys_User.Name))
  700. // {
  701. // if (result.Where(x => x.UserName != Student.Sys_User.Name).Count() > 0)
  702. // throw new Exception("姓名已提交修改,等待老师审批确认,不能重复提交修改");
  703. // }
  704. // }
  705. // //曾用名
  706. // if (Data.Where(x => x.Key == "UsedName") != null && needApproveColumns.IndexOf("UsedName") != -1)
  707. // {
  708. // if (Convert.ToString(Data.Where(x => x.Key == "UsedName").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.UsedName))
  709. // {
  710. // if (result.Where(x => x.UsedName != Student.CF_StudentProfile.UsedName && !(string.IsNullOrEmpty(x.UsedName) && string.IsNullOrEmpty(Student.CF_StudentProfile.UsedName))).Count() > 0)
  711. // throw new Exception("曾用名已提交修改,等待老师审批确认,不能重复提交修改");
  712. // }
  713. // }
  714. // //性别
  715. // if (Data.Where(x => x.Key == "Sex") != null && needApproveColumns.IndexOf("Sex") != -1)
  716. // {
  717. // if (Convert.ToString(Data.Where(x => x.Key == "Sex").FirstOrDefault().Value) != Convert.ToString(Student.SexID))
  718. // {
  719. // if (result.Where(x => x.Sex != Student.SexID).Count() > 0)
  720. // throw new Exception("性别已提交修改,等待老师审批确认,不能重复提交修改");
  721. // }
  722. // }
  723. // //民族
  724. // if (Data.Where(x => x.Key == "Nation") != null && needApproveColumns.IndexOf("Nation") != -1)
  725. // {
  726. // Student.NationID = null;
  727. // if (Convert.ToString(Data.Where(x => x.Key == "Nation").FirstOrDefault().Value) != Convert.ToString(Student.NationID))
  728. // {
  729. // if (result.Where(x => x.Nation != Student.NationID).Count() > 0)
  730. // throw new Exception("民族已提交修改,等待老师审批确认,不能重复提交修改");
  731. // }
  732. // }
  733. // //出生日期
  734. // if (Data.Where(x => x.Key == "BirthDate") != null && needApproveColumns.IndexOf("BirthDate") != -1)
  735. // {
  736. // if (Convert.ToString(Data.Where(x => x.Key == "BirthDate").FirstOrDefault().Value) != Convert.ToString(Student.BirthDate))
  737. // {
  738. // if (result.Where(x => x.BirthDate != Student.BirthDate).Count() > 0)
  739. // throw new Exception("出生日期已提交修改,等待老师审批确认,不能重复提交修改");
  740. // }
  741. // }
  742. // //政治面貌
  743. // if (Data.Where(x => x.Key == "Politics") != null && needApproveColumns.IndexOf("Politics") != -1)
  744. // {
  745. // if (Convert.ToString(Data.Where(x => x.Key == "Politics").FirstOrDefault().Value) != Convert.ToString(Student.PoliticsID))
  746. // {
  747. // if (result.Where(x => x.Politics != Student.PoliticsID).Count() > 0)
  748. // throw new Exception("政治面貌已提交修改,等待老师审批确认,不能重复提交修改");
  749. // }
  750. // }
  751. // //证件类型
  752. // if (Data.Where(x => x.Key == "CertificatesType") != null && needApproveColumns.IndexOf("CertificatesType") != -1)
  753. // {
  754. // if (Convert.ToString(Data.Where(x => x.Key == "CertificatesType").FirstOrDefault().Value) != Convert.ToString(Student.CertificatesType))
  755. // {
  756. // if (result.Where(x => x.CertificatesType != Student.CertificatesType).Count() > 0)
  757. // throw new Exception("证件类型已提交修改,等待老师审批确认,不能重复提交修改");
  758. // }
  759. // }
  760. // //证件号码
  761. // if (Data.Where(x => x.Key == "IDNumber") != null && needApproveColumns.IndexOf("IDNumber") != -1)
  762. // {
  763. // if (Convert.ToString(Data.Where(x => x.Key == "IDNumber").FirstOrDefault().Value) != Convert.ToString(Student.IDNumber))
  764. // {
  765. // if (result.Where(x => x.IDNumber != Student.IDNumber && !(string.IsNullOrEmpty(x.IDNumber) && string.IsNullOrEmpty(Student.IDNumber))).Count() > 0)
  766. // throw new Exception("证件号码已提交修改,等待老师审批确认,不能重复提交修改");
  767. // }
  768. // }
  769. // //班级
  770. // if (Data.Where(x => x.Key == "ClassMajorID") != null && needApproveColumns.IndexOf("ClassMajorID") != -1)
  771. // {
  772. // if (Convert.ToString(Data.Where(x => x.Key == "ClassMajorID").FirstOrDefault().Value) != Convert.ToString(Student.CF_Classmajor.ClassmajorID))
  773. // {
  774. // if (result.Where(x => x.ClassMajorID != Student.CF_Classmajor.ClassmajorID).Count() > 0)
  775. // throw new Exception("班级已提交修改,等待老师审批确认,不能重复提交修改");
  776. // }
  777. // }
  778. // //培养方式
  779. // if (Data.Where(x => x.Key == "CultureModel") != null && needApproveColumns.IndexOf("CultureModel") != -1)
  780. // {
  781. // if (Convert.ToString(Data.Where(x => x.Key == "CultureModel").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.CultureModelID))
  782. // {
  783. // if (result.Where(x => x.CultureModel != Student.CF_StudentProfile.CultureModelID).Count() > 0)
  784. // throw new Exception("培养方式已提交修改,等待老师审批确认,不能重复提交修改");
  785. // }
  786. // }
  787. // //学生类别
  788. // if (Data.Where(x => x.Key == "StudentType") != null && needApproveColumns.IndexOf("StudentType") != -1)
  789. // {
  790. // if (Convert.ToString(Data.Where(x => x.Key == "StudentType").FirstOrDefault().Value) != Convert.ToString(Student.StudentType))
  791. // {
  792. // if (result.Where(x => x.StudentType != Student.StudentType).Count() > 0)
  793. // throw new Exception("学生类别已提交修改,等待老师审批确认,不能重复提交修改");
  794. // }
  795. // }
  796. // //学籍状态
  797. // if (Data.Where(x => x.Key == "StudentStatus") != null && needApproveColumns.IndexOf("StudentStatus") != -1)
  798. // {
  799. // if (Convert.ToString(Data.Where(x => x.Key == "StudentStatus").FirstOrDefault().Value) != Convert.ToString(Student.StudentStatus))
  800. // {
  801. // if (result.Where(x => x.StudentStatus != Student.StudentStatus).Count() > 0)
  802. // throw new Exception("学籍状态已提交修改,等待老师审批确认,不能重复提交修改");
  803. // }
  804. // }
  805. // //在校状态
  806. // if (Data.Where(x => x.Key == "InSchoolStatusID") != null && needApproveColumns.IndexOf("InSchoolStatusID") != -1)
  807. // {
  808. // if (Convert.ToString(Data.Where(x => x.Key == "InSchoolStatusID").FirstOrDefault().Value) != Convert.ToString(Student.InSchoolStatusID))
  809. // {
  810. // if (result.Where(x => x.InSchoolStatusID != Student.InSchoolStatusID).Count() > 0)
  811. // throw new Exception("在校状态已提交修改,等待老师审批确认,不能重复提交修改");
  812. // }
  813. // }
  814. // //入学日期
  815. // if (Data.Where(x => x.Key == "EntranceDate") != null && needApproveColumns.IndexOf("EntranceDate") != -1)
  816. // {
  817. // if (Convert.ToString(Data.Where(x => x.Key == "EntranceDate").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.EntranceDate))
  818. // {
  819. // if (result.Where(x => x.EntranceDate != Student.CF_Recruitstudents.EntranceDate).Count() > 0)
  820. // throw new Exception("入学日期已提交修改,等待老师审批确认,不能重复提交修改");
  821. // }
  822. // }
  823. // //入学方式
  824. // if (Data.Where(x => x.Key == "EntranceWay") != null && needApproveColumns.IndexOf("EntranceWay") != -1)
  825. // {
  826. // if (Convert.ToString(Data.Where(x => x.Key == "EntranceWay").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.EntranceWayID))
  827. // {
  828. // if (result.Where(x => x.EntranceWay != Student.CF_Recruitstudents.EntranceWayID).Count() > 0)
  829. // throw new Exception("入学方式已提交修改,等待老师审批确认,不能重复提交修改");
  830. // }
  831. // }
  832. // //考生号
  833. // if (Data.Where(x => x.Key == "ExamineeNum") != null && needApproveColumns.IndexOf("ExamineeNum") != -1)
  834. // {
  835. // if (Convert.ToString(Data.Where(x => x.Key == "ExamineeNum").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.ExamineeNum))
  836. // {
  837. // if (result.Where(x => x.ExamineeNum != Student.CF_Recruitstudents.ExamineeNum && !(string.IsNullOrEmpty(x.ExamineeNum) && string.IsNullOrEmpty(Student.CF_Recruitstudents.ExamineeNum))).Count() > 0)
  838. // throw new Exception("考生号已提交修改,等待老师审批确认,不能重复提交修改");
  839. // }
  840. // }
  841. // //考生类别
  842. // if (Data.Where(x => x.Key == "ExamineeType") != null && needApproveColumns.IndexOf("ExamineeType") != -1)
  843. // {
  844. // if (Convert.ToString(Data.Where(x => x.Key == "ExamineeType").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.ExamineeType))
  845. // {
  846. // if (result.Where(x => x.ExamineeType != Student.CF_Recruitstudents.ExamineeType).Count() > 0)
  847. // throw new Exception("考生类别已提交修改,等待老师审批确认,不能重复提交修改");
  848. // }
  849. // }
  850. // //考生特征
  851. // if (Data.Where(x => x.Key == "Features") != null && needApproveColumns.IndexOf("Features") != -1)
  852. // {
  853. // if (Convert.ToString(Data.Where(x => x.Key == "Features").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.FeaturesID))
  854. // {
  855. // if (result.Where(x => x.Features != Student.CF_Recruitstudents.FeaturesID).Count() > 0)
  856. // throw new Exception("考生特征已提交修改,等待老师审批确认,不能重复提交修改");
  857. // }
  858. // }
  859. // //高考总分
  860. // if (Data.Where(x => x.Key == "Score") != null && needApproveColumns.IndexOf("Score") != -1)
  861. // {
  862. // if (Convert.ToString(Data.Where(x => x.Key == "Score").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.Score))
  863. // {
  864. // if (result.Where(x => x.Score != Student.CF_Recruitstudents.Score).Count() > 0)
  865. // throw new Exception("高考总分已提交修改,等待老师审批确认,不能重复提交修改");
  866. // }
  867. // }
  868. // //生源所属地
  869. // if (Data.Where(x => x.Key == "Territorial") != null && needApproveColumns.IndexOf("Territorial") != -1)
  870. // {
  871. // if (Convert.ToString(Data.Where(x => x.Key == "Territorial").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.TerritorialID))
  872. // {
  873. // if (result.Where(x => x.Territorial != Student.CF_Recruitstudents.TerritorialID).Count() > 0)
  874. // throw new Exception("生源所属地已提交修改,等待老师审批确认,不能重复提交修改");
  875. // }
  876. // }
  877. // //籍贯
  878. // if (Data.Where(x => x.Key == "Place") != null && needApproveColumns.IndexOf("Place") != -1)
  879. // {
  880. // if (Convert.ToString(Data.Where(x => x.Key == "Place").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Place))
  881. // {
  882. // if (result.Where(x => x.Place != Student.CF_StudentProfile.Place && !(string.IsNullOrEmpty(x.Place) && string.IsNullOrEmpty(Student.CF_StudentProfile.Place))).Count() > 0)
  883. // throw new Exception("籍贯已提交修改,等待老师审批确认,不能重复提交修改");
  884. // }
  885. // }
  886. // //来源地区
  887. // if (Data.Where(x => x.Key == "Area") != null && needApproveColumns.IndexOf("Area") != -1)
  888. // {
  889. // if (Convert.ToString(Data.Where(x => x.Key == "Area").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.Area))
  890. // {
  891. // if (result.Where(x => x.Area != Student.CF_Recruitstudents.Area && !(string.IsNullOrEmpty(x.Area) && string.IsNullOrEmpty(Student.CF_Recruitstudents.Area))).Count() > 0)
  892. // throw new Exception("来源地区已提交修改,等待老师审批确认,不能重复提交修改");
  893. // }
  894. // }
  895. // //健康状况
  896. // if (Data.Where(x => x.Key == "Healthy") != null && needApproveColumns.IndexOf("Healthy") != -1)
  897. // {
  898. // if (Convert.ToString(Data.Where(x => x.Key == "Healthy").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.HealthyID))
  899. // {
  900. // if (result.Where(x => x.Healthy != Student.CF_StudentProfile.HealthyID).Count() > 0)
  901. // throw new Exception("健康状况已提交修改,等待老师审批确认,不能重复提交修改");
  902. // }
  903. // }
  904. // //特长
  905. // if (Data.Where(x => x.Key == "Specialty") != null && needApproveColumns.IndexOf("Specialty") != -1)
  906. // {
  907. // if (Convert.ToString(Data.Where(x => x.Key == "Specialty").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Specialty))
  908. // {
  909. // if (result.Where(x => x.Specialty != Student.CF_StudentProfile.Specialty && !(string.IsNullOrEmpty(x.Specialty) && string.IsNullOrEmpty(Student.CF_StudentProfile.Specialty))).Count() > 0)
  910. // throw new Exception("特长已提交修改,等待老师审批确认,不能重复提交修改");
  911. // }
  912. // }
  913. // //身高
  914. // if (Data.Where(x => x.Key == "Height") != null && needApproveColumns.IndexOf("Height") != -1)
  915. // {
  916. // if (Convert.ToString(Data.Where(x => x.Key == "Height").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Height))
  917. // {
  918. // if (result.Where(x => x.Height != Student.CF_StudentProfile.Height && !(string.IsNullOrEmpty(x.Height) && string.IsNullOrEmpty(Student.CF_StudentProfile.Height))).Count() > 0)
  919. // throw new Exception("身高已提交修改,等待老师审批确认,不能重复提交修改");
  920. // }
  921. // }
  922. // //体重
  923. // if (Data.Where(x => x.Key == "Weight") != null && needApproveColumns.IndexOf("Weight") != -1)
  924. // {
  925. // if (Convert.ToString(Data.Where(x => x.Key == "Weight").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Weight))
  926. // {
  927. // if (result.Where(x => x.Weight != Student.CF_StudentProfile.Weight && !(string.IsNullOrEmpty(x.Weight) && string.IsNullOrEmpty(Student.CF_StudentProfile.Weight))).Count() > 0)
  928. // throw new Exception("体重已提交修改,等待老师审批确认,不能重复提交修改");
  929. // }
  930. // }
  931. // //邮件
  932. // if (Data.Where(x => x.Key == "Email") != null && needApproveColumns.IndexOf("Email") != -1)
  933. // {
  934. // if (Convert.ToString(Data.Where(x => x.Key == "Email").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Email))
  935. // {
  936. // if (result.Where(x => x.Email != Student.CF_StudentContact.Email && !(string.IsNullOrEmpty(x.Email) && string.IsNullOrEmpty(Student.CF_StudentContact.Email))).Count() > 0)
  937. // throw new Exception("邮件已提交修改,等待老师审批确认,不能重复提交修改");
  938. // }
  939. // }
  940. // //QQ
  941. // if (Data.Where(x => x.Key == "QQ") != null && needApproveColumns.IndexOf("QQ") != -1)
  942. // {
  943. // if (Convert.ToString(Data.Where(x => x.Key == "QQ").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.QQ))
  944. // {
  945. // if (result.Where(x => x.QQ != Student.CF_StudentContact.QQ && !(string.IsNullOrEmpty(x.QQ) && string.IsNullOrEmpty(Student.CF_StudentContact.QQ))).Count() > 0)
  946. // throw new Exception("QQ已提交修改,等待老师审批确认,不能重复提交修改");
  947. // }
  948. // }
  949. // //宿舍编号
  950. // if (Data.Where(x => x.Key == "Dormitory") != null && needApproveColumns.IndexOf("Dormitory") != -1)
  951. // {
  952. // if (Convert.ToString(Data.Where(x => x.Key == "Dormitory").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Dormitory))
  953. // {
  954. // if (result.Where(x => x.Dormitory != Student.CF_StudentContact.Dormitory && !(string.IsNullOrEmpty(x.Dormitory) && string.IsNullOrEmpty(Student.CF_StudentContact.Dormitory))).Count() > 0)
  955. // throw new Exception("宿舍编号已提交修改,等待老师审批确认,不能重复提交修改");
  956. // }
  957. // }
  958. // //固定电话
  959. // if (Data.Where(x => x.Key == "Telephone") != null && needApproveColumns.IndexOf("Telephone") != -1)
  960. // {
  961. // if (Convert.ToString(Data.Where(x => x.Key == "Telephone").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Telephone))
  962. // {
  963. // if (result.Where(x => x.Telephone != Student.CF_StudentContact.Telephone && !(string.IsNullOrEmpty(x.Telephone) && string.IsNullOrEmpty(Student.CF_StudentContact.Telephone))).Count() > 0)
  964. // throw new Exception("固定电话已提交修改,等待老师审批确认,不能重复提交修改");
  965. // }
  966. // }
  967. // //移动电话
  968. // if (Data.Where(x => x.Key == "Mobile") != null && needApproveColumns.IndexOf("Mobile") != -1)
  969. // {
  970. // if (Convert.ToString(Data.Where(x => x.Key == "Mobile").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Mobile))
  971. // {
  972. // if (result.Where(x => x.Mobile != Student.CF_StudentContact.Mobile && !(string.IsNullOrEmpty(x.Mobile) && string.IsNullOrEmpty(Student.CF_StudentContact.Mobile))).Count() > 0)
  973. // throw new Exception("移动电话已提交修改,等待老师审批确认,不能重复提交修改");
  974. // }
  975. // }
  976. // //通信地址
  977. // if (Data.Where(x => x.Key == "Address") != null && needApproveColumns.IndexOf("Address") != -1)
  978. // {
  979. // if (Convert.ToString(Data.Where(x => x.Key == "Address").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Address))
  980. // {
  981. // if (result.Where(x => x.Address != Student.CF_StudentContact.Address && !(string.IsNullOrEmpty(x.Address) && string.IsNullOrEmpty(Student.CF_StudentContact.Address))).Count() > 0)
  982. // throw new Exception("通信地址已提交修改,等待老师审批确认,不能重复提交修改");
  983. // }
  984. // }
  985. // //工作单位
  986. // if (Data.Where(x => x.Key == "WorkUnit") != null && needApproveColumns.IndexOf("WorkUnit") != -1)
  987. // {
  988. // if (Convert.ToString(Data.Where(x => x.Key == "WorkUnit").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.WorkUnit))
  989. // {
  990. // if (result.Where(x => x.WorkUnit != Student.CF_StudentContact.WorkUnit && !(string.IsNullOrEmpty(x.WorkUnit) && string.IsNullOrEmpty(Student.CF_StudentContact.WorkUnit))).Count() > 0)
  991. // throw new Exception("工作单位已提交修改,等待老师审批确认,不能重复提交修改");
  992. // }
  993. // }
  994. // //邮编
  995. // if (Data.Where(x => x.Key == "ZipCode") != null && needApproveColumns.IndexOf("ZipCode") != -1)
  996. // {
  997. // if (Convert.ToString(Data.Where(x => x.Key == "ZipCode").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.ZipCode))
  998. // {
  999. // if (result.Where(x => x.ZipCode != Student.CF_StudentContact.ZipCode && !(string.IsNullOrEmpty(x.ZipCode) && string.IsNullOrEmpty(Student.CF_StudentContact.ZipCode))).Count() > 0)
  1000. // throw new Exception("邮编已提交修改,等待老师审批确认,不能重复提交修改");
  1001. // }
  1002. // }
  1003. // //收件人
  1004. // if (Data.Where(x => x.Key == "Recipient") != null && needApproveColumns.IndexOf("Recipient") != -1)
  1005. // {
  1006. // if (Convert.ToString(Data.Where(x => x.Key == "Recipient").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Recipient))
  1007. // {
  1008. // if (result.Where(x => x.Recipient != Student.CF_StudentContact.Recipient && !(string.IsNullOrEmpty(x.Recipient) && string.IsNullOrEmpty(Student.CF_StudentContact.Recipient))).Count() > 0)
  1009. // throw new Exception("收件人已提交修改,等待老师审批确认,不能重复提交修改");
  1010. // }
  1011. // }
  1012. // //开户银行
  1013. // if (Data.Where(x => x.Key == "BankName") != null && needApproveColumns.IndexOf("BankName") != -1)
  1014. // {
  1015. // if (Convert.ToString(Data.Where(x => x.Key == "BankName").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentAccount.BankName))
  1016. // {
  1017. // if (result.Where(x => x.BankName != Student.CF_StudentAccount.BankName && !(string.IsNullOrEmpty(x.BankName) && string.IsNullOrEmpty(Student.CF_StudentAccount.BankName))).Count() > 0)
  1018. // throw new Exception("开户银行已提交修改,等待老师审批确认,不能重复提交修改");
  1019. // }
  1020. // }
  1021. // //银行卡号
  1022. // if (Data.Where(x => x.Key == "CardNo") != null && needApproveColumns.IndexOf("CardNo") != -1)
  1023. // {
  1024. // if (Convert.ToString(Data.Where(x => x.Key == "CardNo").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentAccount.CardNo))
  1025. // {
  1026. // if (result.Where(x => x.CardNo != Student.CF_StudentAccount.CardNo && !(string.IsNullOrEmpty(x.CardNo) && string.IsNullOrEmpty(Student.CF_StudentAccount.CardNo))).Count() > 0)
  1027. // throw new Exception("银行卡号已提交修改,等待老师审批确认,不能重复提交修改");
  1028. // }
  1029. // }
  1030. // //备注
  1031. // if (Data.Where(x => x.Key == "Remarks") != null && needApproveColumns.IndexOf("Remarks") != -1)
  1032. // {
  1033. // if (Convert.ToString(Data.Where(x => x.Key == "Remarks").FirstOrDefault().Value) != Convert.ToString(Student.Remark))
  1034. // {
  1035. // if (result.Where(x => x.Remarks != Student.Remark).Count() > 0)
  1036. // throw new Exception("备注已提交修改,等待老师审批确认,不能重复提交修改");
  1037. // }
  1038. // }
  1039. // #endregion
  1040. // //studentRecordDAL.StudentRepository.UnitOfWork.Update(Student);
  1041. // //studentRecordDAL.StudentRepository.UnitOfWork.Commit();
  1042. //}
  1043. public int InsertRecord(Dictionary<string, object> Data, Guid UserID, List<string> needApproveColumns)
  1044. {
  1045. var Student = studentRecordDAL.StudentRepository.GetSingle(q => q.UserID == UserID, x => x.CF_StudentAccount, x => x.CF_StudentProfile, x => x.CF_StudentContact, x => x.CF_Recruitstudents, x => x.Sys_User);
  1046. var StudentContrast = new CF_StudentContrast();
  1047. List<string> modifiedColumns = new List<string>();
  1048. #region
  1049. StudentContrast.StudentContrastID = Guid.NewGuid();
  1050. StudentContrast.UserID = Student.UserID;
  1051. StudentContrast.ClassmajorID = Student.ClassmajorID;
  1052. StudentContrast.PhotoUrl = Student.PhotoUrl;
  1053. StudentContrast.SexID = Student.SexID.Value;
  1054. StudentContrast.CertificatesType = Student.CertificatesType;
  1055. StudentContrast.IDNumber = Student.IDNumber;
  1056. StudentContrast.StudentCardNo = Student.StudentCardNo;
  1057. StudentContrast.PlanningGraduateDate = Student.PlanningGraduateDate;
  1058. StudentContrast.CF_StudentProfileContrast.CultureModelID = Student.CF_StudentProfile.CultureModelID;
  1059. StudentContrast.StudentType = Student.StudentType;
  1060. StudentContrast.StudentStatus = Student.StudentStatus;
  1061. StudentContrast.InSchoolStatusID = Student.InSchoolStatusID;
  1062. StudentContrast.Career = Student.Career;
  1063. //this.SetNewStatus(StudentContrast);
  1064. StudentContrast.CreateTime = DateTime.Now;
  1065. StudentContrast.CreateUserID = UserID;
  1066. StudentContrast.IP = HttpContext.Current.Request.UserHostAddress;
  1067. StudentContrast.CF_StudentSource = new CF_StudentSource();
  1068. StudentContrast.CF_StudentSource.ClassmajorID = Student.ClassmajorID;
  1069. StudentContrast.CF_StudentSource.PhotoUrl = Student.PhotoUrl;
  1070. StudentContrast.CF_StudentSource.SexID = Student.SexID.Value;
  1071. StudentContrast.CF_StudentSource.CertificatesType = Student.CertificatesType;
  1072. StudentContrast.CF_StudentSource.IDNumber = Student.IDNumber;
  1073. StudentContrast.CF_StudentSource.StudentCardNo = Student.StudentCardNo;
  1074. StudentContrast.CF_StudentSource.PlanningGraduateDate = Student.PlanningGraduateDate;
  1075. StudentContrast.CF_StudentSource.CF_StudentProfileSource.CultureModelID = Student.CF_StudentProfile.CultureModelID;
  1076. StudentContrast.CF_StudentSource.StudentType = Student.StudentType;
  1077. StudentContrast.CF_StudentSource.StudentStatus = Student.StudentStatus;
  1078. StudentContrast.CF_StudentSource.InSchoolStatusID = Student.InSchoolStatusID;
  1079. StudentContrast.CF_StudentSource.Career = Student.Career;
  1080. StudentContrast.CF_StudentAccountContrast = new CF_StudentAccountContrast();
  1081. StudentContrast.CF_StudentAccountContrast.StudentContrastID = StudentContrast.StudentContrastID;
  1082. StudentContrast.CF_StudentAccountContrast.BankName = Student.CF_StudentAccount.BankName;
  1083. StudentContrast.CF_StudentAccountContrast.CardNo = Student.CF_StudentAccount.CardNo;
  1084. //this.SetNewStatus(StudentContrast.CF_StudentAccountContrast);
  1085. StudentContrast.CF_StudentAccountContrast.CreateTime = DateTime.Now;
  1086. StudentContrast.CF_StudentAccountContrast.CreateUserID = UserID;
  1087. StudentContrast.CF_StudentSource.CF_StudentAccountSource = new CF_StudentAccountSource();
  1088. StudentContrast.CF_StudentSource.CF_StudentAccountSource.StudentContrastID = StudentContrast.StudentContrastID;
  1089. StudentContrast.CF_StudentSource.CF_StudentAccountSource.BankName = Student.CF_StudentAccount.BankName;
  1090. StudentContrast.CF_StudentSource.CF_StudentAccountSource.CardNo = Student.CF_StudentAccount.CardNo;
  1091. StudentContrast.CF_RecruitstudentsContrast = new CF_RecruitstudentsContrast();
  1092. StudentContrast.CF_RecruitstudentsContrast.StudentContrastID = StudentContrast.StudentContrastID;
  1093. StudentContrast.CF_RecruitstudentsContrast.EnteringSchoolYearID = Student.CF_Recruitstudents.EnteringSchoolYearID;
  1094. StudentContrast.CF_RecruitstudentsContrast.EntranceDate = Student.CF_Recruitstudents.EntranceDate;
  1095. StudentContrast.CF_RecruitstudentsContrast.EntranceWayID = Student.CF_Recruitstudents.EntranceWayID;
  1096. StudentContrast.CF_RecruitstudentsContrast.ExamineeNum = Student.CF_Recruitstudents.ExamineeNum;
  1097. //StudentContrast.CF_RecruitstudentsContrast.PlaceBirth = Student.CF_Recruitstudents.PlaceBirth;
  1098. StudentContrast.CF_RecruitstudentsContrast.ExamineeType = Student.CF_Recruitstudents.ExamineeType;
  1099. StudentContrast.CF_RecruitstudentsContrast.FeaturesID = Student.CF_Recruitstudents.FeaturesID;
  1100. StudentContrast.CF_RecruitstudentsContrast.Score = Student.CF_Recruitstudents.Score;
  1101. StudentContrast.CF_RecruitstudentsContrast.TerritorialID = Student.CF_Recruitstudents.TerritorialID;
  1102. StudentContrast.CF_RecruitstudentsContrast.Area = Student.CF_Recruitstudents.Area;
  1103. //this.SetNewStatus(StudentContrast.CF_RecruitstudentsContrast);
  1104. StudentContrast.CF_RecruitstudentsContrast.CreateTime = DateTime.Now;
  1105. StudentContrast.CF_RecruitstudentsContrast.CreateUserID = UserID;
  1106. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource = new CF_RecruitstudentsSource();
  1107. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.StudentContrastID = StudentContrast.StudentContrastID;
  1108. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EnteringSchoolYearID = Student.CF_Recruitstudents.EnteringSchoolYearID;
  1109. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EntranceDate = Student.CF_Recruitstudents.EntranceDate;
  1110. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EntranceWayID = Student.CF_Recruitstudents.EntranceWayID;
  1111. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.ExamineeNum = Student.CF_Recruitstudents.ExamineeNum;
  1112. //StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.PlaceBirth = Student.CF_Recruitstudents.PlaceBirth;
  1113. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.ExamineeType = Student.CF_Recruitstudents.ExamineeType;
  1114. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.FeaturesID = Student.CF_Recruitstudents.FeaturesID;
  1115. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Score = Student.CF_Recruitstudents.Score;
  1116. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.TerritorialID = Student.CF_Recruitstudents.TerritorialID;
  1117. StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Area = Student.CF_Recruitstudents.Area;
  1118. StudentContrast.CF_StudentContactContrast = new CF_StudentContactContrast();
  1119. StudentContrast.CF_StudentContactContrast.StudentContrastID = StudentContrast.StudentContrastID;
  1120. StudentContrast.CF_StudentContactContrast.Email = Student.CF_StudentContact.Email;
  1121. StudentContrast.CF_StudentContactContrast.QQ = Student.CF_StudentContact.QQ;
  1122. StudentContrast.CF_StudentContactContrast.Mobile = Student.CF_StudentContact.Mobile;
  1123. StudentContrast.CF_StudentContactContrast.Telephone = Student.CF_StudentContact.Telephone;
  1124. StudentContrast.CF_StudentContactContrast.WeChatNum = Student.CF_StudentContact.WeChatNum;
  1125. StudentContrast.CF_StudentContactContrast.ZIPCode = Student.CF_StudentContact.ZIPCode;
  1126. StudentContrast.CF_StudentContactContrast.Address = Student.CF_StudentContact.Address;
  1127. StudentContrast.CF_StudentContactContrast.WorkUnit = Student.CF_StudentContact.WorkUnit;
  1128. StudentContrast.CF_StudentContactContrast.HomeAddress = Student.CF_StudentContact.HomeAddress;
  1129. StudentContrast.CF_StudentContactContrast.Recipient = Student.CF_StudentContact.Recipient;
  1130. StudentContrast.CF_StudentContactContrast.Dormitory = Student.CF_StudentContact.Dormitory;
  1131. //this.SetNewStatus(StudentContrast.CF_StudentContactContrast);
  1132. StudentContrast.CF_StudentContactContrast.CreateTime = DateTime.Now;
  1133. StudentContrast.CF_StudentContactContrast.CreateUserID = UserID;
  1134. StudentContrast.CF_StudentSource.CF_StudentContactSource = new CF_StudentContactSource();
  1135. StudentContrast.CF_StudentSource.CF_StudentContactSource.StudentContrastID = StudentContrast.StudentContrastID;
  1136. StudentContrast.CF_StudentSource.CF_StudentContactSource.Email = Student.CF_StudentContact.Email;
  1137. StudentContrast.CF_StudentSource.CF_StudentContactSource.QQ = Student.CF_StudentContact.QQ;
  1138. StudentContrast.CF_StudentSource.CF_StudentContactSource.Mobile = Student.CF_StudentContact.Mobile;
  1139. StudentContrast.CF_StudentSource.CF_StudentContactSource.Telephone = Student.CF_StudentContact.Telephone;
  1140. StudentContrast.CF_StudentSource.CF_StudentContactSource.WeChatNum = Student.CF_StudentContact.WeChatNum;
  1141. StudentContrast.CF_StudentSource.CF_StudentContactSource.ZIPCode = Student.CF_StudentContact.ZIPCode;
  1142. StudentContrast.CF_StudentSource.CF_StudentContactSource.Address = Student.CF_StudentContact.Address;
  1143. StudentContrast.CF_StudentSource.CF_StudentContactSource.WorkUnit = Student.CF_StudentContact.WorkUnit;
  1144. StudentContrast.CF_StudentSource.CF_StudentContactSource.HomeAddress = Student.CF_StudentContact.HomeAddress;
  1145. StudentContrast.CF_StudentSource.CF_StudentContactSource.Recipient = Student.CF_StudentContact.Recipient;
  1146. StudentContrast.CF_StudentSource.CF_StudentContactSource.Dormitory = Student.CF_StudentContact.Dormitory;
  1147. StudentContrast.CF_StudentProfileContrast = new CF_StudentProfileContrast();
  1148. StudentContrast.CF_StudentProfileContrast.StudentContrastID = StudentContrast.StudentContrastID;
  1149. StudentContrast.CF_StudentProfileContrast.UsedName = Student.CF_StudentProfile.UsedName;
  1150. StudentContrast.CF_StudentProfileContrast.DirectorName = Student.CF_StudentProfile.DirectorName;
  1151. StudentContrast.BirthDate = Student.BirthDate;
  1152. StudentContrast.CF_StudentProfileContrast.Country = Student.CF_StudentProfile.Country;
  1153. StudentContrast.PoliticsID = Student.PoliticsID;
  1154. StudentContrast.NationID = Student.NationID;
  1155. StudentContrast.CF_StudentProfileContrast.Place = Student.CF_StudentProfile.Place;
  1156. StudentContrast.CF_StudentProfileContrast.HealthStateID = Student.CF_StudentProfile.HealthStateID;
  1157. StudentContrast.CF_StudentProfileContrast.BloodGroup = Student.CF_StudentProfile.BloodGroup;
  1158. StudentContrast.CF_StudentProfileContrast.BornPlace = Student.CF_StudentProfile.BornPlace;
  1159. StudentContrast.CF_StudentProfileContrast.Specialty = Student.CF_StudentProfile.Specialty;
  1160. StudentContrast.CF_StudentProfileContrast.Height = Student.CF_StudentProfile.Height;
  1161. StudentContrast.CF_StudentProfileContrast.Weight = Student.CF_StudentProfile.Weight;
  1162. StudentContrast.Remark = Student.Remark;
  1163. //this.SetNewStatus(StudentContrast.CF_StudentProfileContrast);
  1164. StudentContrast.CF_StudentProfileContrast.CreateTime = DateTime.Now;
  1165. StudentContrast.CF_StudentProfileContrast.CreateUserID = UserID;
  1166. StudentContrast.CF_StudentSource.CF_StudentProfileSource = new CF_StudentProfileSource();
  1167. StudentContrast.CF_StudentSource.CF_StudentProfileSource.StudentContrastID = StudentContrast.StudentContrastID;
  1168. StudentContrast.CF_StudentSource.CF_StudentProfileSource.UsedName = Student.CF_StudentProfile.UsedName;
  1169. StudentContrast.CF_StudentSource.CF_StudentProfileSource.DirectorName = Student.CF_StudentProfile.DirectorName;
  1170. StudentContrast.CF_StudentSource.BirthDate = Student.BirthDate;
  1171. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Country = Student.CF_StudentProfile.Country;
  1172. StudentContrast.CF_StudentSource.PoliticsID = Student.PoliticsID;
  1173. StudentContrast.CF_StudentSource.NationID = Student.NationID;
  1174. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Place = Student.CF_StudentProfile.Place;
  1175. StudentContrast.CF_StudentSource.CF_StudentProfileSource.HealthStateID = Student.CF_StudentProfile.HealthStateID;
  1176. StudentContrast.CF_StudentSource.CF_StudentProfileSource.BloodGroup = Student.CF_StudentProfile.BloodGroup;
  1177. StudentContrast.CF_StudentSource.CF_StudentProfileSource.BornPlace = Student.CF_StudentProfile.BornPlace;
  1178. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Specialty = Student.CF_StudentProfile.Specialty;
  1179. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Height = Student.CF_StudentProfile.Height;
  1180. StudentContrast.CF_StudentSource.CF_StudentProfileSource.Weight = Student.CF_StudentProfile.Weight;
  1181. StudentContrast.CF_StudentSource.Remark = Student.Remark;
  1182. StudentContrast.Sys_UserContrast = new Sys_UserContrast();
  1183. StudentContrast.Sys_UserContrast.StudentContrastID = StudentContrast.StudentContrastID;
  1184. StudentContrast.Sys_UserContrast.Name = Student.Sys_User.Name;
  1185. StudentContrast.Sys_UserContrast.LoginID = Student.Sys_User.LoginID;
  1186. StudentContrast.CF_StudentSource.Sys_UserSource = new Sys_UserSource();
  1187. StudentContrast.CF_StudentSource.Sys_UserSource.StudentContrastID = StudentContrast.StudentContrastID;
  1188. StudentContrast.CF_StudentSource.Sys_UserSource.Name = Student.Sys_User.Name;
  1189. StudentContrast.CF_StudentSource.Sys_UserSource.LoginID = Student.Sys_User.LoginID;
  1190. #endregion
  1191. var studentProperties = typeof(CF_Student).GetProperties();
  1192. var studentAccountProperties = typeof(CF_StudentAccount).GetProperties();
  1193. var studentProfileProperties = typeof(CF_StudentProfile).GetProperties();
  1194. var studentContactProperties = typeof(CF_StudentContact).GetProperties();
  1195. var recruitStudentsProperties = typeof(CF_Recruitstudents).GetProperties();
  1196. var userProperties = typeof(Sys_User).GetProperties();
  1197. var studentContrastProperties = typeof(CF_StudentContrast).GetProperties();
  1198. var studentAccountContrastProperties = typeof(CF_StudentAccountContrast).GetProperties();
  1199. var studentProfileContrastProperties = typeof(CF_StudentProfileContrast).GetProperties();
  1200. var studentContactContrastProperties = typeof(CF_StudentContactContrast).GetProperties();
  1201. var recruitStudentsContrastProperties = typeof(CF_RecruitstudentsContrast).GetProperties();
  1202. var studentUserProperties = typeof(Sys_UserContrast).GetProperties();
  1203. //var studentContrastProperty = studentContrastProperties.Where();
  1204. Guid StudentContrastID = StudentContrast.StudentContrastID;
  1205. Dictionary<string, string> tableAndcol = new Dictionary<string, string>();
  1206. #region
  1207. foreach (var key in Data.Keys)
  1208. {
  1209. string tableNameStr = studentEditColumnDescriptionRepository.GetList(x => x.ColumnName == key).Select(x => x.TableName).FirstOrDefault();
  1210. var studentContrastProperty = studentContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1211. if (studentContrastProperty != null)
  1212. {
  1213. var studentProperty = studentProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1214. var oldValue = studentProperty.GetValue(Student, null);
  1215. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  1216. {
  1217. modifiedColumns.Add(key);
  1218. studentContrastProperty.SetValue(StudentContrast, Data[key], null);
  1219. ////记录修改的字段还有对应的表名
  1220. //tableAndcol.Add(key, tableNameStr);
  1221. }
  1222. }
  1223. var studentAccountContrastProperty = studentAccountContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1224. if (studentAccountContrastProperty != null)
  1225. {
  1226. var studentAccountProperty = studentAccountProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1227. var oldValue = studentAccountProperty.GetValue(Student.CF_StudentAccount, null);
  1228. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  1229. {
  1230. modifiedColumns.Add(key);
  1231. studentAccountContrastProperty.SetValue(StudentContrast.CF_StudentAccountContrast, Data[key], null);
  1232. ////记录修改的字段还有对应的表名
  1233. //tableAndcol.Add(key, tableNameStr);
  1234. }
  1235. }
  1236. var studentProfileContrastProperty = studentProfileContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1237. if (studentProfileContrastProperty != null)
  1238. {
  1239. var studentProfileProperty = studentProfileProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1240. var oldValue = studentProfileProperty.GetValue(Student.CF_StudentProfile, null);
  1241. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  1242. {
  1243. modifiedColumns.Add(key);
  1244. studentProfileContrastProperty.SetValue(StudentContrast.CF_StudentProfileContrast, Data[key], null);
  1245. ////记录修改的字段还有对应的表名
  1246. //tableAndcol.Add(key, tableNameStr);
  1247. }
  1248. }
  1249. var studentContactContrastProperty = studentContactContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1250. if (studentContactContrastProperty != null)
  1251. {
  1252. var studentContactProperty = studentContactProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1253. var oldValue = studentContactProperty.GetValue(Student.CF_StudentContact, null);
  1254. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  1255. {
  1256. modifiedColumns.Add(key);
  1257. studentContactContrastProperty.SetValue(StudentContrast.CF_StudentContactContrast, Data[key], null);
  1258. ////记录修改的字段还有对应的表名
  1259. //tableAndcol.Add(key, tableNameStr);
  1260. }
  1261. }
  1262. var recruitStudentsContrastProperty = recruitStudentsContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1263. if (recruitStudentsContrastProperty != null)
  1264. {
  1265. var recruitStudentsProperty = recruitStudentsProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1266. var oldValue = recruitStudentsProperty.GetValue(Student.CF_Recruitstudents, null);
  1267. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  1268. {
  1269. modifiedColumns.Add(key);
  1270. recruitStudentsContrastProperty.SetValue(StudentContrast.CF_RecruitstudentsContrast, Data[key], null);
  1271. ////记录修改的字段还有对应的表名
  1272. //tableAndcol.Add(key, tableNameStr);
  1273. }
  1274. }
  1275. //var userStudentsContrastProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower());
  1276. if (key.Equals("UserName"))
  1277. {
  1278. var nameKey = "Name";
  1279. var userStudentsContrastProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower());
  1280. if (userStudentsContrastProperty != null)
  1281. {
  1282. var studentUserProperty = userProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower());
  1283. var oldValue = studentUserProperty.GetValue(Student.Sys_User, null);
  1284. if (!(oldValue ?? "").Equals(Data[key] ?? ""))
  1285. {
  1286. modifiedColumns.Add(key);
  1287. }
  1288. userStudentsContrastProperty.SetValue(StudentContrast.Sys_UserContrast, Data[key], null);
  1289. //记录修改的字段还有对应的表名
  1290. //tableAndcol.Add(key, "Sys_User");
  1291. }
  1292. }
  1293. }
  1294. #endregion
  1295. if (modifiedColumns.Any(x => needApproveColumns.Contains(x)))
  1296. {
  1297. StudentContrast.RecordStatus = (int)CF_CheckingType.OpenRecord;
  1298. }
  1299. else
  1300. {
  1301. StudentContrast.RecordStatus = (int)CF_CheckingType.OpenRecord;
  1302. }
  1303. if (modifiedColumns.Count != 0)
  1304. {
  1305. studentRecordDAL.StudentContrastRepository.UnitOfWork.Add(StudentContrast);
  1306. studentRecordDAL.StudentContrastRepository.UnitOfWork.Commit();
  1307. }
  1308. //foreach (KeyValuePair<string, string> tablecol in tableAndcol)
  1309. //{
  1310. // CF_StudentRecordChangeHistory stuRecordChangeHistory = new CF_StudentRecordChangeHistory();
  1311. // stuRecordChangeHistory.StudentRecordChangeHistoryID = Guid.NewGuid();
  1312. // stuRecordChangeHistory.TableName = tablecol.Value;
  1313. // stuRecordChangeHistory.ColumnName = tablecol.Key;
  1314. // stuRecordChangeHistory.StudentContrastID = StudentContrastID;
  1315. // stuRecordChangeHistory.ApproveTime = null;//修改不需要审核
  1316. // SetNewStatus(stuRecordChangeHistory);
  1317. // UnitOfWork.Add(stuRecordChangeHistory);
  1318. // UnitOfWork.Commit();
  1319. // //stuRecordChangeHistoryList.Add(stuRecordChangeHistory);
  1320. //}
  1321. return modifiedColumns.Count;
  1322. }
  1323. //public IEnumerable<AuditProcessView> GetAuditProcessView(Guid UserID)
  1324. //{
  1325. // var Student = AuditProcessDAL.Value.GetAuditProcessQuery(w => w.UserID == UserID && w.RecordStatus == (int)CF_CheckingType.OpenRecord).AsEnumerable();
  1326. // //if (result != null)
  1327. // //{
  1328. // // result.StudentsView = StudentsDAL.Value.GetStudentQueryable(w => w.UserID == result.UserID).FirstOrDefault();
  1329. // //}
  1330. // return Student;
  1331. //}
  1332. }
  1333. }