WorktimeAdditionDAL.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.PaymentManage;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.PaymentManage
  10. {
  11. public class WorktimeAdditionDAL
  12. {
  13. public WorktimeAdditionRepository WorktimeAdditionRepository { get; set; }
  14. public CoursematerialRepository CoursematerialRepository { get; set; }
  15. public GrademajorRepository GrademajorRepository { get; set; }
  16. public FacultymajorRepository FacultymajorRepository { get; set; }
  17. public SchoolyearRepository SchoolyearRepository { get; set; }
  18. public StaffRepository StaffRepository { get; set; }
  19. public DepartmentRepository DepartmentRepository { get; set; }
  20. public CollegeRepository CollegeRepository { get; set; }
  21. public UserRepository UserRepository { get; set; }
  22. public IQueryable<WorktimeAdditionView> GetWorktimeAdditionViewQueryable(Expression<Func<TP_WorktimeAddition, bool>> exp,
  23. Expression<Func<CF_Department, bool>> departmentExp,
  24. Expression<Func<CF_Grademajor, bool>> gradeExp,
  25. Expression<Func<CF_Facultymajor, bool>> facultyExp)
  26. {
  27. var sql = (from addition in WorktimeAdditionRepository.GetList(exp)
  28. join course in CoursematerialRepository.Entities on addition.CoursematerialID equals course.CoursematerialID
  29. join schoolyear in SchoolyearRepository.Entities on addition.SchoolyearID equals schoolyear.SchoolyearID
  30. join teacher in UserRepository.Entities on addition.UserID equals teacher.UserID
  31. join staff in StaffRepository.Entities on teacher.UserID equals staff.UserID
  32. join department in DepartmentRepository.Entities.Where(departmentExp) on staff.DepartmentID equals department.DepartmentID
  33. join college in CollegeRepository.Entities on staff.CollegeID equals college.CollegeID
  34. join grade in GrademajorRepository.Entities.Where(gradeExp) on addition.GrademajorID equals grade.GrademajorID
  35. join faculty in FacultymajorRepository.Entities.Where(facultyExp) on grade.FacultymajorID equals faculty.FacultymajorID
  36. join courseCollege in CollegeRepository.Entities on addition.CourseCollegeID equals courseCollege.CollegeID
  37. select new WorktimeAdditionView
  38. {
  39. WorktimeAdditionID = addition.WorktimeAdditionID,
  40. UserID = addition.UserID,
  41. CollegeID = staff.CollegeID,
  42. CollegeNo = college.No,
  43. CollegeName = college.Name,
  44. SchoolyearID = addition.SchoolyearID,
  45. SchoolyearCode = schoolyear.Code,
  46. TeacherName = teacher.Name,
  47. GradeYearID = grade.GradeID,
  48. StudentCollegeID = faculty.CollegeID,
  49. StandardID = faculty.StandardID,
  50. GrademajorID = grade.GrademajorID,
  51. GrademajorName = grade.Name,
  52. CoursematerialID = course.CoursematerialID,
  53. CourseCode = course.CourseCode,
  54. CourseName = course.CourseName,
  55. CourseCollegeID = addition.CourseCollegeID,
  56. CourseCollegeNo = courseCollege.No,
  57. CourseCollegeName = courseCollege.Name,
  58. EducationMissionClassName = addition.EducationMissionClassName,
  59. TeachingModeID = addition.TeachingModeID,
  60. TeachType = addition.TeachType,
  61. StudentCount = addition.StudentCount,
  62. CourseTime = addition.CourseTime,
  63. Month=addition.Month,
  64. Remark = addition.Remark
  65. });
  66. return sql;
  67. }
  68. }
  69. }