using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.ScoreManage; using EMIS.Entities; using System.Linq.Expressions; namespace EMIS.DataLogic.ScoreManage { public class LevelScoreDAL { public ExaminationScoreRepository examinationScoreRepository { get; set; } public ExaminationBatchProjectRepository examinationBatchProjectRepository { get; set; } public ExaminationBatchRepository examinationBatchRepository { get; set; } public ExaminationProjectRepository examinationProjectRepository { get; set; } public ProjectScoreRepository projectScoreRepository { get; set; } public LevelSettingRepository levelSettingRepository { get; set; } public StudentRepository studentRepository { get; set; } public ClassmajorRepository classmajorRepository { get; set; } public GrademajorRepository grademajorRepository { get; set; } public FacultymajorRepository facultymajorRepository { get; set; } public CollegeRepository collegeRepository { get; set; } public ExaminationScoreDAL examinationScoreDAL { get; set; } public IQueryable GetLevelScoreViewQueryable(Expression> psexp) { //var examinationScoreList = examinationScoreDAL.GetExaminationScoreView(esexp, x => true, x => true, x => true, x => true, x => true, x => true, x => true).ToList(); var query = from psr in projectScoreRepository.Entities.Where(psexp) from epr in examinationProjectRepository.Entities.Where(x => x.ExaminationProjectID == psr.ExaminationProjectID) from lsr in levelSettingRepository.Entities.Where(x => x.LevelSettingID == psr.LevelSettingID) from stu in studentRepository.Entities.Where(x => x.UserID == psr.UserID) from cla in classmajorRepository.Entities.Where(x => x.ClassmajorID == stu.ClassmajorID) from gra in grademajorRepository.Entities.Where(x => x.GrademajorID == cla.GrademajorID) from fac in facultymajorRepository.Entities.Where(x => x.FacultymajorID == gra.FacultymajorID) from col in collegeRepository.Entities.Where(x => x.CollegeID == fac.CollegeID) select new LevelScoreView { ProjectScoreID = psr.ProjectScoreID, ExaminationTypeID = epr.ExaminationTypeID, ExaminationTypeName = epr.EX_ExaminationType.Name, ExaminationProjectID = psr.ExaminationProjectID, ExaminationProjectName = epr.Name, LevelSettingID = psr.LevelSettingID, LevelName = lsr.LevelName, UserID = psr.UserID, IDNumber = stu.IDNumber, CollegeID = col.CollegeID, CollegeName = col.Name, StandardID = fac.StandardID, ClassmajorID = cla.ClassmajorID, ClassmajorName = cla.Name, StudentNo = stu.StudentCardNo, CertificatesType = stu.CertificatesType, }; return query; } } }