using EMIS.DataLogic.Repositories; using EMIS.Entities; using EMIS.ViewModel.ScoreManage.LevelScoreManage; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace EMIS.DataLogic.ScoreManage.LevelScoreManage { public class LevelSettingDAL { public LevelSettingRepository LevelSettingRepository { get; set; } public ExaminationSubjectRepository ExaminationSubjectRepository { get; set; } public UserRepository UserRepository { get; set; } /// /// 查询对应的成绩等级信息LevelSettingView /// /// /// public IQueryable GetLevelSettingViewQueryable(Expression> expLevelSetting) { var query = from lvst in LevelSettingRepository.GetList(expLevelSetting) join exsub in ExaminationSubjectRepository.Entities on lvst.ExaminationSubjectID equals exsub.ExaminationSubjectID join usc in UserRepository.Entities on lvst.CreateUserID equals usc.UserID into tempusc from uscu in tempusc.DefaultIfEmpty() join usm in UserRepository.Entities on lvst.ModifyUserID equals usm.UserID into tempusm from usmu in tempusm.DefaultIfEmpty() select new LevelSettingView { LevelSettingID = lvst.LevelSettingID, ExaminationSubjectID = lvst.ExaminationSubjectID, ExaminationSubjectName = exsub.Name, LevelNum = lvst.LevelNum ?? 0, LevelName = lvst.LevelName, MinScore = lvst.MinScore, MinScoreOperator = lvst.MinScoreOperator, MaxScore = lvst.MaxScore, MaxScoreOperator = lvst.MaxScoreOperator, TotalScoreRange = lvst.MinScore.ToString() + lvst.MinScoreOperator + "总成绩" + lvst.MaxScoreOperator + lvst.MaxScore.ToString(), Remark = lvst.Remark, RecordStatus = lvst.RecordStatus, CreateUserID = lvst.CreateUserID, CreateUserName = uscu.Name, CreateTime = lvst.CreateTime, ModifyUserID = lvst.ModifyUserID, ModifyUserName = usmu.Name, ModifyTime = lvst.ModifyTime }; return query; } } }