EvaluationProjectDAL.cs 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 EvaluationProjectDAL
  12. {
  13. public EvaluationProjectRepository EvaluationProjectRepository { get; set; }
  14. public EvaluationTargetRepository EvaluationTargetRepository { get; set; }
  15. public EvaluationTableRepository EvaluationTableRepository { get; set; }
  16. public EvaluationNormRepository EvaluationNormRepository { get; set; }
  17. public EvaluationParticipateTypeRepository EvaluationParticipateTypeRepository { get; set; }
  18. public EvaluationIntTypeRepository EvaluationIntTypeRepository { get; set; }
  19. public UserRepository UserRepository { get; set; }
  20. /// <summary>
  21. /// 查询对应的评价项目信息EvaluationProjectView
  22. /// </summary>
  23. /// <param name="exp"></param>
  24. /// <returns></returns>
  25. public IQueryable<EvaluationProjectView> GetEvaluationProjectViewQueryable(Expression<Func<EM_EvaluationProject, bool>> exp)
  26. {
  27. var query = from evpj in EvaluationProjectRepository.GetList(exp)
  28. join evtg in EvaluationTargetRepository.Entities
  29. on evpj.EvaluationTargetID equals evtg.EvaluationTargetID
  30. join evtb in EvaluationTableRepository.Entities
  31. on evtg.EvaluationTableID equals evtb.EvaluationTableID
  32. join evnm in EvaluationNormRepository.Entities
  33. on evtg.EvaluationNormID equals evnm.EvaluationNormID
  34. join evpt in EvaluationParticipateTypeRepository.Entities
  35. on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
  36. join evit in EvaluationIntTypeRepository.Entities
  37. on evtb.EvaluationIntTypeID equals evit.EvaluationIntTypeID
  38. join usc in UserRepository.Entities
  39. on evpj.CreateUserID equals usc.UserID into tempusc
  40. from uscu in tempusc.DefaultIfEmpty()
  41. join usm in UserRepository.Entities
  42. on evpj.ModifyUserID equals usm.UserID into tempusm
  43. from usmu in tempusm.DefaultIfEmpty()
  44. select new EvaluationProjectView
  45. {
  46. EvaluationProjectID = evpj.EvaluationProjectID,
  47. OrderNo = evpj.OrderNo,
  48. Code = evpj.Code,
  49. Name = evpj.Name,
  50. EvaluationTargetID = evpj.EvaluationTargetID,
  51. EvaluationTargetOrderNo = evtg.OrderNo,
  52. EvaluationTargetCode = evtg.Code,
  53. EvaluationTargetName = evtg.Name,
  54. EvaluationTargetWeight = evtg.Weight,
  55. EvaluationTableID = evtg.EvaluationTableID,
  56. EvaluationTableCode = evtb.Code,
  57. EvaluationTableName = evtb.Name,
  58. EvaluationTableWeight = evtb.Weight,
  59. EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
  60. ParticipateTypeID = evpt.ParticipateTypeID,
  61. IsStudent = evpt.IsStudent.Value,
  62. EvaluationTypeID = evtb.EvaluationIntTypeID,
  63. EvaluationTypeCode = evit.Code,
  64. EvaluationTypeName = evit.Name,
  65. TeachingModeIDList = evit.EM_EvaluationTeachingMode.OrderBy(x => x.TeachingModeID).Select(x => x.TeachingModeID).ToList(),
  66. EvaluationNormID = evtg.EvaluationNormID,
  67. EvaluationNormName = evnm.Name,
  68. NormTypeID = evnm.NormTypeID,
  69. Weight = evpj.Weight,
  70. Remark = evpj.Remark,
  71. RecordStatus = evpj.RecordStatus,
  72. CreateUserID = evpj.CreateUserID,
  73. CreateUserName = uscu.Name,
  74. CreateTime = evpj.CreateTime,
  75. ModifyUserID = evpj.ModifyUserID,
  76. ModifyUserName = usmu.Name,
  77. ModifyTime = evpj.ModifyTime
  78. };
  79. return query;
  80. }
  81. }
  82. }