using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMISOnline.Entities; using EMISOnline.ViewModel.Educational; using EMISOnline.DataLogic.Repositories; using EMISOnline.ViewModel; namespace EMISOnline.DataLogic.Educational { public class TeachingPlanDAL { public EducationMissionRepository EducationMissionRepository { get; set; } public EducationMissionClassRepository EducationMissionClassRepository { get; set; } public ClassmajorRepository ClassmajorRepository { get; set; } public CoursematerialRepository CoursematerialRepository { get; set; } public GrademajorRepository GrademajorRepository { get; set; } public FacultymajorRepository FacultymajorRepository { get; set; } public CollegeRepository CollegeRepository { get; set; } public SchoolyearRepository SchoolyearRepository { get; set; } public DictionaryItemRepository DictionaryItemRepository { get; set; } public IQueryable GetTeachingPlanList() { var query = from emc in EducationMissionClassRepository.Entities join em in EducationMissionRepository.Entities on emc.EducationMissionID equals em.EducationMissionID join col in CollegeRepository.Entities on em.CollegeID equals col.CollegeID join c in ClassmajorRepository.Entities on emc.MainScheduleClassID equals c.ClassmajorID into dc from c in dc.DefaultIfEmpty() join g in GrademajorRepository.Entities on c.GrademajorID equals g.GrademajorID into dg from g in dg.DefaultIfEmpty() join fam in FacultymajorRepository.Entities on g.FacultymajorID equals fam.FacultymajorID into df from fam in df.DefaultIfEmpty() join sdic in DictionaryItemRepository.Entities.Where(d => d.DictionaryCode == (typeof(CF_Standard).Name)) on fam.StandardID equals sdic.Value into standard from stype in standard.DefaultIfEmpty() join scy in SchoolyearRepository.Entities on em.SchoolyearID equals scy.SchoolyearID join com in CoursematerialRepository.Entities on emc.CoursematerialID equals com.CoursematerialID join dic in DictionaryItemRepository.Entities.Where(d => d.DictionaryCode == (typeof(CF_CourseType).Name)) on emc.CourseTypeID equals dic.Value into CourseType from ctype in CourseType.DefaultIfEmpty() select new TeachingPlanView { EducationMissionClassID = emc.EducationMissionClassID, CollegeID = em.CollegeID, CollegeName = col.Name, StandardName = stype.Name, GrademajorName = g.Name, SchoolyearID = scy.SchoolyearID, SchoolyearCode = scy.Code, SchoolyearValue = scy.Value, CourseName = com.CourseName, CourseTypeID = emc.CourseTypeID, CourseTypeName = ctype.Name, CreateTime = emc.CreateTime }; return query; } } }