EvaluationIntTypeDAL.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using EMIS.Entities;
  2. using EMIS.ViewModel.EvaluationManage;
  3. using EMIS.DataLogic.Repositories;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Linq.Expressions;
  8. using System.Text;
  9. using EMIS.ViewModel;
  10. namespace EMIS.DataLogic.Common.EvaluationManage
  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. /// <summary>
  18. /// 读取评价类型信息
  19. /// </summary>
  20. /// <param name="exp"></param>
  21. /// <returns></returns>
  22. public IQueryable<EvaluationIntTypeView> GetEvaluationIntTypeQueryable(Expression<Func<EM_EvaluationIntType, bool>> exp)
  23. {
  24. var query = from a in evaluationIntTypeRepository.GetList(exp)
  25. select new EvaluationIntTypeView
  26. {
  27. Remark = a.Remark,
  28. Code = a.Code,
  29. Name = a.Name,
  30. EvaluationIntTypeID = a.EvaluationIntTypeID
  31. };
  32. return query;
  33. }
  34. public List<TeachingModeTypeView> GetEvaluationTeachingModeTypeQuery(Expression<Func<EM_EvaluationTeachingMode, bool>> exp)
  35. {
  36. var query = (from evainTmode in evaluationTeachingModeRepository.GetList(exp)
  37. join b in dictionaryItemRepository.Entities on new { TeachingModeType = evainTmode.TeachingModeID, DictionaryCode = typeof(CF_TeachingMode).Name }
  38. equals new { TeachingModeType = b.Value, b.DictionaryCode }
  39. into dicTep
  40. from dictab in dicTep.DefaultIfEmpty()
  41. select new TeachingModeTypeView
  42. {
  43. EvaluationIntTypeID = evainTmode.EvaluationIntTypeID,
  44. TeachingModeType = evainTmode.TeachingModeID,
  45. TeachingModeTypeName = dictab.Name
  46. });
  47. return query.ToList();
  48. }
  49. /// <summary>
  50. /// 根据教室ID获取教室类型
  51. /// </summary>
  52. /// <param name="specialtyCourseID"></param>
  53. /// <returns></returns>
  54. public List<int> GetTeachingModeTypeQueryble(Guid? evaluationIntTypeID)
  55. {
  56. var query = from a in evaluationTeachingModeRepository.Entities.Where(x => x.EvaluationIntTypeID == evaluationIntTypeID)
  57. join b in dictionaryItemRepository.Entities on new { TeachingModeType = a.TeachingModeID, DictionaryCode = DictionaryItem.CF_TeachingMode.ToString() }
  58. equals new { TeachingModeType = b.Value, b.DictionaryCode }
  59. select b.Value.Value;
  60. return query.ToList();
  61. }
  62. }
  63. }