StudentEdcationMissionClassServices.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using EMIS.DataLogic.EducationManage;
  5. using Bowin.Common.Linq.Entity;
  6. using EMIS.ViewModel.EducationManagement;
  7. using EMIS.ViewModel;
  8. using EMIS.Entities;
  9. using System.Linq.Expressions;
  10. namespace EMIS.CommonLogic.Students
  11. {
  12. class StudentEdcationMissionClassServices:BaseServices,IStudentEdcationMissionClassServices
  13. {
  14. public EducationMissionClassDAL educationMissionClassDAL { get; set; }
  15. public Bowin.Common.Linq.Entity.IGridResultSet<EducationMissionClassView> GetEducationMissionClassViewGrid(Guid user, int pageIndex, int pageSize)
  16. {
  17. Expression<Func<EM_EducationMissionClass, bool>> exp = (x => true);
  18. var query = educationMissionClassDAL.GetEducationMissionClassViewQueryble(exp);
  19. //if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  20. // query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  21. query = query.Where(x => x.CF_Student.Any(w => w.UserID == user));
  22. var result = this.GetQueryByDataRangeByDepartment(query).OrderByDescending(x => x.SchoolyearCode)
  23. .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID)
  24. .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name)
  25. .ToGridResultSet<EducationMissionClassView>(pageIndex, pageSize);
  26. var educationMissionClassID = result.rows.Select(x => x.EducationMissionClassID).ToList();
  27. var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList();
  28. result.rows.ForEach(x => x.MissionClassTeacherView = new HashSet<MissionClassTeacherView>(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID)));
  29. return result;
  30. }
  31. }
  32. }