using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel.ScoreManage; using EMIS.DataLogic.Repositories; using EMIS.Entities; using System.Linq.Expressions; namespace EMIS.DataLogic.ScoreManage { public class NotPassStudentDAL { public FinallyScoreRepository finallyScoreRepository { get; set; } public UserRepository userRepository { get; set; } public IQueryable GetScoreViewQueryable(Expression> exp) { var query = from score in finallyScoreRepository.Entities group score by score.UserID into a join user in userRepository.GetList(exp) on a.Key equals user.UserID select new NotPassStudentView { UserID = a.Key, UserName = user.Name, LoginID = user.LoginID, CampusID = user.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CF_College.CF_Campus.CampusID, CampusName = user.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CF_College.CF_Campus.Name, Years = user.CF_Student.CF_Classmajor.CF_Grademajor.CF_Schoolyear.Years, StandardID = user.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID, ClassMajorID = user.CF_Student.CF_Classmajor.ClassmajorID, ClassMajorName = user.CF_Student.CF_Classmajor.Name, NotPassCount = a.Count(x => x.TotalScore < 60), }; return query; } } }