SpecialtyDAL.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. using EMIS.DataLogic.Repositories;
  7. using EMIS.Entities;
  8. using EMIS.ViewModel;
  9. using EMIS.ViewModel.EnrollManage.SpecialtyManage;
  10. namespace EMIS.DataLogic.EnrollManage.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 spe in SpecialtyRepository.GetList(expSpecialty)
  24. join stan in DictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
  25. on spe.StandardID equals stan.Value into tempstan
  26. from dtstan in tempstan.DefaultIfEmpty()
  27. select new SpecialtyView
  28. {
  29. SpecialtyID = spe.SpecialtyID,
  30. StandardID = spe.StandardID,
  31. StandardCode = dtstan.Code,
  32. StandardName = dtstan.Name,
  33. EducationID = spe.EducationID,
  34. LearningformID = spe.LearningformID,
  35. LearnSystem = spe.LearnSystem,
  36. ScienceclassID = spe.ScienceclassID,
  37. PropertyID = spe.PropertyID,
  38. StandardTitle = spe.StandardTitle,
  39. StandardLevel = spe.StandardLevel,
  40. RecordStatus = spe.RecordStatus,
  41. Remark = spe.Remark,
  42. CreateUserID = spe.CreateUserID,
  43. CreateTime = spe.CreateTime,
  44. ModifyUserID = spe.ModifyUserID,
  45. ModifyTime = spe.ModifyTime,
  46. };
  47. return query;
  48. }
  49. /// <summary>
  50. /// 查询专业信息中专业名称(去重)
  51. /// </summary>
  52. /// <param name="exp"></param>
  53. /// <returns></returns>
  54. public IQueryable<SpecialtyView> GetStandardViewQueryable(Expression<Func<CF_Specialty, bool>> exp)
  55. {
  56. var query = from spe in SpecialtyRepository.GetList(exp)
  57. join dtstan in DictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
  58. on spe.StandardID equals dtstan.Value
  59. select new SpecialtyView
  60. {
  61. StandardID = spe.StandardID,
  62. StandardCode = dtstan.Code,
  63. StandardName = dtstan.Name
  64. };
  65. return query.Distinct();
  66. }
  67. /// <summary>
  68. /// 查询专业信息中学制信息(去重)
  69. /// </summary>
  70. /// <param name="exp"></param>
  71. /// <returns></returns>
  72. public IQueryable<SpecialtyView> GetLearnSystemViewQueryable(Expression<Func<CF_Specialty, bool>> exp)
  73. {
  74. var query = from spe in SpecialtyRepository.GetList(exp)
  75. select new SpecialtyView
  76. {
  77. LearnSystem = spe.LearnSystem
  78. };
  79. return query.Distinct();
  80. }
  81. }
  82. }