SpecialtyDAL.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel.Specialtymanage;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel;
  10. namespace EMIS.DataLogic.Common.Specialtymanage
  11. {
  12. public class SpecialtyDAL
  13. {
  14. public SpecialtyRepository SpecialtyRepository { get; set; }
  15. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的专业信息View
  18. /// </summary>
  19. /// <param name="expSpecialty"></param>
  20. /// <returns></returns>
  21. public IQueryable<SpecialtyView> GetSpecialtyViewQueryable(Expression<Func<CF_Specialty, bool>> expSpecialty)
  22. {
  23. var query = from a in SpecialtyRepository.GetList(expSpecialty)
  24. join b in DictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
  25. on a.StandardID equals b.Value into temp
  26. from standard in temp.DefaultIfEmpty()
  27. select new SpecialtyView
  28. {
  29. SpecialtyID = a.SpecialtyID,
  30. StandardID = a.StandardID,
  31. StandardCode = standard.Code,
  32. StandardName = standard.Name,
  33. EducationID = a.EducationID,
  34. LearningformID = a.LearningformID,
  35. LearnSystem = a.LearnSystem,
  36. ScienceclassID = a.ScienceclassID,
  37. PropertyID = a.PropertyID,
  38. StandardTitle = a.StandardTitle,
  39. StandardLevel = a.StandardLevel,
  40. RecordStatus = a.RecordStatus,
  41. Remark = a.Remark,
  42. CreateUserID = a.CreateUserID,
  43. CreateTime = a.CreateTime,
  44. ModifyUserID = a.ModifyUserID,
  45. ModifyTime = a.ModifyTime,
  46. };
  47. return query;
  48. }
  49. /// <summary>
  50. /// 查询专业信息中学制信息(去重)
  51. /// </summary>
  52. /// <param name="exp"></param>
  53. /// <returns></returns>
  54. public IQueryable<SpecialtyView> GetLearnSystemQueryable(Expression<Func<CF_Specialty, bool>> exp)
  55. {
  56. var query = from a in SpecialtyRepository.GetList(exp)
  57. select new SpecialtyView
  58. {
  59. LearnSystem = a.LearnSystem
  60. };
  61. return query.Distinct();
  62. }
  63. }
  64. }