EvaluationParticipateTypeDAL.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel;
  8. using EMIS.ViewModel.EvaluationManage.EvaluationSetting;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.EvaluationManage.EvaluationSetting
  11. {
  12. public class EvaluationParticipateTypeDAL
  13. {
  14. public EvaluationParticipateTypeRepository EvaluationParticipateTypeRepository { get; set; }
  15. public UserRepository UserRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的参评类型信息EvaluationParticipateTypeView
  18. /// </summary>
  19. /// <param name="exp"></param>
  20. /// <returns></returns>
  21. public IQueryable<EvaluationParticipateTypeView> GetEvaluationParticipateTypeViewQueryable(Expression<Func<EM_EvaluationParticipateType, bool>> exp)
  22. {
  23. var query = from evpt in EvaluationParticipateTypeRepository.GetList(exp)
  24. join usc in UserRepository.Entities
  25. on evpt.CreateUserID equals usc.UserID into tempusc
  26. from uscu in tempusc.DefaultIfEmpty()
  27. join usm in UserRepository.Entities
  28. on evpt.ModifyUserID equals usm.UserID into tempusm
  29. from usmu in tempusm.DefaultIfEmpty()
  30. select new EvaluationParticipateTypeView
  31. {
  32. EvaluationParticipateTypeID = evpt.EvaluationParticipateTypeID,
  33. ParticipateTypeID = evpt.ParticipateTypeID,
  34. IsStudent = evpt.IsStudent.Value,
  35. Number = evpt.Number,
  36. StartTime = evpt.StartTime,
  37. EndTime = evpt.EndTime,
  38. Remark = evpt.Remark,
  39. RecordStatus = evpt.RecordStatus,
  40. CreateUserID = evpt.CreateUserID,
  41. CreateUserName = uscu.Name,
  42. CreateTime = evpt.CreateTime,
  43. ModifyUserID = evpt.ModifyUserID,
  44. ModifyUserName = usmu.Name,
  45. ModifyTime = evpt.ModifyTime
  46. };
  47. return query;
  48. }
  49. }
  50. }