using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.DQPSystem; using System.Linq.Expressions; using EMIS.Entities; using EMIS.ViewModel; namespace EMIS.DataLogic.DQPSystem { public class SOCDocDAL { public DocumentRepository DocumentRepository { get; set; } public StaffRepository StaffRepository { get; set; } public UserRepository UserRepository { get; set; } public CollegeRepository CollegeRepository { get; set; } public IQueryable GetSOCDocViewQueryable(Expression> exp, Expression> staffExp) { var sql = (from doc in DocumentRepository.GetList(exp) from staff in StaffRepository.Entities.Where(staffExp).Where(x => x.UserID == doc.CreateUserID).DefaultIfEmpty() from user in UserRepository.Entities.Where(x => x.UserID == doc.CreateUserID).DefaultIfEmpty() from college in CollegeRepository.Entities.Where(x => x.CollegeID == staff.CollegeID).DefaultIfEmpty() select new SOCDocView { DocumentID = doc.DocumentID, SOCDocTypeID = doc.SOCDocTypeID, Title = doc.Title, Content = doc.Content, RoleList = doc.Sys_Role, CollegeList = doc.CF_College, DepartmentList=doc.CF_Department, RecordStatus = doc.RecordStatus, IsShow = doc.RecordStatus == (int)CF_GeneralPurpose.IsYes, CreateCollegeID = staff.CollegeID, CreateCollegeName = college.Name, CreateUserID = doc.CreateUserID, CreateUserName = user.Name, CreateTime = doc.CreateTime }); return sql; } } }