using System; using System.Collections.Generic; using System.Linq; using EMIS.DataLogic.EducationManage; using Bowin.Common.Linq.Entity; using EMIS.ViewModel.EducationManagement; using EMIS.ViewModel; using EMIS.Entities; using System.Linq.Expressions; namespace EMIS.CommonLogic.Students { class StudentEdcationMissionClassServices:BaseServices,IStudentEdcationMissionClassServices { public EducationMissionClassDAL educationMissionClassDAL { get; set; } public Bowin.Common.Linq.Entity.IGridResultSet GetEducationMissionClassViewGrid(Guid user, int pageIndex, int pageSize) { Expression> exp = (x => true); var query = educationMissionClassDAL.GetEducationMissionClassViewQueryble(exp); //if (!string.IsNullOrEmpty(configuretView.ConditionValue)) // query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); query = query.Where(x => x.CF_Student.Any(w => w.UserID == user)); var result = this.GetQueryByDataRangeByDepartment(query).OrderByDescending(x => x.SchoolyearCode) .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenByDescending(x => x.GradeYearID) .ThenBy(x => x.StandardID).ThenBy(x => x.CourseName).ThenBy(x => x.OrderNo).ThenBy(x => x.Name) .ToGridResultSet(pageIndex, pageSize); var educationMissionClassID = result.rows.Select(x => x.EducationMissionClassID).ToList(); var missionClassTeacherList = educationMissionClassDAL.GetMissionClassTeacherQuery(x => educationMissionClassID.Contains(x.EducationMissionClassID)).ToList(); result.rows.ForEach(x => x.MissionClassTeacherView = new HashSet(missionClassTeacherList.Where(y => y.EducationMissionClassID == x.EducationMissionClassID))); return result; } } }