using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Linq.Expressions; using Bowin.Common.Linq; using Bowin.Common.Linq.Entity; using EMIS.ViewModel.Cultureplan; using EMIS.ViewModel; using EMIS.Entities; using EMIS.ViewModel.DQPSystem; namespace EMIS.CommonLogic.DQPSystem { public partial class SOCServices { public IGridResultSet GetTeacherCoursematerialViewList(ConfiguretView conditionView, Guid schoolyearID, Guid userID, int? pageIndex, int? pageSize) { Expression> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.SchoolyearID == schoolyearID); Expression> staffExp = (x => x.UserID == userID); var query = this.SOCDAL.GetStaffRelateCoursematerialViewQueryable(exp, staffExp); if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute)) query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue); query = query.OrderBy(x => x.CourseCode); return query.ToGridResultSet(pageIndex, pageSize); } public IGridResultSet GetStudentCoursematerialViewList(ConfiguretView conditionView, Guid? schoolyearID, Guid userID, int? pageIndex, int? pageSize) { Expression> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); Expression> studentExp = (x => x.UserID == userID); if (schoolyearID.HasValue) { exp = exp.And(x => x.SchoolyearID == schoolyearID); } var query = this.SOCDAL.GetStudentRelateCoursematerialViewQueryable(exp, studentExp); if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute)) query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue); query = query.OrderBy(x => x.CourseCode); return query.ToGridResultSet(pageIndex, pageSize); } public IGridResultSet GetSOCStudentViewGrid(ConfiguretView conditionView, Guid? schoolyearID, Guid? coursematerialID, Guid userID, int? status, int? pageIndex, int? pageSize) { Expression> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); Expression> studentExp = (x => x.UserID == userID); if (schoolyearID.HasValue) { exp = exp.And(x => x.SchoolyearID == schoolyearID); } if (coursematerialID.HasValue) { exp = exp.And(x => x.CoursematerialID == coursematerialID); } if (status.HasValue) { exp = exp.And(x => x.RecordStatus == status); } var query = this.SOCDAL.GetSOCStudentViewQueryable(exp, studentExp); if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute)) query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue); query = query.OrderByDescending(x => x.SchoolyearCode) .ThenBy(x => x.CourseCode) .ThenBy(x => x.Name); return query.ToGridResultSet(pageIndex, pageSize); } } }