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 EvaluationProjectDAL
{
public EvaluationProjectRepository EvaluationProjectRepository { get; set; }
public EvaluationTargetRepository EvaluationTargetRepository { get; set; }
public EvaluationTableRepository EvaluationTableRepository { get; set; }
public EvaluationNormRepository EvaluationNormRepository { get; set; }
public EvaluationParticipateTypeRepository EvaluationParticipateTypeRepository { get; set; }
public EvaluationIntTypeRepository EvaluationIntTypeRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询对应的评价项目信息EvaluationProjectView
///
///
///
public IQueryable GetEvaluationProjectViewQueryable(Expression> exp)
{
var query = from evpj in EvaluationProjectRepository.GetList(exp)
join evtg in EvaluationTargetRepository.Entities
on evpj.EvaluationTargetID equals evtg.EvaluationTargetID
join evtb in EvaluationTableRepository.Entities
on evtg.EvaluationTableID equals evtb.EvaluationTableID
join evnm in EvaluationNormRepository.Entities
on evtg.EvaluationNormID equals evnm.EvaluationNormID
join evpt in EvaluationParticipateTypeRepository.Entities
on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
join evit in EvaluationIntTypeRepository.Entities
on evtb.EvaluationIntTypeID equals evit.EvaluationIntTypeID
join usc in UserRepository.Entities
on evpj.CreateUserID equals usc.UserID into tempusc
from uscu in tempusc.DefaultIfEmpty()
join usm in UserRepository.Entities
on evpj.ModifyUserID equals usm.UserID into tempusm
from usmu in tempusm.DefaultIfEmpty()
select new EvaluationProjectView
{
EvaluationProjectID = evpj.EvaluationProjectID,
OrderNo = evpj.OrderNo,
Code = evpj.Code,
Name = evpj.Name,
EvaluationTargetID = evpj.EvaluationTargetID,
EvaluationTargetOrderNo = evtg.OrderNo,
EvaluationTargetCode = evtg.Code,
EvaluationTargetName = evtg.Name,
EvaluationTargetWeight = evtg.Weight,
EvaluationTableID = evtg.EvaluationTableID,
EvaluationTableCode = evtb.Code,
EvaluationTableName = evtb.Name,
EvaluationTableWeight = evtb.Weight,
EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
ParticipateTypeID = evpt.ParticipateTypeID,
IsStudent = evpt.IsStudent.Value,
EvaluationTypeID = evtb.EvaluationIntTypeID,
EvaluationTypeCode = evit.Code,
EvaluationTypeName = evit.Name,
TeachingModeIDList = evit.EM_EvaluationTeachingMode.OrderBy(x => x.TeachingModeID).Select(x => x.TeachingModeID).ToList(),
EvaluationNormID = evtg.EvaluationNormID,
EvaluationNormName = evnm.Name,
NormTypeID = evnm.NormTypeID,
Weight = evpj.Weight,
Remark = evpj.Remark,
RecordStatus = evpj.RecordStatus,
CreateUserID = evpj.CreateUserID,
CreateUserName = uscu.Name,
CreateTime = evpj.CreateTime,
ModifyUserID = evpj.ModifyUserID,
ModifyUserName = usmu.Name,
ModifyTime = evpj.ModifyTime
};
return query;
}
}
}