EvaluationNormDAL.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel.EvaluationManage.EvaluationTable;
  8. using EMIS.DataLogic.Repositories;
  9. namespace EMIS.DataLogic.EvaluationManage.EvaluationTable
  10. {
  11. public class EvaluationNormDAL
  12. {
  13. public EvaluationNormRepository EvaluationNormRepository { get; set; }
  14. public EvaluationNormDetailRepository EvaluationNormDetailRepository { get; set; }
  15. public UserRepository UserRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的评分标准信息EvaluationNormView
  18. /// </summary>
  19. /// <param name="exp"></param>
  20. /// <returns></returns>
  21. public IQueryable<EvaluationNormView> GetEvaluationNormViewQueryable(Expression<Func<EM_EvaluationNorm, bool>> exp)
  22. {
  23. var query = from evnm in EvaluationNormRepository.GetList(exp)
  24. join usc in UserRepository.Entities
  25. on evnm.CreateUserID equals usc.UserID into tempusc
  26. from uscu in tempusc.DefaultIfEmpty()
  27. join usm in UserRepository.Entities
  28. on evnm.ModifyUserID equals usm.UserID into tempusm
  29. from usmu in tempusm.DefaultIfEmpty()
  30. select new EvaluationNormView
  31. {
  32. EvaluationNormID = evnm.EvaluationNormID,
  33. Name = evnm.Name,
  34. NormTypeID = evnm.NormTypeID,
  35. SatisfyWeight = evnm.SatisfyWeight,
  36. NormDetailList = evnm.EM_EvaluationNormDetail.OrderBy(x => x.OrderNo).Select(x => x.Name).ToList(),
  37. Remark = evnm.Remark,
  38. RecordStatus = evnm.RecordStatus,
  39. CreateUserID = evnm.CreateUserID,
  40. CreateUserName = uscu.Name,
  41. CreateTime = evnm.CreateTime,
  42. ModifyUserID = evnm.ModifyUserID,
  43. ModifyUserName = usmu.Name,
  44. ModifyTime = evnm.ModifyTime
  45. };
  46. return query;
  47. }
  48. /// <summary>
  49. /// 查询对应的评分标准明细信息EvaluationNormDetailView
  50. /// </summary>
  51. /// <param name="exp"></param>
  52. /// <returns></returns>
  53. public IQueryable<EvaluationNormDetailView> GetEvaluationNormDetailViewQueryable(Expression<Func<EM_EvaluationNormDetail, bool>> exp)
  54. {
  55. var query = from evnmdtl in EvaluationNormDetailRepository.GetList(exp)
  56. join evnm in EvaluationNormRepository.Entities
  57. on evnmdtl.EvaluationNormID equals evnm.EvaluationNormID
  58. select new EvaluationNormDetailView
  59. {
  60. EvaluationNormDetailID = evnmdtl.EvaluationNormDetailID,
  61. EvaluationNormID = evnmdtl.EvaluationNormID,
  62. EvaluationNormName = evnm.Name,
  63. OrderNo = evnmdtl.OrderNo,
  64. Name = evnmdtl.Name,
  65. Weight = evnmdtl.Weight,
  66. NormTypeID = evnm.NormTypeID,
  67. Remark = evnmdtl.Remark,
  68. RecordStatus = evnmdtl.RecordStatus,
  69. CreateUserID = evnmdtl.CreateUserID,
  70. CreateTime = evnmdtl.CreateTime,
  71. ModifyUserID = evnmdtl.ModifyUserID,
  72. ModifyTime = evnmdtl.ModifyTime
  73. };
  74. return query;
  75. }
  76. }
  77. }