123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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; }
- /// <summary>
- /// 读取评分标准信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<EvaluationNormView> GetEvaluationNormQueryable(Expression<Func<EM_EvaluationNorm, bool>> 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;
- }
- /// <summary>
- /// 读取评分标准明细信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<EvaluationNormDetailView> GetEvaluationNormDetailQueryable(Expression<Func<EM_EvaluationNormDetail, bool>> 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<EvaluationNormDetailView> GetEvaluationNormDetailOrProjectQueryable(Expression<Func<EM_EvaluationNormDetail, bool>> 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;
- }
- }
- }
|