using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using EMIS.Entities;
using EMIS.ViewModel;
using EMIS.ViewModel.EvaluationManage.EvaluationSetting;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.EvaluationManage.EvaluationSetting
{
public class EvaluationIntTypeDAL
{
public EvaluationIntTypeRepository EvaluationIntTypeRepository { get; set; }
public EvaluationTeachingModeRepository EvaluationTeachingModeRepository { get; set; }
public DictionaryItemRepository DictionaryItemRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询对应的评价类型信息EvaluationIntTypeView
///
///
///
public IQueryable GetEvaluationIntTypeViewQueryable(Expression> exp)
{
var query = from evit in EvaluationIntTypeRepository.GetList(exp)
join usc in UserRepository.Entities
on evit.CreateUserID equals usc.UserID into tempusc
from uscu in tempusc.DefaultIfEmpty()
join usm in UserRepository.Entities
on evit.ModifyUserID equals usm.UserID into tempusm
from usmu in tempusm.DefaultIfEmpty()
select new EvaluationIntTypeView
{
EvaluationIntTypeID = evit.EvaluationIntTypeID,
Code = evit.Code,
Name = evit.Name,
TeachingModeIDList = evit.EM_EvaluationTeachingMode.OrderBy(x => x.TeachingModeID).Select(x => x.TeachingModeID).ToList(),
Remark = evit.Remark,
RecordStatus = evit.RecordStatus,
CreateUserID = evit.CreateUserID,
CreateUserName = uscu.Name,
CreateTime = evit.CreateTime,
ModifyUserID = evit.ModifyUserID,
ModifyUserName = usmu.Name,
ModifyTime = evit.ModifyTime
};
return query;
}
///
/// 查询评价类型对应的授课方式
///
///
///
public IQueryable GetTeachingModeTypeQueryble(Expression> exp)
{
var query = from it in EvaluationIntTypeRepository.GetList(exp)
join tm in EvaluationTeachingModeRepository.Entities
on it.EvaluationIntTypeID equals tm.EvaluationIntTypeID
join dictm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
on tm.TeachingModeID equals dictm.Value
select dictm.Value;
return query;
}
}
}