public List <StudentEval> GetPageData(SearchModel <StudentEval> search, out int count) { GetPageListParameter <StudentEval, string> parameter = new GetPageListParameter <StudentEval, string>(); parameter.isAsc = true; parameter.orderByLambda = t => t.StudentNo; parameter.pageIndex = search.PageIndex; parameter.pageSize = search.PageSize; parameter.whereLambda = t => !string.IsNullOrEmpty(t.StudentNo); //查询数据 if (!string.IsNullOrEmpty(search.Entity.PEM)) { Expression <Func <StudentEval, bool> > Where = item => item.PEM == search.Entity.PEM; parameter.whereLambda = ExpressionExt.ReBuildExpression <StudentEval>(parameter.whereLambda, Where); } if (!string.IsNullOrEmpty(search.Entity.PRM)) { Expression <Func <StudentEval, bool> > Where = item => item.PRM == search.Entity.PRM; parameter.whereLambda = ExpressionExt.ReBuildExpression <StudentEval>(parameter.whereLambda, Where); } DBBaseService baseService = new DBBaseService(SurveyContext.Instance); List <StudentEval> list = baseService.GetSimplePagedData <StudentEval, string>(parameter, out count); return(list); }
/// <summary> /// 分页查询,代码 /// </summary> /// <param name="search"></param> /// <param name="count"></param> /// <returns></returns> public List <SurveyModel> GetPageData(SearchModel <SurveyModel> search, out int count) { GetPageListParameter <SurveyModel, int> parameter = new GetPageListParameter <SurveyModel, int>(); parameter.isAsc = true; parameter.orderByLambda = t => t.SurveyID; parameter.pageIndex = search.PageIndex; parameter.pageSize = search.PageSize; if (search.RoleName == "学生" || search.RoleName == "项目组组长" || search.RoleName == "技术主管" || search.RoleName == "项目主管" || search.RoleName == "人事主管") { Expression <Func <SurveyModel, bool> > lambda0 = item => item.Status != 1; Expression <Func <SurveyModel, bool> > lambda1 = item => item.StuName == search.UserName; //合并表达式 parameter.whereLambda = ExpressionExt.ReBuildExpression <SurveyModel>(lambda0, lambda1); } else if (search.RoleName == "人事经理") { Expression <Func <SurveyModel, bool> > lambda0 = item => item.Status != 1; Expression <Func <SurveyModel, bool> > lambda1 = item => item.PEM == search.UserName && (item.AuditName == item.PEM || string.IsNullOrEmpty(item.AuditName) || item.AuditStatus == 3); //合并表达式 parameter.whereLambda = ExpressionExt.ReBuildExpression <SurveyModel>(lambda0, lambda1); } else if (search.RoleName == "项目经理") { Expression <Func <SurveyModel, bool> > lambda0 = item => item.Status != 1; Expression <Func <SurveyModel, bool> > lambda1 = item => item.PRM == search.UserName; //合并表达式 parameter.whereLambda = ExpressionExt.ReBuildExpression <SurveyModel>(lambda0, lambda1); } else { Expression <Func <SurveyModel, bool> > lambda0 = item => item.Status != 1; Expression <Func <SurveyModel, bool> > lambda1 = item => item.AuditName == search.UserName || item.AuditStatus == 3; //合并表达式 parameter.whereLambda = ExpressionExt.ReBuildExpression <SurveyModel>(lambda0, lambda1); } if (!string.IsNullOrEmpty(search.Entity.Batch)) { Expression <Func <SurveyModel, bool> > batchWhere = item => item.Batch == search.Entity.Batch; parameter.whereLambda = ExpressionExt.ReBuildExpression <SurveyModel>(parameter.whereLambda, batchWhere); } if (!string.IsNullOrEmpty(search.Entity.ProjectName)) { Expression <Func <SurveyModel, bool> > projectNameWhere = item => item.ProjectName == search.Entity.ProjectName; parameter.whereLambda = ExpressionExt.ReBuildExpression <SurveyModel>(parameter.whereLambda, projectNameWhere); } if (!string.IsNullOrEmpty(search.Entity.Direction)) { Expression <Func <SurveyModel, bool> > directionWhere = item => item.Direction == search.Entity.Direction; parameter.whereLambda = ExpressionExt.ReBuildExpression <SurveyModel>(parameter.whereLambda, directionWhere); } //查询数据 DBBaseService baseService = new DBBaseService(SurveyContext.Instance); List <SurveyModel> list = baseService.GetSimplePagedData <SurveyModel, int>(parameter, out count); return(list); }
public object GetPageData(SearchModel <SkillTag> search, out int count) { GetPageListParameter <SkillTag, string> parameter = new GetPageListParameter <SkillTag, string>(); parameter.isAsc = true; parameter.orderByLambda = t => t.TagID; parameter.pageIndex = search.PageIndex; parameter.pageSize = search.PageSize; parameter.whereLambda = t => t.TagID != ""; if (!string.IsNullOrEmpty(search.Entity.Direction)) { Expression <Func <SkillTag, bool> > Where = item => item.Direction == search.Entity.Direction; parameter.whereLambda = ExpressionExt.ReBuildExpression <SkillTag>(parameter.whereLambda, Where); } if (!string.IsNullOrEmpty(search.Entity.TagType)) { Expression <Func <SkillTag, bool> > Where = item => item.TagType == search.Entity.TagType; parameter.whereLambda = ExpressionExt.ReBuildExpression <SkillTag>(parameter.whereLambda, Where); } DBBaseService baseService = new DBBaseService(SurveyContext.Instance); List <SkillTag> list = baseService.GetSimplePagedData <SkillTag, string>(parameter, out count); return(list); }