NotPassStudentServices.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Bowin.Common.Linq.Entity;
  6. using EMIS.ViewModel.ScoreManage;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. using Bowin.Common.Linq;
  10. using EMIS.DataLogic.ScoreManage;
  11. using EMIS.ViewModel;
  12. namespace EMIS.CommonLogic.ScoreManage
  13. {
  14. public class NotPassStudentServices: BaseServices, INotPassStudentServices
  15. {
  16. public NotPassStudentDAL notPassStudentDAL { get; set; }
  17. /// <summary>
  18. /// 获取不及格学生名单
  19. /// </summary>
  20. /// <param name="configuretView"></param>
  21. /// <param name="campusID"></param>
  22. /// <param name="years"></param>
  23. /// <param name="standardID"></param>
  24. /// <param name="classMajorID"></param>
  25. /// <param name="count"></param>
  26. /// <param name="pageIndex"></param>
  27. /// <param name="pageSize"></param>
  28. /// <returns></returns>
  29. public IGridResultSet<NotPassStudentView> GetNotPassStudentGrid(ConfiguretView configuretView, Guid? campusID, int? years, int? standardID, Guid? classMajorID, int pageIndex, int pageSize)
  30. {
  31. Expression<Func<Sys_User, bool>> exp = x => true;
  32. if (campusID.HasValue)
  33. {
  34. exp = exp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CF_College.CF_Campus.CampusID == campusID);
  35. }
  36. if (standardID.HasValue)
  37. {
  38. exp = exp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
  39. }
  40. if (years.HasValue)
  41. {
  42. exp = exp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Schoolyear.Years == years);
  43. }
  44. if (classMajorID.HasValue)
  45. {
  46. exp = exp.And(x => x.CF_Student.CF_Classmajor.ClassmajorID == classMajorID);
  47. }
  48. var query = notPassStudentDAL.GetScoreViewQueryable(exp).Where(x => x.NotPassCount > 0);
  49. //if (count.HasValue)
  50. //{
  51. // query = query.Where(x => x.NotPassCount == count);
  52. //}
  53. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  54. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  55. var result = query.OrderBy(x => x.CampusID).ThenBy(x => x.Years).ThenBy(x => x.StandardID).ThenBy(x => x.ClassMajorID).ToGridResultSet<NotPassStudentView>(pageIndex, pageSize);
  56. return result;
  57. }
  58. }
  59. }