using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.MinorGraduation.MinorGraduationManage; using System.Linq.Expressions; using EMIS.Entities; namespace EMIS.DataLogic.MinorGraduation.MinorGraduationManage { public class MinorGraduationApplyDAL { public MinorGraduationApplyRepository minorGraduationApplyRepository { get; set; } public UserRepository userRepository { 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 ClassminorStudentRepository classminorStudentRepository { get; set; } public ClassminorRepository classminorRepository { get; set; } public SchoolyearRepository schoolyearRepository { get; set; } public IQueryable GetMinorGraduationApplyViewQueryable(Expression> exp, Expression> expstu) { var query = from mgar in minorGraduationApplyRepository.GetList(exp) join user in userRepository.Entities on mgar.UserID equals user.UserID join stu in studentRepository.GetList(expstu) on mgar.UserID equals stu.UserID join clastu in classminorStudentRepository.Entities on mgar.UserID equals clastu.UserID join appyear in schoolyearRepository.Entities on mgar.ApplySchoolyearID equals appyear.SchoolyearID join grayear in schoolyearRepository.Entities on mgar.GraduatingSemesterID equals grayear.SchoolyearID join claminor in classminorRepository.Entities on clastu.ClassminorID equals claminor.ClassminorID join cla in classmajorRepository.Entities 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.Entities on fac.CollegeID equals col.CollegeID select new MinorGraduationApplyView { MinorGraduationApplyID = mgar.MinorGraduationApplyID, UserID = mgar.UserID, StudentNo = user.LoginID, UserName = user.Name, Sex = stu.SexID, CollegeID = col.CollegeID, CollegeNo = col.No, CollegeName = col.Name, GraduationTypeID = mgar.GraduationTypeID, ClassminorID = claminor.ClassminorID, ClassminorName = claminor.Name, InSchoolStatusID = stu.InSchoolStatusID, ApprovalResult = mgar.ApprovalResult, ApplySchoolyearID = mgar.ApplySchoolyearID, ApplySchoolyearCode = appyear.Code, GraduatingSemesterID = mgar.GraduatingSemesterID, GraduatingSemesterCode = grayear.Code, GraduatingSemesterValue = grayear.Value, MinorGraduationConditionPackageID = mgar.MinorGraduationConditionPackageID, MinorGraduationResult = mgar.MinorGraduationResult, //RecordStatus = mgar.RecordStatus, ApprovalStatus = mgar.RecordStatus, Remark = mgar.Remark, }; return query; } } }