FacultymajorDAL.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMISOnline.Entities;
  6. using EMISOnline.DataLogic.Repositories;
  7. using System.Linq.Expressions;
  8. using EMISOnline.ViewModel.Educational;
  9. using EMISOnline.ViewModel;
  10. namespace EMISOnline.DataLogic.Educational
  11. {
  12. public class FacultymajorDAL
  13. {
  14. public CollegeRepository CollegeRepository { get; set; }
  15. public FacultymajorRepository FacultymajorRepository { get; set; }
  16. public DictionaryItemRepository DictionaryItemRepositoryy { get; set; }
  17. public IQueryable<FacultymajorView> GetFacultymajorList()
  18. {
  19. var query = from fam in FacultymajorRepository.Entities
  20. join col in CollegeRepository.Entities on fam.CollegeID equals col.CollegeID
  21. join dic0 in DictionaryItemRepositoryy.Entities.Where(d => d.DictionaryCode == (typeof(CF_Standard).Name)) on fam.StandardID equals dic0.Value into standard
  22. from std in standard.DefaultIfEmpty()
  23. join dic1 in DictionaryItemRepositoryy.Entities.Where(d => d.DictionaryCode == (typeof(CF_Education).Name)) on fam.EducationID equals dic1.Value into education
  24. from edn in education.DefaultIfEmpty()
  25. join dic2 in DictionaryItemRepositoryy.Entities.Where(d => d.DictionaryCode == (typeof(CF_Learningform).Name)) on fam.LearningformID equals dic2.Value into learningform
  26. from learn in learningform.DefaultIfEmpty()
  27. select new FacultymajorView
  28. {
  29. FacultymajorID = fam.FacultymajorID,
  30. Code = fam.Code,
  31. FacultymajorName = fam.Name,
  32. StandardID = fam.StandardID,
  33. StandardName = std.Name,
  34. LearnSystem = fam.LearnSystem,
  35. EducationID = fam.EducationID,
  36. EducationName = edn.Name,
  37. LearningformID = fam.LearningformID,
  38. LearningformName = learn.Name,
  39. CollegeID = col.CollegeID,
  40. CollegeCode = col.No,
  41. CollegeName = col.Name,
  42. CreateTime = fam.CreateTime
  43. };
  44. return query;
  45. }
  46. }
  47. }