CoursematerialDAL.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel;
  8. using EMIS.ViewModel.Cultureplan;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.Common.Cultureplan
  11. {
  12. public class CoursematerialDAL
  13. {
  14. public CoursematerialRepository CoursematerialRepository { get; set; }
  15. public ClassGroupingRepository ClassGroupingRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的课程信息CoursematerialView
  18. /// </summary>
  19. /// <param name="exp"></param>
  20. /// <returns></returns>
  21. public IQueryable<CoursematerialView> GetCoursematerialViewQueryable(Expression<Func<EM_Coursematerial, bool>> exp)
  22. {
  23. var query = from cou in CoursematerialRepository.GetList(exp)
  24. join cg in ClassGroupingRepository.Entities
  25. on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg
  26. from coucg in tempcg.DefaultIfEmpty()
  27. select new CoursematerialView
  28. {
  29. CoursematerialID = cou.CoursematerialID,
  30. CourseCode = cou.CourseCode,
  31. CourseName = cou.CourseName,
  32. Abbreviation = cou.Abbreviation,
  33. EnglishName = cou.EnglishName,
  34. StandardName = cou.StandardName,
  35. CourseEdition = cou.CourseEdition,
  36. CourseLevelID = cou.CourseLevelID,
  37. CourseScienceID = cou.CourseScienceID,
  38. ClassGroupingID = cou.ClassGroupingID,
  39. ClassName = coucg.ClassName,
  40. CourseSynopsis = cou.CourseSynopsis,
  41. CourseReserve = cou.CourseReserve,
  42. IsEnable = cou.IsEnable == true ? true : false,
  43. Remark = cou.Remark,
  44. RecordStatus = cou.RecordStatus,
  45. CreateUserID = cou.CreateUserID,
  46. CreateTime = cou.CreateTime,
  47. ModifyUserID = cou.ModifyUserID,
  48. ModifyTime = cou.ModifyTime
  49. };
  50. return query;
  51. }
  52. }
  53. }