EvaluationNeedDAL.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.EvaluationSetting;
  8. using EMIS.DataLogic.Repositories;
  9. namespace EMIS.DataLogic.EvaluationManage.EvaluationSetting
  10. {
  11. public class EvaluationNeedDAL
  12. {
  13. public EvaluationNeedRepository EvaluationNeedRepository { get; set; }
  14. public UserRepository UserRepository { get; set; }
  15. /// <summary>
  16. /// 查询对应的评价需知信息EvaluationNeedView
  17. /// </summary>
  18. /// <param name="expEvaluationNeed"></param>
  19. /// <returns></returns>
  20. public IQueryable<EvaluationNeedView> GetEvaluationNeedViewQueryable(Expression<Func<EM_EvaluationNeed, bool>> expEvaluationNeed)
  21. {
  22. var query = from evnd in EvaluationNeedRepository.GetList(expEvaluationNeed)
  23. join usc in UserRepository.Entities
  24. on evnd.CreateUserID equals usc.UserID into tempusc
  25. from uscu in tempusc.DefaultIfEmpty()
  26. join usm in UserRepository.Entities
  27. on evnd.ModifyUserID equals usm.UserID into tempusm
  28. from usmu in tempusm.DefaultIfEmpty()
  29. select new EvaluationNeedView
  30. {
  31. EvaluationNeedID = evnd.EvaluationNeedID,
  32. Code = evnd.Code,
  33. Title = evnd.Title,
  34. ParticipateTypeID = evnd.ParticipateTypeID,
  35. Content = evnd.Content,
  36. IsEnabled = evnd.IsEnabled.Value,
  37. Remark = evnd.Remark,
  38. RecordStatus = evnd.RecordStatus,
  39. CreateUserID = evnd.CreateUserID,
  40. CreateUserName = uscu.Name,
  41. CreateTime = evnd.CreateTime,
  42. ModifyUserID = evnd.ModifyUserID,
  43. ModifyUserName = usmu.Name,
  44. ModifyTime = evnd.ModifyTime
  45. };
  46. return query;
  47. }
  48. }
  49. }