using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMISOnline.Entities; using EMISOnline.DataLogic.Repositories; using System.Linq.Expressions; using EMISOnline.ViewModel.Educational; using EMISOnline.ViewModel; namespace EMISOnline.DataLogic.Educational { public class FacultymajorDAL { public CollegeRepository CollegeRepository { get; set; } public FacultymajorRepository FacultymajorRepository { get; set; } public DictionaryItemRepository DictionaryItemRepositoryy { get; set; } public IQueryable GetFacultymajorList() { var query = from fam in FacultymajorRepository.Entities join col in CollegeRepository.Entities on fam.CollegeID equals col.CollegeID join dic0 in DictionaryItemRepositoryy.Entities.Where(d => d.DictionaryCode == (typeof(CF_Standard).Name)) on fam.StandardID equals dic0.Value into standard from std in standard.DefaultIfEmpty() join dic1 in DictionaryItemRepositoryy.Entities.Where(d => d.DictionaryCode == (typeof(CF_Education).Name)) on fam.EducationID equals dic1.Value into education from edn in education.DefaultIfEmpty() join dic2 in DictionaryItemRepositoryy.Entities.Where(d => d.DictionaryCode == (typeof(CF_Learningform).Name)) on fam.LearningformID equals dic2.Value into learningform from learn in learningform.DefaultIfEmpty() select new FacultymajorView { FacultymajorID = fam.FacultymajorID, Code = fam.Code, FacultymajorName = fam.Name, StandardID = fam.StandardID, StandardName = std.Name, LearnSystem = fam.LearnSystem, EducationID = fam.EducationID, EducationName = edn.Name, LearningformID = fam.LearningformID, LearningformName = learn.Name, CollegeID = col.CollegeID, CollegeCode = col.No, CollegeName = col.Name, CreateTime = fam.CreateTime }; return query; } } }