using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Linq.Expressions; using System.Text; using Bowin.Common.Linq; using Bowin.Common.Linq.Entity; using EMIS.ViewModel.EvaluationManage; using EMIS.ViewModel; using EMIS.DataLogic.Common.EvaluationManage; using EMIS.Entities; namespace EMIS.CommonLogic.EvaluationManage { public class SatisfyRateServices : BaseServices, ISatisfyRateServices { public SatisfyRateDAL SatisfyRateDAL { get; set; } public IGridResultSet GetSatisfyRateViewList(ConfiguretView configuretView, Guid? evaluationTypeID, Guid? collegeID, int? teacherTypeID, int pageIndex, int pageSize) { Expression> filter = x => true; Expression> typeFilter = x => true; if (collegeID.HasValue) { filter = filter.And(x => x.CollegeID == collegeID); } if (evaluationTypeID.HasValue) { typeFilter = typeFilter.And(x => x.EvaluationTypeID == evaluationTypeID); } if (teacherTypeID.HasValue) { filter = filter.And(x => x.TeacherTypeID == teacherTypeID); } var query = SatisfyRateDAL.GetUserSatisfyRateView(filter, typeFilter); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); return this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.SatisfyRate).ThenBy(x => x.LoginID) .ToGridResultSet(pageIndex, pageSize); } public List GetSatisfyRateViewList(ConfiguretView configuretView, Guid? evaluationTypeID, Guid? collegeID, int? teacherTypeID) { Expression> filter = x => true; Expression> typeFilter = x => true; if (collegeID.HasValue) { filter = filter.And(x => x.CollegeID == collegeID); } if (evaluationTypeID.HasValue) { typeFilter = typeFilter.And(x => x.EvaluationTypeID == evaluationTypeID); } if (teacherTypeID.HasValue) { filter = filter.And(x => x.TeacherTypeID == teacherTypeID); } var query = SatisfyRateDAL.GetUserSatisfyRateView(filter, typeFilter); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); return this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.SatisfyRate).ThenBy(x => x.LoginID).ToList(); } } }