using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.SchedulingManage.ScheduleApproval; using EMIS.Entities; using System.Linq.Expressions; namespace EMIS.DataLogic.SchedulingManage.ScheduleApproval { public class CollegeScheduleApprovalDAL { public CollegePriorityRepository collegePriorityRepository { get; set; } public CollegeScheduleStatusRepository collegeScheduleStatusRepository { get; set; } public CollegeRepository collegeRepository { get; set; } public SchoolyearRepository schoolyearRepository { get; set; } public UserRepository userRepository { get; set; } public IQueryable GetCollegeScheduleApprovalViewQueryable(Expression> exp, Expression> exp1) { var query = from a in collegeRepository.GetList(exp) join b in collegeScheduleStatusRepository.GetList(exp1) on a.CollegeID equals b.CollegeID into tmp1 from ab in tmp1.DefaultIfEmpty() join c in userRepository.Entities on ab.ModifyUserID equals c.UserID into tmp from abc in tmp.DefaultIfEmpty() join d in schoolyearRepository.Entities on ab.SchoolyearID equals d.SchoolyearID into tmp2 from abd in tmp2.DefaultIfEmpty() select new CollegeScheduleApprovalView { //CollegePriorityID = a.CollegePriorityID, CollegeScheduleStatusID = ab.CollegeScheduleStatusID, CollegeID = a.CollegeID, CollegeName=a.Name, CollegeNo=a.No, SchoolyearID=ab.SchoolyearID, SchoolYearCode=abd.Code, //Priority = a.Priority, //StartDate = a.StartDate, //EndDate = a.EndDate, //ApprovalStatus = a.ApprovalStatus, RecordStatus = ab.RecordStatus, CreateUserID = ab.CreateUserID, CreateTime = ab.CreateTime, ModifyUserID = ab.ModifyUserID, ModifyTime = ab.ModifyTime, ModifyUserName=abc.Name, }; return query; } } }