EvaluationIntTypeDAL.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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;
  8. using EMIS.ViewModel.EvaluationManage.EvaluationSetting;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.EvaluationManage.EvaluationSetting
  11. {
  12. public class EvaluationIntTypeDAL
  13. {
  14. public EvaluationIntTypeRepository EvaluationIntTypeRepository { get; set; }
  15. public EvaluationTeachingModeRepository EvaluationTeachingModeRepository { get; set; }
  16. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  17. public UserRepository UserRepository { get; set; }
  18. /// <summary>
  19. /// 查询对应的评价类型信息EvaluationIntTypeView
  20. /// </summary>
  21. /// <param name="exp"></param>
  22. /// <returns></returns>
  23. public IQueryable<EvaluationIntTypeView> GetEvaluationIntTypeViewQueryable(Expression<Func<EM_EvaluationIntType, bool>> exp)
  24. {
  25. var query = from evit in EvaluationIntTypeRepository.GetList(exp)
  26. join usc in UserRepository.Entities
  27. on evit.CreateUserID equals usc.UserID into tempusc
  28. from uscu in tempusc.DefaultIfEmpty()
  29. join usm in UserRepository.Entities
  30. on evit.ModifyUserID equals usm.UserID into tempusm
  31. from usmu in tempusm.DefaultIfEmpty()
  32. select new EvaluationIntTypeView
  33. {
  34. EvaluationIntTypeID = evit.EvaluationIntTypeID,
  35. Code = evit.Code,
  36. Name = evit.Name,
  37. TeachingModeIDList = evit.EM_EvaluationTeachingMode.OrderBy(x => x.TeachingModeID).Select(x => x.TeachingModeID).ToList(),
  38. Remark = evit.Remark,
  39. RecordStatus = evit.RecordStatus,
  40. CreateUserID = evit.CreateUserID,
  41. CreateUserName = uscu.Name,
  42. CreateTime = evit.CreateTime,
  43. ModifyUserID = evit.ModifyUserID,
  44. ModifyUserName = usmu.Name,
  45. ModifyTime = evit.ModifyTime
  46. };
  47. return query;
  48. }
  49. /// <summary>
  50. /// 查询评价类型对应的授课方式
  51. /// </summary>
  52. /// <param name="exp"></param>
  53. /// <returns></returns>
  54. public IQueryable<int?> GetTeachingModeTypeQueryble(Expression<Func<EM_EvaluationIntType, bool>> exp)
  55. {
  56. var query = from it in EvaluationIntTypeRepository.GetList(exp)
  57. join tm in EvaluationTeachingModeRepository.Entities
  58. on it.EvaluationIntTypeID equals tm.EvaluationIntTypeID
  59. join dictm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
  60. on tm.TeachingModeID equals dictm.Value
  61. select dictm.Value;
  62. return query;
  63. }
  64. }
  65. }