SpecialtyClassSettingDAL.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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;
  8. using EMIS.ViewModel.EnrollManage.SpecialtyManage;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.EnrollManage.SpecialtyManage
  11. {
  12. public class SpecialtyClassSettingDAL
  13. {
  14. public SpecialtyClassSettingRepository SpecialtyClassSettingRepository { get; set; }
  15. public SpecialtyRepository SpecialtyRepository { get; set; }
  16. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  17. /// <summary>
  18. /// 查询对应的专业分班信息View
  19. /// </summary>
  20. /// <param name="exp"></param>
  21. /// <returns></returns>
  22. public IQueryable<SpecialtyClassSettingView> GetSpecialtyClassSettingViewQueryable(Expression<Func<CF_SpecialtyClassSetting, bool>> exp)
  23. {
  24. var query = from spcs in SpecialtyClassSettingRepository.GetList(exp)
  25. join sp in SpecialtyRepository.Entities
  26. on spcs.SpecialtyID equals sp.SpecialtyID
  27. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  28. on sp.StandardID equals dicst.Value into tempst
  29. from standard in tempst.DefaultIfEmpty()
  30. select new SpecialtyClassSettingView
  31. {
  32. SpecialtyClassSettingID = spcs.SpecialtyClassSettingID,
  33. SpecialtyID = spcs.SpecialtyID,
  34. StandardID = sp.StandardID,
  35. StandardCode = standard.Code,
  36. StandardName = standard.Name,
  37. EducationID = sp.EducationID,
  38. LearningformID = sp.LearningformID,
  39. LearnSystem = sp.LearnSystem,
  40. ScienceclassID = sp.ScienceclassID,
  41. PropertyID = sp.PropertyID,
  42. StandardTitle = sp.StandardTitle,
  43. StandardLevel = sp.StandardLevel,
  44. PlanRecruitStudentCount = spcs.PlanRecruitStudentCount ?? 0,
  45. ClassArrangeStudentCount = spcs.ClassArrangeStudentCount ?? 0,
  46. ClassMaxStudentCount = spcs.ClassMaxStudentCount ?? 0,
  47. ClassNumber = spcs.ClassNumber ?? 1,
  48. RecordStatus = spcs.RecordStatus,
  49. CreateUserID = spcs.CreateUserID,
  50. CreateTime = spcs.CreateTime,
  51. ModifyUserID = spcs.ModifyUserID,
  52. ModifyTime = spcs.ModifyTime,
  53. };
  54. return query;
  55. }
  56. /// <summary>
  57. /// 查询专业分班中未新增的专业信息SpecialtyView
  58. /// </summary>
  59. /// <param name="expSpecialty"></param>
  60. /// <param name="expSpecialtyClassSetting"></param>
  61. /// <returns></returns>
  62. public IQueryable<SpecialtyView> GetSpecialtyViewNoAddQueryable(Expression<Func<CF_Specialty, bool>> expSpecialty, Expression<Func<CF_SpecialtyClassSetting, bool>> expSpecialtyClassSetting)
  63. {
  64. var query = from sp in SpecialtyRepository.GetList(expSpecialty)
  65. join stdic in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  66. on sp.StandardID equals stdic.Value into tempstdic
  67. from standard in tempstdic.DefaultIfEmpty()
  68. join sc in SpecialtyClassSettingRepository.GetList(expSpecialtyClassSetting)
  69. on sp.SpecialtyID equals sc.SpecialtyID into tempsc
  70. from spcs in tempsc.DefaultIfEmpty()
  71. where spcs.SpecialtyClassSettingID == null
  72. select new SpecialtyView
  73. {
  74. SpecialtyID = sp.SpecialtyID,
  75. StandardID = sp.StandardID,
  76. StandardCode = standard.Code,
  77. StandardName = standard.Name,
  78. EducationID = sp.EducationID,
  79. LearningformID = sp.LearningformID,
  80. LearnSystem = sp.LearnSystem,
  81. ScienceclassID = sp.ScienceclassID,
  82. PropertyID = sp.PropertyID,
  83. StandardTitle = sp.StandardTitle,
  84. StandardLevel = sp.StandardLevel,
  85. RecordStatus = sp.RecordStatus,
  86. Remark = sp.Remark,
  87. CreateUserID = sp.CreateUserID,
  88. CreateTime = sp.CreateTime,
  89. ModifyUserID = sp.ModifyUserID,
  90. ModifyTime = sp.ModifyTime,
  91. };
  92. return query;
  93. }
  94. }
  95. }