EvaluationTypeDAL.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.EvaluationManage.EvaluationSetting;
  8. using EMIS.DataLogic.Repositories;
  9. namespace EMIS.DataLogic.EvaluationManage.EvaluationSetting
  10. {
  11. public class EvaluationTypeDAL
  12. {
  13. public EvaluationTypeRepository EvaluationTypeRepository { get; set; }
  14. public UserRepository UserRepository { get; set; }
  15. /// <summary>
  16. /// 查询对应的参评类型信息EvaluationTypeView
  17. /// </summary>
  18. /// <param name="exp"></param>
  19. /// <returns></returns>
  20. public IQueryable<EvaluationTypeView> GetEvaluationTypeViewQueryable(Expression<Func<EM_EvaluationType, bool>> exp)
  21. {
  22. var query = from evtp in EvaluationTypeRepository.GetList(exp)
  23. join usc in UserRepository.Entities
  24. on evtp.CreateUserID equals usc.UserID into tempusc
  25. from uscu in tempusc.DefaultIfEmpty()
  26. join usm in UserRepository.Entities
  27. on evtp.ModifyUserID equals usm.UserID into tempusm
  28. from usmu in tempusm.DefaultIfEmpty()
  29. select new EvaluationTypeView
  30. {
  31. EvaluationTypeID = evtp.EvaluationTypeID,
  32. Name = evtp.Name,
  33. IsStudent = evtp.IsStudent.Value,
  34. Number = evtp.Number,
  35. StartTime = evtp.StartTime,
  36. EndTime = evtp.EndTime,
  37. Remark = evtp.Remark,
  38. RecordStatus = evtp.RecordStatus,
  39. CreateUserID = evtp.CreateUserID,
  40. CreateUserName = uscu.Name,
  41. CreateTime = evtp.CreateTime,
  42. ModifyUserID = evtp.ModifyUserID,
  43. ModifyUserName = usmu.Name,
  44. ModifyTime = evtp.ModifyTime
  45. };
  46. return query;
  47. }
  48. }
  49. }