CollegeScheduleApprovalDAL.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.ScheduleApproval;
  7. using EMIS.Entities;
  8. using System.Linq.Expressions;
  9. namespace EMIS.DataLogic.SchedulingManage.ScheduleApproval
  10. {
  11. public class CollegeScheduleApprovalDAL
  12. {
  13. public CollegePriorityRepository collegePriorityRepository { get; set; }
  14. public CollegeScheduleStatusRepository collegeScheduleStatusRepository { get; set; }
  15. public CollegeRepository collegeRepository { get; set; }
  16. public SchoolyearRepository schoolyearRepository { get; set; }
  17. public UserRepository userRepository { get; set; }
  18. public IQueryable<CollegeScheduleApprovalView> GetCollegeScheduleApprovalViewQueryable(Expression<Func<CF_College, bool>> exp, Expression<Func<ES_CollegeScheduleStatus, bool>> exp1)
  19. {
  20. var query = from a in collegeRepository.GetList(exp)
  21. join b in collegeScheduleStatusRepository.GetList(exp1) on a.CollegeID equals b.CollegeID into tmp1 from ab in tmp1.DefaultIfEmpty()
  22. join c in userRepository.Entities on ab.ModifyUserID equals c.UserID into tmp from abc in tmp.DefaultIfEmpty()
  23. join d in schoolyearRepository.Entities on ab.SchoolyearID equals d.SchoolyearID into tmp2 from abd in tmp2.DefaultIfEmpty()
  24. select new CollegeScheduleApprovalView
  25. {
  26. //CollegePriorityID = a.CollegePriorityID,
  27. CollegeScheduleStatusID = ab.CollegeScheduleStatusID,
  28. CollegeID = a.CollegeID,
  29. CollegeName=a.Name,
  30. CollegeNo=a.No,
  31. SchoolyearID=ab.SchoolyearID,
  32. SchoolYearCode=abd.Code,
  33. //Priority = a.Priority,
  34. //StartDate = a.StartDate,
  35. //EndDate = a.EndDate,
  36. //ApprovalStatus = a.ApprovalStatus,
  37. RecordStatus = ab.RecordStatus,
  38. CreateUserID = ab.CreateUserID,
  39. CreateTime = ab.CreateTime,
  40. ModifyUserID = ab.ModifyUserID,
  41. ModifyTime = ab.ModifyTime,
  42. ModifyUserName=abc.Name,
  43. };
  44. return query;
  45. }
  46. }
  47. }