TeachingPlanDAL.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMISOnline.Entities;
  6. using EMISOnline.ViewModel.Educational;
  7. using EMISOnline.DataLogic.Repositories;
  8. using EMISOnline.ViewModel;
  9. namespace EMISOnline.DataLogic.Educational
  10. {
  11. public class TeachingPlanDAL
  12. {
  13. public EducationMissionRepository EducationMissionRepository { get; set; }
  14. public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
  15. public ClassmajorRepository ClassmajorRepository { get; set; }
  16. public CoursematerialRepository CoursematerialRepository { get; set; }
  17. public GrademajorRepository GrademajorRepository { get; set; }
  18. public FacultymajorRepository FacultymajorRepository { get; set; }
  19. public CollegeRepository CollegeRepository { get; set; }
  20. public SchoolyearRepository SchoolyearRepository { get; set; }
  21. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  22. public IQueryable<TeachingPlanView> GetTeachingPlanList()
  23. {
  24. var query = from emc in EducationMissionClassRepository.Entities
  25. join em in EducationMissionRepository.Entities on emc.EducationMissionID equals em.EducationMissionID
  26. join col in CollegeRepository.Entities on em.CollegeID equals col.CollegeID
  27. join c in ClassmajorRepository.Entities on emc.MainScheduleClassID equals c.ClassmajorID into dc
  28. from c in dc.DefaultIfEmpty()
  29. join g in GrademajorRepository.Entities on c.GrademajorID equals g.GrademajorID into dg
  30. from g in dg.DefaultIfEmpty()
  31. join fam in FacultymajorRepository.Entities on g.FacultymajorID equals fam.FacultymajorID into df
  32. from fam in df.DefaultIfEmpty()
  33. join sdic in DictionaryItemRepository.Entities.Where(d => d.DictionaryCode == (typeof(CF_Standard).Name)) on fam.StandardID equals sdic.Value into standard
  34. from stype in standard.DefaultIfEmpty()
  35. join scy in SchoolyearRepository.Entities on em.SchoolyearID equals scy.SchoolyearID
  36. join com in CoursematerialRepository.Entities on emc.CoursematerialID equals com.CoursematerialID
  37. join dic in DictionaryItemRepository.Entities.Where(d => d.DictionaryCode == (typeof(CF_CourseType).Name)) on emc.CourseTypeID equals dic.Value into CourseType
  38. from ctype in CourseType.DefaultIfEmpty()
  39. select new TeachingPlanView
  40. {
  41. EducationMissionClassID = emc.EducationMissionClassID,
  42. CollegeID = em.CollegeID,
  43. CollegeName = col.Name,
  44. StandardName = stype.Name,
  45. GrademajorName = g.Name,
  46. SchoolyearID = scy.SchoolyearID,
  47. SchoolyearCode = scy.Code,
  48. SchoolyearValue = scy.Value,
  49. CourseName = com.CourseName,
  50. CourseTypeID = emc.CourseTypeID,
  51. CourseTypeName = ctype.Name,
  52. CreateTime = emc.CreateTime
  53. };
  54. return query;
  55. }
  56. }
  57. }