using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel.ScoreManage; using System.Linq.Expressions; using EMIS.Entities; using EMIS.DataLogic.Repositories; namespace EMIS.DataLogic.ScoreManage { public class ScoreConvertByLevelDAL { public ScoreConvertByLevelScoreRepository ScoreConvertByLevelScoreRepository { get; set; } public UserRepository UserRepository { get; set; } public LevelScoreRepository LevelScoreRepository { get; set; } public StudentRepository StudentRepository { get; set; } public CollegeRepository CollegeRepository { get; set; } public FacultymajorRepository FacultymajorRepository { get; set; } public GrademajorRepository GrademajorRepository { get; set; } public ClassmajorRepository ClassmajorRepository { get; set; } public CoursematerialRepository CoursematerialRepository { get; set; } public ExaminationSubjectRepository ExaminationSubjectRepository { get; set; } public SchoolyearRepository SchoolyearRepository { get; set; } public IQueryable GetScoreConvertByLevelViewQueryable(Expression> exp) { var query = from convert in ScoreConvertByLevelScoreRepository.GetList(exp) from scy in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == convert.SchoolyearID) from ls in LevelScoreRepository.Entities.Where(x => x.LevelScoreID == convert.LevelScoreID) from es in ExaminationSubjectRepository.Entities.Where(x => x.ExaminationSubjectID == ls.ExaminationSubjectID) from user in UserRepository.Entities.Where(x => x.UserID == ls.UserID) from stu in StudentRepository.Entities.Where(x => x.UserID == user.UserID) from clas in ClassmajorRepository.Entities.Where(x => x.ClassmajorID == stu.ClassmajorID) from grade in GrademajorRepository.Entities.Where(x => x.GrademajorID == clas.GrademajorID) from faculty in FacultymajorRepository.Entities.Where(x => x.FacultymajorID == grade.FacultymajorID) from college in CollegeRepository.Entities.Where(x => x.CollegeID == faculty.CollegeID) from course in CoursematerialRepository.Entities.Where(x => convert.CoursematerialID == x.CoursematerialID) select new ScoreConvertByLevelView { ScoreConvertByLevelScoreID = convert.ScoreConvertByLevelScoreID, SchoolyearID = convert.SchoolyearID, SchoolyearCode = scy.Code, CollegeID = college.CollegeID, CollegeName = college.Name, Year = grade.GradeID, StandardID = faculty.StandardID, ClassmajorID = clas.ClassmajorID, ClassmajorName = clas.Name, LoginID = user.LoginID, UserID = user.UserID, UserName = user.Name, CourseCode = course.CourseCode, CoursematerialID = course.CoursematerialID, CourseName = course.CourseName, Score = convert.TotalScore, LevelScoreID = ls.LevelScoreID, LeveLScore = ls.TotalScore, ExaminationSubjectName = es.Name }; return query; } } }