using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.StudentSystem.StudentMaterial; using EMIS.ViewModel.Students; using EMIS.ViewModel.Cache; using EMIS.ViewModel; using EMIS.Entities; using System.Web; using EMIS.CommonLogic.CalendarManage; using EMIS.DataLogic.Common.Students; using System.ComponentModel; using EMIS.DataLogic.Common.CalendarManage; using EMIS.DataLogic.Common.Specialtyclass; using EMIS.DataLogic.Repositories; namespace EMIS.CommonLogic.Students { class StudentRecordServices : BaseServices, IStudentRecordServices { public GrademajorDAL GrademajorDAL { get; set; } public SchoolYearDAL schoolYearDAL { get; set; } public StudentsDAL StudentsDAL { get; set; } public StudentRecordDAL studentRecordDAL { get; set; } public Lazy SchoolYearServices { get; set; } //public StudentProofreadControlRepository studentProofreadControlRepository { get; set; } public StudentRecordView GetStudentByStudentNo(Guid StudentID) { return studentRecordDAL.GetStudentByStudentNo(StudentID); } public void SaveStudentChange(StudentsView infoView, Guid? userID) { try { var student = studentRecordDAL.StudentRepository.Entities.Where(x => x.UserID == userID).FirstOrDefault(); var studentContact = StudentsDAL.StudentContactRepository.Entities.Where(x => x.UserID == userID).FirstOrDefault(); var studentAccount = StudentsDAL.StudentAccountRepository.Entities.Where(x => x.UserID == userID).FirstOrDefault(); var studentProfile = StudentsDAL.StudentProfileRepository.Entities.Where(x => x.UserID == userID).FirstOrDefault(); student.Sex = infoView.Sex; studentProfile.UsedName = infoView.UsedName; studentProfile.BirthDate = infoView.BirthDate; studentProfile.Politics = infoView.Politics; studentProfile.Nation = infoView.Nation; studentProfile.Place = infoView.Place; studentContact.Email = infoView.Email; studentContact.Mobile = infoView.Mobile; studentContact.QQ = infoView.QQ; studentContact.Address = infoView.Address; studentContact.WorkUnit = infoView.WorkUnit; studentContact.Recipient = infoView.Recipient; studentAccount.BankName = infoView.BankName; studentAccount.CardNo = infoView.CardNo; UnitOfWork.Commit(); } catch (Exception) { throw; } } public void RecordSave(StudentRecordView studentRecordView) { try { var user = EMIS.Utility.FormValidate.CustomPrincipal.Current; var dbuser = StudentsDAL.UserRepository.Entities.Where(x => x.UserID == user.UserID).FirstOrDefault(); var student = studentRecordDAL.StudentRepository.Entities.Where(x => x.UserID == user.UserID).FirstOrDefault(); var studentContact = StudentsDAL.StudentContactRepository.Entities.Where(x => x.UserID == user.UserID).FirstOrDefault(); var studentAccount = StudentsDAL.StudentAccountRepository.Entities.Where(x => x.UserID == user.UserID).FirstOrDefault(); var studentProfile = StudentsDAL.StudentProfileRepository.Entities.Where(x => x.UserID == user.UserID).FirstOrDefault(); var recruitstudent = StudentsDAL.RecruitstudentsRepository.Entities.Where(x => x.UserID == user.UserID).FirstOrDefault(); if(studentRecordView.Sex.HasValue) student.Sex = studentRecordView.Sex; if (studentRecordView.IDNumber != null && studentRecordView.IDNumber != "") { student.IDNumber = studentRecordView.IDNumber; dbuser.LoginID = studentRecordView.IDNumber; } if (studentRecordView.CertificatesType.HasValue) student.CertificatesType = studentRecordView.CertificatesType; if (studentRecordView.PhotoUrl != null && studentRecordView.PhotoUrl !="") student.PhotoUrl = studentRecordView.PhotoUrl; studentProfile.UsedName = studentRecordView.UsedName; studentProfile.Nation = studentRecordView.Nation; studentProfile.BirthDate = studentRecordView.BirthDate; studentProfile.Politics = studentRecordView.Politics; studentProfile.Healthy = studentRecordView.Healthy; studentProfile.Specialty = studentRecordView.Specialty; studentProfile.Healthy = studentRecordView.Healthy; studentProfile.Weight = studentRecordView.Weight; recruitstudent.EntranceDate = studentRecordView.EntranceDate; recruitstudent.EntranceWay = studentRecordView.EntranceWay; recruitstudent.ExamineeNum = studentRecordView.ExamineeNum; recruitstudent.ExamineeType = studentRecordView.ExamineeType; recruitstudent.Features = studentRecordView.Features; recruitstudent.Score = studentRecordView.Score; //recruitstudent.Territorial = studentRecordView.Territorial; recruitstudent.Area = studentRecordView.Area; studentContact.Email = studentRecordView.Email; studentContact.QQ = studentRecordView.QQ; studentContact.Mobile = studentRecordView.Mobile; studentContact.HomeAddress = studentRecordView.HomeAddress; studentContact.WorkUnit = studentRecordView.WorkUnit; studentContact.Zipcode = studentRecordView.Zipcode; studentAccount.BankName = studentRecordView.BankName; studentAccount.CardNo = studentRecordView.CardNo; UnitOfWork.Commit(); } catch (Exception) { throw; } } //private bool IsCanEdit(Guid studentID) //{ // var nowTime = DateTime.Now; // var curSchoolYear = SchoolYearServices.Value.GetCurrentSchoolYear(); // var student = studentRecordDAL.StudentRepository.GetSingle(x => x.UserID == studentID, // (x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor)); // var schoolyearNum = curSchoolYear.Years - student.CF_Classmajor.CF_Grademajor.SchoolyearID + 1; // var editControl = studentRecordDAL.StudentEditObjectsRepository.GetList(x => x.Starttime <= nowTime && x.Endtime >= nowTime // && x.Year == schoolyearNum && x.CultureModel == student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.EducationID).ToList(); // if (editControl.Count > 0) // { // return true; // } // return false; //} ///// ///// 学生资料可以修改字段 ///// ///// ///// //public List GetStudentChangeFeilds(Guid StudentID) //{ // //学生信息 // var Student = StudentsDAL.GetStudentQueryable(x => x.UserID == StudentID, (x => true), (x => true)).FirstOrDefault(); // var studentType = typeof(StudentsView); // List Feilds = new List(); // #region // //var SexName = IdNameExt.GetDictionaryItem("CF_Sex") // // .Where(x => x.Value == Student.Sex) // // .Select(x => x.Name).FirstOrDefault(); // //var NationName = IdNameExt.GetDictionaryItem("CF_Nation") // // .Where(x => x.Value == Student.Nation) // // .Select(x => x.Name).FirstOrDefault(); // //var EducationName = IdNameExt.GetDictionaryItem("CF_Education") // // .Where(x => x.Value == Student.EducationID) // // .Select(x => x.Name).FirstOrDefault(); // //var LearningformName = IdNameExt.GetDictionaryItem("CF_Learningform") // // .Where(x => x.Value == Student.LearningformID) // // .Select(x => x.Name).FirstOrDefault(); // //var LearningstyleName = IdNameExt.GetDictionaryItem("CF_Learningstyle") // // .Where(x => x.Value == Student.LearningstyleID) // // .Select(x => x.Name).FirstOrDefault(); // //var CultureModelName = IdNameExt.GetDictionaryItem("CF_CULTUREMODEL") // // .Where(x => x.Value == Student.CultureModel) // // .Select(x => x.Name).FirstOrDefault(); // //var StudentTypeName = IdNameExt.GetDictionaryItem("CF_STUDENTTYPE") // // .Where(x => x.Value == Student.StudentType) // // .Select(x => x.Name).FirstOrDefault(); // //var StudentStatusName = IdNameExt.GetDictionaryItem("CF_STUDENTSTATUS") // // .Where(x => x.Value == Student.StudentStatus) // // .Select(x => x.Name).FirstOrDefault(); // //var EntranceWayName = IdNameExt.GetDictionaryItem("CF_EntranceWay") // // .Where(x => x.Value == Student.EntranceWay) // // .Select(x => x.Name).FirstOrDefault(); // //var ExamineeTypeName = IdNameExt.GetDictionaryItem("CF_EXAMINEETYPE") // // .Where(x => x.Value == Student.ExamineeType) // // .Select(x => x.Name).FirstOrDefault(); // //var HealthyName = IdNameExt.GetDictionaryItem("CF_HealthState") // // .Where(x => x.Value == Student.Healthy) // // .Select(x => x.Name).FirstOrDefault(); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "照片", ColumnFeild = "PhotoUrl", OrderBy = 1, Value = Student.PhotoUrl, TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学号", ColumnFeild = "LoginID", OrderBy = 2, Value = Student.LoginID, TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "姓名", ColumnFeild = "UserName", OrderBy = 3, Value = Student.UserName, TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "曾用名", ColumnFeild = "UsedName", OrderBy = 4, Value = Student.UsedName, TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "性别", ColumnFeild = "Sex", OrderBy = 5, Value = SexName, TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "出生日期", ColumnFeild = "BirthDate", OrderBy = 6, Value = Student.BirthDate.HasValue ? Student.BirthDate.Value.ToString("yyyy-MM-dd") : "", TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "民族", ColumnFeild = "Nation", OrderBy = 7, Value = NationName, TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "政治面貌", ColumnFeild = "Politics", OrderBy = 8, Value = Student.Politics, TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "身份证", ColumnFeild = "IDNumber", OrderBy = 9, Value = Student.IDNumber, TypeName = "基本信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "年级", ColumnFeild = "GradeName", OrderBy = 10, Value = Student.GradeName, TypeName = "专业班级区" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "年级专业", ColumnFeild = "GradeCode", OrderBy = 11, Value = Student.GradeCode, TypeName = "专业班级区" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "班级名称", ColumnFeild = "ClassName", OrderBy = 12, Value = Student.ClassName, TypeName = "专业班级区" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学制", ColumnFeild = "LearnSystem", OrderBy = 13, Value = Student.LearnSystem.HasValue ? Student.LearnSystem.ToString() : "", TypeName = "专业班级区" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "班序", ColumnFeild = "No", OrderBy = 14, Value = Student.No, TypeName = "专业班级区" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = EMIS.Utility.RSL.Get("EducationID"), ColumnFeild = "EducationID", OrderBy = 15, Value = EducationName, TypeName = "专业班级区" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学习形式", ColumnFeild = "LearningformID", OrderBy = 16, Value = LearningformName, TypeName = "专业班级区" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学习方式", ColumnFeild = "LearningstyleID", OrderBy = 17, Value = LearningstyleName, TypeName = "专业班级区" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "培养方式/办学类型", ColumnFeild = "CultureModel", OrderBy = 18, Value = CultureModelName, TypeName = "补充信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学生类别", ColumnFeild = "StudentType", OrderBy = 19, Value = StudentTypeName, TypeName = "补充信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "学籍状态", ColumnFeild = "StudentStatus", OrderBy = 20, Value = StudentStatusName, TypeName = "补充信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "入学日期", ColumnFeild = "EntranceDate", OrderBy = 21, Value = Student.EntranceDate.HasValue ? Student.EntranceDate.Value.ToString("yyyy-MM-dd") : "", TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "入学方式", ColumnFeild = "EntranceWay", OrderBy = 22, Value = EntranceWayName, TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "教育部考生号", ColumnFeild = "ExamineeNum", OrderBy = 23, Value = Student.ExamineeNum, TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "考生类别", ColumnFeild = "ExamineeType", OrderBy = 24, Value = ExamineeTypeName, TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "考生特征", ColumnFeild = "Features", OrderBy = 25, Value = Student.Features.HasValue ? Student.Features.ToString() : "", TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "高考总分", ColumnFeild = "Score", OrderBy = 26, Value = Student.Score.HasValue ? Student.Score.ToString() : "", TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "生源所属地", ColumnFeild = "Territorial", OrderBy = 27, Value = Student.Territorial.HasValue ? Student.Territorial.ToString() : "", TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "来源地区", ColumnFeild = "Area", OrderBy = 28, Value = Student.Area, TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "籍贯", ColumnFeild = "Place", OrderBy = 29, Value = Student.Place, TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "出生地", ColumnFeild = "BornPlace", OrderBy = 30, Value = Student.BornPlace, TypeName = "高考招生信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "健康状况", ColumnFeild = "Healthy", OrderBy = 31, Value = HealthyName, TypeName = "个人附加信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "特长", ColumnFeild = "Specialty", OrderBy = 32, Value = Student.Specialty, TypeName = "个人附加信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "身高(CM)", ColumnFeild = "Height", OrderBy = 33, Value = Student.Height, TypeName = "个人附加信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "体重(KG)", ColumnFeild = "Weight", OrderBy = 34, Value = Student.Weight, TypeName = "个人附加信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "Email", ColumnFeild = "Email", OrderBy = 35, Value = Student.Email, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "QQ", ColumnFeild = "QQ", OrderBy = 36, Value = Student.QQ, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "宿舍", ColumnFeild = "Dormitory", OrderBy = 37, Value = Student.Dormitory, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "固定电话", ColumnFeild = "Telephone", OrderBy = 38, Value = Student.Telephone, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "移动电话", ColumnFeild = "Mobile", OrderBy = 39, Value = Student.Mobile, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "地址", ColumnFeild = "HomeAddress", OrderBy = 40, Value = Student.HomeAddress, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "工作单位", ColumnFeild = "WorkUnit", OrderBy = 1, Value = Student.WorkUnit, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "邮编", ColumnFeild = "Zipcode", OrderBy = 1, Value = Student.Zipcode, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "收件人", ColumnFeild = "Recipient", OrderBy = 1, Value = Student.Recipient, TypeName = "联系信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "拟毕业日期", ColumnFeild = "PlanningGraduateDate", OrderBy = 1, Value = Student.PlanningGraduateDate.HasValue ? Student.PlanningGraduateDate.Value.ToString("yyyy-MM-dd") : "", TypeName = "其他信息" }); // //Feilds.Add(new StudentChangeFeildView() { ColumnNmae = "备注", ColumnFeild = "Remarks", OrderBy = 1, Value = Student.Remarks, TypeName = "其他信息" }); // #endregion // var canEdit = this.IsCanEdit(StudentID); // //字段修改设定 // var Controls = studentRecordDAL.ControlRepository.Entities.ToList().Select(q => // new StudentChangeFeildView // { // ColumnFeild = q.ColumnName, // ColumnNmae = q.DisplayColumnName, // IsChange = (q.ControlTypeID != (int)CF_ControlType.NotOpen), // OrderBy = q.OrderNo // }).ToList(); // //Feilds = Feilds.Where(q => Controls.Contains(q.ColumnFeild)).ToList(); // return Controls; //} ///// ///// 修改学生信息 ///// ///// ///// //public void ChangeStudentInfo(Dictionary Data, Guid UserID) //{ // //当前学年学期 // var nowSchoolYear = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.IsCurrent == true).FirstOrDefault(); // //全部学年学期 // var schoolYearList = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList(); // //学生 // var student = this.StudentsDAL.StudentRepository.Entities.Where(x => x.UserID == UserID).FirstOrDefault(); // //学生所在班级 // CF_Grademajor grademajor = this.GrademajorDAL.GrademajorRepository.GetSingle(x => x.GrademajorID == student.CF_Classmajor.GrademajorID); // //学生入学学年学期 // //schoolYearList.FirstOrDefault(x => x.Value == (grademajor.SchoolyearID + (grademajor.SchoolcodeID - 1)) * 2); // var startSchoolyear = schoolYearList.FirstOrDefault(x => x.Years == grademajor.SchoolyearID && x.SchoolcodeID == grademajor.SchoolcodeID); // var courseSchoolyear = (startSchoolyear.Value + ((grademajor.SchoolcodeID - 1) * 2)) + (nowSchoolYear.SchoolcodeID == grademajor.SchoolcodeID ? 0 : 1); // var now = (nowSchoolYear.Value - (nowSchoolYear.SchoolcodeID == grademajor.SchoolcodeID ? 0 : 1) - startSchoolyear.Value) / 2 + 1; // //开放学年查询 // var open = this.openObjectsDAL.StudentEditObjectsRepository.GetList(x => x.Year == now && x.CultureModel == grademajor.CF_Facultymajor.EducationID).FirstOrDefault(); // if (open == null) // { // throw new Exception("您没有操作权限。"); // } // else // { // if (open.CultureModel != grademajor.CF_Facultymajor.EducationID) // { // throw new Exception("您没有操作权限。"); // } // if (open.Starttime > System.DateTime.Now) // { // throw new Exception("当前时间不在开放时间范围内。"); // } // if (open.Endtime.Value.AddDays(1) < System.DateTime.Now) // { // throw new Exception("当前时间不在开放时间范围内。"); // } // } // int c = 0; // //字段修改设定 // var Controls = studentRecordDAL.ControlRepository.Entities.Where(q => q.ControlTypeID != (int)CF_ControlType.NotOpen).ToList(); // //需要记录的字段 // var RecordFeilds = Controls.Where(q => q.ControlTypeID == (int)CF_ControlType.NeedLog || q.ControlTypeID == (int)CF_ControlType.NeedAudit).Select(q => q.ColumnName); // //先修改不需要记录的,再修改需要记录不需要审核的,再修改需要记录需要审核的 // //直接修改数据的字段 // var NeedFeilds = Controls.Where(q => q.ControlTypeID == (int)CF_ControlType.OpenAll).Select(q => q.ColumnName); // c = UpdateStudent(Data.Where(q => NeedFeilds.Contains(q.Key)).ToDictionary(q => q.Key, q => q.Value), UserID); // //需要记录日志后修改数据的字段 // var NeedLogFeilds = Controls.Where(q => q.ControlTypeID == (int)CF_ControlType.NeedLog).Select(q => q.ColumnName); // var istrue = Data.Where(q => NeedLogFeilds.Contains(q.Key)); // c += UpdateAndRecordStudent(Data.Where(q => NeedLogFeilds.Contains(q.Key)).ToDictionary(q => q.Key, q => q.Value), UserID); // //检查重复提交,学生提交修改字段时,已提交修改的字段在审批前,不能再提交:邓智荣 // var NeedAuditFeilds = Controls.Where(q => q.ControlTypeID == (int)CF_ControlType.NeedAudit).Select(q => q.ColumnName); // 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()); // 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()); // if (c == 0) // { // throw new Exception("没有修改任何字段!"); // } //} //public IEnumerable GetAuditProcessView(Guid UserID) //{ // var Student = AuditProcessDAL.Value.GetAuditProcessQuery(w => w.UserID == UserID && w.RecordStatus == (int)CF_ProofreadStatus.Undetermined).AsEnumerable(); // //if (result != null) // //{ // // result.StudentsView = StudentsDAL.Value.GetStudentQueryable(w => w.UserID == result.UserID).FirstOrDefault(); // //} // return Student; //} ///// ///// 学生提交修改字段时,已提交修改的字段在审批前,不能再提交 ///// ///// ///// ///// //public void CheckStudentFields(Dictionary Data, Guid UserID, List needApproveColumns) //{ // 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); // var studentProperties = typeof(CF_Student).GetProperties(); // var studentAccountProperties = typeof(CF_StudentAccount).GetProperties(); // var studentProfileProperties = typeof(CF_StudentProfile).GetProperties(); // var studentContactProperties = typeof(CF_StudentContact).GetProperties(); // var recruitStudentsProperties = typeof(CF_Recruitstudents).GetProperties(); // var result = AuditProcessDAL.Value.GetAuditProcessQuery(w => w.UserID == UserID && w.RecordStatus == (int)CF_ProofreadStatus.Undetermined).Where(x => x.RecordStatus == (int)CF_ProofreadStatus.Undetermined).ToList(); // #region // if (result.Count > 0) // { // throw new Exception("您有待审核的修改请求,如需继续修改请在反馈页面撤回!"); // } // //相片 // if (Data.Where(x => x.Key == "PhotoUrl") != null && needApproveColumns.IndexOf("PhotoUrl") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "PhotoUrl").FirstOrDefault().Value) != Convert.ToString(Student.PhotoUrl)) // { // if (result.Where(x => x.PhotoUrl != Student.PhotoUrl).Count() > 0) // throw new Exception("相片已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //学号 // if (Data.Where(x => x.Key == "StudentCardNo") != null && needApproveColumns.IndexOf("StudentCardNo") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "StudentCardNo").FirstOrDefault().Value) != Convert.ToString(Student.StudentCardNo)) // { // if (result.Where(x => x.StudentCardNo != Student.StudentCardNo).Count() > 0) // throw new Exception("学号已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //姓名 // if (Data.Where(x => x.Key == "UserName") != null && needApproveColumns.IndexOf("UserName") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "UserName").FirstOrDefault().Value) != Convert.ToString(Student.Sys_User.Name)) // { // if (result.Where(x => x.UserName != Student.Sys_User.Name).Count() > 0) // throw new Exception("姓名已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //曾用名 // if (Data.Where(x => x.Key == "UsedName") != null && needApproveColumns.IndexOf("UsedName") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "UsedName").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.UsedName)) // { // if (result.Where(x => x.UsedName != Student.CF_StudentProfile.UsedName && !(string.IsNullOrEmpty(x.UsedName) && string.IsNullOrEmpty(Student.CF_StudentProfile.UsedName))).Count() > 0) // throw new Exception("曾用名已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //性别 // if (Data.Where(x => x.Key == "Sex") != null && needApproveColumns.IndexOf("Sex") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Sex").FirstOrDefault().Value) != Convert.ToString(Student.Sex)) // { // if (result.Where(x => x.Sex != Student.Sex).Count() > 0) // throw new Exception("性别已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //民族 // if (Data.Where(x => x.Key == "Nation") != null && needApproveColumns.IndexOf("Nation") != -1) // { // Student.CF_StudentProfile.Nation = null; // if (Convert.ToString(Data.Where(x => x.Key == "Nation").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Nation)) // { // if (result.Where(x => x.Nation != Student.CF_StudentProfile.Nation).Count() > 0) // throw new Exception("民族已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //出生日期 // if (Data.Where(x => x.Key == "BirthDate") != null && needApproveColumns.IndexOf("BirthDate") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "BirthDate").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.BirthDate)) // { // if (result.Where(x => x.BirthDate != Student.CF_StudentProfile.BirthDate).Count() > 0) // throw new Exception("出生日期已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //政治面貌 // if (Data.Where(x => x.Key == "Politics") != null && needApproveColumns.IndexOf("Politics") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Politics").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Politics)) // { // if (result.Where(x => x.Politics != Student.CF_StudentProfile.Politics).Count() > 0) // throw new Exception("政治面貌已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //证件类型 // if (Data.Where(x => x.Key == "CertificatesType") != null && needApproveColumns.IndexOf("CertificatesType") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "CertificatesType").FirstOrDefault().Value) != Convert.ToString(Student.CertificatesType)) // { // if (result.Where(x => x.CertificatesType != Student.CertificatesType).Count() > 0) // throw new Exception("证件类型已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //证件号码 // if (Data.Where(x => x.Key == "IDNumber") != null && needApproveColumns.IndexOf("IDNumber") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "IDNumber").FirstOrDefault().Value) != Convert.ToString(Student.IDNumber)) // { // if (result.Where(x => x.IDNumber != Student.IDNumber && !(string.IsNullOrEmpty(x.IDNumber) && string.IsNullOrEmpty(Student.IDNumber))).Count() > 0) // throw new Exception("证件号码已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //班级 // if (Data.Where(x => x.Key == "ClassMajorID") != null && needApproveColumns.IndexOf("ClassMajorID") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "ClassMajorID").FirstOrDefault().Value) != Convert.ToString(Student.CF_Classmajor.ClassmajorID)) // { // if (result.Where(x => x.ClassMajorID != Student.CF_Classmajor.ClassmajorID).Count() > 0) // throw new Exception("班级已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //培养方式 // if (Data.Where(x => x.Key == "CultureModel") != null && needApproveColumns.IndexOf("CultureModel") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "CultureModel").FirstOrDefault().Value) != Convert.ToString(Student.CultureModel)) // { // if (result.Where(x => x.CultureModel != Student.CultureModel).Count() > 0) // throw new Exception("培养方式已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //学生类别 // if (Data.Where(x => x.Key == "StudentType") != null && needApproveColumns.IndexOf("StudentType") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "StudentType").FirstOrDefault().Value) != Convert.ToString(Student.StudentType)) // { // if (result.Where(x => x.StudentType != Student.StudentType).Count() > 0) // throw new Exception("学生类别已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //学籍状态 // if (Data.Where(x => x.Key == "StudentStatus") != null && needApproveColumns.IndexOf("StudentStatus") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "StudentStatus").FirstOrDefault().Value) != Convert.ToString(Student.StudentStatus)) // { // if (result.Where(x => x.StudentStatus != Student.StudentStatus).Count() > 0) // throw new Exception("学籍状态已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //在校状态 // if (Data.Where(x => x.Key == "InSchoolStatusID") != null && needApproveColumns.IndexOf("InSchoolStatusID") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "InSchoolStatusID").FirstOrDefault().Value) != Convert.ToString(Student.InSchoolStatusID)) // { // if (result.Where(x => x.InSchoolStatusID != Student.InSchoolStatusID).Count() > 0) // throw new Exception("在校状态已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //入学日期 // if (Data.Where(x => x.Key == "EntranceDate") != null && needApproveColumns.IndexOf("EntranceDate") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "EntranceDate").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.EntranceDate)) // { // if (result.Where(x => x.EntranceDate != Student.CF_Recruitstudents.EntranceDate).Count() > 0) // throw new Exception("入学日期已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //入学方式 // if (Data.Where(x => x.Key == "EntranceWay") != null && needApproveColumns.IndexOf("EntranceWay") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "EntranceWay").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.EntranceWay)) // { // if (result.Where(x => x.EntranceWay != Student.CF_Recruitstudents.EntranceWay).Count() > 0) // throw new Exception("入学方式已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //考生号 // if (Data.Where(x => x.Key == "ExamineeNum") != null && needApproveColumns.IndexOf("ExamineeNum") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "ExamineeNum").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.ExamineeNum)) // { // if (result.Where(x => x.ExamineeNum != Student.CF_Recruitstudents.ExamineeNum && !(string.IsNullOrEmpty(x.ExamineeNum) && string.IsNullOrEmpty(Student.CF_Recruitstudents.ExamineeNum))).Count() > 0) // throw new Exception("考生号已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //考生类别 // if (Data.Where(x => x.Key == "ExamineeType") != null && needApproveColumns.IndexOf("ExamineeType") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "ExamineeType").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.ExamineeType)) // { // if (result.Where(x => x.ExamineeType != Student.CF_Recruitstudents.ExamineeType).Count() > 0) // throw new Exception("考生类别已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //考生特征 // if (Data.Where(x => x.Key == "Features") != null && needApproveColumns.IndexOf("Features") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Features").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.Features)) // { // if (result.Where(x => x.Features != Student.CF_Recruitstudents.Features).Count() > 0) // throw new Exception("考生特征已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //高考总分 // if (Data.Where(x => x.Key == "Score") != null && needApproveColumns.IndexOf("Score") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Score").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.Score)) // { // if (result.Where(x => x.Score != Student.CF_Recruitstudents.Score).Count() > 0) // throw new Exception("高考总分已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //生源所属地 // if (Data.Where(x => x.Key == "Territorial") != null && needApproveColumns.IndexOf("Territorial") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Territorial").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.Territorial)) // { // if (result.Where(x => x.Territorial != Student.CF_Recruitstudents.Territorial).Count() > 0) // throw new Exception("生源所属地已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //籍贯 // if (Data.Where(x => x.Key == "Place") != null && needApproveColumns.IndexOf("Place") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Place").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Place)) // { // if (result.Where(x => x.Place != Student.CF_StudentProfile.Place && !(string.IsNullOrEmpty(x.Place) && string.IsNullOrEmpty(Student.CF_StudentProfile.Place))).Count() > 0) // throw new Exception("籍贯已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //来源地区 // if (Data.Where(x => x.Key == "Area") != null && needApproveColumns.IndexOf("Area") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Area").FirstOrDefault().Value) != Convert.ToString(Student.CF_Recruitstudents.Area)) // { // if (result.Where(x => x.Area != Student.CF_Recruitstudents.Area && !(string.IsNullOrEmpty(x.Area) && string.IsNullOrEmpty(Student.CF_Recruitstudents.Area))).Count() > 0) // throw new Exception("来源地区已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //健康状况 // if (Data.Where(x => x.Key == "Healthy") != null && needApproveColumns.IndexOf("Healthy") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Healthy").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Healthy)) // { // if (result.Where(x => x.Healthy != Student.CF_StudentProfile.Healthy).Count() > 0) // throw new Exception("健康状况已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //特长 // if (Data.Where(x => x.Key == "Specialty") != null && needApproveColumns.IndexOf("Specialty") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Specialty").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Specialty)) // { // if (result.Where(x => x.Specialty != Student.CF_StudentProfile.Specialty && !(string.IsNullOrEmpty(x.Specialty) && string.IsNullOrEmpty(Student.CF_StudentProfile.Specialty))).Count() > 0) // throw new Exception("特长已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //身高 // if (Data.Where(x => x.Key == "Height") != null && needApproveColumns.IndexOf("Height") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Height").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Height)) // { // if (result.Where(x => x.Height != Student.CF_StudentProfile.Height && !(string.IsNullOrEmpty(x.Height) && string.IsNullOrEmpty(Student.CF_StudentProfile.Height))).Count() > 0) // throw new Exception("身高已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //体重 // if (Data.Where(x => x.Key == "Weight") != null && needApproveColumns.IndexOf("Weight") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Weight").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Weight)) // { // if (result.Where(x => x.Weight != Student.CF_StudentProfile.Weight && !(string.IsNullOrEmpty(x.Weight) && string.IsNullOrEmpty(Student.CF_StudentProfile.Weight))).Count() > 0) // throw new Exception("体重已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //邮件 // if (Data.Where(x => x.Key == "Email") != null && needApproveColumns.IndexOf("Email") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Email").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Email)) // { // if (result.Where(x => x.Email != Student.CF_StudentContact.Email && !(string.IsNullOrEmpty(x.Email) && string.IsNullOrEmpty(Student.CF_StudentContact.Email))).Count() > 0) // throw new Exception("邮件已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //QQ // if (Data.Where(x => x.Key == "QQ") != null && needApproveColumns.IndexOf("QQ") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "QQ").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.QQ)) // { // if (result.Where(x => x.QQ != Student.CF_StudentContact.QQ && !(string.IsNullOrEmpty(x.QQ) && string.IsNullOrEmpty(Student.CF_StudentContact.QQ))).Count() > 0) // throw new Exception("QQ已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //宿舍编号 // if (Data.Where(x => x.Key == "Dormitory") != null && needApproveColumns.IndexOf("Dormitory") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Dormitory").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Dormitory)) // { // if (result.Where(x => x.Dormitory != Student.CF_StudentContact.Dormitory && !(string.IsNullOrEmpty(x.Dormitory) && string.IsNullOrEmpty(Student.CF_StudentContact.Dormitory))).Count() > 0) // throw new Exception("宿舍编号已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //固定电话 // if (Data.Where(x => x.Key == "Telephone") != null && needApproveColumns.IndexOf("Telephone") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Telephone").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Telephone)) // { // if (result.Where(x => x.Telephone != Student.CF_StudentContact.Telephone && !(string.IsNullOrEmpty(x.Telephone) && string.IsNullOrEmpty(Student.CF_StudentContact.Telephone))).Count() > 0) // throw new Exception("固定电话已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //移动电话 // if (Data.Where(x => x.Key == "Mobile") != null && needApproveColumns.IndexOf("Mobile") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Mobile").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Mobile)) // { // if (result.Where(x => x.Mobile != Student.CF_StudentContact.Mobile && !(string.IsNullOrEmpty(x.Mobile) && string.IsNullOrEmpty(Student.CF_StudentContact.Mobile))).Count() > 0) // throw new Exception("移动电话已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //通信地址 // if (Data.Where(x => x.Key == "Address") != null && needApproveColumns.IndexOf("Address") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Address").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Address)) // { // if (result.Where(x => x.Address != Student.CF_StudentContact.Address && !(string.IsNullOrEmpty(x.Address) && string.IsNullOrEmpty(Student.CF_StudentContact.Address))).Count() > 0) // throw new Exception("通信地址已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //工作单位 // if (Data.Where(x => x.Key == "WorkUnit") != null && needApproveColumns.IndexOf("WorkUnit") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "WorkUnit").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.WorkUnit)) // { // if (result.Where(x => x.WorkUnit != Student.CF_StudentContact.WorkUnit && !(string.IsNullOrEmpty(x.WorkUnit) && string.IsNullOrEmpty(Student.CF_StudentContact.WorkUnit))).Count() > 0) // throw new Exception("工作单位已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //邮编 // if (Data.Where(x => x.Key == "ZipCode") != null && needApproveColumns.IndexOf("ZipCode") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "ZipCode").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Zipcode)) // { // if (result.Where(x => x.ZipCode != Student.CF_StudentContact.Zipcode && !(string.IsNullOrEmpty(x.ZipCode) && string.IsNullOrEmpty(Student.CF_StudentContact.Zipcode))).Count() > 0) // throw new Exception("邮编已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //收件人 // if (Data.Where(x => x.Key == "Recipient") != null && needApproveColumns.IndexOf("Recipient") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Recipient").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentContact.Recipient)) // { // if (result.Where(x => x.Recipient != Student.CF_StudentContact.Recipient && !(string.IsNullOrEmpty(x.Recipient) && string.IsNullOrEmpty(Student.CF_StudentContact.Recipient))).Count() > 0) // throw new Exception("收件人已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //开户银行 // if (Data.Where(x => x.Key == "BankName") != null && needApproveColumns.IndexOf("BankName") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "BankName").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentAccount.BankName)) // { // if (result.Where(x => x.BankName != Student.CF_StudentAccount.BankName && !(string.IsNullOrEmpty(x.BankName) && string.IsNullOrEmpty(Student.CF_StudentAccount.BankName))).Count() > 0) // throw new Exception("开户银行已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //银行卡号 // if (Data.Where(x => x.Key == "CardNo") != null && needApproveColumns.IndexOf("CardNo") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "CardNo").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentAccount.CardNo)) // { // if (result.Where(x => x.CardNo != Student.CF_StudentAccount.CardNo && !(string.IsNullOrEmpty(x.CardNo) && string.IsNullOrEmpty(Student.CF_StudentAccount.CardNo))).Count() > 0) // throw new Exception("银行卡号已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // //备注 // if (Data.Where(x => x.Key == "Remarks") != null && needApproveColumns.IndexOf("Remarks") != -1) // { // if (Convert.ToString(Data.Where(x => x.Key == "Remarks").FirstOrDefault().Value) != Convert.ToString(Student.CF_StudentProfile.Remarks)) // { // if (result.Where(x => x.Remarks != Student.CF_StudentProfile.Remarks).Count() > 0) // throw new Exception("备注已提交修改,等待老师审批确认,不能重复提交修改"); // } // } // #endregion // //studentRecordDAL.StudentRepository.UnitOfWork.Update(Student); // //studentRecordDAL.StudentRepository.UnitOfWork.Commit(); //} public int UpdateStudent(Dictionary Data, Guid UserID) { 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); List modifiedColumns = new List(); var studentProperties = typeof(CF_Student).GetProperties(); var studentAccountProperties = typeof(CF_StudentAccount).GetProperties(); var studentProfileProperties = typeof(CF_StudentProfile).GetProperties(); var studentContactProperties = typeof(CF_StudentContact).GetProperties(); var recruitStudentsProperties = typeof(CF_Recruitstudents).GetProperties(); var studentUserProperties = typeof(Sys_User).GetProperties(); //Dictionary tableAndcol = new Dictionary(); //Guid StudentContrastID = ; #region foreach (var key in Data.Keys) { var studentProperty = studentProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); if (studentProperty != null) { var oldValue = studentProperty.GetValue(Student, null); if (!(oldValue ?? "").Equals(Data[key] ?? "")) { modifiedColumns.Add(key); } studentProperty.SetValue(Student, Data[key], null); } var studentAccountProperty = studentAccountProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); if (studentAccountProperty != null) { var oldValue = studentAccountProperty.GetValue(Student.CF_StudentAccount, null); if (!(oldValue ?? "").Equals(Data[key] ?? "")) { modifiedColumns.Add(key); } studentAccountProperty.SetValue(Student.CF_StudentAccount, Data[key], null); } var studentProfileProperty = studentProfileProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); if (studentProfileProperty != null) { var oldValue = studentProfileProperty.GetValue(Student.CF_StudentProfile, null); if (!(oldValue ?? "").Equals(Data[key] ?? "")) { modifiedColumns.Add(key); } studentProfileProperty.SetValue(Student.CF_StudentProfile, Data[key], null); } var studentContactProperty = studentContactProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); if (studentContactProperty != null) { var oldValue = studentContactProperty.GetValue(Student.CF_StudentContact, null); if (!(oldValue ?? "").Equals(Data[key] ?? "")) { modifiedColumns.Add(key); } studentContactProperty.SetValue(Student.CF_StudentContact, Data[key], null); } var recruitStudentsProperty = recruitStudentsProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); if (recruitStudentsProperty != null) { var oldValue = recruitStudentsProperty.GetValue(Student.CF_Recruitstudents, null); if (!(oldValue ?? "").Equals(Data[key] ?? "")) { modifiedColumns.Add(key); } recruitStudentsProperty.SetValue(Student.CF_Recruitstudents, Data[key], null); } if (key.Equals("UserName")) { var nameKey = "Name"; var studentUserProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower()); if (studentUserProperty != null) { var oldValue = studentUserProperty.GetValue(Student.Sys_User, null); if (!(oldValue ?? "").Equals(Data[key] ?? "")) { modifiedColumns.Add(key); } studentUserProperty.SetValue(Student.Sys_User, Data[key], null); } } //var studentUserProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); //if (studentUserProperty != null) //{ // var oldValue = studentUserProperty.GetValue(Student.Sys_User, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // } // studentUserProperty.SetValue(Student.Sys_User, Data[key], null); //} //string tableNameStr = tableColumnDescriptionRepository.GetList(x => x.ColumnName == key).Select(x => x.TableName).FirstOrDefault(); //tableAndcol.Add(key, tableNameStr); } #endregion studentRecordDAL.StudentRepository.UnitOfWork.Update(Student); studentRecordDAL.StudentRepository.UnitOfWork.Commit(); //foreach (KeyValuePair tablecol in tableAndcol) //{ // CF_StudentRecordChangeHistory stuRecordChangeHistory = new CF_StudentRecordChangeHistory(); // stuRecordChangeHistory.StudentRecordChangeHistoryID = Guid.NewGuid(); // stuRecordChangeHistory.TableName = tablecol.Value; // stuRecordChangeHistory.ColumnName = tablecol.Key; // //stuRecordChangeHistory.StudentContrastID = StudentContrastID; // stuRecordChangeHistory.ApproveTime = DateTime.Now; // SetNewStatus(stuRecordChangeHistory); // UnitOfWork.Add(stuRecordChangeHistory); // UnitOfWork.Commit(); // //stuRecordChangeHistoryList.Add(stuRecordChangeHistory); //} return modifiedColumns.Count; } //public int UpdateAndRecordStudent(Dictionary Data, Guid UserID) //{ // 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); // var StudentContrast = new CF_StudentContrast(); // List modifiedColumns = new List(); // #region // StudentContrast.StudentContrastID = Guid.NewGuid(); // StudentContrast.UserID = Student.UserID; // StudentContrast.ClassmajorID = Student.ClassmajorID; // StudentContrast.PhotoUrl = Student.PhotoUrl; // StudentContrast.Sex = Student.Sex.Value; // StudentContrast.CertificatesType = Student.CertificatesType; // StudentContrast.IDNumber = Student.IDNumber; // StudentContrast.StudentCardNo = Student.StudentCardNo; // StudentContrast.PlanningGraduateDate = Student.PlanningGraduateDate; // StudentContrast.CultureModel = Student.CultureModel; // StudentContrast.StudentType = Student.StudentType; // StudentContrast.StudentStatus = Student.StudentStatus; // StudentContrast.InSchoolStatusID = Student.InSchoolStatusID; // StudentContrast.Career = Student.Career; // this.SetNewStatus(StudentContrast); // StudentContrast.IP = HttpContext.Current.Request.UserHostAddress; // StudentContrast.CF_StudentSource = new CF_StudentSource(); // StudentContrast.CF_StudentSource.ClassmajorID = Student.ClassmajorID; // StudentContrast.CF_StudentSource.PhotoUrl = Student.PhotoUrl; // StudentContrast.CF_StudentSource.Sex = Student.Sex.Value; // StudentContrast.CF_StudentSource.CertificatesType = Student.CertificatesType; // StudentContrast.CF_StudentSource.IDNumber = Student.IDNumber; // StudentContrast.CF_StudentSource.StudentCardNo = Student.StudentCardNo; // StudentContrast.CF_StudentSource.PlanningGraduateDate = Student.PlanningGraduateDate; // StudentContrast.CF_StudentSource.CultureModel = Student.CultureModel; // StudentContrast.CF_StudentSource.StudentType = Student.StudentType; // StudentContrast.CF_StudentSource.StudentStatus = Student.StudentStatus; // StudentContrast.CF_StudentSource.InSchoolStatusID = Student.InSchoolStatusID; // StudentContrast.CF_StudentSource.Career = Student.Career; // StudentContrast.CF_StudentAccountContrast = new CF_StudentAccountContrast(); // StudentContrast.CF_StudentAccountContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentAccountContrast.BankName = Student.CF_StudentAccount.BankName; // StudentContrast.CF_StudentAccountContrast.CardNo = Student.CF_StudentAccount.CardNo; // this.SetNewStatus(StudentContrast.CF_StudentAccountContrast); // StudentContrast.CF_StudentSource.CF_StudentAccountSource = new CF_StudentAccountSource(); // StudentContrast.CF_StudentSource.CF_StudentAccountSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.CF_StudentAccountSource.BankName = Student.CF_StudentAccount.BankName; // StudentContrast.CF_StudentSource.CF_StudentAccountSource.CardNo = Student.CF_StudentAccount.CardNo; // StudentContrast.CF_RecruitstudentsContrast = new CF_RecruitstudentsContrast(); // StudentContrast.CF_RecruitstudentsContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_RecruitstudentsContrast.EnteringSchoolYearID = Student.CF_Recruitstudents.EnteringSchoolYearID; // StudentContrast.CF_RecruitstudentsContrast.EntranceDate = Student.CF_Recruitstudents.EntranceDate; // StudentContrast.CF_RecruitstudentsContrast.EntranceWay = Student.CF_Recruitstudents.EntranceWay; // StudentContrast.CF_RecruitstudentsContrast.ExamineeNum = Student.CF_Recruitstudents.ExamineeNum; // StudentContrast.CF_RecruitstudentsContrast.PlaceBirth = Student.CF_Recruitstudents.PlaceBirth; // StudentContrast.CF_RecruitstudentsContrast.ExamineeType = Student.CF_Recruitstudents.ExamineeType; // StudentContrast.CF_RecruitstudentsContrast.Features = Student.CF_Recruitstudents.Features; // StudentContrast.CF_RecruitstudentsContrast.Score = Student.CF_Recruitstudents.Score; // StudentContrast.CF_RecruitstudentsContrast.Territorial = Student.CF_Recruitstudents.Territorial; // StudentContrast.CF_RecruitstudentsContrast.Area = Student.CF_Recruitstudents.Area; // this.SetNewStatus(StudentContrast.CF_RecruitstudentsContrast); // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource = new CF_RecruitstudentsSource(); // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EnteringSchoolYearID = Student.CF_Recruitstudents.EnteringSchoolYearID; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EntranceDate = Student.CF_Recruitstudents.EntranceDate; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EntranceWay = Student.CF_Recruitstudents.EntranceWay; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.ExamineeNum = Student.CF_Recruitstudents.ExamineeNum; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.PlaceBirth = Student.CF_Recruitstudents.PlaceBirth; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.ExamineeType = Student.CF_Recruitstudents.ExamineeType; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Features = Student.CF_Recruitstudents.Features; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Score = Student.CF_Recruitstudents.Score; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Territorial = Student.CF_Recruitstudents.Territorial; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Area = Student.CF_Recruitstudents.Area; // StudentContrast.CF_StudentContactContrast = new CF_StudentContactContrast(); // StudentContrast.CF_StudentContactContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentContactContrast.Email = Student.CF_StudentContact.Email; // StudentContrast.CF_StudentContactContrast.QQ = Student.CF_StudentContact.QQ; // StudentContrast.CF_StudentContactContrast.Mobile = Student.CF_StudentContact.Mobile; // StudentContrast.CF_StudentContactContrast.Telephone = Student.CF_StudentContact.Telephone; // StudentContrast.CF_StudentContactContrast.MicroMsgNo = Student.CF_StudentContact.MicroMsgNo; // StudentContrast.CF_StudentContactContrast.Zipcode = Student.CF_StudentContact.Zipcode; // StudentContrast.CF_StudentContactContrast.Address = Student.CF_StudentContact.Address; // StudentContrast.CF_StudentContactContrast.WorkUnit = Student.CF_StudentContact.WorkUnit; // StudentContrast.CF_StudentContactContrast.HomeAddress = Student.CF_StudentContact.HomeAddress; // StudentContrast.CF_StudentContactContrast.Recipient = Student.CF_StudentContact.Recipient; // StudentContrast.CF_StudentContactContrast.Dormitory = Student.CF_StudentContact.Dormitory; // this.SetNewStatus(StudentContrast.CF_StudentContactContrast); // StudentContrast.CF_StudentSource.CF_StudentContactSource = new CF_StudentContactSource(); // StudentContrast.CF_StudentSource.CF_StudentContactSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Email = Student.CF_StudentContact.Email; // StudentContrast.CF_StudentSource.CF_StudentContactSource.QQ = Student.CF_StudentContact.QQ; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Mobile = Student.CF_StudentContact.Mobile; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Telephone = Student.CF_StudentContact.Telephone; // StudentContrast.CF_StudentSource.CF_StudentContactSource.MicroMsgNo = Student.CF_StudentContact.MicroMsgNo; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Zipcode = Student.CF_StudentContact.Zipcode; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Address = Student.CF_StudentContact.Address; // StudentContrast.CF_StudentSource.CF_StudentContactSource.WorkUnit = Student.CF_StudentContact.WorkUnit; // StudentContrast.CF_StudentSource.CF_StudentContactSource.HomeAddress = Student.CF_StudentContact.HomeAddress; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Recipient = Student.CF_StudentContact.Recipient; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Dormitory = Student.CF_StudentContact.Dormitory; // StudentContrast.CF_StudentProfileContrast = new CF_StudentProfileContrast(); // StudentContrast.CF_StudentProfileContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentProfileContrast.UsedName = Student.CF_StudentProfile.UsedName; // StudentContrast.CF_StudentProfileContrast.DirectorName = Student.CF_StudentProfile.DirectorName; // StudentContrast.CF_StudentProfileContrast.BirthDate = Student.CF_StudentProfile.BirthDate; // StudentContrast.CF_StudentProfileContrast.Country = Student.CF_StudentProfile.Country; // StudentContrast.CF_StudentProfileContrast.Politics = Student.CF_StudentProfile.Politics; // StudentContrast.CF_StudentProfileContrast.Nation = Student.CF_StudentProfile.Nation; // StudentContrast.CF_StudentProfileContrast.Place = Student.CF_StudentProfile.Place; // StudentContrast.CF_StudentProfileContrast.Healthy = Student.CF_StudentProfile.Healthy; // StudentContrast.CF_StudentProfileContrast.BloodGroup = Student.CF_StudentProfile.BloodGroup; // StudentContrast.CF_StudentProfileContrast.BornPlace = Student.CF_StudentProfile.BornPlace; // StudentContrast.CF_StudentProfileContrast.Specialty = Student.CF_StudentProfile.Specialty; // StudentContrast.CF_StudentProfileContrast.Height = Student.CF_StudentProfile.Height; // StudentContrast.CF_StudentProfileContrast.Weight = Student.CF_StudentProfile.Weight; // StudentContrast.CF_StudentProfileContrast.LiteracyLevels = Student.CF_StudentProfile.LiteracyLevels; // StudentContrast.CF_StudentProfileContrast.Remarks = Student.CF_StudentProfile.Remarks; // this.SetNewStatus(StudentContrast.CF_StudentProfileContrast); // StudentContrast.CF_StudentSource.CF_StudentProfileSource = new CF_StudentProfileSource(); // StudentContrast.CF_StudentSource.CF_StudentProfileSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.UsedName = Student.CF_StudentProfile.UsedName; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.DirectorName = Student.CF_StudentProfile.DirectorName; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.BirthDate = Student.CF_StudentProfile.BirthDate; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Country = Student.CF_StudentProfile.Country; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Politics = Student.CF_StudentProfile.Politics; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Nation = Student.CF_StudentProfile.Nation; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Place = Student.CF_StudentProfile.Place; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Healthy = Student.CF_StudentProfile.Healthy; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.BloodGroup = Student.CF_StudentProfile.BloodGroup; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.BornPlace = Student.CF_StudentProfile.BornPlace; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Specialty = Student.CF_StudentProfile.Specialty; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Height = Student.CF_StudentProfile.Height; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Weight = Student.CF_StudentProfile.Weight; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.LiteracyLevels = Student.CF_StudentProfile.LiteracyLevels; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Remarks = Student.CF_StudentProfile.Remarks; // StudentContrast.Sys_UserContrast = new Sys_UserContrast(); // StudentContrast.Sys_UserContrast.Name = Student.Sys_User.Name; // StudentContrast.Sys_UserContrast.LoginID = Student.Sys_User.LoginID; // StudentContrast.CF_StudentSource.Sys_UserSource = new Sys_UserSource(); // StudentContrast.CF_StudentSource.Sys_UserSource.Name = Student.Sys_User.Name; // StudentContrast.CF_StudentSource.Sys_UserSource.LoginID = Student.Sys_User.LoginID; // #endregion // var studentProperties = typeof(CF_Student).GetProperties(); // var studentAccountProperties = typeof(CF_StudentAccount).GetProperties(); // var studentProfileProperties = typeof(CF_StudentProfile).GetProperties(); // var studentContactProperties = typeof(CF_StudentContact).GetProperties(); // var recruitStudentsProperties = typeof(CF_Recruitstudents).GetProperties(); // var userProperties = typeof(Sys_User).GetProperties(); // var studentContrastProperties = typeof(CF_StudentContrast).GetProperties(); // var studentAccountContrastProperties = typeof(CF_StudentAccountContrast).GetProperties(); // var studentProfileContrastProperties = typeof(CF_StudentProfileContrast).GetProperties(); // var studentContactContrastProperties = typeof(CF_StudentContactContrast).GetProperties(); // var recruitStudentsContrastProperties = typeof(CF_RecruitstudentsContrast).GetProperties(); // var studentUserProperties = typeof(Sys_UserContrast).GetProperties(); // //var studentContrastProperty = studentContrastProperties.Where(); // Guid StudentContrastID = StudentContrast.StudentContrastID; // Dictionary tableAndcol = new Dictionary(); // #region // foreach (var key in Data.Keys) // { // string tableNameStr = studentEditColumnDescriptionRepository.GetList(x => x.ColumnName == key).Select(x => x.TableName).FirstOrDefault(); // var studentContrastProperty = studentContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (studentContrastProperty != null) // { // var studentProperty = studentProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = studentProperty.GetValue(Student, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // studentContrastProperty.SetValue(StudentContrast, Data[key], null); // studentProperty.SetValue(Student, Data[key], null); // //记录修改的字段还有对应的表名 // tableAndcol.Add(key, tableNameStr); // } // } // var studentAccountContrastProperty = studentAccountContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (studentAccountContrastProperty != null) // { // var studentAccountProperty = studentAccountProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = studentAccountProperty.GetValue(Student.CF_StudentAccount, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // studentAccountContrastProperty.SetValue(StudentContrast.CF_StudentAccountContrast, Data[key], null); // studentAccountProperty.SetValue(Student.CF_StudentAccount, Data[key], null); // //记录修改的字段还有对应的表名 // tableAndcol.Add(key, tableNameStr); // } // } // var studentProfileContrastProperty = studentProfileContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (studentProfileContrastProperty != null) // { // var studentProfileProperty = studentProfileProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = studentProfileProperty.GetValue(Student.CF_StudentProfile, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // studentProfileContrastProperty.SetValue(StudentContrast.CF_StudentProfileContrast, Data[key], null); // studentProfileProperty.SetValue(Student.CF_StudentProfile, Data[key], null); // //记录修改的字段还有对应的表名 // tableAndcol.Add(key, tableNameStr); // } // } // var studentContactContrastProperty = studentContactContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (studentContactContrastProperty != null) // { // var studentContactProperty = studentContactProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = studentContactProperty.GetValue(Student.CF_StudentContact, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // studentContactContrastProperty.SetValue(StudentContrast.CF_StudentContactContrast, Data[key], null); // studentContactProperty.SetValue(Student.CF_StudentContact, Data[key], null); // //记录修改的字段还有对应的表名 // tableAndcol.Add(key, tableNameStr); // } // } // var recruitStudentsContrastProperty = recruitStudentsContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (recruitStudentsContrastProperty != null) // { // var recruitStudentsProperty = recruitStudentsProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = recruitStudentsProperty.GetValue(Student.CF_Recruitstudents, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // recruitStudentsContrastProperty.SetValue(StudentContrast.CF_RecruitstudentsContrast, Data[key], null); // recruitStudentsProperty.SetValue(Student.CF_Recruitstudents, Data[key], null); // //记录修改的字段还有对应的表名 // tableAndcol.Add(key, tableNameStr); // } // } // if (key.Equals("UserName")) // { // var nameKey = "Name"; // var userStudentsContrastProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower()); // if (userStudentsContrastProperty != null) // { // var studentUserProperty = userProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower()); // var oldValue = studentUserProperty.GetValue(Student.Sys_User, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // } // userStudentsContrastProperty.SetValue(StudentContrast.Sys_UserContrast, Data[key], null); // studentUserProperty.SetValue(Student.Sys_User, Data[key], null); // //记录修改的字段还有对应的表名 // tableAndcol.Add(nameKey, "Sys_UserContrast"); // } // } // } // #endregion // StudentContrast.RecordStatus = (int)CF_ProofreadStatus.NotAudited; // if (modifiedColumns.Count != 0) // { // studentRecordDAL.StudentContrastRepository.UnitOfWork.Add(StudentContrast); // studentRecordDAL.StudentContrastRepository.UnitOfWork.Commit(); // studentRecordDAL.StudentRepository.UnitOfWork.Update(Student); // studentRecordDAL.StudentRepository.UnitOfWork.Commit(); // } // foreach (KeyValuePair tablecol in tableAndcol) // { // CF_StudentRecordChangeHistory stuRecordChangeHistory = new CF_StudentRecordChangeHistory(); // stuRecordChangeHistory.StudentRecordChangeHistoryID = Guid.NewGuid(); // stuRecordChangeHistory.TableName = tablecol.Value; // stuRecordChangeHistory.ColumnName = tablecol.Key; // stuRecordChangeHistory.StudentContrastID = StudentContrastID; // stuRecordChangeHistory.ApproveTime = null;//记录不需要审核 // SetNewStatus(stuRecordChangeHistory); // UnitOfWork.Add(stuRecordChangeHistory); // UnitOfWork.Commit(); // //stuRecordChangeHistoryList.Add(stuRecordChangeHistory); // } // return modifiedColumns.Count; //} //public int InsertRecord(Dictionary Data, Guid UserID, List needApproveColumns) //{ // 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); // var StudentContrast = new CF_StudentContrast(); // List modifiedColumns = new List(); // #region // StudentContrast.StudentContrastID = Guid.NewGuid(); // StudentContrast.UserID = Student.UserID; // StudentContrast.ClassmajorID = Student.ClassmajorID; // StudentContrast.PhotoUrl = Student.PhotoUrl; // StudentContrast.Sex = Student.Sex.Value; // StudentContrast.CertificatesType = Student.CertificatesType; // StudentContrast.IDNumber = Student.IDNumber; // StudentContrast.StudentCardNo = Student.StudentCardNo; // StudentContrast.PlanningGraduateDate = Student.PlanningGraduateDate; // StudentContrast.CultureModel = Student.CultureModel; // StudentContrast.StudentType = Student.StudentType; // StudentContrast.StudentStatus = Student.StudentStatus; // StudentContrast.InSchoolStatusID = Student.InSchoolStatusID; // StudentContrast.Career = Student.Career; // this.SetNewStatus(StudentContrast); // StudentContrast.IP = HttpContext.Current.Request.UserHostAddress; // StudentContrast.CF_StudentSource = new CF_StudentSource(); // StudentContrast.CF_StudentSource.ClassmajorID = Student.ClassmajorID; // StudentContrast.CF_StudentSource.PhotoUrl = Student.PhotoUrl; // StudentContrast.CF_StudentSource.Sex = Student.Sex.Value; // StudentContrast.CF_StudentSource.CertificatesType = Student.CertificatesType; // StudentContrast.CF_StudentSource.IDNumber = Student.IDNumber; // StudentContrast.CF_StudentSource.StudentCardNo = Student.StudentCardNo; // StudentContrast.CF_StudentSource.PlanningGraduateDate = Student.PlanningGraduateDate; // StudentContrast.CF_StudentSource.CultureModel = Student.CultureModel; // StudentContrast.CF_StudentSource.StudentType = Student.StudentType; // StudentContrast.CF_StudentSource.StudentStatus = Student.StudentStatus; // StudentContrast.CF_StudentSource.InSchoolStatusID = Student.InSchoolStatusID; // StudentContrast.CF_StudentSource.Career = Student.Career; // StudentContrast.CF_StudentAccountContrast = new CF_StudentAccountContrast(); // StudentContrast.CF_StudentAccountContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentAccountContrast.BankName = Student.CF_StudentAccount.BankName; // StudentContrast.CF_StudentAccountContrast.CardNo = Student.CF_StudentAccount.CardNo; // this.SetNewStatus(StudentContrast.CF_StudentAccountContrast); // StudentContrast.CF_StudentSource.CF_StudentAccountSource = new CF_StudentAccountSource(); // StudentContrast.CF_StudentSource.CF_StudentAccountSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.CF_StudentAccountSource.BankName = Student.CF_StudentAccount.BankName; // StudentContrast.CF_StudentSource.CF_StudentAccountSource.CardNo = Student.CF_StudentAccount.CardNo; // StudentContrast.CF_RecruitstudentsContrast = new CF_RecruitstudentsContrast(); // StudentContrast.CF_RecruitstudentsContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_RecruitstudentsContrast.EnteringSchoolYearID = Student.CF_Recruitstudents.EnteringSchoolYearID; // StudentContrast.CF_RecruitstudentsContrast.EntranceDate = Student.CF_Recruitstudents.EntranceDate; // StudentContrast.CF_RecruitstudentsContrast.EntranceWay = Student.CF_Recruitstudents.EntranceWay; // StudentContrast.CF_RecruitstudentsContrast.ExamineeNum = Student.CF_Recruitstudents.ExamineeNum; // StudentContrast.CF_RecruitstudentsContrast.PlaceBirth = Student.CF_Recruitstudents.PlaceBirth; // StudentContrast.CF_RecruitstudentsContrast.ExamineeType = Student.CF_Recruitstudents.ExamineeType; // StudentContrast.CF_RecruitstudentsContrast.Features = Student.CF_Recruitstudents.Features; // StudentContrast.CF_RecruitstudentsContrast.Score = Student.CF_Recruitstudents.Score; // StudentContrast.CF_RecruitstudentsContrast.Territorial = Student.CF_Recruitstudents.Territorial; // StudentContrast.CF_RecruitstudentsContrast.Area = Student.CF_Recruitstudents.Area; // this.SetNewStatus(StudentContrast.CF_RecruitstudentsContrast); // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource = new CF_RecruitstudentsSource(); // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EnteringSchoolYearID = Student.CF_Recruitstudents.EnteringSchoolYearID; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EntranceDate = Student.CF_Recruitstudents.EntranceDate; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.EntranceWay = Student.CF_Recruitstudents.EntranceWay; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.ExamineeNum = Student.CF_Recruitstudents.ExamineeNum; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.PlaceBirth = Student.CF_Recruitstudents.PlaceBirth; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.ExamineeType = Student.CF_Recruitstudents.ExamineeType; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Features = Student.CF_Recruitstudents.Features; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Score = Student.CF_Recruitstudents.Score; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Territorial = Student.CF_Recruitstudents.Territorial; // StudentContrast.CF_StudentSource.CF_RecruitstudentsSource.Area = Student.CF_Recruitstudents.Area; // StudentContrast.CF_StudentContactContrast = new CF_StudentContactContrast(); // StudentContrast.CF_StudentContactContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentContactContrast.Email = Student.CF_StudentContact.Email; // StudentContrast.CF_StudentContactContrast.QQ = Student.CF_StudentContact.QQ; // StudentContrast.CF_StudentContactContrast.Mobile = Student.CF_StudentContact.Mobile; // StudentContrast.CF_StudentContactContrast.Telephone = Student.CF_StudentContact.Telephone; // StudentContrast.CF_StudentContactContrast.MicroMsgNo = Student.CF_StudentContact.MicroMsgNo; // StudentContrast.CF_StudentContactContrast.Zipcode = Student.CF_StudentContact.Zipcode; // StudentContrast.CF_StudentContactContrast.Address = Student.CF_StudentContact.Address; // StudentContrast.CF_StudentContactContrast.WorkUnit = Student.CF_StudentContact.WorkUnit; // StudentContrast.CF_StudentContactContrast.HomeAddress = Student.CF_StudentContact.HomeAddress; // StudentContrast.CF_StudentContactContrast.Recipient = Student.CF_StudentContact.Recipient; // StudentContrast.CF_StudentContactContrast.Dormitory = Student.CF_StudentContact.Dormitory; // this.SetNewStatus(StudentContrast.CF_StudentContactContrast); // StudentContrast.CF_StudentSource.CF_StudentContactSource = new CF_StudentContactSource(); // StudentContrast.CF_StudentSource.CF_StudentContactSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Email = Student.CF_StudentContact.Email; // StudentContrast.CF_StudentSource.CF_StudentContactSource.QQ = Student.CF_StudentContact.QQ; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Mobile = Student.CF_StudentContact.Mobile; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Telephone = Student.CF_StudentContact.Telephone; // StudentContrast.CF_StudentSource.CF_StudentContactSource.MicroMsgNo = Student.CF_StudentContact.MicroMsgNo; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Zipcode = Student.CF_StudentContact.Zipcode; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Address = Student.CF_StudentContact.Address; // StudentContrast.CF_StudentSource.CF_StudentContactSource.WorkUnit = Student.CF_StudentContact.WorkUnit; // StudentContrast.CF_StudentSource.CF_StudentContactSource.HomeAddress = Student.CF_StudentContact.HomeAddress; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Recipient = Student.CF_StudentContact.Recipient; // StudentContrast.CF_StudentSource.CF_StudentContactSource.Dormitory = Student.CF_StudentContact.Dormitory; // StudentContrast.CF_StudentProfileContrast = new CF_StudentProfileContrast(); // StudentContrast.CF_StudentProfileContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentProfileContrast.UsedName = Student.CF_StudentProfile.UsedName; // StudentContrast.CF_StudentProfileContrast.DirectorName = Student.CF_StudentProfile.DirectorName; // StudentContrast.CF_StudentProfileContrast.BirthDate = Student.CF_StudentProfile.BirthDate; // StudentContrast.CF_StudentProfileContrast.Country = Student.CF_StudentProfile.Country; // StudentContrast.CF_StudentProfileContrast.Politics = Student.CF_StudentProfile.Politics; // StudentContrast.CF_StudentProfileContrast.Nation = Student.CF_StudentProfile.Nation; // StudentContrast.CF_StudentProfileContrast.Place = Student.CF_StudentProfile.Place; // StudentContrast.CF_StudentProfileContrast.Healthy = Student.CF_StudentProfile.Healthy; // StudentContrast.CF_StudentProfileContrast.BloodGroup = Student.CF_StudentProfile.BloodGroup; // StudentContrast.CF_StudentProfileContrast.BornPlace = Student.CF_StudentProfile.BornPlace; // StudentContrast.CF_StudentProfileContrast.Specialty = Student.CF_StudentProfile.Specialty; // StudentContrast.CF_StudentProfileContrast.Height = Student.CF_StudentProfile.Height; // StudentContrast.CF_StudentProfileContrast.Weight = Student.CF_StudentProfile.Weight; // StudentContrast.CF_StudentProfileContrast.Remarks = Student.CF_StudentProfile.Remarks; // this.SetNewStatus(StudentContrast.CF_StudentProfileContrast); // StudentContrast.CF_StudentSource.CF_StudentProfileSource = new CF_StudentProfileSource(); // StudentContrast.CF_StudentSource.CF_StudentProfileSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.UsedName = Student.CF_StudentProfile.UsedName; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.DirectorName = Student.CF_StudentProfile.DirectorName; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.BirthDate = Student.CF_StudentProfile.BirthDate; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Country = Student.CF_StudentProfile.Country; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Politics = Student.CF_StudentProfile.Politics; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Nation = Student.CF_StudentProfile.Nation; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Place = Student.CF_StudentProfile.Place; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Healthy = Student.CF_StudentProfile.Healthy; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.BloodGroup = Student.CF_StudentProfile.BloodGroup; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.BornPlace = Student.CF_StudentProfile.BornPlace; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Specialty = Student.CF_StudentProfile.Specialty; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Height = Student.CF_StudentProfile.Height; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Weight = Student.CF_StudentProfile.Weight; // StudentContrast.CF_StudentSource.CF_StudentProfileSource.Remarks = Student.CF_StudentProfile.Remarks; // StudentContrast.Sys_UserContrast = new Sys_UserContrast(); // StudentContrast.Sys_UserContrast.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.Sys_UserContrast.Name = Student.Sys_User.Name; // StudentContrast.Sys_UserContrast.LoginID = Student.Sys_User.LoginID; // StudentContrast.CF_StudentSource.Sys_UserSource = new Sys_UserSource(); // StudentContrast.CF_StudentSource.Sys_UserSource.StudentContrastID = StudentContrast.StudentContrastID; // StudentContrast.CF_StudentSource.Sys_UserSource.Name = Student.Sys_User.Name; // StudentContrast.CF_StudentSource.Sys_UserSource.LoginID = Student.Sys_User.LoginID; // #endregion // var studentProperties = typeof(CF_Student).GetProperties(); // var studentAccountProperties = typeof(CF_StudentAccount).GetProperties(); // var studentProfileProperties = typeof(CF_StudentProfile).GetProperties(); // var studentContactProperties = typeof(CF_StudentContact).GetProperties(); // var recruitStudentsProperties = typeof(CF_Recruitstudents).GetProperties(); // var userProperties = typeof(Sys_User).GetProperties(); // var studentContrastProperties = typeof(CF_StudentContrast).GetProperties(); // var studentAccountContrastProperties = typeof(CF_StudentAccountContrast).GetProperties(); // var studentProfileContrastProperties = typeof(CF_StudentProfileContrast).GetProperties(); // var studentContactContrastProperties = typeof(CF_StudentContactContrast).GetProperties(); // var recruitStudentsContrastProperties = typeof(CF_RecruitstudentsContrast).GetProperties(); // var studentUserProperties = typeof(Sys_UserContrast).GetProperties(); // //var studentContrastProperty = studentContrastProperties.Where(); // Guid StudentContrastID = StudentContrast.StudentContrastID; // Dictionary tableAndcol = new Dictionary(); // #region // foreach (var key in Data.Keys) // { // string tableNameStr = studentEditColumnDescriptionRepository.GetList(x => x.ColumnName == key).Select(x => x.TableName).FirstOrDefault(); // var studentContrastProperty = studentContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (studentContrastProperty != null) // { // var studentProperty = studentProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = studentProperty.GetValue(Student, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // studentContrastProperty.SetValue(StudentContrast, Data[key], null); // ////记录修改的字段还有对应的表名 // //tableAndcol.Add(key, tableNameStr); // } // } // var studentAccountContrastProperty = studentAccountContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (studentAccountContrastProperty != null) // { // var studentAccountProperty = studentAccountProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = studentAccountProperty.GetValue(Student.CF_StudentAccount, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // studentAccountContrastProperty.SetValue(StudentContrast.CF_StudentAccountContrast, Data[key], null); // ////记录修改的字段还有对应的表名 // //tableAndcol.Add(key, tableNameStr); // } // } // var studentProfileContrastProperty = studentProfileContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (studentProfileContrastProperty != null) // { // var studentProfileProperty = studentProfileProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = studentProfileProperty.GetValue(Student.CF_StudentProfile, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // studentProfileContrastProperty.SetValue(StudentContrast.CF_StudentProfileContrast, Data[key], null); // ////记录修改的字段还有对应的表名 // //tableAndcol.Add(key, tableNameStr); // } // } // var studentContactContrastProperty = studentContactContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (studentContactContrastProperty != null) // { // var studentContactProperty = studentContactProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = studentContactProperty.GetValue(Student.CF_StudentContact, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // studentContactContrastProperty.SetValue(StudentContrast.CF_StudentContactContrast, Data[key], null); // ////记录修改的字段还有对应的表名 // //tableAndcol.Add(key, tableNameStr); // } // } // var recruitStudentsContrastProperty = recruitStudentsContrastProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (recruitStudentsContrastProperty != null) // { // var recruitStudentsProperty = recruitStudentsProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // var oldValue = recruitStudentsProperty.GetValue(Student.CF_Recruitstudents, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // recruitStudentsContrastProperty.SetValue(StudentContrast.CF_RecruitstudentsContrast, Data[key], null); // ////记录修改的字段还有对应的表名 // //tableAndcol.Add(key, tableNameStr); // } // } // //var userStudentsContrastProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == key.ToLower()); // if (key.Equals("UserName")) // { // var nameKey = "Name"; // var userStudentsContrastProperty = studentUserProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower()); // if (userStudentsContrastProperty != null) // { // var studentUserProperty = userProperties.FirstOrDefault(x => x.Name.ToLower() == nameKey.ToLower()); // var oldValue = studentUserProperty.GetValue(Student.Sys_User, null); // if (!(oldValue ?? "").Equals(Data[key] ?? "")) // { // modifiedColumns.Add(key); // } // userStudentsContrastProperty.SetValue(StudentContrast.Sys_UserContrast, Data[key], null); // //记录修改的字段还有对应的表名 // //tableAndcol.Add(key, "Sys_User"); // } // } // } // #endregion // if (modifiedColumns.Any(x => needApproveColumns.Contains(x))) // { // StudentContrast.RecordStatus = (int)CF_ProofreadStatus.Undetermined; // } // else // { // StudentContrast.RecordStatus = (int)CF_ProofreadStatus.NotAudited; // } // if (modifiedColumns.Count != 0) // { // studentRecordDAL.StudentContrastRepository.UnitOfWork.Add(StudentContrast); // studentRecordDAL.StudentContrastRepository.UnitOfWork.Commit(); // } // //foreach (KeyValuePair tablecol in tableAndcol) // //{ // // CF_StudentRecordChangeHistory stuRecordChangeHistory = new CF_StudentRecordChangeHistory(); // // stuRecordChangeHistory.StudentRecordChangeHistoryID = Guid.NewGuid(); // // stuRecordChangeHistory.TableName = tablecol.Value; // // stuRecordChangeHistory.ColumnName = tablecol.Key; // // stuRecordChangeHistory.StudentContrastID = StudentContrastID; // // stuRecordChangeHistory.ApproveTime = null;//修改不需要审核 // // SetNewStatus(stuRecordChangeHistory); // // UnitOfWork.Add(stuRecordChangeHistory); // // UnitOfWork.Commit(); // // //stuRecordChangeHistoryList.Add(stuRecordChangeHistory); // //} // return modifiedColumns.Count; //} //public void ProofreadIsOpen(Guid UserID) //{ // //当前学年学期 // var nowSchoolYear = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.IsCurrent == true).FirstOrDefault(); // //全部学年学期 // var schoolYearList = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList(); // //学生 // var studentclass = this.StudentsDAL.StudentRepository.GetList(x => x.UserID == UserID).Select(x => x.CF_Classmajor).FirstOrDefault(); // //学生所在班级 // CF_Grademajor grademajor = this.GrademajorDAL.GrademajorRepository.GetSingle(x => x.GrademajorID == studentclass.GrademajorID); // CF_Facultymajor facultymajor = GrademajorDAL.GrademajorRepository.GetList(x => x.GrademajorID == studentclass.GrademajorID).Select(x => x.CF_Facultymajor).FirstOrDefault(); // //学生入学学年学期 // //schoolYearList.FirstOrDefault(x => x.Value == (grademajor.SchoolyearID + (grademajor.SchoolcodeID - 1)) * 2); // var startSchoolyear = schoolYearList.FirstOrDefault(x => x.Years == grademajor.SchoolyearID && x.SchoolcodeID == grademajor.SchoolcodeID); // var courseSchoolyear = (startSchoolyear.Value + ((grademajor.SchoolcodeID - 1) * 2)) + (nowSchoolYear.SchoolcodeID == grademajor.SchoolcodeID ? 0 : 1); // var now = (nowSchoolYear.Value - (nowSchoolYear.SchoolcodeID == grademajor.SchoolcodeID ? 0 : 1) - startSchoolyear.Value) / 2 + 1; // //开放学年查询 // var open = this.openObjectsDAL.StudentEditObjectsRepository.GetList(x => x.Year == now && x.CultureModel == facultymajor.EducationID).FirstOrDefault(); // if (open == null) // { // throw new Exception("没有开放该功能。"); // } // else // { // if (open.CultureModel != grademajor.CF_Facultymajor.EducationID) // { // throw new Exception("您没有操作权限。"); // } // if (open.Starttime > System.DateTime.Now) // { // throw new Exception("当前时间不在开放时间范围内。"); // } // if (open.Endtime.Value.AddDays(1) < System.DateTime.Now) // { // throw new Exception("当前时间不在开放时间范围内。"); // } // } //} //public void ProofreadStudent(Guid userID) //{ // try // { // CF_Student student = StudentsDAL.StudentRepository.GetSingle(x => x.UserID == userID); // student.IsProofread = true; // SetModifyStatus(student); // UnitOfWork.Commit(); // } // catch (Exception) // { // throw; // } //} } }