TeachingPlanServices.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMISOnline.Entities;
  6. using Bowin.Common.Linq.Entity;
  7. using System.Linq.Expressions;
  8. using EMISOnline.ViewModel.Educational;
  9. using Bowin.Common.Linq;
  10. using EMISOnline.DataLogic.Educational;
  11. namespace EMISOnline.CommonLogic.EducationalServices
  12. {
  13. public class TeachingPlanServices : BaseServices, ITeachingPlanServices
  14. {
  15. public TeachingPlanDAL TeachingPlanDAL { get; set; }
  16. public IGridResultSet<TeachingPlanView> GetTeachingPlanList(int pageIndex, int pageSize, string grademajorName, string facultymajorName, string courseName)
  17. {
  18. Expression<Func<TeachingPlanView, bool>> exp = (e => true);
  19. if (!string.IsNullOrEmpty(grademajorName))
  20. {
  21. exp = exp.And(e => e.GrademajorName.Contains(grademajorName.Trim()));
  22. }
  23. if (!string.IsNullOrEmpty(facultymajorName))
  24. {
  25. exp = exp.And(e => e.StandardName.Contains(facultymajorName.Trim()));
  26. }
  27. if (!string.IsNullOrEmpty(courseName))
  28. {
  29. exp = exp.And(e => e.CourseName.Contains(courseName.Trim()));
  30. }
  31. var list = TeachingPlanDAL.GetTeachingPlanList().Where(exp).OrderByDescending(r => r.SchoolyearValue).ThenBy(x => x.CourseName).ToGridResultSet(pageIndex, pageSize);
  32. return list;
  33. }
  34. }
  35. }