GraduationConditionPackageDAL.cs 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.GraduationManage.GraduationSetting;
  7. using EMIS.Entities;
  8. using System.Linq.Expressions;
  9. namespace EMIS.DataLogic.GraduationManage.GraduationSetting
  10. {
  11. public class GraduationConditionPackageDAL
  12. {
  13. public GraduationConditionPackageRepository GraduationConditionPackageRepository { get; set; }
  14. public GraduationConditionRepository GraduationConditionRepository { get; set; }
  15. public GraduationApplyRepository GraduationApplyRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的毕业公式信息View(只查询毕业公式信息,不查询毕业公式对应的毕业条件)
  18. /// </summary>
  19. /// <param name="exp"></param>
  20. /// <returns></returns>
  21. public IQueryable<GraduationConditionPackageView> GetGraduationConditionPackageQueryable(Expression<Func<ER_GraduationConditionPackage, bool>> exp)
  22. {
  23. var query = from gp in GraduationConditionPackageRepository.GetList(exp)
  24. select new GraduationConditionPackageView
  25. {
  26. GraduationConditionPackageID = gp.GraduationConditionPackageID,
  27. Title = gp.Title,
  28. StudentTypeID = gp.StudentType,
  29. IsDefault = gp.IsDefault.Value,
  30. IsEnable = gp.RecordStatus.Value > 0 ? true : false,
  31. RecordStatus = gp.RecordStatus,
  32. CreateUserID = gp.CreateUserID,
  33. CreateTime = gp.CreateTime,
  34. ModifyUserID = gp.ModifyUserID,
  35. ModifyTime = gp.ModifyTime
  36. };
  37. return query;
  38. }
  39. /// <summary>
  40. /// 查询毕业公式中对应的毕业条件信息View(GraduationConditionView)
  41. /// </summary>
  42. /// <param name="exp"></param>
  43. /// <returns></returns>
  44. public IQueryable<GraduationConditionView> GraduationConditionQueryable(Expression<Func<ER_GraduationConditionPackage, bool>> exp)
  45. {
  46. var query = from gp in GraduationConditionPackageRepository.GetList(exp)
  47. from gc in gp.ER_GraduationCondition
  48. select new GraduationConditionView
  49. {
  50. GraduationConditionID = gc.GraduationConditionID,
  51. OrderNo = gc.OrderNo,
  52. Title = gc.Title,
  53. MethodFullName = gc.MethodFullName,
  54. IsEnable = gc.RecordStatus.Value > 0 ? true : false,
  55. RecordStatus = gc.RecordStatus,
  56. CreateUserID = gc.CreateUserID,
  57. CreateTime = gc.CreateTime,
  58. ModifyUserID = gc.ModifyUserID,
  59. ModifyTime = gc.ModifyTime
  60. };
  61. return query;
  62. }
  63. /// <summary>
  64. /// 查询毕业公式中未存在的毕业条件信息View(GraduationConditionView)
  65. /// </summary>
  66. /// <param name="expGraduationCondition"></param>
  67. /// <param name="graduationConditionPackageID"></param>
  68. /// <returns></returns>
  69. public IQueryable<GraduationConditionView> GetGraduationConditionNoQueryable(Expression<Func<ER_GraduationCondition, bool>> expGraduationCondition, Guid? graduationConditionPackageID)
  70. {
  71. var query = from gc in GraduationConditionRepository.GetList(expGraduationCondition)
  72. from gp in gc.ER_GraduationConditionPackage.Where(x => x.GraduationConditionPackageID == graduationConditionPackageID).DefaultIfEmpty()
  73. where !gp.ER_GraduationCondition.Contains(gc)
  74. select new GraduationConditionView
  75. {
  76. GraduationConditionID = gc.GraduationConditionID,
  77. OrderNo = gc.OrderNo,
  78. Title = gc.Title,
  79. MethodFullName = gc.MethodFullName,
  80. IsEnable = gc.RecordStatus.Value > 0 ? true : false,
  81. RecordStatus = gc.RecordStatus,
  82. CreateUserID = gc.CreateUserID,
  83. CreateTime = gc.CreateTime,
  84. ModifyUserID = gc.ModifyUserID,
  85. ModifyTime = gc.ModifyTime
  86. };
  87. return query;
  88. }
  89. }
  90. }