using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using System.Linq.Expressions; using EMIS.Entities; using EMIS.ViewModel.EvaluationManage; namespace EMIS.DataLogic.Common.EvaluationManage { public class EvaluationNormDAL { public EvaluationNormRepository evaluationNormRepository { get; set; } public EvaluationNormDetailRepository evaluationNormDetailRepository { get; set; } public DictionaryItemRepository dictionaryItemRepository { get; set; } /// /// 读取评分标准信息 /// /// /// public IQueryable GetEvaluationNormQueryable(Expression> exp) { var query = from a in evaluationNormRepository.GetList(exp) join b in dictionaryItemRepository.Entities on new { IntType = a.NormTypeID, DictionaryCode = "EM_EvaluationNormType" } equals new { IntType = b.Value, b.DictionaryCode } into gbty from gicbty in gbty.DefaultIfEmpty() select new EvaluationNormView { NormID = a.EvaluationNormID, //Code = a.Code, Name = a.Name, IntType = a.NormTypeID == null ? 0 : a.NormTypeID, SatisfyWeight = a.SatisfyWeight, EvaluationNormType = gicbty.Name, Remark = a.Remark, CreateUserID = a.CreateUserID, CreateTime = a.CreateTime }; return query; } /// /// 读取评分标准明细信息 /// /// /// public IQueryable GetEvaluationNormDetailQueryable(Expression> exp) { var query = from a in evaluationNormDetailRepository.GetList(exp) join b in evaluationNormRepository.Entities on a.EvaluationNormID equals b.EvaluationNormID select new EvaluationNormDetailView { DetailID = a.EvaluationNormDetailID, NormID = a.EvaluationNormID, OrderID = a.OrderNo, Name = a.Name, Weight = a.Weight, Remark = a.Remark, CreateUserID = a.CreateUserID, CreateTime = a.CreateTime, ModifyUserID = a.ModifyUserID, ModifyTime = a.ModifyTime }; return query; } public IQueryable GetEvaluationNormDetailOrProjectQueryable(Expression> exp) { var query = from a in evaluationNormDetailRepository.GetList(exp) join b in evaluationNormRepository.Entities on a.EvaluationNormID equals b.EvaluationNormID from c in b.EM_EvaluationTarget from d in c.EM_EvaluationProject group new { a, d } by new { a.Name, a.Weight, d.EvaluationProjectID } into g select new EvaluationNormDetailView { ProjectID = g.Key.EvaluationProjectID, Name = g.Key.Name, Weight =g.Key.Weight, }; return query; } } }