FacultymajorServices.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMISOnline.Entities;
  6. using System.Linq.Expressions;
  7. using EMISOnline.DataLogic.Educational;
  8. using Bowin.Common.Linq.Entity;
  9. using EMISOnline.ViewModel.Educational;
  10. using Bowin.Common.Linq;
  11. namespace EMISOnline.CommonLogic.EducationalServices
  12. {
  13. public class FacultymajorServices : BaseServices, IFacultymajorServices
  14. {
  15. public FacultymajorDAL FacultymajorDAL { get; set; }
  16. public IGridResultSet<FacultymajorView> GetFacultymajorList(int pageIndex, int pageSize, string collegeName, string standardName, int? educationID,
  17. int? learningformID)
  18. {
  19. Expression<Func<FacultymajorView, bool>> exp = (e => true);
  20. if (!string.IsNullOrEmpty(collegeName))
  21. {
  22. exp = exp.And(e => e.CollegeName.Contains(collegeName.Trim()));
  23. }
  24. if (!string.IsNullOrEmpty(standardName))
  25. {
  26. exp = exp.And(e => e.StandardName.Contains(standardName.Trim()));
  27. }
  28. if (educationID.HasValue && educationID > 0)
  29. {
  30. exp = exp.And(e => e.EducationID == educationID);
  31. }
  32. if (learningformID.HasValue && learningformID > 0)
  33. {
  34. exp = exp.And(e => e.LearningformID == learningformID);
  35. }
  36. var list = FacultymajorDAL.GetFacultymajorList().Where(exp).OrderBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode)
  37. .ThenBy(x => x.StandardID).ThenBy(x => x.Code).ToGridResultSet(pageIndex, pageSize);
  38. return list;
  39. }
  40. }
  41. }