using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using System.Linq.Expressions; using EMIS.Entities; using EMIS.ViewModel.MinorManage.MinorApply; namespace EMIS.DataLogic.MinorManage.MinorApply { public class MinorApplyDAL { public StudentMinorRegistRepository studentMinorRegistRepository { get; set; } public UserRepository userRepository { get; set; } public SchoolyearRepository schoolyearRepository { get; set; } public StudentRepository studentRepository { get; set; } public GrademajorRepository grademajorRepository { get; set; } public ClassmajorRepository classmajorRepository { get; set; } public GrademinorRepository grademinorRepository { get; set; } public GrademinorApplicationRepository grademinorApplicationRepository { get; set; } public DictionaryItemRepository dictionaryItemRepository { get; set; } public CollegeRepository collegeRepository { get; set; } public FacultymajorRepository facultymajorRepository { get; set; } public IQueryable GetMinorApplyViewQueryable(Expression> exp, Expression> expcla, Expression> expcol) { var query = from stumrr in studentMinorRegistRepository.GetList(exp) join gm in grademinorRepository.Entities on stumrr.GrademinorID equals gm.GrademinorID join gmar in grademinorApplicationRepository.Entities on gm.GrademinorApplicationID equals gmar.GradeMinorApplicationID join dic in dictionaryItemRepository.GetList(x => x.DictionaryCode == "CF_Standard") on gmar.StandardID equals dic.Value join user in userRepository.Entities on stumrr.UserID equals user.UserID join year in schoolyearRepository.Entities on stumrr.SchoolyearID equals year.SchoolyearID join stu in studentRepository.Entities on stumrr.UserID equals stu.UserID join cla in classmajorRepository.GetList(expcla) on stu.ClassmajorID equals cla.ClassmajorID join gra in grademajorRepository.Entities on cla.GrademajorID equals gra.GrademajorID join fac in facultymajorRepository.Entities on gra.FacultymajorID equals fac.FacultymajorID join col in collegeRepository.GetList(expcol) on fac.CollegeID equals col.CollegeID select new MinorApplyView { StudentMinorRegistID = stumrr.StudentMinorRegistID, UserID = stumrr.UserID, LoginID = user.LoginID, UserName = user.Name, SchoolyearID = stumrr.SchoolyearID, SchoolyearCode = year.Code, GrademajorID = gra.GrademajorID, GrademajorCode = gra.Code, GrademajorName = gra.Name, GradeYearID = gm.YearID, ClassmajorID = cla.ClassmajorID, ClassmajorCode = cla.No, ClassmajorName = cla.Name, GrademinorID = gm.GrademinorID, GrademinorCode = dic.Code, GrademinorName = dic.Name, RecordStatus = stumrr.RecordStatus, CollegeID = col.CollegeID, CollegeCode = col.No, CollegeName = col.Name, OpenStatus = gm.RecordStatus, }; return query; } //public IQueryable GetMinorConditionViewQueryable() //{ //} } }