using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.MinorManage.MinorSetting; using System.Linq.Expressions; using EMIS.Entities; namespace EMIS.DataLogic.MinorManage.MinorSetting { public class MinorControlDAL { public MinorControlRepository minorControlRepository { get; set; } public CollegeRepository collegeRepository { get; set; } public SchoolyearRepository schoolyearRepository { get; set; } public IQueryable GetMinorControlViewQueryable(Expression> exp) { var query = from mcr in minorControlRepository.GetList(exp) join cr in collegeRepository.Entities on mcr.CollegeID equals cr.CollegeID into gcr from gcrt in gcr.DefaultIfEmpty() join year in schoolyearRepository.Entities on mcr.SchoolyearID equals year.SchoolyearID select new MinorControlView { MinorControlID = mcr.MinorControlID, CollegeID = mcr.CollegeID, CollegeName = gcrt.Name, SchoolyearID = mcr.SchoolyearID, SchoolyearCode = year.Code, GradeYearID = mcr.GradeyearID, StartDate = mcr.StartDate, EndDate = mcr.EndDate }; return query; } } }