1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- 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 EvaluationTargetDAL
- {
- 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 EvaluationProjectRepository EvaluationProjectRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- /// <summary>
- /// 查询对应的评价指标信息EvaluationTargetView
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<EvaluationTargetView> GetEvaluationTargetViewQueryable(Expression<Func<EM_EvaluationTarget, bool>> exp)
- {
- var query = from evtg in EvaluationTargetRepository.GetList(exp)
- 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 pj in
- (
- from pj in EvaluationProjectRepository.Entities
- group pj by pj.EvaluationTargetID into gpj
- select new
- {
- EvaluationTargetID = gpj.Key,
- ProjectCount = gpj.Count()
- }
- )
- on evtg.EvaluationTargetID equals pj.EvaluationTargetID into temppj
- from evpj in temppj.DefaultIfEmpty()
- join usc in UserRepository.Entities
- on evtg.CreateUserID equals usc.UserID into tempusc
- from uscu in tempusc.DefaultIfEmpty()
- join usm in UserRepository.Entities
- on evtg.ModifyUserID equals usm.UserID into tempusm
- from usmu in tempusm.DefaultIfEmpty()
- select new EvaluationTargetView
- {
- EvaluationTargetID = evtg.EvaluationTargetID,
- OrderNo = evtg.OrderNo,
- Code = evtg.Code,
- Name = evtg.Name,
- 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 = evtg.Weight,
- ProjectCount = evpj.ProjectCount == null ? 0 : evpj.ProjectCount,
- Remark = evtg.Remark,
- RecordStatus = evtg.RecordStatus,
- CreateUserID = evtg.CreateUserID,
- CreateUserName = uscu.Name,
- CreateTime = evtg.CreateTime,
- ModifyUserID = evtg.ModifyUserID,
- ModifyUserName = usmu.Name,
- ModifyTime = evtg.ModifyTime
- };
- return query;
- }
- }
- }
|