EvaluationNormDAL.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using EMIS.ViewModel.EvaluationManage;
  9. namespace EMIS.DataLogic.Common.EvaluationManage
  10. {
  11. public class EvaluationNormDAL
  12. {
  13. public EvaluationNormRepository evaluationNormRepository { get; set; }
  14. public EvaluationNormDetailRepository evaluationNormDetailRepository { get; set; }
  15. public DictionaryItemRepository dictionaryItemRepository { get; set; }
  16. /// <summary>
  17. /// 读取评分标准信息
  18. /// </summary>
  19. /// <param name="exp"></param>
  20. /// <returns></returns>
  21. public IQueryable<EvaluationNormView> GetEvaluationNormQueryable(Expression<Func<EM_EvaluationNorm, bool>> exp)
  22. {
  23. var query = from a in evaluationNormRepository.GetList(exp)
  24. join b in dictionaryItemRepository.Entities on new { IntType = a.NormTypeID, DictionaryCode = "EM_EvaluationNormType" }
  25. equals new { IntType = b.Value, b.DictionaryCode } into gbty
  26. from gicbty in gbty.DefaultIfEmpty()
  27. select new EvaluationNormView
  28. {
  29. NormID = a.EvaluationNormID,
  30. //Code = a.Code,
  31. Name = a.Name,
  32. IntType = a.NormTypeID == null ? 0 : a.NormTypeID,
  33. SatisfyWeight = a.SatisfyWeight,
  34. EvaluationNormType = gicbty.Name,
  35. Remark = a.Remark,
  36. CreateUserID = a.CreateUserID,
  37. CreateTime = a.CreateTime
  38. };
  39. return query;
  40. }
  41. /// <summary>
  42. /// 读取评分标准明细信息
  43. /// </summary>
  44. /// <param name="exp"></param>
  45. /// <returns></returns>
  46. public IQueryable<EvaluationNormDetailView> GetEvaluationNormDetailQueryable(Expression<Func<EM_EvaluationNormDetail, bool>> exp)
  47. {
  48. var query = from a in evaluationNormDetailRepository.GetList(exp)
  49. join b in evaluationNormRepository.Entities on a.EvaluationNormID equals b.EvaluationNormID
  50. select new EvaluationNormDetailView
  51. {
  52. DetailID = a.EvaluationNormDetailID,
  53. NormID = a.EvaluationNormID,
  54. OrderID = a.OrderNo,
  55. Name = a.Name,
  56. Weight = a.Weight,
  57. Remark = a.Remark,
  58. CreateUserID = a.CreateUserID,
  59. CreateTime = a.CreateTime,
  60. ModifyUserID = a.ModifyUserID,
  61. ModifyTime = a.ModifyTime
  62. };
  63. return query;
  64. }
  65. public IQueryable<EvaluationNormDetailView> GetEvaluationNormDetailOrProjectQueryable(Expression<Func<EM_EvaluationNormDetail, bool>> exp)
  66. {
  67. var query = from a in evaluationNormDetailRepository.GetList(exp)
  68. join b in evaluationNormRepository.Entities on a.EvaluationNormID equals b.EvaluationNormID
  69. from c in b.EM_EvaluationTarget
  70. from d in c.EM_EvaluationProject
  71. group new { a, d } by new { a.Name, a.Weight, d.EvaluationProjectID } into g
  72. select new EvaluationNormDetailView
  73. {
  74. ProjectID = g.Key.EvaluationProjectID,
  75. Name = g.Key.Name,
  76. Weight =g.Key.Weight,
  77. };
  78. return query;
  79. }
  80. }
  81. }