using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using EMIS.Entities;
using EMIS.ViewModel.EvaluationManage.EvaluationTable;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.EvaluationManage.EvaluationTable
{
public class EvaluationNormDAL
{
public EvaluationNormRepository EvaluationNormRepository { get; set; }
public EvaluationNormDetailRepository EvaluationNormDetailRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询对应的评分标准信息EvaluationNormView
///
///
///
public IQueryable GetEvaluationNormViewQueryable(Expression> exp)
{
var query = from evnm in EvaluationNormRepository.GetList(exp)
join usc in UserRepository.Entities
on evnm.CreateUserID equals usc.UserID into tempusc
from uscu in tempusc.DefaultIfEmpty()
join usm in UserRepository.Entities
on evnm.ModifyUserID equals usm.UserID into tempusm
from usmu in tempusm.DefaultIfEmpty()
select new EvaluationNormView
{
EvaluationNormID = evnm.EvaluationNormID,
Name = evnm.Name,
NormTypeID = evnm.NormTypeID,
SatisfyWeight = evnm.SatisfyWeight,
NormDetailList = evnm.EM_EvaluationNormDetail.OrderBy(x => x.OrderNo).Select(x => x.Name).ToList(),
Remark = evnm.Remark,
RecordStatus = evnm.RecordStatus,
CreateUserID = evnm.CreateUserID,
CreateUserName = uscu.Name,
CreateTime = evnm.CreateTime,
ModifyUserID = evnm.ModifyUserID,
ModifyUserName = usmu.Name,
ModifyTime = evnm.ModifyTime
};
return query;
}
///
/// 查询对应的评分标准明细信息EvaluationNormDetailView
///
///
///
public IQueryable GetEvaluationNormDetailViewQueryable(Expression> exp)
{
var query = from evnmdtl in EvaluationNormDetailRepository.GetList(exp)
join evnm in EvaluationNormRepository.Entities
on evnmdtl.EvaluationNormID equals evnm.EvaluationNormID
select new EvaluationNormDetailView
{
EvaluationNormDetailID = evnmdtl.EvaluationNormDetailID,
EvaluationNormID = evnmdtl.EvaluationNormID,
EvaluationNormName = evnm.Name,
OrderNo = evnmdtl.OrderNo,
Name = evnmdtl.Name,
Weight = evnmdtl.Weight,
NormTypeID = evnm.NormTypeID,
Remark = evnmdtl.Remark,
RecordStatus = evnmdtl.RecordStatus,
CreateUserID = evnmdtl.CreateUserID,
CreateTime = evnmdtl.CreateTime,
ModifyUserID = evnmdtl.ModifyUserID,
ModifyTime = evnmdtl.ModifyTime
};
return query;
}
}
}