using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Linq.Expressions; using EMIS.Entities; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.Cultureplan; using EMIS.ViewModel.CultureplanManage.CourseMaterial; namespace EMIS.DataLogic.CultureplanManage.CourseMaterial { public class ClubCourseDAL { public ClubCourseRepository ClubCourseRepository { get; set; } public CoursematerialRepository CoursematerialRepository { get; set; } public ClassGroupingRepository ClassGroupingRepository { get; set; } /// /// 查询对应的俱乐部课程信息View /// /// /// public IQueryable GetClubCourseViewQueryable(Expression> exp) { var query = from club in ClubCourseRepository.GetList(exp) join cou in CoursematerialRepository.Entities on club.CoursematerialID equals cou.CoursematerialID join cg in ClassGroupingRepository.Entities on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg from coucg in tempcg.DefaultIfEmpty() select new ClubCourseView { ClubCourseID = club.ClubCourseID, CoursematerialID = club.CoursematerialID, CourseCode = cou.CourseCode, CourseName = cou.CourseName, Abbreviation = cou.Abbreviation, CourseLevelID = cou.CourseLevelID, CourseScienceID = cou.CourseScienceID, ClassGroupingID = cou.ClassGroupingID, ClassName = coucg.ClassName, IsEnable = cou.IsEnable == true ? true : false, RecordStatus = club.RecordStatus, CreateUserID = club.CreateUserID, CreateTime = club.CreateTime, ModifyUserID = club.ModifyUserID, ModifyTime = club.ModifyTime }; return query; } /// /// 查询对应的课程信息View(课程信息表左连俱乐部课程表,排除对应的俱乐部课程信息) /// /// /// public IQueryable GetCourseNoClubViewQueryable(Expression> exp) { var query = from cou in CoursematerialRepository.GetList(exp) join cg in ClassGroupingRepository.Entities on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg from coucg in tempcg.DefaultIfEmpty() join club in ClubCourseRepository.Entities on cou.CoursematerialID equals club.CoursematerialID into tempclub from clubcou in tempclub.DefaultIfEmpty() where clubcou.CoursematerialID == null select new CoursematerialView { CoursematerialID = cou.CoursematerialID, CourseCode = cou.CourseCode, CourseName = cou.CourseName, Abbreviation = cou.Abbreviation, EnglishName = cou.EnglishName, StandardName = cou.StandardName, CourseEdition = cou.CourseEdition, CourseLevelID = cou.CourseLevelID, CourseScienceID = cou.CourseScienceID, ClassGroupingID = cou.ClassGroupingID, ClassName = coucg.ClassName, CourseSynopsis = cou.CourseSynopsis, CourseReserve = cou.CourseReserve, IsEnable = cou.IsEnable == true ? true : false, Remark = cou.Remark, RecordStatus = cou.RecordStatus, CreateUserID = cou.CreateUserID, CreateTime = cou.CreateTime, ModifyUserID = cou.ModifyUserID, ModifyTime = cou.ModifyTime }; return query; } } }