using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Linq.Expressions; using EMIS.ViewModel.DQPSystem; using EMIS.ViewModel; using EMIS.DataLogic.DQPSystem; using EMIS.Entities; using Bowin.Common.Linq.Entity; namespace EMIS.CommonLogic.DQPSystem { public class CommunicateServices : BaseServices, ICommunicateServices { public CommunicateDAL CommunicateDAL { get; set; } public IGridResultSet GetTeacherCommunicateViewList(ConfiguretView conditionView, Guid schoolyearID, Guid coursematerialID, Guid userID, int? pageIndex, int? pageSize) { Expression> staffExp = (x => x.UserID == userID); Expression> socExp = (x => x.SchoolyearID == schoolyearID && x.CoursematerialID == coursematerialID); var query = this.CommunicateDAL.GetTeacherCommunicateViewQueryable(staffExp, socExp); if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute)) query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue); query = query.OrderBy(x => x.ClassmajorNo) .ThenBy(x => x.LoginID); return query.ToGridResultSet(pageIndex, pageSize); } public IGridResultSet GetStudentCommunicateViewList(ConfiguretView conditionView, Guid schoolyearID, Guid coursematerialID, Guid userID, int? pageIndex, int? pageSize) { Expression> studentExp = (x => x.UserID == userID); Expression> socExp = (x => x.SchoolyearID == schoolyearID && x.CoursematerialID == coursematerialID); var query = this.CommunicateDAL.GetStudentCommunicateViewQueryable(studentExp, socExp); if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute)) query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue); query = query.OrderBy(x => x.RoleOrder) .ThenBy(x => x.ClassmajorNo) .ThenBy(x => x.LoginID); return query.ToGridResultSet(pageIndex, pageSize); } } }