DegreeConditionPackageDAL.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.DegreeManage.DegreeSetting;
  9. namespace EMIS.DataLogic.DegreeManage.DegreeSetting
  10. {
  11. public class DegreeConditionPackageDAL
  12. {
  13. public DegreeConditionPackageRepository DegreeConditionPackageRepository { get; set; }
  14. public DegreeConditionRepository DegreeConditionRepository { get; set; }
  15. public DegreeApplyRepository DegreeApplyRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的学位公式信息View(只查询学位公式信息,不查询学位公式对应的学位条件)
  18. /// </summary>
  19. /// <param name="exp"></param>
  20. /// <returns></returns>
  21. public IQueryable<DegreeConditionPackageView> GetDegreeConditionPackageViewQueryable(Expression<Func<ER_DegreeConditionPackage, bool>> exp)
  22. {
  23. var query = from dp in DegreeConditionPackageRepository.GetList(exp)
  24. select new DegreeConditionPackageView
  25. {
  26. DegreeConditionPackageID = dp.DegreeConditionPackageID,
  27. Title = dp.Title,
  28. StudentTypeID = dp.StudentType,
  29. IsDefault = dp.IsDefault.Value,
  30. IsEnable = dp.RecordStatus.Value > 0 ? true : false,
  31. RecordStatus = dp.RecordStatus,
  32. CreateUserID = dp.CreateUserID,
  33. CreateTime = dp.CreateTime,
  34. ModifyUserID = dp.ModifyUserID,
  35. ModifyTime = dp.ModifyTime
  36. };
  37. return query;
  38. }
  39. /// <summary>
  40. /// 查询学位公式中对应的学位条件信息View(DegreeConditionView)
  41. /// </summary>
  42. /// <param name="exp"></param>
  43. /// <returns></returns>
  44. public IQueryable<DegreeConditionView> GetDegreeConditionQueryable(Expression<Func<ER_DegreeConditionPackage, bool>> exp)
  45. {
  46. var query = from dp in DegreeConditionPackageRepository.GetList(exp)
  47. from dc in dp.ER_DegreeCondition
  48. select new DegreeConditionView
  49. {
  50. DegreeConditionID = dc.DegreeConditionID,
  51. OrderNo = dc.OrderNo,
  52. Title = dc.Title,
  53. MethodFullName = dc.MethodFullName,
  54. IsEnable = dc.RecordStatus.Value > 0 ? true : false,
  55. RecordStatus = dc.RecordStatus,
  56. CreateUserID = dc.CreateUserID,
  57. CreateTime = dc.CreateTime,
  58. ModifyUserID = dc.ModifyUserID,
  59. ModifyTime = dc.ModifyTime
  60. };
  61. return query;
  62. }
  63. /// <summary>
  64. /// 查询学位公式中未存在的学位条件信息View(DegreeConditionView)
  65. /// </summary>
  66. /// <param name="expDegreeCondition"></param>
  67. /// <param name="degreeConditionPackageID"></param>
  68. /// <returns></returns>
  69. public IQueryable<DegreeConditionView> GetDegreeConditionNoQueryable(Expression<Func<ER_DegreeCondition, bool>> expDegreeCondition,
  70. Guid? degreeConditionPackageID)
  71. {
  72. var query = from dc in DegreeConditionRepository.GetList(expDegreeCondition)
  73. from dp in dc.ER_DegreeConditionPackage
  74. .Where(x => x.DegreeConditionPackageID == degreeConditionPackageID).DefaultIfEmpty()
  75. where !dp.ER_DegreeCondition.Contains(dc)
  76. select new DegreeConditionView
  77. {
  78. DegreeConditionID = dc.DegreeConditionID,
  79. OrderNo = dc.OrderNo,
  80. Title = dc.Title,
  81. MethodFullName = dc.MethodFullName,
  82. IsEnable = dc.RecordStatus.Value > 0 ? true : false,
  83. RecordStatus = dc.RecordStatus,
  84. CreateUserID = dc.CreateUserID,
  85. CreateTime = dc.CreateTime,
  86. ModifyUserID = dc.ModifyUserID,
  87. ModifyTime = dc.ModifyTime
  88. };
  89. return query;
  90. }
  91. }
  92. }