ExaminationSubjectCollegeControlDAL.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel.SelectCourse;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.SelectCourse
  10. {
  11. public class ExaminationSubjectCollegeControlDAL
  12. {
  13. public ExaminationSubjectCollegeControlRepository examinationSubjectCollegeControlRepository { get; set; }
  14. public ExaminationSubjectRepository examinationSubjectRepository { get; set; }
  15. public FacultymajorRepository facultymajorRepository { get; set; }
  16. public ExaminationTypeRepository examinationTypeRepository { get; set; }
  17. public CollegeRepository collegeRepository { get; set; }
  18. public IQueryable<ExaminationSubjectCollegeControlView> GetExaminationSubjectCollegeControlView(Expression<Func<EX_ExaminationSubjectCollegeControl, bool>> esccexp, Expression<Func<EX_ExaminationSubject, bool>> esexp, Expression<Func<CF_Facultymajor, bool>> fexp)
  19. {
  20. var query = from esccr in examinationSubjectCollegeControlRepository.GetList(esccexp)
  21. join esr in examinationSubjectRepository.GetList(esexp)
  22. on esccr.ExaminationSubjectID equals esr.ExaminationSubjectID
  23. join etr in examinationTypeRepository.Entities
  24. on esr.ExaminationTypeID equals etr.ExaminationTypeID
  25. join fac in facultymajorRepository.GetList(fexp)
  26. on esccr.FacultymajorID equals fac.FacultymajorID
  27. join col in collegeRepository.Entities
  28. on fac.CollegeID equals col.CollegeID
  29. select new ExaminationSubjectCollegeControlView
  30. {
  31. ExaminationSubjectCollegeControlID = esccr.ExaminationSubjectCollegeControlID,
  32. ExaminationSubjectID = esccr.ExaminationSubjectID,
  33. ExaminationSubjectName = esr.Name,
  34. ExaminationTypeID = esr.ExaminationTypeID,
  35. ExaminationTypeName = etr.Name,
  36. FacultymajorID = esccr.FacultymajorID,
  37. FacultymajorName = fac.Name,
  38. CollegeID = fac.CollegeID,
  39. CollegeName = col.Name,
  40. SchoolyearNumID = esccr.SchoolyearNumID,
  41. RecordStatus = esccr.RecordStatus,
  42. };
  43. return query;
  44. }
  45. }
  46. }