using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.PaymentManage; using System.Linq.Expressions; using EMIS.Entities; namespace EMIS.DataLogic.PaymentManage { public class WorktimeAdditionDAL { public WorktimeAdditionRepository WorktimeAdditionRepository { get; set; } public CoursematerialRepository CoursematerialRepository { get; set; } public GrademajorRepository GrademajorRepository { get; set; } public FacultymajorRepository FacultymajorRepository { get; set; } public SchoolyearRepository SchoolyearRepository { get; set; } public StaffRepository StaffRepository { get; set; } public DepartmentRepository DepartmentRepository { get; set; } public CollegeRepository CollegeRepository { get; set; } public UserRepository UserRepository { get; set; } public IQueryable GetWorktimeAdditionViewQueryable(Expression> exp, Expression> departmentExp, Expression> gradeExp, Expression> facultyExp) { var sql = (from addition in WorktimeAdditionRepository.GetList(exp) join course in CoursematerialRepository.Entities on addition.CoursematerialID equals course.CoursematerialID join schoolyear in SchoolyearRepository.Entities on addition.SchoolyearID equals schoolyear.SchoolyearID join teacher in UserRepository.Entities on addition.UserID equals teacher.UserID join staff in StaffRepository.Entities on teacher.UserID equals staff.UserID join department in DepartmentRepository.Entities.Where(departmentExp) on staff.DepartmentID equals department.DepartmentID join college in CollegeRepository.Entities on staff.CollegeID equals college.CollegeID join grade in GrademajorRepository.Entities.Where(gradeExp) on addition.GrademajorID equals grade.GrademajorID join faculty in FacultymajorRepository.Entities.Where(facultyExp) on grade.FacultymajorID equals faculty.FacultymajorID join courseCollege in CollegeRepository.Entities on addition.CourseCollegeID equals courseCollege.CollegeID select new WorktimeAdditionView { WorktimeAdditionID = addition.WorktimeAdditionID, UserID = addition.UserID, CollegeID = staff.CollegeID, CollegeNo = college.No, CollegeName = college.Name, SchoolyearID = addition.SchoolyearID, SchoolyearCode = schoolyear.Code, TeacherName = teacher.Name, GradeYearID = grade.GradeID, StudentCollegeID = faculty.CollegeID, StandardID = faculty.StandardID, GrademajorID = grade.GrademajorID, GrademajorName = grade.Name, CoursematerialID = course.CoursematerialID, CourseCode = course.CourseCode, CourseName = course.CourseName, CourseCollegeID = addition.CourseCollegeID, CourseCollegeNo = courseCollege.No, CourseCollegeName = courseCollege.Name, EducationMissionClassName = addition.EducationMissionClassName, TeachingModeID = addition.TeachingModeID, TeachType = addition.TeachType, StudentCount = addition.StudentCount, CourseTime = addition.CourseTime, Month=addition.Month, Remark = addition.Remark }); return sql; } } }