using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using EMIS.Entities;
using EMIS.ViewModel.EvaluationManage.EvaluationSetting;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.EvaluationManage.EvaluationSetting
{
public class EvaluationNeedDAL
{
public EvaluationNeedRepository EvaluationNeedRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询对应的评价需知信息EvaluationNeedView
///
///
///
public IQueryable GetEvaluationNeedViewQueryable(Expression> expEvaluationNeed)
{
var query = from evnd in EvaluationNeedRepository.GetList(expEvaluationNeed)
join usc in UserRepository.Entities
on evnd.CreateUserID equals usc.UserID into tempusc
from uscu in tempusc.DefaultIfEmpty()
join usm in UserRepository.Entities
on evnd.ModifyUserID equals usm.UserID into tempusm
from usmu in tempusm.DefaultIfEmpty()
select new EvaluationNeedView
{
EvaluationNeedID = evnd.EvaluationNeedID,
Code = evnd.Code,
Title = evnd.Title,
ParticipateTypeID = evnd.ParticipateTypeID,
Content = evnd.Content,
IsEnabled = evnd.IsEnabled.Value,
Remark = evnd.Remark,
RecordStatus = evnd.RecordStatus,
CreateUserID = evnd.CreateUserID,
CreateUserName = uscu.Name,
CreateTime = evnd.CreateTime,
ModifyUserID = evnd.ModifyUserID,
ModifyUserName = usmu.Name,
ModifyTime = evnd.ModifyTime
};
return query;
}
}
}