StudentsServices.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMISOnline.Entities;
  6. using EMISOnline.ViewModel.Educational;
  7. using Bowin.Common.Linq.Entity;
  8. using System.Linq.Expressions;
  9. using Bowin.Common.Linq;
  10. using EMISOnline.DataLogic.Educational;
  11. namespace EMISOnline.CommonLogic.EducationalServices
  12. {
  13. public class StudentsServices : BaseServices, IStudentsServices
  14. {
  15. public StudentsDAL StudentsDAL { get; set; }
  16. public IGridResultSet<StudentView> GetStudentList(int pageIndex, int pageSize, string loginID, string name, int? studentStatus,
  17. string schoolyear, string standardName)
  18. {
  19. Expression<Func<StudentView, bool>> exp = (e => true);
  20. if (!string.IsNullOrEmpty(loginID))
  21. {
  22. exp = exp.And(e => e.LoginID.Contains(loginID.Trim()));
  23. }
  24. if (!string.IsNullOrEmpty(name))
  25. {
  26. exp = exp.And(e => e.Name.Contains(name.Trim()));
  27. }
  28. if (studentStatus.HasValue && studentStatus > 0)
  29. {
  30. exp = exp.And(e => e.StudentStatus == studentStatus);
  31. }
  32. if (!string.IsNullOrEmpty(schoolyear))
  33. {
  34. exp = exp.And(e => e.SchoolyearName.Contains(schoolyear.Trim()));
  35. }
  36. if (!string.IsNullOrEmpty(standardName))
  37. {
  38. exp = exp.And(e => e.StandardName.Contains(standardName.Trim()));
  39. }
  40. var list = StudentsDAL.GetStudentList().Where(exp).OrderByDescending(r => r.CreateTime).ToGridResultSet(pageIndex, pageSize);
  41. return list;
  42. }
  43. }
  44. }