StudentRecordServices.cs 104 KB

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