StaffStandardDAL.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.DataLogic.Repositories;
  7. using EMIS.ViewModel.PaymentManage;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.PaymentManage
  10. {
  11. public class StaffStandardDAL
  12. {
  13. public StaffStandardRepository StaffStandardRepository { get; set; }
  14. public StaffRepository StaffRepository { get; set; }
  15. public UserRepository UserRepository { get; set; }
  16. public DepartmentRepository DepartmentRepository { get; set; }
  17. public CollegeRepository CollegeRepository { get; set; }
  18. public IQueryable<StaffStandardView> GetStaffStandardViewQueryable(Expression<Func<TP_StaffStandard, bool>> exp,
  19. Expression<Func<CF_Department, bool>> departmentExp,
  20. Expression<Func<CF_College, bool>> collegeExp)
  21. {
  22. var sql = (from standard in StaffStandardRepository.GetList(exp)
  23. join staff in StaffRepository.Entities on standard.UserID equals staff.UserID
  24. join user in UserRepository.Entities on staff.UserID equals user.UserID
  25. join department in DepartmentRepository.Entities.Where(departmentExp) on staff.DepartmentID equals department.DepartmentID
  26. join college in CollegeRepository.Entities.Where(collegeExp) on staff.CollegeID equals college.CollegeID
  27. select new StaffStandardView
  28. {
  29. StaffStandardID = standard.StaffStandardID,
  30. UserID = staff.UserID,
  31. LoginID = user.LoginID,
  32. UserName = user.Name,
  33. DepartmentID = department.DepartmentID,
  34. DepartmentName = department.Name,
  35. CollegeID = college.CollegeID,
  36. CollegeNo = college.No,
  37. CollegeName = college.Name,
  38. Amount = standard.Amount
  39. });
  40. return sql;
  41. }
  42. }
  43. }