ReentryServices.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Bowin.Common.Linq;
  6. using EMIS.CommonLogic.SystemServices;
  7. using EMIS.Entities;
  8. using Bowin.Common.Linq.Entity;
  9. using EMIS.ViewModel.DifferentDynamic;
  10. using EMIS.ViewModel;
  11. using EMIS.DataLogic.Common.Students;
  12. using System.Linq.Expressions;
  13. namespace EMIS.CommonLogic.Students
  14. {
  15. public class ReentryServices : BaseWorkflowServices<CF_DifferentDynamic>, IReentryServices
  16. {
  17. public DifferentDynamicDAL DifferentDynamicDAL { get; set; }
  18. public IGridResultSet<StudentReentryView> GetStudentReentryViewGrid(ConfiguretView configuretView, Guid? returnSchoolyearID, Guid? campusID, Guid? collegeID,
  19. int? education, int? year, int? standard, int? learningform, int pageIndex, int pageSize)
  20. {
  21. var endStatusID = this.GetCorrectEndStatus();
  22. Expression<Func<CF_DifferentDynamic, bool>> filter = (x => true);
  23. Expression<Func<CF_College, bool>> collegeFilter = (x => true);
  24. Expression<Func<CF_Facultymajor, bool>> facultyFilter = (x => true);
  25. Expression<Func<CF_Grademajor, bool>> gradeFilter = (x => true);
  26. if (returnSchoolyearID.HasValue)
  27. {
  28. filter = filter.And(x => x.ReturnSchoolyearID == returnSchoolyearID);
  29. }
  30. if (campusID.HasValue)
  31. {
  32. collegeFilter = collegeFilter.And(x => x.CampusID == campusID);
  33. }
  34. if (collegeID.HasValue)
  35. {
  36. collegeFilter = collegeFilter.And(x => x.CollegeID == collegeID);
  37. }
  38. if (education.HasValue)
  39. {
  40. facultyFilter = facultyFilter.And(x => x.EducationID == education);
  41. }
  42. if (year.HasValue)
  43. {
  44. gradeFilter = gradeFilter.And(x => x.GradeID == year);
  45. }
  46. if (standard.HasValue)
  47. {
  48. facultyFilter = facultyFilter.And(x => x.StandardID == standard);
  49. }
  50. if (learningform.HasValue)
  51. {
  52. facultyFilter = facultyFilter.And(x => x.LearningformID == learningform);
  53. }
  54. var query = DifferentDynamicDAL.GetNeedReturnList(filter, endStatusID.Value, gradeFilter, facultyFilter, collegeFilter);
  55. query = GetQueryByDataRangeByCollege(query);
  56. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  57. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  58. query = query.OrderByDescending(w => w.CreateTime);
  59. var result = query.ToGridResultSet(pageIndex, pageSize);
  60. return result;
  61. }
  62. public List<StudentReentryView> GetStudentReentryViewList(ConfiguretView configuretView, Guid? returnSchoolyearID, Guid? campusID, Guid? collegeID,
  63. int? education, int? year, int? standard, int? learningform)
  64. {
  65. var endStatusID = this.GetCorrectEndStatus();
  66. Expression<Func<CF_DifferentDynamic, bool>> filter = (x => true);
  67. Expression<Func<CF_College, bool>> collegeFilter = (x => true);
  68. Expression<Func<CF_Facultymajor, bool>> facultyFilter = (x => true);
  69. Expression<Func<CF_Grademajor, bool>> gradeFilter = (x => true);
  70. if (returnSchoolyearID.HasValue)
  71. {
  72. filter = filter.And(x => x.ReturnSchoolyearID == returnSchoolyearID);
  73. }
  74. if (campusID.HasValue)
  75. {
  76. collegeFilter = collegeFilter.And(x => x.CampusID == campusID);
  77. }
  78. if (collegeID.HasValue)
  79. {
  80. collegeFilter = collegeFilter.And(x => x.CollegeID == collegeID);
  81. }
  82. if (education.HasValue)
  83. {
  84. facultyFilter = facultyFilter.And(x => x.EducationID == education);
  85. }
  86. if (year.HasValue)
  87. {
  88. gradeFilter = gradeFilter.And(x => x.GradeID == year);
  89. }
  90. if (standard.HasValue)
  91. {
  92. facultyFilter = facultyFilter.And(x => x.StandardID == standard);
  93. }
  94. if (learningform.HasValue)
  95. {
  96. facultyFilter = facultyFilter.And(x => x.LearningformID == learningform);
  97. }
  98. var query = DifferentDynamicDAL.GetNeedReturnList(filter, endStatusID.Value, gradeFilter, facultyFilter, collegeFilter);
  99. query = GetQueryByDataRangeByCollege(query);
  100. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  101. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  102. query = query.OrderByDescending(w => w.CreateTime);
  103. var result = query.ToList();
  104. return result;
  105. }
  106. }
  107. }