CourseTimeHoursDAL.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.SchedulingManage.SchedulingSettings;
  7. using System.Linq.Expressions;
  8. using EMIS.ViewModel.CalendarManage;
  9. using EMIS.Entities;
  10. namespace EMIS.DataLogic.SchedulingManage.SchedulingSettings
  11. {
  12. public class CourseTimeHoursDAL
  13. {
  14. public CoursesTimeRepository coursesTimeRepository { get; set; }
  15. public DictionaryItemRepository dictionaryItemRepository { get; set; }
  16. public CourseTimeHoursRepository courseTimeHoursRepository { get; set; }
  17. /// <summary>
  18. /// 读取课程课时类别信息
  19. /// </summary>
  20. /// <param name="exp"></param>
  21. /// <returns></returns>
  22. public IQueryable<CourseTimeHoursView> GetCoursesTimeQueryable(Expression<Func<EM_CoursesTime, bool>> exp, Expression<Func<TP_CourseTimeHours, bool>> exps)
  23. {
  24. var query = from a in coursesTimeRepository.GetList(exp)
  25. join b in courseTimeHoursRepository.GetList(exps) on a.CoursesTimeID equals b.CoursesTimeID
  26. join c in dictionaryItemRepository.Entities on new { a.TimesSegment, DictionaryCode = "CF_TimesSegment" }
  27. equals new { TimesSegment = c.Value.Value, c.DictionaryCode } into gbsta
  28. from gicbsta in gbsta.DefaultIfEmpty()
  29. select new CourseTimeHoursView
  30. {
  31. CoursesTimeID = a.CoursesTimeID,
  32. StartTimes = a.StartTimes,
  33. EndTimes = a.EndTimes,
  34. TimesSegment = a.TimesSegment,
  35. TimesSegmentName = gicbsta.Name,
  36. StartHour = a.StartHour,
  37. StartMinutes = a.StartMinutes,
  38. EndHour = a.EndHour,
  39. EndMinutes = a.EndMinutes,
  40. CourseTimeHoursID=b.CourseTimeHoursID,
  41. Year = b.Years,
  42. Hours=b.Hours
  43. };
  44. return query;
  45. }
  46. }
  47. }