using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Data; using System.Data.OleDb; using System.Linq.Expressions; using System.Transactions; using System.Globalization; using System.IO; using System.Web; using Bowin.Common; using Bowin.Common.Utility; using Bowin.Common.Linq; using Bowin.Common.Linq.Entity; using EMIS.Utility; using EMIS.Entities; using EMIS.ViewModel; using EMIS.ViewModel.CacheManage; using EMIS.ViewModel.StudentManage.StudentProfile; using EMIS.ViewModel.StudentManage.StudentRegister; using EMIS.ViewModel.StudentManage.StudentChange; using EMIS.DataLogic.StudentManage.StudentProfile; using EMIS.DataLogic.StudentManage.StudentRegister; using EMIS.DataLogic.StudentManage.StudentChange; using EMIS.DataLogic.SystemDAL; using EMIS.CommonLogic.SystemServices; using EMIS.CommonLogic.StudentManage.StudentStatistics; namespace EMIS.CommonLogic.StudentManage.StudentProfile { public class StudentServices : BaseWorkflowServices, IStudentServices { public Lazy StudentDAL { get; set; } public Lazy StudentReportDAL { get; set; } public Lazy StudentChangeDAL { get; set; } public Lazy DataRangeDAL { get; set; } public Lazy InSchoolSettingServices { get; set; } /// /// 查询对应的学生信息StudentView /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IGridResultSet GetStudentViewGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? classmajorID, int? isPhoto, int? reportStatus, string planningGraduateDate, int? inSchoolStatus, int pageIndex, int pageSize) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (classmajorID.HasValue) { expStudent = expStudent.And(x => x.ClassmajorID == classmajorID); } if (isPhoto.HasValue) { if (isPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.PhotoUrl != null && x.PhotoUrl != ""); } if (isPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.PhotoUrl == null || x.PhotoUrl == ""); } } if (!string.IsNullOrEmpty(planningGraduateDate) && planningGraduateDate != "-1") { DateTime planDate = DateTime.ParseExact(planningGraduateDate, "yyyyMMdd", CultureInfo.CurrentCulture); expStudent = expStudent.And(x => DateTime.Compare((DateTime)x.PlanningGraduateDate, planDate) == 0); } if (inSchoolStatus.HasValue) { expStudent = expStudent.And(x => x.InSchoolStatusID == inSchoolStatus); } var endStatusID = this.GetCorrectEndStatus(); Expression> expChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expChange = expChange.And(x => x.ApprovalStatus == endStatusID); var query = StudentDAL.Value.GetStudentViewQueryable(expStudent, expChange); if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (gradeID.HasValue) { query = query.Where(x => x.GradeID == gradeID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (educationID.HasValue) { query = query.Where(x => x.EducationID == educationID); } if (learningformID.HasValue) { query = query.Where(x => x.LearningformID == learningformID); } if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1") { var LearnSystems = Convert.ToDecimal(learnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } if (reportStatus.HasValue) { query = query.Where(x => x.ReportStatus == reportStatus); } //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)) .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo) .ThenBy(x => x.GradeID).ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo) .ToGridResultSet(pageIndex, pageSize); } /// /// 查询对应的学生信息List /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IList GetStudentViewList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? classmajorID, int? isPhoto, int? reportStatus, string planningGraduateDate, int? inSchoolStatus) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (classmajorID.HasValue) { expStudent = expStudent.And(x => x.ClassmajorID == classmajorID); } if (isPhoto.HasValue) { if (isPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.PhotoUrl != null && x.PhotoUrl != ""); } if (isPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.PhotoUrl == null || x.PhotoUrl == ""); } } if (!string.IsNullOrEmpty(planningGraduateDate) && planningGraduateDate != "-1") { DateTime planDate = DateTime.ParseExact(planningGraduateDate, "yyyyMMdd", CultureInfo.CurrentCulture); expStudent = expStudent.And(x => DateTime.Compare((DateTime)x.PlanningGraduateDate, planDate) == 0); } if (inSchoolStatus.HasValue) { expStudent = expStudent.And(x => x.InSchoolStatusID == inSchoolStatus); } var endStatusID = this.GetCorrectEndStatus(); Expression> expChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expChange = expChange.And(x => x.ApprovalStatus == endStatusID); var query = StudentDAL.Value.GetStudentViewQueryable(expStudent, expChange); if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (gradeID.HasValue) { query = query.Where(x => x.GradeID == gradeID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (educationID.HasValue) { query = query.Where(x => x.EducationID == educationID); } if (learningformID.HasValue) { query = query.Where(x => x.LearningformID == learningformID); } if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1") { var LearnSystems = Convert.ToDecimal(learnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } if (reportStatus.HasValue) { query = query.Where(x => x.ReportStatus == reportStatus); } //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)) .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo) .ThenBy(x => x.GradeID).ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo) .ToList(); } /// /// 查询对应的学生信息List(userIDList) /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IList GetStudentViewList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? classmajorID, int? isPhoto, int? reportStatus, string planningGraduateDate, int? inSchoolStatus, List userIDList) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (userIDList != null && userIDList.Count() > 0) { expStudent = expStudent.And(x => userIDList.Contains(x.UserID)); } else { if (classmajorID.HasValue) { expStudent = expStudent.And(x => x.ClassmajorID == classmajorID); } if (isPhoto.HasValue) { if (isPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.PhotoUrl != null && x.PhotoUrl != ""); } if (isPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.PhotoUrl == null || x.PhotoUrl == ""); } } if (!string.IsNullOrEmpty(planningGraduateDate) && planningGraduateDate != "-1") { DateTime planDate = DateTime.ParseExact(planningGraduateDate, "yyyyMMdd", CultureInfo.CurrentCulture); expStudent = expStudent.And(x => DateTime.Compare((DateTime)x.PlanningGraduateDate, planDate) == 0); } if (inSchoolStatus.HasValue) { expStudent = expStudent.And(x => x.InSchoolStatusID == inSchoolStatus); } } var endStatusID = this.GetCorrectEndStatus(); Expression> expChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expChange = expChange.And(x => x.ApprovalStatus == endStatusID); var query = StudentDAL.Value.GetStudentViewQueryable(expStudent, expChange); if (userIDList == null || userIDList.Count() <= 0) { if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (gradeID.HasValue) { query = query.Where(x => x.GradeID == gradeID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (educationID.HasValue) { query = query.Where(x => x.EducationID == educationID); } if (learningformID.HasValue) { query = query.Where(x => x.LearningformID == learningformID); } if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1") { var LearnSystems = Convert.ToDecimal(learnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } if (reportStatus.HasValue) { query = query.Where(x => x.ReportStatus == reportStatus); } //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } } return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)) .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo) .ThenBy(x => x.GradeID).ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo) .ToList(); } /// /// 查询对应的学生信息List(根据userIDList) /// /// /// public IList GetStudentViewList(List userIDList) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expStudent = expStudent.And(x => userIDList.Contains(x.UserID)); var query = StudentDAL.Value.GetStudentViewQueryable(expStudent); return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)).OrderBy(x => x.ClassmajorNo.Length) .ThenBy(x => x.ClassmajorNo).ThenBy(x => x.GradeID).ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ToList(); } /// /// 查询对应的学生信息StudentBaseView(全部、在校或非在校信息) /// /// /// /// /// /// /// public IGridResultSet GetStudentBaseViewGrid(ConfiguretView configuretView, Guid? userID, int? inSchoolStatus, int pageIndex, int pageSize) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (inSchoolStatus.HasValue) { if (inSchoolStatus != null && inSchoolStatus > -1) { var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true); if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes) { if (userID.HasValue) { expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID) || x.UserID == userID); } else { expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID)); } } if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No) { if (userID.HasValue) { expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID) || x.UserID == userID); } else { expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID)); } } } } var query = StudentDAL.Value.GetStudentBaseViewQueryable(expStudent); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)) .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo).ThenBy(x => x.GradeID) .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ToGridResultSet(pageIndex, pageSize); } /// /// 查询对应的学生信息List(全部、在校或非在校信息) /// /// /// /// /// public IList GetStudentBaseViewList(ConfiguretView configuretView, Guid? userID, int? inSchoolStatus) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (inSchoolStatus.HasValue) { if (inSchoolStatus != null && inSchoolStatus > -1) { var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true); if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes) { if (userID.HasValue) { expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID) || x.UserID == userID); } else { expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID)); } } if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No) { if (userID.HasValue) { expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID) || x.UserID == userID); } else { expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID)); } } } } var query = StudentDAL.Value.GetStudentBaseViewQueryable(expStudent); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)) .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo).ThenBy(x => x.GradeID) .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ToList(); } /// /// 查询对应的照片比对学生信息StudentView /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IGridResultSet GetStudentPicComparisonGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? classmajorID, int? isRecruitPhoto, int? isPhoto, int? isGraduationPhoto, int? isPhotoComparison, int? inSchoolStatus, int pageIndex, int pageSize) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (classmajorID.HasValue) { expStudent = expStudent.And(x => x.ClassmajorID == classmajorID); } if (isPhoto.HasValue) { if (isPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.PhotoUrl != null && x.PhotoUrl != ""); } if (isPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.PhotoUrl == null || x.PhotoUrl == ""); } } if (isGraduationPhoto.HasValue) { if (isGraduationPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.GraduationPictureUrl != null && x.GraduationPictureUrl != ""); } if (isGraduationPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.GraduationPictureUrl == null || x.GraduationPictureUrl == ""); } } if (isPhotoComparison.HasValue) { if (isPhotoComparison.Value == (int)CF_GeneralPurpose.IsYes) { expStudent = expStudent.And(x => x.IsPhotoComparison == true); } if (isPhotoComparison.Value == (int)CF_GeneralPurpose.IsNo) { expStudent = expStudent.And(x => x.IsPhotoComparison != true); } } if (inSchoolStatus.HasValue) { expStudent = expStudent.And(x => x.InSchoolStatusID == inSchoolStatus); } var query = StudentDAL.Value.GetStudentViewQueryable(expStudent); if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (gradeID.HasValue) { query = query.Where(x => x.GradeID == gradeID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (educationID.HasValue) { query = query.Where(x => x.EducationID == educationID); } if (learningformID.HasValue) { query = query.Where(x => x.LearningformID == learningformID); } if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1") { var LearnSystems = Convert.ToDecimal(learnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } if (isRecruitPhoto.HasValue) { if (isRecruitPhoto.Value == (int)CF_GeneralExist.Have) { query = query.Where(x => x.RecruitPictureUrl != null && x.RecruitPictureUrl != ""); } if (isRecruitPhoto.Value == (int)CF_GeneralExist.No) { query = query.Where(x => x.RecruitPictureUrl == null || x.RecruitPictureUrl == ""); } } //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)) .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo) .ThenBy(x => x.GradeID).ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo) .ToGridResultSet(pageIndex, pageSize); } /// /// 查询对应的照片比对学生信息List /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IList GetStudentPicComparisonList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? classmajorID, int? isRecruitPhoto, int? isPhoto, int? isGraduationPhoto, int? isPhotoComparison, int? inSchoolStatus) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (classmajorID.HasValue) { expStudent = expStudent.And(x => x.ClassmajorID == classmajorID); } if (isPhoto.HasValue) { if (isPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.PhotoUrl != null && x.PhotoUrl != ""); } if (isPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.PhotoUrl == null || x.PhotoUrl == ""); } } if (isGraduationPhoto.HasValue) { if (isGraduationPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.GraduationPictureUrl != null && x.GraduationPictureUrl != ""); } if (isGraduationPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.GraduationPictureUrl == null || x.GraduationPictureUrl == ""); } } if (isPhotoComparison.HasValue) { if (isPhotoComparison.Value == (int)CF_GeneralPurpose.IsYes) { expStudent = expStudent.And(x => x.IsPhotoComparison == true); } if (isPhotoComparison.Value == (int)CF_GeneralPurpose.IsNo) { expStudent = expStudent.And(x => x.IsPhotoComparison != true); } } if (inSchoolStatus.HasValue) { expStudent = expStudent.And(x => x.InSchoolStatusID == inSchoolStatus); } var query = StudentDAL.Value.GetStudentViewQueryable(expStudent); if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (gradeID.HasValue) { query = query.Where(x => x.GradeID == gradeID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (educationID.HasValue) { query = query.Where(x => x.EducationID == educationID); } if (learningformID.HasValue) { query = query.Where(x => x.LearningformID == learningformID); } if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1") { var LearnSystems = Convert.ToDecimal(learnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } if (isRecruitPhoto.HasValue) { if (isRecruitPhoto.Value == (int)CF_GeneralExist.Have) { query = query.Where(x => x.RecruitPictureUrl != null && x.RecruitPictureUrl != ""); } if (isRecruitPhoto.Value == (int)CF_GeneralExist.No) { query = query.Where(x => x.RecruitPictureUrl == null || x.RecruitPictureUrl == ""); } } //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)) .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo) .ThenBy(x => x.GradeID).ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ToList(); } /// /// 查询对应的照片比对学生信息List(userIDList) /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IList GetStudentPicComparisonList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID, int? educationID, int? learningformID, string learnSystem, Guid? classmajorID, int? isRecruitPhoto, int? isPhoto, int? isGraduationPhoto, int? isPhotoComparison, int? inSchoolStatus, List userIDList) { Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (userIDList != null && userIDList.Count() > 0) { expStudent = expStudent.And(x => userIDList.Contains(x.UserID)); } else { if (classmajorID.HasValue) { expStudent = expStudent.And(x => x.ClassmajorID == classmajorID); } if (isPhoto.HasValue) { if (isPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.PhotoUrl != null && x.PhotoUrl != ""); } if (isPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.PhotoUrl == null || x.PhotoUrl == ""); } } if (isGraduationPhoto.HasValue) { if (isGraduationPhoto.Value == (int)CF_GeneralExist.Have) { expStudent = expStudent.And(x => x.GraduationPictureUrl != null && x.GraduationPictureUrl != ""); } if (isGraduationPhoto.Value == (int)CF_GeneralExist.No) { expStudent = expStudent.And(x => x.GraduationPictureUrl == null || x.GraduationPictureUrl == ""); } } if (isPhotoComparison.HasValue) { if (isPhotoComparison.Value == (int)CF_GeneralPurpose.IsYes) { expStudent = expStudent.And(x => x.IsPhotoComparison == true); } if (isPhotoComparison.Value == (int)CF_GeneralPurpose.IsNo) { expStudent = expStudent.And(x => x.IsPhotoComparison != true); } } if (inSchoolStatus.HasValue) { expStudent = expStudent.And(x => x.InSchoolStatusID == inSchoolStatus); } } var query = StudentDAL.Value.GetStudentViewQueryable(expStudent); if (userIDList == null || userIDList.Count() <= 0) { if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (gradeID.HasValue) { query = query.Where(x => x.GradeID == gradeID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (educationID.HasValue) { query = query.Where(x => x.EducationID == educationID); } if (learningformID.HasValue) { query = query.Where(x => x.LearningformID == learningformID); } if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1") { var LearnSystems = Convert.ToDecimal(learnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } if (isRecruitPhoto.HasValue) { if (isRecruitPhoto.Value == (int)CF_GeneralExist.Have) { query = query.Where(x => x.RecruitPictureUrl != null && x.RecruitPictureUrl != ""); } if (isRecruitPhoto.Value == (int)CF_GeneralExist.No) { query = query.Where(x => x.RecruitPictureUrl == null || x.RecruitPictureUrl == ""); } } //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } } return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(query)) .OrderBy(x => x.ClassmajorNo.Length).ThenBy(x => x.ClassmajorNo) .ThenBy(x => x.GradeID).ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo) .ToList(); } /// /// 查询对应的学生信息StudentView /// /// /// public StudentView GetStudentView(Guid? userID) { try { var query = StudentDAL.Value.GetStudentViewQueryable(x => x.UserID == userID); return query.SingleOrDefault(); } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 编辑(新增、修改,业务主键:学号或考生号唯一) /// /// /// public virtual void StudentEdit(StudentView studentView, string photoUrl) { try { //查询相关Web.config配置 if (EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateSpringMonth == null) { throw new Exception("预计毕业月(春季、上学期入学月)未配置,请检查。"); } if (EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateSpringDay == null) { throw new Exception("预计毕业日(春季、上学期入学日)未配置,请检查。"); } if (EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateAutumnMonth == null) { throw new Exception("预计毕业月(秋季、下学期入学月)未配置,请检查。"); } if (EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateAutumnDay == null) { throw new Exception("预计毕业日(秋季、下学期入学日)未配置,请检查。"); } if (EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID == null) { throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查。"); } var studentNoTotal = EMIS.Utility.Const.LOCAL_SETTING_LOGINIDTOTAL; if (studentNoTotal == null) { throw new Exception("学号总位数未配置,请检查。"); } if (!string.IsNullOrEmpty(studentView.StudentNo)) { if (studentView.StudentNo.Trim().Length != Convert.ToInt32(studentNoTotal)) { throw new Exception("输入的学号总位数有误,学号总位数应为" + studentNoTotal + "位。"); } } else { throw new Exception("学号不能为空,请输入学号。"); } var userVerify = StudentDAL.Value.UserRepository.GetList(x => x.UserID != studentView.UserID && x.LoginID == studentView.StudentNo.Trim()).SingleOrDefault(); if (userVerify == null) { var newStudentVerify = StudentDAL.Value.NewStudentRepository.GetList(x => x.AssignStatus == (int)CF_AssignStatus.Assigned && x.ExamineeNum != studentView.ExamineeNum && x.StudentNo == studentView.StudentNo.Trim()).SingleOrDefault(); if (newStudentVerify != null) { throw new Exception("录取名单中已存在相同的学号(学号重复),请核查。"); } if (!string.IsNullOrEmpty(studentView.ExamineeNum)) { var examineeNumVerify = StudentDAL.Value.RecruitstudentsRepository.GetList(x => x.UserID != studentView.UserID && x.ExamineeNum == studentView.ExamineeNum.Trim()).SingleOrDefault(); if (examineeNumVerify != null) { throw new Exception("已存在相同的考生号(考生号重复),请核查。"); } } if (!string.IsNullOrEmpty(studentView.StudentCardNo)) { var studentCardNoVerify = StudentDAL.Value.StudentRepository.GetList(x => x.UserID != studentView.UserID && x.StudentCardNo == studentView.StudentCardNo.Trim()).SingleOrDefault(); if (studentCardNoVerify != null) { throw new Exception("已存在相同的学籍卡编号(学籍卡编号重复),请核查。"); } } if (!string.IsNullOrEmpty(studentView.GraduateCardNo)) { var graduateCardNoVerify = StudentDAL.Value.StudentRepository.GetList(x => x.UserID != studentView.UserID && x.GraduateCardNo == studentView.GraduateCardNo.Trim()).SingleOrDefault(); if (graduateCardNoVerify != null) { throw new Exception("已存在相同的毕结业证书编号(毕结业证书编号重复),请核查。"); } } if (!string.IsNullOrEmpty(studentView.ReplaceGraduateNo)) { var replaceGraduateNoVerify = StudentDAL.Value.StudentRepository.GetList(x => x.UserID != studentView.UserID && x.ReplaceGraduateNo == studentView.ReplaceGraduateNo.Trim()).SingleOrDefault(); if (replaceGraduateNoVerify != null) { throw new Exception("已存在相同的补证编号(补证编号重复),请核查。"); } } var passwordParameter = StudentDAL.Value.ParameterRepository.GetSingle(x => x.ParameterTypeID == (int)ViewModel.CF_ParameterType.StudentInitPassword); var roleList = StudentDAL.Value.RoleRepository.GetList(x => x.TypeID == (int)SYS_RoleType.Student, (x => x.CF_StudentRole)).ToList(); List newUserInList = new List(); List newUserUpList = new List(); List newStudentInList = new List(); List newStudentUpList = new List(); List newStudentProfileInList = new List(); List newStudentProfileUpList = new List(); List newStudentContactInList = new List(); List newStudentContactUpList = new List(); List newStudentAccountInList = new List(); List newStudentAccountUpList = new List(); List newRecruitstudentsInList = new List(); List newRecruitstudentsUpList = new List(); if (studentView.UserID != Guid.Empty) { //修改 var student = StudentDAL.Value.StudentRepository.GetList(x => x.UserID == studentView.UserID, (x => x.CF_StudentProfile), (x => x.CF_StudentContact), (x => x.CF_StudentAccount), (x => x.CF_Recruitstudents), (x => x.Sys_User)).SingleOrDefault(); if (student == null) { throw new Exception("数据有误,请核查。"); } else { student.Sys_User.LoginID = studentView.StudentNo.Trim(); student.Sys_User.Name = studentView.Name.Trim(); this.SetModifyStatus(student.Sys_User); newUserUpList.Add(student.Sys_User); student.ClassmajorID = studentView.ClassmajorID; student.SexID = studentView.SexID; student.BirthDate = studentView.BirthDate; student.NationID = studentView.NationID; student.PoliticsID = studentView.PoliticsID; student.CertificatesType = studentView.CertificatesType; student.IDNumber = studentView.IDNumber; student.StudentType = studentView.StudentType; student.Sys_User.Sys_Role = new HashSet(); roleList = roleList.Where(x => x.CF_StudentRole.StudentType == studentView.StudentType).ToList(); if (roleList != null && roleList.Count > 0) { roleList.ForEach(x => student.Sys_User.Sys_Role.Add(x)); } else { //对应角色为空时,默认为不分配用户角色 } student.InSchoolStatusID = studentView.InSchoolStatusID; student.StudentStatus = studentView.StudentStatus; student.StudentCardNo = studentView.StudentCardNo; if (!string.IsNullOrEmpty(photoUrl)) { student.PhotoUrl = photoUrl; } if (studentView.PlanningGraduateDate.HasValue) { student.PlanningGraduateDate = studentView.PlanningGraduateDate; } if(studentView.GraduateDate.HasValue) { student.GraduateDate = studentView.GraduateDate; } student.GraduateCardNo = studentView.GraduateCardNo; student.ReplaceGraduateNo = studentView.ReplaceGraduateNo; student.DegreeStatus = studentView.DegreeStatus; //if (!string.IsNullOrEmpty(studentView.GraduationPictureUrl)) //{ // student.GraduationPictureUrl = studentView.GraduationPictureUrl; //} student.Career = studentView.Career; //student.IsPhotoComparison = studentView.IsPhotoComparison; //student.IsProofread = studentView.IsProofread; student.Remark = studentView.Remark; this.SetModifyStatus(student); newStudentUpList.Add(student); if (student.CF_StudentProfile == null) { var studentProfile = new CF_StudentProfile(); studentProfile.UserID = student.UserID; studentProfile.UsedName = studentView.UsedName; studentProfile.LiteracyLevelID = studentView.LiteracyLevelID; studentProfile.CultureModelID = studentView.CultureModelID; studentProfile.IsDreamProject = studentView.IsDreamProject; studentProfile.Country = studentView.Country; studentProfile.Place = studentView.Place; studentProfile.BornPlace = studentView.BornPlace; studentProfile.HealthStateID = studentView.HealthStateID; studentProfile.BloodGroup = studentView.BloodGroup; studentProfile.Specialty = studentView.Specialty; studentProfile.Height = studentView.Height; studentProfile.Weight = studentView.Weight; studentProfile.DirectorName = studentView.DirectorName; this.SetNewStatus(studentProfile); newStudentProfileInList.Add(studentProfile); } else { student.CF_StudentProfile.UsedName = studentView.UsedName; student.CF_StudentProfile.LiteracyLevelID = studentView.LiteracyLevelID; student.CF_StudentProfile.CultureModelID = studentView.CultureModelID; student.CF_StudentProfile.IsDreamProject = studentView.IsDreamProject; student.CF_StudentProfile.Country = studentView.Country; student.CF_StudentProfile.Place = studentView.Place; student.CF_StudentProfile.BornPlace = studentView.BornPlace; student.CF_StudentProfile.HealthStateID = studentView.HealthStateID; student.CF_StudentProfile.BloodGroup = studentView.BloodGroup; student.CF_StudentProfile.Specialty = studentView.Specialty; student.CF_StudentProfile.Height = studentView.Height; student.CF_StudentProfile.Weight = studentView.Weight; student.CF_StudentProfile.DirectorName = studentView.DirectorName; this.SetModifyStatus(student.CF_StudentProfile); newStudentProfileUpList.Add(student.CF_StudentProfile); } if (student.CF_StudentContact == null) { var studentContact = new CF_StudentContact(); studentContact.UserID = student.UserID; studentContact.Email = studentView.Email; studentContact.Telephone = studentView.Email; studentContact.Mobile = studentView.Email; studentContact.ZIPCode = studentView.ZIPCode; studentContact.WeChatNum = studentView.WeChatNum; studentContact.QQ = studentView.QQ; studentContact.HomeAddress = studentView.HomeAddress; studentContact.WorkUnit = studentView.WorkUnit; studentContact.Address = studentView.Address; studentContact.Recipient = studentView.Recipient; studentContact.Dormitory = studentView.Dormitory; this.SetNewStatus(studentContact); newStudentContactInList.Add(studentContact); } else { student.CF_StudentContact.Email = studentView.Email; student.CF_StudentContact.Telephone = studentView.Telephone; student.CF_StudentContact.Mobile = studentView.Mobile; student.CF_StudentContact.ZIPCode = studentView.ZIPCode; student.CF_StudentContact.WeChatNum = studentView.WeChatNum; student.CF_StudentContact.QQ = studentView.QQ; student.CF_StudentContact.HomeAddress = studentView.HomeAddress; student.CF_StudentContact.WorkUnit = studentView.WorkUnit; student.CF_StudentContact.Address = studentView.Address; student.CF_StudentContact.Recipient = studentView.Recipient; student.CF_StudentContact.Dormitory = studentView.Dormitory; this.SetModifyStatus(student.CF_StudentContact); newStudentContactUpList.Add(student.CF_StudentContact); } if (student.CF_StudentAccount == null) { var studentAccount = new CF_StudentAccount(); studentAccount.UserID = student.UserID; studentAccount.BankName = studentView.BankName; studentAccount.CardNo = studentView.CardNo; this.SetNewStatus(studentAccount); newStudentAccountInList.Add(studentAccount); } else { student.CF_StudentAccount.BankName = studentView.BankName; student.CF_StudentAccount.CardNo = studentView.CardNo; this.SetModifyStatus(student.CF_StudentAccount); newStudentAccountUpList.Add(student.CF_StudentAccount); } if (student.CF_Recruitstudents == null) { var recruitstudents = new CF_Recruitstudents(); recruitstudents.UserID = student.UserID; recruitstudents.ExamineeNum = studentView.ExamineeNum; recruitstudents.AdmissionTicketNo = studentView.AdmissionTicketNo; recruitstudents.ExamineeType = studentView.ExamineeType; recruitstudents.EnteringSchoolYearID = studentView.StartSchoolyearID; recruitstudents.EntranceDate = studentView.EntranceDate; recruitstudents.Score = studentView.Score; recruitstudents.EntranceWayID = studentView.EntranceWayID; recruitstudents.FeaturesID = studentView.FeaturesID; recruitstudents.TerritorialID = studentView.TerritorialID; recruitstudents.Area = studentView.Area; //if (!string.IsNullOrEmpty(studentView.RecruitPictureUrl)) //{ // recruitstudents.RecruitPictureUrl = studentView.RecruitPictureUrl; //} this.SetNewStatus(recruitstudents); newRecruitstudentsInList.Add(recruitstudents); } else { student.CF_Recruitstudents.ExamineeNum = studentView.ExamineeNum; student.CF_Recruitstudents.AdmissionTicketNo = studentView.AdmissionTicketNo; student.CF_Recruitstudents.ExamineeType = studentView.ExamineeType; student.CF_Recruitstudents.EnteringSchoolYearID = studentView.StartSchoolyearID; student.CF_Recruitstudents.EntranceDate = studentView.EntranceDate; student.CF_Recruitstudents.Score = studentView.Score; student.CF_Recruitstudents.EntranceWayID = studentView.EntranceWayID; student.CF_Recruitstudents.FeaturesID = studentView.FeaturesID; student.CF_Recruitstudents.TerritorialID = studentView.TerritorialID; student.CF_Recruitstudents.Area = studentView.Area; //if (!string.IsNullOrEmpty(studentView.RecruitPictureUrl)) //{ // student.CF_Recruitstudents.RecruitPictureUrl = studentView.RecruitPictureUrl; //} this.SetModifyStatus(student.CF_Recruitstudents); newRecruitstudentsUpList.Add(student.CF_Recruitstudents); } } } else { //新增 var newUser = new Sys_User(); newUser.UserID = Guid.NewGuid(); newUser.LoginID = studentView.StudentNo.Trim(); newUser.Name = studentView.Name.Trim(); if (passwordParameter == null) { newUser.Password = ("A" + studentView.StudentNo.Trim()).MD5(); } else { if (passwordParameter.Value != null) { newUser.Password = passwordParameter.Value; } else { newUser.Password = ("A" + studentView.StudentNo.Trim()).MD5(); } } this.SetNewStatus(newUser, (int)SYS_STATUS.USABLE); newUserInList.Add(newUser); newUser.Sys_Role = new HashSet(); roleList = roleList.Where(x => x.CF_StudentRole.StudentType == studentView.StudentType).ToList(); if (roleList != null && roleList.Count > 0) { roleList.ForEach(x => newUser.Sys_Role.Add(x)); } else { //对应角色为空时,默认为不分配用户角色 } var newStudent = new CF_Student(); newStudent.UserID = newUser.UserID; newStudent.ClassmajorID = studentView.ClassmajorID; newStudent.SexID = studentView.SexID; newStudent.BirthDate = studentView.BirthDate; newStudent.NationID = studentView.NationID; newStudent.PoliticsID = studentView.PoliticsID; newStudent.CertificatesType = studentView.CertificatesType; newStudent.IDNumber = studentView.IDNumber; newStudent.StudentType = studentView.StudentType; newStudent.InSchoolStatusID = studentView.InSchoolStatusID; newStudent.StudentStatus = studentView.StudentStatus; newStudent.StudentCardNo = studentView.StudentCardNo; if (!string.IsNullOrEmpty(photoUrl)) { newStudent.PhotoUrl = photoUrl; } newStudent.PlanningGraduateDate = this.GetClassmajorPlanningGraduateDate(studentView.ClassmajorID); newStudent.GraduateDate = this.GetClassmajorGraduateDate(studentView.ClassmajorID); newStudent.GraduateCardNo = studentView.GraduateCardNo; newStudent.ReplaceGraduateNo = studentView.ReplaceGraduateNo; newStudent.DegreeStatus = studentView.DegreeStatus; //if (!string.IsNullOrEmpty(studentView.GraduationPictureUrl)) //{ // newStudent.GraduationPictureUrl = studentView.GraduationPictureUrl; //} newStudent.Career = studentView.Career; //newStudent.IsPhotoComparison = studentView.IsPhotoComparison; //newStudent.IsProofread = studentView.IsProofread; newStudent.Remark = studentView.Remark; this.SetNewStatus(newStudent); newStudentInList.Add(newStudent); var newStudentProfile = new CF_StudentProfile(); newStudentProfile.UserID = newStudent.UserID; newStudentProfile.UsedName = studentView.UsedName; newStudentProfile.LiteracyLevelID = studentView.LiteracyLevelID; newStudentProfile.CultureModelID = studentView.CultureModelID; newStudentProfile.IsDreamProject = studentView.IsDreamProject; newStudentProfile.Country = studentView.Country; newStudentProfile.Place = studentView.Place; newStudentProfile.BornPlace = studentView.BornPlace; newStudentProfile.HealthStateID = studentView.HealthStateID; newStudentProfile.BloodGroup = studentView.BloodGroup; newStudentProfile.Specialty = studentView.Specialty; newStudentProfile.Height = studentView.Height; newStudentProfile.Weight = studentView.Weight; newStudentProfile.DirectorName = studentView.DirectorName; this.SetNewStatus(newStudentProfile); newStudentProfileInList.Add(newStudentProfile); var newStudentContact = new CF_StudentContact(); newStudentContact.UserID = newStudent.UserID; newStudentContact.Email = studentView.Email; newStudentContact.Telephone = studentView.Telephone; newStudentContact.Mobile = studentView.Mobile; newStudentContact.ZIPCode = studentView.ZIPCode; newStudentContact.WeChatNum = studentView.WeChatNum; newStudentContact.QQ = studentView.QQ; newStudentContact.HomeAddress = studentView.HomeAddress; newStudentContact.WorkUnit = studentView.WorkUnit; newStudentContact.Address = studentView.Address; newStudentContact.Recipient = studentView.Recipient; newStudentContact.Dormitory = studentView.Dormitory; this.SetNewStatus(newStudentContact); newStudentContactInList.Add(newStudentContact); var newStudentAccount = new CF_StudentAccount(); newStudentAccount.UserID = newStudent.UserID; newStudentAccount.CardNo = studentView.CardNo; newStudentAccount.BankName = studentView.BankName; this.SetNewStatus(newStudentAccount); newStudentAccountInList.Add(newStudentAccount); var newRecruitstudents = new CF_Recruitstudents(); newRecruitstudents.UserID = newStudent.UserID; newRecruitstudents.ExamineeNum = studentView.ExamineeNum; newRecruitstudents.AdmissionTicketNo = studentView.AdmissionTicketNo; newRecruitstudents.ExamineeType = studentView.ExamineeType; newRecruitstudents.EnteringSchoolYearID = studentView.StartSchoolyearID; newRecruitstudents.EntranceDate = studentView.EntranceDate; newRecruitstudents.Score = studentView.Score; newRecruitstudents.EntranceWayID = studentView.EntranceWayID; newRecruitstudents.FeaturesID = studentView.FeaturesID; newRecruitstudents.TerritorialID = studentView.TerritorialID; newRecruitstudents.Area = studentView.Area; //if (!string.IsNullOrEmpty(studentView.RecruitPictureUrl)) //{ // newRecruitstudents.RecruitPictureUrl = studentView.RecruitPictureUrl; //} this.SetNewStatus(newRecruitstudents); newRecruitstudentsInList.Add(newRecruitstudents); } using (TransactionScope ts = new TransactionScope()) { UnitOfWork.BulkInsert(newUserInList); UnitOfWork.BulkInsert(newUserInList, (x => x.Sys_Role)); UnitOfWork.BulkInsert(newStudentInList); UnitOfWork.BulkInsert(newStudentProfileInList); UnitOfWork.BulkInsert(newStudentContactInList); UnitOfWork.BulkInsert(newStudentAccountInList); UnitOfWork.BulkInsert(newRecruitstudentsInList); if (newUserUpList != null && newUserUpList.Count() > 0) { UnitOfWork.BatchUpdate(newUserUpList); UnitOfWork.Delete(newUserUpList, (x => x.Sys_Role)); UnitOfWork.BulkInsert(newUserUpList, (x => x.Sys_Role)); } if (newStudentUpList != null && newStudentUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentUpList); } if (newStudentProfileUpList != null && newStudentProfileUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentProfileUpList); } if (newStudentContactUpList != null && newStudentContactUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentContactUpList); } if (newStudentAccountUpList != null && newStudentAccountUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentAccountUpList); } if (newRecruitstudentsUpList != null && newRecruitstudentsUpList.Count() > 0) { UnitOfWork.BatchUpdate(newRecruitstudentsUpList); } ts.Complete(); } } else { var studentVerify = StudentDAL.Value.StudentRepository.GetList(x => x.UserID != studentView.UserID, (x => x.Sys_User)).Where(x => x.Sys_User.LoginID == studentView.StudentNo.Trim()).SingleOrDefault(); if (studentVerify != null) { throw new Exception("已存在相同的学号(学号重复),请核查。"); } else { var staffVerify = StudentDAL.Value.StaffRepository.GetList(x => x.UserID != studentView.UserID, (x => x.Sys_User)).Where(x => x.Sys_User.LoginID == studentView.StudentNo.Trim()).SingleOrDefault(); if (staffVerify != null) { throw new Exception("教师信息中已存在相同的用户(用户名重复),请核查。"); } else { throw new Exception("用户信息中已存在相同的用户(用户名重复),请核查。"); } } } } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 删除 /// 注:删除成功后,需对相应的录取名单提交状态进行更新(以学号和证件号码进行查询) /// /// /// public bool StudentDelete(List userIDs) { try { var studentList = StudentDAL.Value.StudentRepository.GetList(x => userIDs.Contains(x.UserID), (x => x.Sys_User)).ToList(); var iDNumberList = studentList.Where(x => !string.IsNullOrEmpty(x.IDNumber)).Select(x => x.IDNumber).ToList(); var newStudentList = StudentDAL.Value.NewStudentRepository.GetList(x => iDNumberList.Contains(x.IDNumber)).ToList(); List newStudentUpList = new List(); foreach (var student in studentList) { var newStudent = newStudentList.Where(x => x.IDNumber == student.IDNumber && x.StudentNo == student.Sys_User.LoginID).SingleOrDefault(); if (newStudent != null) { newStudent.RecordStatus = (int)CF_NewStudentEnterStatus.NotSubmitted; SetModifyStatus(newStudent); newStudentUpList.Add(newStudent); } } UnitOfWork.Remove(x => userIDs.Contains((Guid)x.UserID)); UnitOfWork.Remove(x => userIDs.Contains((Guid)x.UserID)); UnitOfWork.Remove(x => userIDs.Contains(x.UserID)); UnitOfWork.Remove(x => userIDs.Contains(x.UserID)); UnitOfWork.Remove(x => userIDs.Contains(x.UserID)); UnitOfWork.Remove(x => userIDs.Contains(x.UserID)); UnitOfWork.Remove(x => userIDs.Contains(x.UserID)); var userList = StudentDAL.Value.UserRepository.GetList(x => userIDs.Contains(x.UserID), (x => x.Sys_Role)).ToList(); userList.ForEach(x => x.Sys_Role = new HashSet()); UnitOfWork.Remove(x => userIDs.Contains(x.UserID)); UnitOfWork.Commit(); return true; } catch (Exception) { throw; } } /// /// 查询对应的学籍异动信息StudentChangeView /// /// /// /// /// /// /// /// public IGridResultSet GetStudentChangeViewGrid(ConfiguretView configuretView, Guid? userID, Guid? schoolyearID, int? changeTypeID, int pageIndex, int pageSize) { var approveStatusList = this.GetStatusViewList(); var endStatusID = this.GetCorrectEndStatus(); Expression> expStudentChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expStudentChange = expStudentChange.And(x => x.UserID == userID); expStudentChange = expStudentChange.And(x => x.ApprovalStatus == endStatusID); if (schoolyearID.HasValue) { expStudentChange = expStudentChange.And(x => x.SchoolyearID == schoolyearID); } if (changeTypeID.HasValue) { expStudentChange = expStudentChange.And(x => x.ChangeTypeID == changeTypeID); } var query = StudentChangeDAL.Value.GetStudentChangeViewQueryable(expStudentChange); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } var result = query.OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ThenBy(x => x.SchoolyearValue).ToGridResultSet(pageIndex, pageSize); result.rows.ForEach(x => x.ApprovalStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name); return result; } /// /// 查询对应的学籍异动信息List /// /// /// /// /// /// public IList GetStudentChangeViewList(ConfiguretView configuretView, Guid? userID, Guid? schoolyearID, int? changeTypeID) { var approveStatusList = this.GetStatusViewList(); var endStatusID = this.GetCorrectEndStatus(); Expression> expStudentChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expStudentChange = expStudentChange.And(x => x.UserID == userID); expStudentChange = expStudentChange.And(x => x.ApprovalStatus == endStatusID); if (schoolyearID.HasValue) { expStudentChange = expStudentChange.And(x => x.SchoolyearID == schoolyearID); } if (changeTypeID.HasValue) { expStudentChange = expStudentChange.And(x => x.ChangeTypeID == changeTypeID); } var query = StudentChangeDAL.Value.GetStudentChangeViewQueryable(expStudentChange); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } var result = query.OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ThenBy(x => x.SchoolyearValue).ToList(); result.ForEach(x => x.ApprovalStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name); return result; } /// /// 查询对应的学籍注册信息StudentReportView /// /// /// /// /// /// /// /// public IGridResultSet GetStudentReportViewGrid(ConfiguretView configuretView, Guid? userID, Guid? schoolyearID, int? reportStatus, int pageIndex, int pageSize) { Expression> expStudentReport = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expStudentReport = expStudentReport.And(x => x.UserID == userID); if (schoolyearID.HasValue) { expStudentReport = expStudentReport.And(x => x.SchoolyearID == schoolyearID); } if (reportStatus.HasValue) { expStudentReport = expStudentReport.And(x => x.ReportStatus == reportStatus); } var query = StudentReportDAL.Value.GetStudentReportViewQueryable(expStudentReport); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return query.OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ThenBy(x => x.SchoolyearValue).ToGridResultSet(pageIndex, pageSize); } /// /// 查询对应的学籍注册信息List /// /// /// /// /// /// public IList GetStudentReportViewList(ConfiguretView configuretView, Guid? userID, Guid? schoolyearID, int? reportStatus) { Expression> expStudentReport = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expStudentReport = expStudentReport.And(x => x.UserID == userID); if (schoolyearID.HasValue) { expStudentReport = expStudentReport.And(x => x.SchoolyearID == schoolyearID); } if (reportStatus.HasValue) { expStudentReport = expStudentReport.And(x => x.ReportStatus == reportStatus); } var query = StudentReportDAL.Value.GetStudentReportViewQueryable(expStudentReport); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return query.OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ThenBy(x => x.SchoolyearValue).ToList(); } /// /// 删除照片(单个删除) /// /// public void DeletePhoto(Guid? userID) { try { var student = StudentDAL.Value.StudentRepository.GetList(x => x.UserID == userID).SingleOrDefault(); if (student != null) { if (!string.IsNullOrEmpty(student.PhotoUrl)) { FileUploadHelper.DeleteFile(student.PhotoUrl); student.PhotoUrl = null; this.UnitOfWork.Commit(); } else { throw new Exception("对应的照片不存在。"); } } else { throw new Exception("对应的信息未保存,数据有误。"); } } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 删除照片(批量删除) /// /// /// public bool PicDelete(List userIDs) { try { List photoUrlList = new List(); List studentUpList = new List(); var studentList = StudentDAL.Value.StudentRepository.GetList(x => userIDs.Contains(x.UserID)).ToList(); foreach (var student in studentList) { if (student != null) { if (!string.IsNullOrEmpty(student.PhotoUrl)) { photoUrlList.Add(student.PhotoUrl); student.PhotoUrl = null; studentUpList.Add(student); } } } using (TransactionScope ts = new TransactionScope()) { foreach (var photoUrl in photoUrlList) { FileUploadHelper.DeleteFile(photoUrl); } if (studentUpList != null && studentUpList.Count() > 0) { UnitOfWork.BatchUpdate(studentUpList); } ts.Complete(); } return true; } catch (Exception) { throw; } } /// /// 照片比对通过 /// /// /// public string StudentPicComparisonPass(List userIDList) { try { var studentList = StudentDAL.Value.StudentRepository.GetList(x => userIDList.Contains(x.UserID), (x => x.CF_Recruitstudents)).ToList(); int success = 0; int fail = 0; string tipMessage = null; var studentUpList = new List(); foreach (var userID in userIDList) { var student = studentList.Where(x => x.UserID == userID).SingleOrDefault(); if (student == null) { throw new Exception("数据有误,请检查。"); } else { if (student.CF_Recruitstudents == null) { fail++; } else if (string.IsNullOrWhiteSpace(student.CF_Recruitstudents.RecruitPictureUrl) || string.IsNullOrWhiteSpace(student.PhotoUrl) || string.IsNullOrWhiteSpace(student.GraduationPictureUrl)) { fail++; } else { student.IsPhotoComparison = true; SetModifyStatus(student); studentUpList.Add(student); success++; } } } if (studentUpList != null && studentUpList.Count() > 0) { UnitOfWork.BatchUpdate(studentUpList); } if (success > 0 && fail <= 0) { tipMessage = success + "条"; } else { tipMessage = success + "条," + fail + "条失败,原因:录取照片、学籍照片或学历照片信息不全,请检查"; } return tipMessage; } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 照片比对驳回 /// /// /// public string StudentPicComparisonUndo(List userIDList) { try { var studentList = StudentDAL.Value.StudentRepository.GetList(x => userIDList.Contains(x.UserID), (x => x.CF_Recruitstudents)).ToList(); int success = 0; int fail = 0; string tipMessage = null; var studentUpList = new List(); foreach (var userID in userIDList) { var student = studentList.Where(x => x.UserID == userID).SingleOrDefault(); if (student == null) { fail++; } else { student.IsPhotoComparison = false; SetModifyStatus(student); studentUpList.Add(student); success++; } } if (studentUpList != null && studentUpList.Count() > 0) { UnitOfWork.BatchUpdate(studentUpList); } if (success > 0 && fail <= 0) { tipMessage = success + "条"; } else { tipMessage = success + "条," + fail + "条失败,原因:数据有误,请检查"; } return tipMessage; } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// DBF文件创建 /// /// /// /// /// public string CreateDBFFile(DataTable dt, List colnameList, string savePath = null) { if (dt == null || dt.Rows.Count <= 0) return null; if (colnameList == null || colnameList.Count <= 0) return null; var tagetPhysicalPath = FileUploadHelper.GetFileUploadTagetPhysicalPath(savePath); var newFileName = DateTime.Today.ToString("MMdd") + "DBF.dbf"; var physicalFileName = tagetPhysicalPath + newFileName; string connString = "Provider=Microsoft.Jet.OLEDB.4.0; " + "Data Source=" + tagetPhysicalPath + "; " + "Extended Properties=dBASE IV;"; OleDbConnection conn = new OleDbConnection(connString); conn.Open(); OleDbCommand oleDbComm; try { if (File.Exists(physicalFileName)) { File.Delete(physicalFileName); } StringBuilder createTable = new StringBuilder(); createTable.Append("CREATE TABLE " + newFileName + " ("); for (int i = 0; i < colnameList.Count; i++) { createTable.Append(colnameList[i]); if (colnameList[i].Equals("KSH", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(18)"); } else if (colnameList[i].Equals("XM", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(40)"); } else if (colnameList[i].Equals("XB", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(2)"); } else if (colnameList[i].Equals("CSRQ", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(8)"); } else if (colnameList[i].Equals("SFZH", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(18)"); } else if (colnameList[i].Equals("YXDM", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(5)"); } else if (colnameList[i].Equals("YXMC", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(60)"); } else if (colnameList[i].Equals("ZYDM", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(8)"); } else if (colnameList[i].Equals("ZYMC", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(50)"); } else if (colnameList[i].Equals("XZ", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(3)"); } else if (colnameList[i].Equals("XXXS", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(10)"); } else if (colnameList[i].Equals("CC", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(12)"); } else if (colnameList[i].Equals("RXRQ", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(8)"); } else if (colnameList[i].Equals("BYRQ", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(8)"); } else if (colnameList[i].Equals("BJYJL", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(4)"); } else if (colnameList[i].Equals("ZSBH", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(18)"); } else if (colnameList[i].Equals("XZM", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(40)"); } else if (colnameList[i].Equals("SYSSDM", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(2)"); } else if (colnameList[i].Equals("XH", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(15)"); } else if (colnameList[i].Equals("ZZMM", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(16)"); } else if (colnameList[i].Equals("MZ", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(24)"); } else if (colnameList[i].Equals("FY", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(24)"); } else if (colnameList[i].Equals("XSH", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(24)"); } else if (colnameList[i].Equals("BH", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(24)"); } else if (colnameList[i].Equals("BM", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(100)"); } else if (colnameList[i].Equals("YJBYRQ", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(8)"); } else if (colnameList[i].Equals("BZ", StringComparison.OrdinalIgnoreCase)) { createTable.Append(" char(50)"); } else { createTable.Append(" char(50)"); } if (i != colnameList.Count - 1) { createTable.Append(", "); } else { createTable.Append(")"); } } oleDbComm = new OleDbCommand(createTable.ToString(), conn); oleDbComm.ExecuteNonQuery(); StringBuilder createInsert = new StringBuilder(); foreach (DataRow dr in dt.Rows) { createInsert.Clear(); createInsert.Append(" INSERT INTO " + newFileName + " ("); for (int i = 0; i < colnameList.Count; i++) { createInsert.Append(colnameList[i]); if (i != colnameList.Count - 1) { createInsert.Append(", "); } } createInsert.Append(") VALUES ("); for (int i = 0; i < dt.Columns.Count; i++) { createInsert.Append("'" + dr[i].ToString() + "'"); if (i != dt.Columns.Count - 1) { createInsert.Append(", "); } else { createInsert.Append(")"); } } oleDbComm = new OleDbCommand(createInsert.ToString(), conn); oleDbComm.ExecuteNonQuery(); } return physicalFileName; } catch (Exception ex) { throw new Exception(ex.Message); } finally { conn.Close(); } } /// /// 操行录入 /// /// /// /// public string StudentConductInput(List userIDs, StudentConductView studentConductView) { try { var studentConductList = StudentDAL.Value.StudentConductRepository.GetList(x => userIDs.Contains(x.UserID)).ToList(); int success = 0; string tipMessage = null; List studentConductInList = new List(); List studentConductUpList = new List(); foreach (var userID in userIDs) { var studentConduct = studentConductList.Where(x => x.UserID == userID && x.SchoolyearNumID == studentConductView.SchoolyearNumID).SingleOrDefault(); if (studentConduct != null) { studentConduct.Comment = studentConductView.Comment; this.SetModifyStatus(studentConduct); studentConductUpList.Add(studentConduct); success++; } else { var newStudentConduct = new EM_StudentConduct(); newStudentConduct.StudentConductID = Guid.NewGuid(); newStudentConduct.UserID = userID; newStudentConduct.SchoolyearNumID = studentConductView.SchoolyearNumID; newStudentConduct.Comment = studentConductView.Comment; newStudentConduct.Remark = null; this.SetNewStatus(newStudentConduct); studentConductInList.Add(newStudentConduct); success++; } } UnitOfWork.BulkInsert(studentConductInList); if (studentConductUpList != null && studentConductUpList.Count() > 0) { UnitOfWork.BatchUpdate(studentConductUpList); } if (success > 0) { tipMessage = success + "条"; } else { tipMessage = success + "条"; } return tipMessage; } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 毕业证书编号Excel导入 /// /// /// /// /// /// /// public void GraduateNoImport(Dictionary cellheader, out int? inCount, out int? upCount, out List errdataList, out int? errCount, string sourcePhysicalPath) { try { StringBuilder errorMsg = new StringBuilder(); List errList = new List(); cellheader.Remove("ErrorMessage"); List enlist = NpoiExcelHelper.ExcelToEntityList(cellheader, sourcePhysicalPath, out errorMsg, out errList); cellheader.Add("ErrorMessage", "未导入原因"); //对List集合进行有效性校验 if (enlist.Count() <= 0) { throw new Exception("Excel文件数据为空,请检查。"); } Regex reg = null; //正则表达式 //DateTime result; //用于返回判断日期字段格式 inCount = 0; //导入个数 upCount = 0; //更新个数 errCount = 0; //失败个数 string errorMsgStr = ""; //错误信息 List newStudentInList = new List(); List newStudentUpList = new List(); //移除StuUpList List removeStuUpList = new List(); //将循环中相关数据库查询统一查询出来进行匹配(尽量避免在循环中进行数据库查询) Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); //身份证号List var iDNumberList = enlist.Where(x => !string.IsNullOrEmpty(x.IDNumber)).Select(x => x.IDNumber).ToList(); //毕业证书编号List var graduateCardNoList = enlist.Where(x => !string.IsNullOrEmpty(x.GraduateCardNo)).Select(x => x.GraduateCardNo).ToList(); expStudent = expStudent.And(x => iDNumberList.Contains(x.IDNumber) || graduateCardNoList.Contains(x.GraduateCardNo)); //对比后的newStudentList var newStudentList = StudentDAL.Value.StudentRepository.GetList(expStudent).ToList(); //循环检测数据列,对各数据列进行验证(必填、字典项验证、数据格式等) for (int i = 0; i < enlist.Count; i++) { StudentView en = enlist[i]; CF_Student newStudent = new CF_Student(); //身份证号 if (string.IsNullOrEmpty(en.IDNumber)) { errCount++; errorMsgStr = "身份证号不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var studentIDNumberList = newStudentList.Where(x => x.IDNumber == en.IDNumber.Trim()).ToList(); if (studentIDNumberList != null && studentIDNumberList.Count() > 1) { errCount++; errorMsgStr = "对应的身份证号存在多个学生信息,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var student = studentIDNumberList.Where(x => x.IDNumber == en.IDNumber.Trim()).SingleOrDefault(); if (student == null) { errCount++; errorMsgStr = "对应的身份证号不存在相应的学生信息,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { //学生信息 newStudent.UserID = student.UserID; newStudent.IDNumber = en.IDNumber.Trim(); } } } //毕业证书编号 if (string.IsNullOrEmpty(en.GraduateCardNo)) { errCount++; errorMsgStr = "毕业证书编号不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式(请输入数字或英文字母) if (!reg.IsMatch(en.GraduateCardNo)) { errCount++; errorMsgStr = "毕业证书编号格式不正确,请检查(数字或英文字母)"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var graduateNoStudentList = newStudentList.Where(x => x.UserID != newStudent.UserID && x.GraduateCardNo == en.GraduateCardNo.Trim()).ToList(); if (graduateNoStudentList != null && graduateNoStudentList.Count() > 1) { errCount++; errorMsgStr = "对应的毕业证书编号存在多个学生信息中(重复),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var graduateNoStudent = graduateNoStudentList.Where(x => x.GraduateCardNo == en.GraduateCardNo.Trim()).SingleOrDefault(); if (graduateNoStudent == null) { newStudent.GraduateCardNo = en.GraduateCardNo.Trim(); } else { errCount++; errorMsgStr = "对应的毕业证书编号已存在学生信息中(重复),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } } } ////Excel表重复性验证(注:当数据表中没有此记录,但是Excel中有重复数据时的去掉) //for (int j = i + 1; j < enlist.Count; j++) //{ // StudentView enA = enlist[j]; // //根据Excel表中的业务主键进行去重(学号、毕业证书编号或学生信息ID唯一) // if (en.StudentNo == enA.StudentNo || en.GraduateCardNo == enA.GraduateCardNo || en.UserID == enA.UserID) // { // //用于标识Excel表中的重复记录(由于是批量进行插入数据表) // } //} //数据表重复性验证(学号、毕业证书编号或学生信息ID唯一) var studentVerify = newStudentList.Where(x => x.UserID == newStudent.UserID).SingleOrDefault(); if (studentVerify == null) { //由于前面已做相应判断,此处代码暂时无效 //新增 if (!newStudentInList.Any(x => x.UserID == newStudent.UserID)) { inCount++; } else { //Excel表重复性验证 //(注:当数据表中没有此记录,但是Excel中有重复数据,可在此处进行抛出到失败数据文件中,目前暂不考虑) inCount++; } } else { //注:毕业证书编号唯一 //更新(Excel中有重复时,以数据重复抛出到失败数据文件中进行处理,不进行更新) if (!removeStuUpList.Any(x => x.GraduateCardNo == en.GraduateCardNo.Trim())) { if (!newStudentUpList.Any(x => x.GraduateCardNo == en.GraduateCardNo.Trim())) { studentVerify.GraduateCardNo = newStudent.GraduateCardNo; studentVerify.InSchoolStatusID = (int)CF_InschoolStatus.Graduation; studentVerify.StudentStatus = (int)CF_StudentStatus.Graduation; SetModifyStatus(studentVerify); newStudentUpList.Add(studentVerify); upCount++; } else { var stuUpList = newStudentUpList.Where(x => x.GraduateCardNo == en.GraduateCardNo.Trim()).ToList(); foreach (var stuUp in stuUpList) { errCount++; errorMsgStr = "毕业证书编号重复,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(new StudentView() { IDNumber = en.IDNumber, GraduateCardNo = en.GraduateCardNo, ErrorMessage = en.ErrorMessage }); errorMsg.AppendLine(errorMsgStr); newStudentUpList.Remove(stuUp); removeStuUpList.Add(stuUp); upCount--; } errCount++; errorMsgStr = "毕业证书编号重复,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "毕业证书编号重复,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } } //移除Up if (removeStuUpList != null && removeStuUpList.Count() > 0) { foreach (var removeStuUp in removeStuUpList) { newStudentUpList.Remove(removeStuUp); } } //批量统一提交更新 if (newStudentUpList != null && newStudentUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentUpList); } errdataList = errList.Distinct().ToList(); } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 导入学籍照片 /// /// /// /// /// /// public void StudentPicImport(IList photoPaths, string importPicType, out int? inCount, out int? errCount, out DataTable errDataTable) { try { var mapList = photoPaths.Select(s => new { PhotoInfo = Path.GetFileName(s).Trim(), PhotoName = Path.GetFileNameWithoutExtension(s).Trim(), PhotoPath = s, }).ToArray(); var photoNameList = mapList.Select(s => s.PhotoName).Distinct().ToList(); inCount = 0; errCount = 0; errDataTable = new DataTable(); List studentUpList = new List(); if (importPicType.Equals("StudentNo")) { errDataTable.Columns.Add("PhotoInfo", typeof(string)); errDataTable.Columns.Add("StudentNo", typeof(string)); errDataTable.Columns.Add("ErrorMessage", typeof(string)); var userList = StudentDAL.Value.UserRepository.GetList(x => photoNameList.Contains(x.LoginID), (x => x.CF_Student)).ToList(); foreach (var map in mapList) { var user = userList.Where(x => x.LoginID == map.PhotoName).SingleOrDefault(); if (user == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["StudentNo"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的学号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { if (user.CF_Student == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["StudentNo"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的学号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { user.CF_Student.PhotoUrl = map.PhotoPath; studentUpList.Add(user.CF_Student); inCount++; } } } } else if (importPicType.Equals("ExamineeNum")) { var newPhotoNameList = new List(); foreach (var photoName in photoNameList) { var photoNameStart = photoName.Substring(0, 1); if (photoNameStart.Equals("F") || photoNameStart.Equals("Z")) { newPhotoNameList.Add(photoName.Substring(1)); } } errDataTable.Columns.Add("PhotoInfo", typeof(string)); errDataTable.Columns.Add("ExamineeNum", typeof(string)); errDataTable.Columns.Add("ErrorMessage", typeof(string)); var recruitStudentList = StudentDAL.Value.RecruitstudentsRepository.GetList(x => photoNameList.Contains(x.ExamineeNum) || newPhotoNameList.Contains(x.ExamineeNum), (x => x.CF_Student)).ToList(); foreach (var map in mapList) { var photoNameStart = map.PhotoName.Substring(0, 1); if (photoNameStart.Equals("F") || photoNameStart.Equals("Z")) { var recruitStudent = recruitStudentList.Where(x => x.ExamineeNum == map.PhotoName || x.ExamineeNum == map.PhotoName.Substring(1)).SingleOrDefault(); if (recruitStudent == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["ExamineeNum"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的考生号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { if (recruitStudent.CF_Student == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["ExamineeNum"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的考生号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { recruitStudent.CF_Student.PhotoUrl = map.PhotoPath; studentUpList.Add(recruitStudent.CF_Student); inCount++; } } } else { var recruitStudent = recruitStudentList.Where(x => x.ExamineeNum == map.PhotoName).SingleOrDefault(); if (recruitStudent == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["ExamineeNum"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的考生号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { if (recruitStudent.CF_Student == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["ExamineeNum"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的考生号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { recruitStudent.CF_Student.PhotoUrl = map.PhotoPath; studentUpList.Add(recruitStudent.CF_Student); inCount++; } } } } } else if (importPicType.Equals("IDNumber")) { errDataTable.Columns.Add("PhotoInfo", typeof(string)); errDataTable.Columns.Add("IDNumber", typeof(string)); errDataTable.Columns.Add("ErrorMessage", typeof(string)); var studentList = StudentDAL.Value.StudentRepository.GetList(x => photoNameList.Contains(x.IDNumber)).ToList(); foreach (var map in mapList) { var newStudentList = studentList.Where(x => x.IDNumber == map.PhotoName).ToList(); if (newStudentList != null && newStudentList.Count() > 1) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["IDNumber"] = map.PhotoName; errDataRow["ErrorMessage"] = "存在多个对应的证件号码(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { if (newStudentList != null && newStudentList.Count() == 1) { var student = newStudentList.Where(x => x.IDNumber == map.PhotoName).SingleOrDefault(); if (student == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["IDNumber"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的证件号码(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { student.PhotoUrl = map.PhotoPath; studentUpList.Add(student); inCount++; } } else { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["IDNumber"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的证件号码(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } } } } if (studentUpList != null && studentUpList.Count() > 0) { UnitOfWork.BatchUpdate(studentUpList); } } catch (Exception) { throw; } } /// /// 导入学历照片 /// /// /// public void StudentGraPicImport(IList photoPaths, string importGraPicType, out int? inCount, out int? errCount, out DataTable errDataTable) { try { var mapList = photoPaths.Select(s => new { PhotoInfo = Path.GetFileName(s).Trim(), PhotoName = Path.GetFileNameWithoutExtension(s).Trim(), PhotoPath = s, }).ToArray(); var photoNameList = mapList.Select(s => s.PhotoName).Distinct().ToList(); inCount = 0; errCount = 0; errDataTable = new DataTable(); List studentUpList = new List(); if (importGraPicType.Equals("StudentNo")) { errDataTable.Columns.Add("PhotoInfo", typeof(string)); errDataTable.Columns.Add("StudentNo", typeof(string)); errDataTable.Columns.Add("ErrorMessage", typeof(string)); var userList = StudentDAL.Value.UserRepository.GetList(x => photoNameList.Contains(x.LoginID), (x => x.CF_Student)).ToList(); foreach (var map in mapList) { var user = userList.Where(x => x.LoginID == map.PhotoName).SingleOrDefault(); if (user == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["StudentNo"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的学号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { if (user.CF_Student == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["StudentNo"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的学号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { user.CF_Student.GraduationPictureUrl = map.PhotoPath; studentUpList.Add(user.CF_Student); inCount++; } } } } else if (importGraPicType.Equals("ExamineeNum")) { var newPhotoNameList = new List(); foreach (var photoName in photoNameList) { var photoNameStart = photoName.Substring(0, 1); if (photoNameStart.Equals("F") || photoNameStart.Equals("Z")) { newPhotoNameList.Add(photoName.Substring(1)); } } errDataTable.Columns.Add("PhotoInfo", typeof(string)); errDataTable.Columns.Add("ExamineeNum", typeof(string)); errDataTable.Columns.Add("ErrorMessage", typeof(string)); var recruitStudentList = StudentDAL.Value.RecruitstudentsRepository.GetList(x => photoNameList.Contains(x.ExamineeNum) || newPhotoNameList.Contains(x.ExamineeNum), (x => x.CF_Student)).ToList(); foreach (var map in mapList) { var photoNameStart = map.PhotoName.Substring(0, 1); if (photoNameStart.Equals("F") || photoNameStart.Equals("Z")) { var recruitStudent = recruitStudentList.Where(x => x.ExamineeNum == map.PhotoName || x.ExamineeNum == map.PhotoName.Substring(1)).SingleOrDefault(); if (recruitStudent == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["ExamineeNum"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的考生号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { if (recruitStudent.CF_Student == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["ExamineeNum"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的考生号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { recruitStudent.CF_Student.GraduationPictureUrl = map.PhotoPath; studentUpList.Add(recruitStudent.CF_Student); inCount++; } } } else { var recruitStudent = recruitStudentList.Where(x => x.ExamineeNum == map.PhotoName).SingleOrDefault(); if (recruitStudent == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["ExamineeNum"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的考生号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { if (recruitStudent.CF_Student == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["ExamineeNum"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的考生号(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { recruitStudent.CF_Student.GraduationPictureUrl = map.PhotoPath; studentUpList.Add(recruitStudent.CF_Student); inCount++; } } } } } else if (importGraPicType.Equals("IDNumber")) { errDataTable.Columns.Add("PhotoInfo", typeof(string)); errDataTable.Columns.Add("IDNumber", typeof(string)); errDataTable.Columns.Add("ErrorMessage", typeof(string)); var studentList = StudentDAL.Value.StudentRepository.GetList(x => photoNameList.Contains(x.IDNumber)).ToList(); foreach (var map in mapList) { var newStudentList = studentList.Where(x => x.IDNumber == map.PhotoName).ToList(); if (newStudentList != null && newStudentList.Count() > 1) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["IDNumber"] = map.PhotoName; errDataRow["ErrorMessage"] = "存在多个对应的证件号码(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { if (newStudentList != null && newStudentList.Count() == 1) { var student = newStudentList.Where(x => x.IDNumber == map.PhotoName).SingleOrDefault(); if (student == null) { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["IDNumber"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的证件号码(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } else { student.GraduationPictureUrl = map.PhotoPath; studentUpList.Add(student); inCount++; } } else { DataRow errDataRow = errDataTable.NewRow(); errDataRow["PhotoInfo"] = map.PhotoInfo; errDataRow["IDNumber"] = map.PhotoName; errDataRow["ErrorMessage"] = "不存在对应的证件号码(" + map.PhotoName + ")"; errDataTable.Rows.Add(errDataRow); errCount++; } } } } if (studentUpList != null && studentUpList.Count() > 0) { UnitOfWork.BatchUpdate(studentUpList); } } catch (Exception) { throw; } } /// /// 查询对应的学生照片RemoteFileInfoList /// /// /// /// public IList GetStudentPicRemoteFileInfoList(List studentViewList, string exportPicType) { try { var remoteFileList = new List(); if (studentViewList != null && studentViewList.Count() > 0) { switch (exportPicType) { case "StudentNoToPic": remoteFileList = studentViewList.Where(x => !string.IsNullOrEmpty(x.PhotoUrl)).Select(x => new EMIS.Utility.FileUploadHelper.RemoteFileInfo() { FileName = x.StudentNo + Path.GetExtension(x.PhotoUrl.Trim()), RemotePath = (x.PhotoUrl.Trim().StartsWith("http://") ? x.PhotoUrl.Trim() : x.PhotoUrl.Trim()) //Url.Content(x.PhotoUrl.Trim()) }).ToList(); break; case "ExamineeNumToPic": remoteFileList = studentViewList.Where(x => !string.IsNullOrEmpty(x.PhotoUrl)).Select(x => new EMIS.Utility.FileUploadHelper.RemoteFileInfo() { FileName = x.ExamineeNum + Path.GetExtension(x.PhotoUrl.Trim()), RemotePath = (x.PhotoUrl.Trim().StartsWith("http://") ? x.PhotoUrl.Trim() : x.PhotoUrl.Trim()) }).ToList(); break; case "IDNumberToPic": remoteFileList = studentViewList.Where(x => !string.IsNullOrEmpty(x.PhotoUrl)).Select(x => new EMIS.Utility.FileUploadHelper.RemoteFileInfo() { FileName = x.IDNumber + Path.GetExtension(x.PhotoUrl.Trim()), RemotePath = (x.PhotoUrl.Trim().StartsWith("http://") ? x.PhotoUrl.Trim() : x.PhotoUrl.Trim()) }).ToList(); break; case "StudentNoAndNameToPic": remoteFileList = studentViewList.Where(x => !string.IsNullOrEmpty(x.PhotoUrl)).Select(x => new EMIS.Utility.FileUploadHelper.RemoteFileInfo() { FileName = x.StudentNo + x.Name + Path.GetExtension(x.PhotoUrl.Trim()), RemotePath = (x.PhotoUrl.Trim().StartsWith("http://") ? x.PhotoUrl.Trim() : x.PhotoUrl.Trim()) }).ToList(); break; default: break; } } return remoteFileList; } catch (Exception) { throw; } } /// /// 查询默认的学习形式(个性化配置) /// 默认为全部 /// /// public virtual int? GetDefaultLearnformForList() { return null; } /// /// 查询班级信息对应的预计毕业日期DateTime /// /// /// public DateTime? GetClassmajorPlanningGraduateDate(Guid? classmajorID) { try { var classmajor = StudentDAL.Value.ClassmajorRepository.GetList(x => x.ClassmajorID == classmajorID, (x => x.CF_Grademajor)).SingleOrDefault(); if (classmajor != null) { if (classmajor.CF_Grademajor != null) { if (classmajor.CF_Grademajor.GraduateSchoolyearID.HasValue) { var graduateSchoolyear = StudentDAL.Value.SchoolyearRepository.GetList(x => x.SchoolyearID == classmajor.CF_Grademajor.GraduateSchoolyearID).SingleOrDefault(); if (graduateSchoolyear != null) { var planningGraduateDate = PlanningGraduateDateHelper.GetPlanningGraduateDate(graduateSchoolyear.FirstWeek); return planningGraduateDate; } } } return null; } else { return null; } } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 查询年级专业ID对应的预计毕业日期string /// /// /// public string GetPlanningGraduateDate(Guid? grademajorID) { try { var grademajor = StudentDAL.Value.GrademajorRepository.GetList(x => x.GrademajorID == grademajorID).SingleOrDefault(); if (grademajor != null) { if (grademajor.GraduateSchoolyearID.HasValue) { var graduateSchoolyear = StudentDAL.Value.SchoolyearRepository.GetList(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault(); if (graduateSchoolyear != null) { var planningGraduateDate = PlanningGraduateDateHelper.GetPlanningGraduateDate(graduateSchoolyear.FirstWeek); return planningGraduateDate.ToString("yyyy-MM-dd"); } } return null; } else { return null; } } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 查询班级信息对应的毕业学期中的毕业日期DateTime /// /// /// public DateTime? GetClassmajorGraduateDate(Guid? classmajorID) { try { var classmajor = StudentDAL.Value.ClassmajorRepository.GetList(x => x.ClassmajorID == classmajorID, (x => x.CF_Grademajor)).SingleOrDefault(); if (classmajor != null) { if (classmajor.CF_Grademajor != null) { if (classmajor.CF_Grademajor.GraduateSchoolyearID.HasValue) { var graduateSchoolyear = StudentDAL.Value.GraduateSchoolyearRepository.GetList(x => x.SchoolyearID == classmajor.CF_Grademajor.GraduateSchoolyearID).SingleOrDefault(); if (graduateSchoolyear != null) { var graduateDate = graduateSchoolyear.GraduateDate; return graduateDate; } } } return null; } else { return null; } } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 查询年级专业对应的毕业学期中的毕业日期string /// /// /// public string GetGraduateDate(Guid? grademajorID) { try { var grademajor = StudentDAL.Value.GrademajorRepository.GetList(x => x.GrademajorID == grademajorID).SingleOrDefault(); if (grademajor != null) { if (grademajor.GraduateSchoolyearID.HasValue) { var graduateSchoolyear = StudentDAL.Value.GraduateSchoolyearRepository .GetList(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault(); if (graduateSchoolyear != null) { var graduateDate = graduateSchoolyear.GraduateDate; if (graduateDate.HasValue) { return graduateDate.Value.ToString("yyyy-MM-dd"); } } } return null; } else { return null; } } catch (Exception ex) { throw new Exception(ex.Message); } } /// /// 查询对应的学生预计毕业日期 /// /// /// /// /// public IGridResultSet GetStudentPlanningGraduateDateGrid(ConfiguretView configuretView, int pageIndex, int pageSize) { Expression> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); var query = StudentDAL.Value.GetStudentPlanningGraduateDateQueryable(exp).Where(x => x.PlanningGraduateDate != null).ToList(); foreach (var item in query) { item.PlanningGraduateDateStr = item.PlanningGraduateDate.Value.ToString("yyyyMMdd"); } var result = query.AsQueryable(); //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { result = result.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return result.OrderByDescending(x => x.PlanningGraduateDateStr).ToGridResultSet(pageIndex, pageSize); } /// /// 查询对应的学生预计毕业日期List /// /// /// public IList GetStudentPlanningGraduateDateList(ConfiguretView configuretView) { Expression> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); var query = StudentDAL.Value.GetStudentPlanningGraduateDateQueryable(exp).Where(x => x.PlanningGraduateDate != null).ToList(); foreach (var item in query) { item.PlanningGraduateDateStr = item.PlanningGraduateDate.Value.ToString("yyyyMMdd"); } var result = query.AsQueryable(); //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { result = result.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return result.OrderByDescending(x => x.PlanningGraduateDateStr).ToList(); } /// /// 查询对应的数据范围ID /// /// public int? GetDataRangeID() { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; if (curUser.IsStudent) { return (int)SYS_DataRange.Student; } var menuNo = HttpHelper.GetMenuNo(); if (string.IsNullOrEmpty(menuNo)) { menuNo = HttpContext.Current.Request.UrlReferrer.GetQueryStringByPath("FromMNU"); } var dataRange = DataRangeDAL.Value.GetRoleDataRange(curUser.RoleID, menuNo); switch (dataRange) { case SYS_DataRange.All: return (int)SYS_DataRange.All; case SYS_DataRange.Campus: return (int)SYS_DataRange.Campus; case SYS_DataRange.College: return (int)SYS_DataRange.College; case SYS_DataRange.Department: return (int)SYS_DataRange.Department; case SYS_DataRange.Teacher: return (int)SYS_DataRange.Teacher; case SYS_DataRange.Assistant: return (int)SYS_DataRange.Assistant; default: return (int)SYS_DataRange.All; } } /// /// 学生信息Excel导入 /// /// /// /// /// /// /// public virtual void StudentImport(Dictionary cellheader, out int? inCount, out int? upCount, out List errdataList, out int? errCount, string sourcePhysicalPath) { try { //查询相关Web.config配置 if (EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateSpringMonth == null) { throw new Exception("预计毕业月(春季、上学期入学月)未配置,请检查。"); } if (EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateSpringDay == null) { throw new Exception("预计毕业日(春季、上学期入学日)未配置,请检查。"); } if (EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateAutumnMonth == null) { throw new Exception("预计毕业月(秋季、下学期入学月)未配置,请检查。"); } if (EMIS.Utility.Const.LOCAL_SETTING_PlanningGraduateDateAutumnDay == null) { throw new Exception("预计毕业日(秋季、下学期入学日)未配置,请检查。"); } if (EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID == null) { throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查。"); } var studentNoTotal = EMIS.Utility.Const.LOCAL_SETTING_LOGINIDTOTAL; if (studentNoTotal == null) { throw new Exception("学号总位数未配置,请检查。"); } StringBuilder errorMsg = new StringBuilder(); // 错误信息 List errList = new List(); // 1.1解析文件,存放到一个List集合里 cellheader.Remove("ErrorMessage");//移除“未导入原因”列(ErrorMessage) List enlist = NpoiExcelHelper.ExcelToEntityList(cellheader, sourcePhysicalPath, out errorMsg, out errList); cellheader.Add("ErrorMessage", "未导入原因"); //对List集合进行有效性校验 if (enlist.Count() <= 0) { throw new Exception("Excel文件数据为空,请检查。"); } Regex reg = null; //正则表达式 DateTime result; //用于返回判断日期字段格式 inCount = 0; //导入个数 upCount = 0; //更新个数 errCount = 0; //失败个数 string errorMsgStr = ""; //错误信息 List newUserInList = new List(); List newUserUpList = new List(); List newStudentInList = new List(); List newStudentUpList = new List(); List newStudentProfileInList = new List(); List newStudentProfileUpList = new List(); List newStudentContactInList = new List(); List newStudentContactUpList = new List(); List newStudentAccountInList = new List(); List newStudentAccountUpList = new List(); List newRecruitstudentsInList = new List(); List newRecruitstudentsUpList = new List(); var passwordParameter = StudentDAL.Value.ParameterRepository.GetSingle(x => x.ParameterTypeID == (int)ViewModel.CF_ParameterType.StudentInitPassword); var roleList = StudentDAL.Value.RoleRepository.GetList(x => x.TypeID == (int)SYS_RoleType.Student, (x => x.CF_StudentRole)).ToList(); //将循环中相关数据库查询统一查询出来进行匹配(尽量避免在循环中进行数据库查询) //性别 var sexList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Sex).ToList(); //民族 var nationList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Nation).ToList(); //政治面貌 var politicsList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Politics).ToList(); //学生类别 var studentTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_STUDENTTYPE).ToList(); //证件类型 var certificatesTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CertificatesType).ToList(); //在校状态 var inschoolStatusList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_InschoolStatus).ToList(); //学籍状态 var studentStatusList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_StudentStatus).ToList(); //文化程度 var literacyLevelList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_LiteracyLevel).ToList(); //培养方式 var cultureModelList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_CULTUREMODEL).ToList(); //考生类别 var examineeTypeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_EXAMINEETYPE).ToList(); //入学方式 var entranceWayList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_EntranceWay).ToList(); //考生特征 var featuresList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Features).ToList(); //生源所属地 var territorialList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_Province).ToList(); //健康状况 var healthStateList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_HealthState).ToList(); //血型 var bloodGroupList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_BLOODGROUP).ToList(); //是否 var generalPurposeList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_GeneralPurpose).ToList(); //有无 var generalExistList = IdNameExt.GetDictionaryItem(DictionaryItem.CF_GeneralExist).ToList(); //班级编号 var classmajorNoList = enlist.Where(x => !string.IsNullOrEmpty(x.ClassmajorNo)).Select(x => x.ClassmajorNo.Trim()).ToList(); //对比后的newClassmajorList var newClassmajorList = StudentDAL.Value.ClassmajorRepository.GetList(x => classmajorNoList.Contains(x.No)).ToList(); //学籍卡编号 var studentCardNoList = enlist.Where(x => !string.IsNullOrEmpty(x.StudentCardNo)).Select(x => x.StudentCardNo.Trim()).ToList(); //对比后的newStudentCardNoList var newStudentCardNoList = StudentDAL.Value.StudentRepository.GetList(x => studentCardNoList.Contains(x.StudentCardNo)).ToList(); //毕结业证书编号 var graduateCardNoList = enlist.Where(x => !string.IsNullOrEmpty(x.GraduateCardNo)).Select(x => x.GraduateCardNo.Trim()).ToList(); //对比后的newGraduateCardNoList var newGraduateCardNoList = StudentDAL.Value.StudentRepository.GetList(x => graduateCardNoList.Contains(x.GraduateCardNo)).ToList(); //考生号 var examineeNumList = enlist.Where(x => !string.IsNullOrEmpty(x.ExamineeNum)).Select(x => x.ExamineeNum.Trim()).ToList(); //对比后的newExamineeNumList var newExamineeNumList = StudentDAL.Value.RecruitstudentsRepository.GetList(x => examineeNumList.Contains(x.ExamineeNum)).ToList(); //学号 var studentNoList = enlist.Where(x => !string.IsNullOrEmpty(x.StudentNo)).Select(x => x.StudentNo.Trim()).ToList(); //对比后的newNewStuList var newNewStuList = StudentDAL.Value.NewStudentRepository.GetList(x => x.AssignStatus == (int)CF_AssignStatus.Assigned).Where(x => studentNoList.Contains(x.StudentNo)).ToList(); //对比后的newStudentList var newStudentList = StudentDAL.Value.StudentRepository.GetList(x => studentNoList.Contains(x.Sys_User.LoginID), (x => x.CF_StudentProfile), (x => x.CF_StudentContact), (x => x.CF_StudentAccount), (x => x.CF_Recruitstudents), (x => x.Sys_User)).ToList(); //循环检测数据列,对各数据列进行验证(必填、字典项验证、数据格式等) for (int i = 0; i < enlist.Count; i++) { StudentView en = enlist[i]; //Excel表数据视图 var newUser = new Sys_User(); var newStudent = new CF_Student(); var newStudentProfile = new CF_StudentProfile(); var newStudentContact = new CF_StudentContact(); var newStudentAccount = new CF_StudentAccount(); var newRecruitstudents = new CF_Recruitstudents(); //考生号 if (string.IsNullOrWhiteSpace(en.ExamineeNum)) { errCount++; errorMsgStr = "考生号不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式(请输入数字或英文字母) if (!reg.IsMatch(en.ExamineeNum.Trim())) { errCount++; errorMsgStr = "考生号格式不正确,请检查(数字或英文字母)"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newRecruitstudents.ExamineeNum = en.ExamineeNum.Trim(); } } //准考证号 if (string.IsNullOrWhiteSpace(en.AdmissionTicketNo)) { //暂不考虑 } else { reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式(请输入数字或英文字母) if (!reg.IsMatch(en.AdmissionTicketNo.Trim())) { errCount++; errorMsgStr = "准考证号格式不正确,请检查(数字或英文字母)"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newRecruitstudents.AdmissionTicketNo = en.AdmissionTicketNo.Trim(); } } //学号 if (string.IsNullOrWhiteSpace(en.StudentNo)) { errCount++; errorMsgStr = "学号不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式(请输入数字或英文字母) if (!reg.IsMatch(en.StudentNo.Trim())) { errCount++; errorMsgStr = "学号格式不正确,请检查(数字或英文字母)"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { if (en.StudentNo.Trim().Length != Convert.ToInt32(studentNoTotal)) { errCount++; errorMsgStr = "学号总位数有误,学号总位数应为" + studentNoTotal + "位。"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newUser.LoginID = en.StudentNo.Trim(); } } } //姓名 if (string.IsNullOrWhiteSpace(en.Name)) { errCount++; errorMsgStr = "姓名不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newUser.Name = en.Name.Trim(); } //曾用名 if (string.IsNullOrWhiteSpace(en.UsedName)) { //暂不考虑 } else { newStudentProfile.UsedName = en.UsedName.Trim(); } //性别 if (string.IsNullOrWhiteSpace(en.SexStr)) { errCount++; errorMsgStr = "性别不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var sex = sexList.Where(x => x.Name == en.SexStr.Trim()).SingleOrDefault(); if (sex == null) { errCount++; errorMsgStr = "性别不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.SexID = sex.Value; } } //出生日期 if (string.IsNullOrWhiteSpace(en.BirthDateStr)) { errCount++; errorMsgStr = "出生日期不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { //reg = new Regex(@"(\d{4})-(\d{1,2})-(\d{1,2})"); //日期正则表达式,2017-12-28 if (!DateTime.TryParse(en.BirthDateStr, out result)) { errCount++; errorMsgStr = "出生日期格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.BirthDate = Convert.ToDateTime(en.BirthDateStr); } } //民族 if (string.IsNullOrWhiteSpace(en.NationStr)) { errCount++; errorMsgStr = "民族不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var nation = nationList.Where(x => x.Name == en.NationStr.Trim()).SingleOrDefault(); if (nation == null) { errCount++; errorMsgStr = "民族不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.NationID = nation.Value; } } //政治面貌 if (string.IsNullOrWhiteSpace(en.PoliticsStr)) { errCount++; errorMsgStr = "政治面貌不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var politics = politicsList.Where(x => x.Name == en.PoliticsStr.Trim()).SingleOrDefault(); if (politics == null) { errCount++; errorMsgStr = "政治面貌不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.PoliticsID = politics.Value; } } //学生类别 if (string.IsNullOrWhiteSpace(en.StudentTypeStr)) { newStudent.StudentType = (int)CF_STUDENTTYPE.DefaultType; } else { var studentType = studentTypeList.Where(x => x.Name == en.StudentTypeStr.Trim()).SingleOrDefault(); if (studentType == null) { errCount++; errorMsgStr = "学生类别不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.StudentType = studentType.Value; } } //证件类型 if (string.IsNullOrWhiteSpace(en.CertificatesTypeStr)) { //默认为身份证 newStudent.CertificatesType = (int)CF_CertificatesType.IdCrad; } else { var certificatesType = certificatesTypeList.Where(x => x.Name == en.CertificatesTypeStr.Trim()).SingleOrDefault(); if (certificatesType == null) { errCount++; errorMsgStr = "证件类型不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.CertificatesType = certificatesType.Value; } } //证件号码 if (string.IsNullOrWhiteSpace(en.IDNumber)) { errCount++; errorMsgStr = "证件号码不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { //reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式(请输入数字或英文字母) //if (!reg.IsMatch(en.IDNumber.Trim())) //{ // errCount++; // errorMsgStr = "证件号码格式不正确,请检查(数字或英文字母)"; // en.ErrorMessage = errorMsgStr; // errList.Add(en); // errorMsg.AppendLine(errorMsgStr); // continue; //} //else //{ // newStudent.IDNumber = en.IDNumber.Trim(); //} newStudent.IDNumber = en.IDNumber.Trim(); } //在校状态 if (string.IsNullOrWhiteSpace(en.InSchoolStatusStr)) { errCount++; errorMsgStr = "在校状态不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var inSchoolStatus = inschoolStatusList.Where(x => x.Name == en.InSchoolStatusStr.Trim()).SingleOrDefault(); if (inSchoolStatus == null) { errCount++; errorMsgStr = "在校状态不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.InSchoolStatusID = inSchoolStatus.Value; } } //学籍状态 if (string.IsNullOrWhiteSpace(en.StudentStatusStr)) { errCount++; errorMsgStr = "学籍状态不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var studentStatus = studentStatusList.Where(x => x.Name == en.StudentStatusStr.Trim()).SingleOrDefault(); if (studentStatus == null) { errCount++; errorMsgStr = "学籍状态不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.StudentStatus = studentStatus.Value; } } //班级编号 if (string.IsNullOrWhiteSpace(en.ClassmajorNo)) { errCount++; errorMsgStr = "班级编号不能为空"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var classmajor = newClassmajorList.Where(x => x.No == en.ClassmajorNo.Trim()).SingleOrDefault(); if (classmajor == null) { errCount++; errorMsgStr = "班级编号不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { //判断班级编号与班级名称(以班级编号为准) if (string.IsNullOrWhiteSpace(en.ClassmajorName)) { //暂不考虑 } else { //班级编号与班级名称不对应 if (classmajor.Name.Trim() != en.ClassmajorName.Trim()) { errCount++; errorMsgStr = "班级编号与班级名称不对应(以班级编号为准),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } newStudent.ClassmajorID = classmajor.ClassmajorID; newStudent.PlanningGraduateDate = this.GetClassmajorPlanningGraduateDate(classmajor.ClassmajorID); newStudent.GraduateDate = this.GetClassmajorGraduateDate(classmajor.ClassmajorID); } } //班级名称 if (string.IsNullOrWhiteSpace(en.ClassmajorName)) { //暂不考虑 } else { //暂不考虑 } //文化程度 if (string.IsNullOrWhiteSpace(en.LiteracyLevelStr)) { //暂不考虑 } else { var literacyLevel = literacyLevelList.Where(x => x.Name == en.LiteracyLevelStr.Trim()).SingleOrDefault(); if (literacyLevel == null) { errCount++; errorMsgStr = "文化程度不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentProfile.LiteracyLevelID = literacyLevel.Value; } } //培养方式 if (string.IsNullOrWhiteSpace(en.CultureModelStr)) { //暂不考虑 } else { var cultureModel = cultureModelList.Where(x => x.Name == en.CultureModelStr.Trim()).SingleOrDefault(); if (cultureModel == null) { errCount++; errorMsgStr = "培养方式不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentProfile.CultureModelID = cultureModel.Value; } } //考生类别 if (string.IsNullOrWhiteSpace(en.ExamineeTypeStr)) { //暂不考虑 } else { var examineeType = examineeTypeList.Where(x => x.Name == en.ExamineeTypeStr.Trim()).SingleOrDefault(); if (examineeType == null) { errCount++; errorMsgStr = "考生类别不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newRecruitstudents.ExamineeType = examineeType.Value; } } //入学日期 if (string.IsNullOrWhiteSpace(en.EntranceDateStr)) { //暂不考虑 } else { if (!DateTime.TryParse(en.EntranceDateStr, out result)) { errCount++; errorMsgStr = "入学日期格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newRecruitstudents.EntranceDate = Convert.ToDateTime(en.EntranceDateStr); } } //总分 if (string.IsNullOrWhiteSpace(en.ScoreStr)) { //暂不考虑 } else { reg = new Regex(@"^[0-9]+([.]{1}[0-9]+){0,1}$"); //数字正则表达式 if (!reg.IsMatch(en.ScoreStr)) { errCount++; errorMsgStr = "总分格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newRecruitstudents.Score = Convert.ToDecimal(en.ScoreStr); } } //入学方式 if (string.IsNullOrWhiteSpace(en.EntranceWayStr)) { //暂不考虑 } else { var entranceWay = entranceWayList.Where(x => x.Name == en.EntranceWayStr.Trim()).SingleOrDefault(); if (entranceWay == null) { errCount++; errorMsgStr = "入学方式不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newRecruitstudents.EntranceWayID = entranceWay.Value; } } //考生特征 if (string.IsNullOrWhiteSpace(en.FeaturesStr)) { //暂不考虑 } else { var features = featuresList.Where(x => x.Name == en.FeaturesStr.Trim()).SingleOrDefault(); if (features == null) { errCount++; errorMsgStr = "考生特征不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newRecruitstudents.FeaturesID = features.Value; } } //生源所属地 if (string.IsNullOrWhiteSpace(en.TerritorialStr)) { //暂不考虑 } else { var territorial = territorialList.Where(x => x.Name == en.TerritorialStr.Trim()).SingleOrDefault(); if (territorial == null) { errCount++; errorMsgStr = "生源所属地不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newRecruitstudents.TerritorialID = territorial.Value; } } //来源地区 if (string.IsNullOrWhiteSpace(en.Area)) { //暂不考虑 } else { newRecruitstudents.Area = en.Area.Trim(); } //国籍 if (string.IsNullOrWhiteSpace(en.Country)) { //暂不考虑 } else { newStudentProfile.Country = en.Country.Trim(); } //籍贯 if (string.IsNullOrWhiteSpace(en.Place)) { //暂不考虑 } else { newStudentProfile.Place = en.Place.Trim(); } //出生地 if (string.IsNullOrWhiteSpace(en.BornPlace)) { //暂不考虑 } else { newStudentProfile.BornPlace = en.BornPlace.Trim(); } //电子邮箱 if (string.IsNullOrWhiteSpace(en.Email)) { //暂不考虑 } else { reg = new Regex(@"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"); //正则表达式 if (!reg.IsMatch(en.Email.Trim())) { errCount++; errorMsgStr = "电子邮箱格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentContact.Email = en.Email.Trim(); } } //移动电话 if (string.IsNullOrWhiteSpace(en.Mobile)) { //暂不考虑 } else { newStudentContact.Mobile = en.Mobile.Trim(); } //家庭电话 if (string.IsNullOrWhiteSpace(en.Telephone)) { //暂不考虑 } else { newStudentContact.Telephone = en.Telephone.Trim(); } //邮政编码 if (string.IsNullOrWhiteSpace(en.ZIPCode)) { //暂不考虑 } else { reg = new Regex(@"[1-9]\d{5}(?!\d)"); //正则表达式 if (!reg.IsMatch(en.ZIPCode.Trim())) { errCount++; errorMsgStr = "邮政编码格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentContact.ZIPCode = en.ZIPCode.Trim(); } } //健康状况 if (string.IsNullOrWhiteSpace(en.HealthStateStr)) { newStudentProfile.HealthStateID = (int)CF_HealthState.Healthy; } else { var healthState = healthStateList.Where(x => x.Name == en.HealthStateStr.Trim()).SingleOrDefault(); if (healthState == null) { errCount++; errorMsgStr = "健康状况不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentProfile.HealthStateID = healthState.Value; } } //血型 if (string.IsNullOrWhiteSpace(en.BloodGroupStr)) { //暂不考虑 } else { var bloodGroup = bloodGroupList.Where(x => x.Name == en.BloodGroupStr.Trim()).SingleOrDefault(); if (bloodGroup == null) { errCount++; errorMsgStr = "血型不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentProfile.BloodGroup = bloodGroup.Value; } } //特长 if (string.IsNullOrWhiteSpace(en.Specialty)) { //暂不考虑 } else { newStudentProfile.Specialty = en.Specialty.Trim(); } //身高(cm) if (string.IsNullOrWhiteSpace(en.Height)) { //暂不考虑 } else { reg = new Regex(@"^\d+(\.\d+)?$"); //正则表达式 if (!reg.IsMatch(en.Height.Trim())) { errCount++; errorMsgStr = "身高(cm)格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentProfile.Height = en.Height.Trim(); } } //体重(kg) if (string.IsNullOrWhiteSpace(en.Weight)) { //暂不考虑 } else { reg = new Regex(@"^\d+(\.\d+)?$"); //正则表达式 if (!reg.IsMatch(en.Weight.Trim())) { errCount++; errorMsgStr = "体重(cm)格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentProfile.Weight = en.Weight.Trim(); } } //微信号 if (string.IsNullOrWhiteSpace(en.WeChatNum)) { //暂不考虑 } else { newStudentContact.WeChatNum = en.WeChatNum.Trim(); } //QQ if (string.IsNullOrWhiteSpace(en.QQ)) { //暂不考虑 } else { reg = new Regex(@"[1-9][0-9]{4,}"); //正则表达式 if (!reg.IsMatch(en.QQ.Trim())) { errCount++; errorMsgStr = "QQ格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentContact.QQ = en.QQ.Trim(); } } //家庭住址 if (string.IsNullOrWhiteSpace(en.HomeAddress)) { //暂不考虑 } else { newStudentContact.HomeAddress = en.HomeAddress.Trim(); } //工作单位 if (string.IsNullOrWhiteSpace(en.WorkUnit)) { //暂不考虑 } else { newStudentContact.WorkUnit = en.WorkUnit.Trim(); } //通信地址 if (string.IsNullOrWhiteSpace(en.Address)) { //暂不考虑 } else { newStudentContact.Address = en.Address.Trim(); } //宿舍地址 if (string.IsNullOrWhiteSpace(en.Dormitory)) { //暂不考虑 } else { newStudentContact.Dormitory = en.Dormitory.Trim(); } //收件人 if (string.IsNullOrWhiteSpace(en.Recipient)) { //暂不考虑 } else { newStudentContact.Recipient = en.Recipient.Trim(); } //圆梦计划 if (string.IsNullOrWhiteSpace(en.IsDreamProjectStr)) { newStudentProfile.IsDreamProject = false; } else { var isDreamProject = generalPurposeList.Where(x => x.Name == en.IsDreamProjectStr.Trim()).SingleOrDefault(); if (isDreamProject == null) { errCount++; errorMsgStr = "是否圆梦计划不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentProfile.IsDreamProject = isDreamProject.Value == (int)CF_GeneralPurpose.IsYes ? true : false; } } //导师姓名 if (string.IsNullOrWhiteSpace(en.DirectorName)) { //暂不考虑 } else { newStudentProfile.DirectorName = en.DirectorName.Trim(); } //开户银行 if (string.IsNullOrWhiteSpace(en.BankName)) { //暂不考虑 } else { newStudentAccount.BankName = en.BankName.Trim(); } //银行卡号 if (string.IsNullOrWhiteSpace(en.CardNo)) { //暂不考虑 } else { reg = new Regex(@"^[0-9]*$"); //正则表达式 if (!reg.IsMatch(en.CardNo.Trim())) { errCount++; errorMsgStr = "银行卡号格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudentAccount.CardNo = en.CardNo.Trim(); } } //学籍卡编号 if (string.IsNullOrWhiteSpace(en.StudentCardNo)) { //暂不考虑 } else { reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式 if (!reg.IsMatch(en.StudentCardNo.Trim())) { errCount++; errorMsgStr = "学籍卡编号格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.StudentCardNo = en.StudentCardNo.Trim(); } } //毕结业证书编号 if (string.IsNullOrWhiteSpace(en.GraduateCardNo)) { //暂不考虑 } else { reg = new Regex(@"^[0-9a-zA-Z\s?]+$"); //正则表达式 if (!reg.IsMatch(en.GraduateCardNo.Trim())) { errCount++; errorMsgStr = "毕结业证书编号格式不正确,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.GraduateCardNo = en.GraduateCardNo.Trim(); } } //学位有无 if (string.IsNullOrWhiteSpace(en.DegreeStatusStr)) { newStudent.DegreeStatus = false; } else { var degreeStatus = generalExistList.Where(x => x.Name == en.DegreeStatusStr.Trim()).SingleOrDefault(); if (degreeStatus == null) { errCount++; errorMsgStr = "学位有无不存在,请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { newStudent.DegreeStatus = degreeStatus.Value == (int)CF_GeneralExist.Have ? true : false; } } //在校经历 if (string.IsNullOrWhiteSpace(en.Career)) { //暂不考虑 } else { newStudent.Career = en.Career.Trim(); } //备注 if (string.IsNullOrWhiteSpace(en.Remark)) { //暂不考虑 } else { newStudent.Remark = en.Remark.Trim(); } ////Excel表重复性验证(注:当数据表中没有此记录,但是Excel中有重复数据时的去掉) //for (int j = i + 1; j < enlist.Count; j++) //{ // StudentView enA = enlist[j]; // //根据Excel表中的业务主键进行去重(学号或考生号唯一) // if (en.StudentNo == enA.StudentNo || en.ExamineeNum == enA.ExamineeNum) // { // //用于标识Excel表中的重复记录(由于是批量进行插入数据表) // } //} //数据表重复性验证(学号或考生号唯一) var userVerify = newStudentList.Select(x => x.Sys_User).Where(x => x.LoginID == newUser.LoginID).SingleOrDefault(); if (userVerify == null) { var newNewStuVerify = newNewStuList.Where(x => x.ExamineeNum != newRecruitstudents.ExamineeNum && x.StudentNo == newUser.LoginID).SingleOrDefault(); if (newNewStuVerify != null) { errCount++; errorMsgStr = "学号重复(录取名单中学号重复),请核查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } if (!newRecruitstudentsUpList.Any(x => x.ExamineeNum == newRecruitstudents.ExamineeNum)) { if (!newRecruitstudentsInList.Any(x => x.ExamineeNum == newRecruitstudents.ExamineeNum)) { var newExamineeNumVerify = newExamineeNumList.Where(x => x.ExamineeNum == newRecruitstudents.ExamineeNum).SingleOrDefault(); if (newExamineeNumVerify != null) { errCount++; errorMsgStr = "考生号重复,请核查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "考生号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "考生号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } if (!string.IsNullOrEmpty(newStudent.StudentCardNo)) { if (!newStudentUpList.Any(x => x.StudentCardNo == newStudent.StudentCardNo)) { if (!newStudentInList.Any(x => x.StudentCardNo == newStudent.StudentCardNo)) { var newStudentCardNoVerify = newStudentCardNoList.Where(x => x.StudentCardNo == newStudent.StudentCardNo).SingleOrDefault(); if (newStudentCardNoVerify != null) { errCount++; errorMsgStr = "学籍卡编号重复,请核查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "学籍卡编号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "学籍卡编号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } if (!string.IsNullOrEmpty(newStudent.GraduateCardNo)) { if (!newStudentUpList.Any(x => x.GraduateCardNo == newStudent.GraduateCardNo)) { if (!newStudentInList.Any(x => x.GraduateCardNo == newStudent.GraduateCardNo)) { var newGraduateCardNoVerify = newGraduateCardNoList.Where(x => x.GraduateCardNo == newStudent.GraduateCardNo).SingleOrDefault(); if (newGraduateCardNoVerify != null) { errCount++; errorMsgStr = "毕结业证书编号重复,请核查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "毕结业证书编号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "毕结业证书编号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } //新增 if (!newUserInList.Any(x => x.LoginID == newUser.LoginID)) { newUser.UserID = Guid.NewGuid(); if (passwordParameter == null) { newUser.Password = ("A" + newUser.LoginID.Trim()).MD5(); } else { if (passwordParameter.Value != null) { newUser.Password = passwordParameter.Value; } else { newUser.Password = ("A" + newUser.LoginID.Trim()).MD5(); } } this.SetNewStatus(newUser, (int)SYS_STATUS.USABLE); newUserInList.Add(newUser); newUser.Sys_Role = new HashSet(); roleList = roleList.Where(x => x.CF_StudentRole.StudentType == newStudent.StudentType).ToList(); if (roleList != null && roleList.Count > 0) { roleList.ForEach(x => newUser.Sys_Role.Add(x)); } else { //对应角色为空时,默认为不分配用户角色 } newStudent.UserID = newUser.UserID; newStudent.IsPhotoComparison = false; newStudent.IsProofread = false; this.SetNewStatus(newStudent); newStudentInList.Add(newStudent); newStudentProfile.UserID = newStudent.UserID; this.SetNewStatus(newStudentProfile); newStudentProfileInList.Add(newStudentProfile); newStudentContact.UserID = newStudent.UserID; this.SetNewStatus(newStudentContact); newStudentContactInList.Add(newStudentContact); newStudentAccount.UserID = newStudent.UserID; this.SetNewStatus(newStudentAccount); newStudentAccountInList.Add(newStudentAccount); newRecruitstudents.UserID = newStudent.UserID; this.SetNewStatus(newRecruitstudents); newRecruitstudentsInList.Add(newRecruitstudents); inCount++; } else { //Excel表重复性验证 //(注:当数据表中没有此记录,但是Excel中有重复数据,可在此处进行抛出到失败数据文件中) errCount++; errorMsgStr = "学号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { //更新(判断Excel有重复时,以最后一条记录更新为准) var studentVerify = newStudentList.Where(x => x.UserID == userVerify.UserID).SingleOrDefault(); if (studentVerify == null) { errCount++; errorMsgStr = "学号冲突(与其它帐号冲突),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } else { var newNewStuVerify = newNewStuList.Where(x => x.ExamineeNum != newRecruitstudents.ExamineeNum && x.StudentNo == newUser.LoginID).SingleOrDefault(); if (newNewStuVerify != null) { errCount++; errorMsgStr = "学号重复(录取名单中学号重复),请核查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } if (!newRecruitstudentsInList.Any(x => x.ExamineeNum == newRecruitstudents.ExamineeNum)) { if (!newRecruitstudentsUpList.Any(x => x.ExamineeNum == newRecruitstudents.ExamineeNum)) { var newExamineeNumVerify = newExamineeNumList.Where(x => x.UserID != userVerify.UserID && x.ExamineeNum == newRecruitstudents.ExamineeNum).ToList(); if (newExamineeNumVerify != null && newExamineeNumVerify.Count() > 0) { errCount++; errorMsgStr = "考生号已存在(与其它学生冲突),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "考生号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "考生号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } if (!string.IsNullOrEmpty(newStudent.StudentCardNo)) { if (!newStudentInList.Any(x => x.StudentCardNo == newStudent.StudentCardNo)) { if (!newStudentUpList.Any(x => x.StudentCardNo == newStudent.StudentCardNo)) { var newStudentCardNoVerify = newStudentCardNoList.Where(x => x.UserID != userVerify.UserID && x.StudentCardNo == newStudent.StudentCardNo).ToList(); if (newStudentCardNoVerify != null && newStudentCardNoVerify.Count() > 0) { errCount++; errorMsgStr = "学籍卡编号已存在(与其它学生冲突),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "学籍卡编号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "学籍卡编号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } if (!string.IsNullOrEmpty(newStudent.GraduateCardNo)) { if (!newStudentInList.Any(x => x.GraduateCardNo == newStudent.GraduateCardNo)) { if (!newStudentUpList.Any(x => x.GraduateCardNo == newStudent.GraduateCardNo)) { var newGraduateCardNoVerify = newGraduateCardNoList.Where(x => x.UserID != userVerify.UserID && x.GraduateCardNo == newStudent.GraduateCardNo).ToList(); if (newGraduateCardNoVerify != null && newGraduateCardNoVerify.Count() > 0) { errCount++; errorMsgStr = "毕结业证书编号已存在(与其它学生冲突),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "毕结业证书编号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } else { errCount++; errorMsgStr = "毕结业证书编号重复(Excel中),请检查"; en.ErrorMessage = errorMsgStr; errList.Add(en); errorMsg.AppendLine(errorMsgStr); continue; } } studentVerify.Sys_User.LoginID = newUser.LoginID.Trim(); studentVerify.Sys_User.Name = newUser.Name.Trim(); this.SetModifyStatus(studentVerify.Sys_User); newUserUpList.Add(studentVerify.Sys_User); studentVerify.SexID = newStudent.SexID; studentVerify.BirthDate = newStudent.BirthDate; studentVerify.NationID = newStudent.NationID; studentVerify.PoliticsID = newStudent.PoliticsID; studentVerify.CertificatesType = newStudent.CertificatesType; studentVerify.IDNumber = newStudent.IDNumber; studentVerify.StudentType = newStudent.StudentType; studentVerify.Sys_User.Sys_Role = new HashSet(); roleList = roleList.Where(x => x.CF_StudentRole.StudentType == newStudent.StudentType).ToList(); if (roleList != null && roleList.Count > 0) { roleList.ForEach(x => studentVerify.Sys_User.Sys_Role.Add(x)); } else { //对应角色为空时,默认为不分配用户角色 } studentVerify.StudentCardNo = newStudent.StudentCardNo; studentVerify.GraduateCardNo = newStudent.GraduateCardNo; studentVerify.DegreeStatus = newStudent.DegreeStatus; studentVerify.Career = newStudent.Career; studentVerify.Remark = newStudent.Remark; this.SetModifyStatus(studentVerify); newStudentUpList.Add(studentVerify); if (studentVerify.CF_StudentProfile == null) { var studentProfile = new CF_StudentProfile(); studentProfile.UserID = studentVerify.UserID; studentProfile.UsedName = newStudentProfile.UsedName; studentProfile.LiteracyLevelID = newStudentProfile.LiteracyLevelID; studentProfile.CultureModelID = newStudentProfile.CultureModelID; studentProfile.IsDreamProject = newStudentProfile.IsDreamProject; studentProfile.Country = newStudentProfile.Country; studentProfile.Place = newStudentProfile.Place; studentProfile.BornPlace = newStudentProfile.BornPlace; studentProfile.HealthStateID = newStudentProfile.HealthStateID; studentProfile.BloodGroup = newStudentProfile.BloodGroup; studentProfile.Specialty = newStudentProfile.Specialty; studentProfile.Height = newStudentProfile.Height; studentProfile.Weight = newStudentProfile.Weight; studentProfile.DirectorName = newStudentProfile.DirectorName; this.SetNewStatus(studentProfile); newStudentProfileInList.Add(studentProfile); } else { studentVerify.CF_StudentProfile.UsedName = newStudentProfile.UsedName; studentVerify.CF_StudentProfile.LiteracyLevelID = newStudentProfile.LiteracyLevelID; studentVerify.CF_StudentProfile.CultureModelID = newStudentProfile.CultureModelID; studentVerify.CF_StudentProfile.IsDreamProject = newStudentProfile.IsDreamProject; studentVerify.CF_StudentProfile.Country = newStudentProfile.Country; studentVerify.CF_StudentProfile.Place = newStudentProfile.Place; studentVerify.CF_StudentProfile.BornPlace = newStudentProfile.BornPlace; studentVerify.CF_StudentProfile.HealthStateID = newStudentProfile.HealthStateID; studentVerify.CF_StudentProfile.BloodGroup = newStudentProfile.BloodGroup; studentVerify.CF_StudentProfile.Specialty = newStudentProfile.Specialty; studentVerify.CF_StudentProfile.Height = newStudentProfile.Height; studentVerify.CF_StudentProfile.Weight = newStudentProfile.Weight; studentVerify.CF_StudentProfile.DirectorName = newStudentProfile.DirectorName; this.SetModifyStatus(studentVerify.CF_StudentProfile); newStudentProfileUpList.Add(studentVerify.CF_StudentProfile); } if (studentVerify.CF_StudentContact == null) { var studentContact = new CF_StudentContact(); studentContact.UserID = studentVerify.UserID; studentContact.Email = newStudentContact.Email; studentContact.Telephone = newStudentContact.Email; studentContact.Mobile = newStudentContact.Email; studentContact.ZIPCode = newStudentContact.ZIPCode; studentContact.WeChatNum = newStudentContact.WeChatNum; studentContact.QQ = newStudentContact.QQ; studentContact.HomeAddress = newStudentContact.HomeAddress; studentContact.WorkUnit = newStudentContact.WorkUnit; studentContact.Address = newStudentContact.Address; studentContact.Recipient = newStudentContact.Recipient; studentContact.Dormitory = newStudentContact.Dormitory; this.SetNewStatus(studentContact); newStudentContactInList.Add(studentContact); } else { studentVerify.CF_StudentContact.Email = newStudentContact.Email; studentVerify.CF_StudentContact.Telephone = newStudentContact.Telephone; studentVerify.CF_StudentContact.Mobile = newStudentContact.Mobile; studentVerify.CF_StudentContact.ZIPCode = newStudentContact.ZIPCode; studentVerify.CF_StudentContact.WeChatNum = newStudentContact.WeChatNum; studentVerify.CF_StudentContact.QQ = newStudentContact.QQ; studentVerify.CF_StudentContact.HomeAddress = newStudentContact.HomeAddress; studentVerify.CF_StudentContact.WorkUnit = newStudentContact.WorkUnit; studentVerify.CF_StudentContact.Address = newStudentContact.Address; studentVerify.CF_StudentContact.Recipient = newStudentContact.Recipient; studentVerify.CF_StudentContact.Dormitory = newStudentContact.Dormitory; this.SetModifyStatus(studentVerify.CF_StudentContact); newStudentContactUpList.Add(studentVerify.CF_StudentContact); } if (studentVerify.CF_StudentAccount == null) { var studentAccount = new CF_StudentAccount(); studentAccount.UserID = studentVerify.UserID; studentAccount.BankName = newStudentAccount.BankName; studentAccount.CardNo = newStudentAccount.CardNo; this.SetNewStatus(studentAccount); newStudentAccountInList.Add(studentAccount); } else { studentVerify.CF_StudentAccount.BankName = newStudentAccount.BankName; studentVerify.CF_StudentAccount.CardNo = newStudentAccount.CardNo; this.SetModifyStatus(studentVerify.CF_StudentAccount); newStudentAccountUpList.Add(studentVerify.CF_StudentAccount); } if (studentVerify.CF_Recruitstudents == null) { var recruitstudents = new CF_Recruitstudents(); recruitstudents.UserID = studentVerify.UserID; recruitstudents.ExamineeNum = newRecruitstudents.ExamineeNum; recruitstudents.AdmissionTicketNo = newRecruitstudents.AdmissionTicketNo; recruitstudents.ExamineeType = newRecruitstudents.ExamineeType; recruitstudents.EntranceDate = newRecruitstudents.EntranceDate; recruitstudents.Score = newRecruitstudents.Score; recruitstudents.EntranceWayID = newRecruitstudents.EntranceWayID; recruitstudents.FeaturesID = newRecruitstudents.FeaturesID; recruitstudents.TerritorialID = newRecruitstudents.TerritorialID; recruitstudents.Area = newRecruitstudents.Area; this.SetNewStatus(recruitstudents); newRecruitstudentsInList.Add(recruitstudents); } else { studentVerify.CF_Recruitstudents.ExamineeNum = newRecruitstudents.ExamineeNum; studentVerify.CF_Recruitstudents.AdmissionTicketNo = newRecruitstudents.AdmissionTicketNo; studentVerify.CF_Recruitstudents.ExamineeType = newRecruitstudents.ExamineeType; studentVerify.CF_Recruitstudents.EntranceDate = newRecruitstudents.EntranceDate; studentVerify.CF_Recruitstudents.Score = newRecruitstudents.Score; studentVerify.CF_Recruitstudents.EntranceWayID = newRecruitstudents.EntranceWayID; studentVerify.CF_Recruitstudents.FeaturesID = newRecruitstudents.FeaturesID; studentVerify.CF_Recruitstudents.TerritorialID = newRecruitstudents.TerritorialID; studentVerify.CF_Recruitstudents.Area = newRecruitstudents.Area; this.SetModifyStatus(studentVerify.CF_Recruitstudents); newRecruitstudentsUpList.Add(studentVerify.CF_Recruitstudents); } upCount++; } } } TransactionOptions transactionOption = new TransactionOptions(); transactionOption.IsolationLevel = System.Transactions.IsolationLevel.Serializable; transactionOption.Timeout = new TimeSpan(0, 3, 0); using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOption)) { UnitOfWork.BulkInsert(newUserInList); UnitOfWork.BulkInsert(newUserInList, (x => x.Sys_Role)); UnitOfWork.BulkInsert(newStudentInList); UnitOfWork.BulkInsert(newStudentProfileInList); UnitOfWork.BulkInsert(newStudentContactInList); UnitOfWork.BulkInsert(newStudentAccountInList); UnitOfWork.BulkInsert(newRecruitstudentsInList); if (newUserUpList != null && newUserUpList.Count() > 0) { UnitOfWork.BatchUpdate(newUserUpList); } if (newStudentUpList != null && newStudentUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentUpList); } if (newStudentProfileUpList != null && newStudentProfileUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentProfileUpList); } if (newStudentContactUpList != null && newStudentContactUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentContactUpList); } if (newStudentAccountUpList != null && newStudentAccountUpList.Count() > 0) { UnitOfWork.BatchUpdate(newStudentAccountUpList); } if (newRecruitstudentsUpList != null && newRecruitstudentsUpList.Count() > 0) { UnitOfWork.BatchUpdate(newRecruitstudentsUpList); } ts.Complete(); } errdataList = errList.Distinct().ToList(); //错误列表List } catch (Exception) { throw; } } /// /// 学生信息新增刷新相关业务处理 /// /// public void StudentOnAddRefresh(List userID) { throw new NotImplementedException(); } } }