using EMIS.Entities;
using EMIS.ViewModel.EvaluationManage;
using EMIS.DataLogic.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using EMIS.ViewModel;
namespace EMIS.DataLogic.Common.EvaluationManage
{
public class EvaluationIntTypeDAL
{
public EvaluationIntTypeRepository evaluationIntTypeRepository { get; set; }
public EvaluationTeachingModeRepository evaluationTeachingModeRepository { get; set; }
public DictionaryItemRepository dictionaryItemRepository { get; set; }
///
/// 读取评价类型信息
///
///
///
public IQueryable GetEvaluationIntTypeQueryable(Expression> exp)
{
var query = from a in evaluationIntTypeRepository.GetList(exp)
select new EvaluationIntTypeView
{
Remark = a.Remark,
Code = a.Code,
Name = a.Name,
EvaluationIntTypeID = a.EvaluationIntTypeID
};
return query;
}
public List GetEvaluationTeachingModeTypeQuery(Expression> exp)
{
var query = (from evainTmode in evaluationTeachingModeRepository.GetList(exp)
join b in dictionaryItemRepository.Entities on new { TeachingModeType = evainTmode.TeachingModeID, DictionaryCode = typeof(CF_TeachingMode).Name }
equals new { TeachingModeType = b.Value, b.DictionaryCode }
into dicTep
from dictab in dicTep.DefaultIfEmpty()
select new TeachingModeTypeView
{
EvaluationIntTypeID = evainTmode.EvaluationIntTypeID,
TeachingModeType = evainTmode.TeachingModeID,
TeachingModeTypeName = dictab.Name
});
return query.ToList();
}
///
/// 根据教室ID获取教室类型
///
///
///
public List GetTeachingModeTypeQueryble(Guid? evaluationIntTypeID)
{
var query = from a in evaluationTeachingModeRepository.Entities.Where(x => x.EvaluationIntTypeID == evaluationIntTypeID)
join b in dictionaryItemRepository.Entities on new { TeachingModeType = a.TeachingModeID, DictionaryCode = DictionaryItem.CF_TeachingMode.ToString() }
equals new { TeachingModeType = b.Value, b.DictionaryCode }
select b.Value.Value;
return query.ToList();
}
}
}