using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.ScoreManage; using EMIS.ViewModel.ScoreManage; using EMIS.Entities; using System.Linq.Expressions; using EMIS.ViewModel; using Bowin.Common.Linq; using Bowin.Common.Linq.Entity; using Bowin.Common.DataTime; using Bowin.Common.Utility; using System.Text.RegularExpressions; using EMIS.DataLogic.Repositories; using EMIS.DataLogic.ExaminationApply; using EMIS.DataLogic.Common.CalendarManage; using EMIS.ViewModel.Cache; namespace EMIS.CommonLogic.ScoreManage { public class LevelScoreServices : BaseServices, ILevelScoreServices { public LevelScoreDAL levelScoreDAL { get; set; } public ExaminationScoreDAL examinationScoreDAL { get; set; } public StudentRepository studentRepository { get; set; } public ExaminationSubjectDAL examinationSubjectDAL { get; set; } public SchoolYearDAL schoolYearDAL { get; set; } //学生版过级成绩 public IGridResultSet GetStudentLevelScoreGrid(ConfiguretView configuretView, Guid userId, int pageIndex, int pageSize) { Expression> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); exp = (x => x.UserID == userId); var query = levelScoreDAL.GetLevelScoreViewQueryable(exp).ToList(); var examinationScoreList = examinationScoreDAL.GetExaminationScoreViewForProjectScore(exp).ToList(); //if (!string.IsNullOrEmpty(configuretView.ConditionValue)) // query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); query.ForEach(x => { var examinationScore = examinationScoreList.Where(y => y.UserID == userId && y.ExaminationProjectID == x.ExaminationProjectID); //x.ScoreList = new Dictionary(); foreach (var score in examinationScore) { //x.ScoreList.Add(score.ExaminationSubjectID, score.Score); x.ScoreStr += score.ExaminationSubjectName + ":" + score.Score + ";\r\n"; } }); var result = query.OrderBy(x => x.ExaminationProjectName).AsQueryable().ToGridResultSet(pageIndex, pageSize); return result; } public IGridResultSet GetExaminationScoreViewGrid(ConfiguretView configuretView, Guid? schoolYearID, Guid? examinationBatchID, Guid? examinationTypeID, Guid? examinationProjectID, int pageIndex, int pageSize) { Expression> esexp = x => true; Expression> ebrexp = x => true; Expression> ebexp = x => true; Expression> epexp = x => true; var user = EMIS.Utility.FormValidate.CustomPrincipal.Current; if (user != null) { esexp = esexp.And(x => x.UserID == user.UserID); } if (schoolYearID.HasValue) ebexp = ebexp.And(x => x.SchoolyearID == schoolYearID); if (examinationBatchID.HasValue) ebrexp = ebrexp.And(x => x.ExaminationBatchID == examinationBatchID); if (examinationTypeID.HasValue) epexp = epexp.And(x => x.ExaminationTypeID == examinationTypeID); if (examinationProjectID.HasValue) ebrexp = ebrexp.And(x => x.ExaminationProjectID == examinationProjectID); var query = examinationScoreDAL.GetExaminationScoreView(esexp, ebrexp, ebexp, epexp, x => true, x => true, x => true, x => true); if (!string.IsNullOrEmpty(configuretView.ConditionValue) && !string.IsNullOrEmpty(configuretView.Attribute)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); return query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.ExaminationBatchID).ThenBy(x => x.ExaminationTypeID).ThenBy(x => x.ExaminationProjectID) .ThenBy(x => x.ExaminationSubjectID).ToGridResultSet(pageIndex, pageSize); } } }