123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 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<SOCDocView> GetSOCDocViewQueryable(Expression<Func<DQP_Document, bool>> exp,
- Expression<Func<CF_Staff, bool>> 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;
- }
- }
- }
|