/// <summary> /// </summary> /// <returns></returns> public async Task <IPagedResult <AuditLogOutputPageDto> > GetAuditLogPageAsync(PageRequest request) { var exp = MongoDBFilterBuilder.GetExpression <AuditLog>(request.Filter); OrderCondition <AuditLog>[] orderConditions = new OrderCondition <AuditLog>[] { new OrderCondition <AuditLog>(o => o.CreatedTime, DestinyCore.Enums.SortDirection.Descending) }; request.OrderConditions = orderConditions; //_auditLogRepository.Collection.Find(o=>o.FunctionName.Contains("dd")) var page = await _auditLogRepository.Collection.ToPageAsync(exp, request, x => new AuditLogOutputPageDto { BrowserInformation = x.BrowserInformation, Ip = x.Ip, FunctionName = x.FunctionName, Action = x.Action, ExecutionDuration = x.ExecutionDuration, CreatedTime = x.CreatedTime, Id = x.Id, OperationType = x.OperationType, Message = x.Message, UserId = x.UserId, NickName = x.NickName, UserName = x.UserName }); return(page); }
public PageRequest() { PageIndex = 1; PageRow = 10; OrderConditions = new OrderCondition[] { }; queryFilter = new QueryFilter(); }
public async Task <IPagedResult <OrganizationOutPageListDto> > GetPageOrganizationAsync(PageRequest request) { request.NotNull(nameof(request)); OrderCondition <OrganizatedEntity>[] orderConditions = new OrderCondition <OrganizatedEntity>[] { new OrderCondition <OrganizatedEntity>(o => o.CreatedTime, SortDirection.Descending) }; request.OrderConditions = orderConditions; return(await _organizated.Entities.ToPageAsync <OrganizatedEntity, OrganizationOutPageListDto>(request)); }
public bool evaluate(Collider[] onPlate) { bool recipeFailed = false; for (int j = 0; j < conditions.Count; j++) { OrderCondition condition = conditions[j]; Debug.Log("Checking requirement" + j); for (int i = 0; i < onPlate.Length; i++) { if (condition.evaluate(onPlate[i].gameObject)) { Debug.Log("Ingredient" + i + ": " + onPlate[i].name + " meets requirement" + j); break; } else { Debug.Log("Ingredient" + i + ": " + onPlate[i].name + " doesn't meet requirement" + j); } if (i == onPlate.Length - 1) { recipeFailed = true; } } if (recipeFailed) { break; } } Debug.Log("recipe success: " + !recipeFailed); return(!recipeFailed); }
public async Task <IPageResult <FunctionOutputPageDto> > GetFunctionPageAsync(PageRequest request) { request.NotNull(nameof(request)); OrderCondition <FunctionEntity>[] orderConditions = new OrderCondition <FunctionEntity>[] { new OrderCondition <FunctionEntity>(o => o.CreatedAt, SortDirectionEnum.Descending) }; request.OrderConditions = orderConditions; return(await _functionRepository.NoTrackEntities.ToPageAsync <FunctionEntity, FunctionOutputPageDto>(request)); }
public async Task GetPageAsync_Test() { FilterCondition condition = new FilterCondition(); QueryFilter filter = new QueryFilter(); //condition.Field = "Name"; //condition.Value = "大黄瓜18CM"; //filter.Conditions.Add(condition); var exp = FilterHelp.GetExpression <TestDB>(filter); OrderCondition[] orderConditions = new OrderCondition[] { new OrderCondition("Name", SuktCore.Shared.Enums.SortDirectionEnum.Descending), new OrderCondition("CreatedTime") }; PagedRequest pagedRequest = new PagedRequest(); pagedRequest.OrderConditions = orderConditions; var page = await _mongoDBRepository.Collection.ToPageAsync(exp, pagedRequest); Assert.True(page.Data.Count == 10); var page1 = await _mongoDBRepository.Collection.ToPageAsync(exp, pagedRequest, o => new TestDto { Id = o.Id, Name = o.Name }); Assert.True(page1.Data.Count == 10); }
public async Task <IPageResult <MultiTenantOutPutPageDto> > GetLoadPageAsync(PageRequest request) { request.NotNull(nameof(request)); OrderCondition <MultiTenantEntity>[] orderConditions = new OrderCondition <MultiTenantEntity>[] { new OrderCondition <MultiTenantEntity>(o => o.CreatedAt, SortDirectionEnum.Descending) }; request.OrderConditions = orderConditions; return(await _multiTenantRepository.NoTrackEntities.ToPageAsync <MultiTenantEntity, MultiTenantOutPutPageDto>(request)); }
void conditionList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (orderBindingSource.Count <= e.RowIndex) { return; } OrderCondition obj = orderBindingSource[e.RowIndex] as OrderCondition; e.FormattingApplied = true; switch (e.ColumnIndex) { case 0: e.Value = obj.ToString(); break; case 1: e.Value = obj.IsConjunctionConnection ? "and" : "or"; break; default: e.FormattingApplied = false; break; } }
/// <summary> /// 分页获取数据实体审计 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <IPagedResult <AuditEntryOutputDto> > GetAuditEntryPageAsync(PageRequest request) { var exp = FilterBuilder.GetExpression <AuditEntry>(request.Filter); OrderCondition <AuditEntry>[] orderConditions = new OrderCondition <AuditEntry>[] { new OrderCondition <AuditEntry>(o => o.CreatedTime, Enums.SortDirection.Descending) }; request.OrderConditions = orderConditions; var users = _userManager.Users.ToList(); var page = await _auditEntryRepository.Collection.ToPageAsync(exp, request, x => new AuditEntryOutputDto { Id = x.Id, EntityAllName = x.EntityAllName, EntityDisplayName = x.EntityDisplayName, KeyValues = x.KeyValues, OperationType = x.OperationType, CreatedTime = x.CreatedTime, CreatorUserId = x.CreatorUserId }); page.ItemList.ForEach(x => { x.NickName = x.CreatorUserId == Guid.Empty || x.CreatorUserId == null ? string.Empty : users.FirstOrDefault(o => o.Id == x.CreatorUserId.Value).NickName; }); return(page); }
/// <summary> /// </summary> /// <returns></returns> public async Task <IPagedResult <AuditLogOutputPageDto> > GetAuditLogPageAsync(PageRequest request) { var exp = FilterBuilder.GetExpression <AuditLog>(request.Filter); OrderCondition <AuditLog>[] orderConditions = new OrderCondition <AuditLog>[] { new OrderCondition <AuditLog>(o => o.CreatedTime, Enums.SortDirection.Descending) }; request.OrderConditions = orderConditions; var users = _userManager.Users.ToList(); var page = await _auditLogRepository.Collection.ToPageAsync(exp, request, x => new AuditLogOutputPageDto { BrowserInformation = x.BrowserInformation, Ip = x.Ip, FunctionName = x.FunctionName, Action = x.Action, ExecutionDuration = x.ExecutionDuration, CreatorUserId = x.CreatorUserId, CreatedTime = x.CreatedTime, Id = x.Id, //NickName=x.CreatorUserId == Guid.Empty || x.CreatorUserId == null ? string.Empty : users.FirstOrDefault(o => o.Id == x.CreatorUserId.Value).NickName }); page.ItemList.ForEach(x => { x.NickName = x.CreatorUserId == Guid.Empty || x.CreatorUserId == null ? string.Empty : users.FirstOrDefault(o => o.Id == x.CreatorUserId.Value).NickName; x.UserName = x.CreatorUserId == Guid.Empty || x.CreatorUserId == null ? string.Empty : users.FirstOrDefault(o => o.Id == x.CreatorUserId.Value).UserName; }); return(page); }
/// <summary> /// 得到菜单分页数据(不是树,只是普通表格) /// </summary> /// <param name="request">请求参数</param> /// <returns></returns> public Task <IPagedResult <MenuOutPageListDto> > GetMenuPageAsync(PageRequest request) { request.NotNull(nameof(request)); OrderCondition <MenuEntity>[] orderConditions = new OrderCondition <MenuEntity>[] { new OrderCondition <MenuEntity>(o => o.Depth, SortDirection.Ascending), new OrderCondition <MenuEntity>(o => o.Sort, SortDirection.Ascending) }; request.OrderConditions = orderConditions; return(_menuRepository.Entities.ToPageAsync <MenuEntity, MenuOutPageListDto>(request)); }
/// <summary> /// 异步得到用户分页 /// </summary> /// <param name="request"></param> /// <returns></returns> public Task <IPagedResult <UserOutputPageListDto> > GetUserPageAsync(PageRequest request) { request.NotNull(nameof(request)); OrderCondition <User>[] orderConditions = new OrderCondition <User>[] { new OrderCondition <User>(o => o.CreatedTime, SortDirection.Descending) }; request.OrderConditions = orderConditions; return(_userManager.Users.AsNoTracking().ToPageAsync <User, UserOutputPageListDto>(request)); }
public IActionResult Condition(int id) { Order order = dataContext.Orders.FirstOrDefault(p => p.OrderId == id); var condition = dataContext.OrderConditions.Select(p => p).ToList(); OrderCondition orderCondition = dataContext.OrderConditions.FirstOrDefault(p => p.OrderConditionId == order.OrderConditionId); ViewBag.Condition = new SelectList(condition, "OrderConditionId", "OrderConditionName", orderCondition.OrderConditionId); return(View(order)); }
T ParseCondition <T>(string strCond) where T : OrderCondition { var cond = OrderCondition.Parse(strCond) as T; Assert.IsNotNull(cond); Assert.AreEqual(strCond, cond.ToString()); return(cond); }
/// <summary> /// Default constructor. /// </summary> public Order() { ordDir = OrderDirection.None; ordType = OrderType.None; ordCond = OrderCondition.None; ordStatus = OrderStatus.None; ordSender = OrderSender.None; ordOrigin = OrderOrigin.None; ordNote = "Not Defined"; }
/// <summary> /// 分页获取按钮列表 /// </summary> /// <param name="baseQuery"></param> /// <param name="Total"></param> /// <returns></returns> public (List <ButtonViewMoel>, int) GetQueryByPage(ButtonQuery buttonQuery) { var query = ExpressionBuilder.True <SysButton>(); query = query.And(menu => menu.IsDrop == false); var menuquery = ExpressionBuilder.True <SysMenu>(); menuquery = menuquery.And(menu => menu.IsDrop == false); if (!buttonQuery.Name.IsNullOrEmpty()) { query = query.And(m => m.Name.Contains(buttonQuery.Name.Trim())); } if (!buttonQuery.JSKeyCode.IsNullOrEmpty()) { query = query.And(m => m.KeyCode.Contains(buttonQuery.JSKeyCode.Trim())); } if (!buttonQuery.APIAddress.IsNullOrEmpty()) { query = query.And(m => m.APIAddress.Contains(buttonQuery.APIAddress.Trim())); } if (!buttonQuery.MenuName.IsNullOrEmpty()) { menuquery = menuquery.And(m => m.Name.Contains(buttonQuery.MenuName.Trim())); } var list = (from a in _buttonRepositoty.GetAll(query) join b in _menuRepositoty.GetAll(menuquery) on a.MenuId equals b.Id select new ButtonViewMoel { Id = a.Id, Name = a.Name, APIAddress = a.APIAddress, KeyCode = a.KeyCode, Memo = a.Memo, ButtonStyle = a.ButtonStyle, IsShow = a.IsShow, CreatedDate = a.CreatedDate, MenuId = b.Id, MenuName = b.Name, }); int Total = list.Count();//查询符合添加的总数执行一次 //添加排序 OrderCondition <ButtonViewMoel>[] orderConditions = new OrderCondition <ButtonViewMoel>[] { new OrderCondition <ButtonViewMoel>(x => x.CreatedDate, SortDirectionEnum.Descending) }; Parameters parameters = new Parameters(); parameters.PageIndex = buttonQuery.PageIndex; parameters.PageSize = buttonQuery.PageSize; parameters.OrderConditions = orderConditions; return(list.PageBy(parameters).ToList(), Total); //再查询符合条件的数据在查一次 }
private void conditionList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { var dlg = new ConditionDialog(selectedCondition, orderManager.IBClient); if (dlg.ShowDialog() == DialogResult.OK) { selectedCondition = dlg.Condition; } } }
/// <summary> /// 查询条件分页查询出来菜单列表 /// </summary> /// <param name="GuIds"></param> /// <returns></returns> public (List <MenuViewMoel>, int) GetQueryMenuByPage(MenuQuery menuQuery) { var query = ExpressionBuilder.True <SysMenu>(); query = query.And(menu => menu.IsDrop == false); if (!menuQuery.Name.IsNullOrEmpty()) { query = query.And(m => m.Name.Contains(menuQuery.Name.Trim())); } if (!menuQuery.UrlAddress.IsNullOrEmpty()) { query = query.And(m => m.UrlAddress.Contains(menuQuery.UrlAddress.Trim())); } if (!menuQuery.APIAddress.IsNullOrEmpty()) { query = query.And(m => m.APIAddress.Contains(menuQuery.APIAddress.Trim())); } var list = (from a in _menuRepositoty.GetAll(query) join b in _menuRepositoty.GetAll(x => x.IsDrop == false) on a.ParentId equals b.Id into le from aa in le.DefaultIfEmpty() select new MenuViewMoel { Id = a.Id, Name = a.Name, ParentId = a.ParentId, ParentName = aa.Name, Memo = a.Memo, APIAddress = a.APIAddress, UrlAddress = a.UrlAddress, Sort = a.Sort, Icon = a.Icon, CreatedDate = a.CreatedDate, ParentIdArr = a.ParentIdArr, }); //添加排序 OrderCondition <MenuViewMoel>[] orderConditions = new OrderCondition <MenuViewMoel>[] { new OrderCondition <MenuViewMoel>(x => x.CreatedDate, SortDirectionEnum.Descending), new OrderCondition <MenuViewMoel>(x => x.UrlAddress, SortDirectionEnum.Ascending) }; Parameters parameters = new Parameters(); parameters.PageIndex = menuQuery.PageIndex; parameters.PageSize = menuQuery.PageSize; parameters.OrderConditions = orderConditions; return(list.PageBy(parameters).ToList(), list.Count()); //_menuRepositoty.PageBy<SysMenu>(menuQuery.PageIndex, menuQuery.PageSize, query).ToList(); }
public void ParseExecutionCondition() { ExecutionCondition cond = ParseCondition <ExecutionCondition>("trade occurs for ANY symbol on ANY exchange for * security type"); var examp = OrderCondition.Create(OrderConditionType.Execution) as ExecutionCondition; examp.Exchange = "ANY"; examp.Symbol = "ANY"; examp.SecType = "*"; Assert.IsNotNull(cond); Assert.AreEqual(cond.Exchange, "any", true); Assert.IsFalse(cond.IsConjunctionConnection); Assert.AreEqual(cond.SecType, "*"); Assert.AreEqual(cond.Symbol, "any", true); Assert.AreEqual(cond, examp); }
public IActionResult Index(string search) { var item = dataContext.Orders.Select(p => p).ToList(); List <OrderCondition> orderConditions = new List <OrderCondition>(); foreach (var item2 in item) { OrderCondition orderCondition = dataContext.OrderConditions.FirstOrDefault(p => p.OrderConditionId == item2.OrderConditionId); orderConditions.Add(orderCondition); } if (!string.IsNullOrEmpty(search)) { var query = dataContext.Orders.Where(p => p.Email.Contains(search)).ToList(); return(View(query)); } return(View(item)); }
public async Task <IPagedResult <FunctionOutputPageList> > GetFunctionPageAsync(FunctionPageRequestDto request) { OrderCondition <Function>[] orderConditions = new OrderCondition <Function>[] { new OrderCondition <Function>(o => o.CreatedTime, SortDirection.Descending) }; request.OrderConditions = orderConditions; Expression <Func <Function, bool> > expression = o => true; if (request.MenuIds?.Any() == true) { var functionIds = _menuFunctionRepository.Entities.Where(o => request.MenuIds.Contains(o.MenuId)).Select(o => o.FunctionId); expression = o => !functionIds.Contains(o.Id); //if (functionIds.Any()) //{ // request.Filter.Conditions.Add(new FilterCondition() { Field = "Id", Value = functionIds, Operator = FilterOperator.In }); //} } return(await _functionRepository.Entities.Where(expression).ToPageAsync <Function, FunctionOutputPageList>(request)); }
/// <summary> /// 分页获取数据实体属性审计 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <IPagedResult <AuditPropertyEntryOutputDto> > GetAuditEntryPropertyPageAsync(PageRequest request) { var exp = FilterBuilder.GetExpression <AuditPropertysEntry>(request.Filter); OrderCondition <AuditPropertysEntry>[] orderConditions = new OrderCondition <AuditPropertysEntry>[] { new OrderCondition <AuditPropertysEntry>(o => o.CreatedTime, Enums.SortDirection.Descending) }; request.OrderConditions = orderConditions; var page = await _auditPropertysEntryRepository.Collection.ToPageAsync(exp, request, x => new AuditPropertyEntryOutputDto { Id = x.Id, PropertieDisplayName = x.PropertieDisplayName, NewValues = x.NewValues, OriginalValues = x.OriginalValues, Properties = x.Properties, PropertiesType = x.PropertiesType, }); return(page); }
internal void ReadConditions() { if (R.Builder.SupportsServerVersion(ServerVersion.PEGGED_TO_BENCHMARK)) { int n = R.ReadInt(); if (n > 0) { for (int i = 0; i < n; i++) { var orderConditionType = R.ReadEnum <OrderConditionType>(); OrderCondition condition = OrderCondition.Create(orderConditionType); condition.Deserialize(R); Order.Conditions.Add(condition); } Order.ConditionsIgnoreRegularTradingHours = R.ReadBool(); Order.ConditionsCancelOrder = R.ReadBool(); } } }
/// <summary> /// 分页获取数据实体审计 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <IPagedResult <AuditEntryOutputPageDto> > GetAuditEntryPageAsync(PageRequest request) { var exp = MongoDBFilterBuilder.GetExpression <AuditEntry>(request.Filter); OrderCondition <AuditEntry>[] orderConditions = new OrderCondition <AuditEntry>[] { new OrderCondition <AuditEntry>(o => o.CreatedTime, DestinyCore.Enums.SortDirection.Descending) }; request.OrderConditions = orderConditions; var page = await _auditEntryRepository.Collection.ToPageAsync(exp, request, x => new AuditEntryOutputPageDto { Id = x.Id, EntityAllName = x.EntityAllName, EntityDisplayName = x.EntityDisplayName, KeyValues = x.KeyValues, OperationType = x.OperationType, CreatedTime = x.CreatedTime, NickName = x.NickName, UserName = x.UserName, }); return(page); }
private void apply_Click(object sender, EventArgs e) { var type = radioMap[radioButtons.FirstOrDefault(rb => rb.Checked)].Item2; if (type != Condition.Type) { Condition = OrderCondition.Create(type); } switch (type) { case OrderConditionType.Execution: fillCondition(Condition as ExecutionCondition); break; case OrderConditionType.Margin: fillCondition(Condition as MarginCondition); break; case OrderConditionType.PercentCange: fillCondition(Condition as PercentChangeCondition); break; case OrderConditionType.Price: fillCondition(Condition as PriceCondition); break; case OrderConditionType.Time: fillCondition(Condition as TimeCondition); break; case OrderConditionType.Volume: fillCondition(Condition as VolumeCondition); break; } DialogResult = DialogResult.OK; Close(); }
public JsonResult SearchList() { #region 权限控制 int[] iRangePage = { ListPageNodeId }; int iCurrentPageNodeId = RequestParameters.Pint("NodeId"); var tempAuth = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId); if (tempAuth.ErrorType != 1) { return(Json(tempAuth)); } #endregion //当前页 int iCurrentPage = RequestParameters.Pint("currentPage"); iCurrentPage = iCurrentPage <= 0 ? 1 : iCurrentPage; //索引页 int iPageIndex = iCurrentPage - 1; //一页的数量 int iPageSize = RequestParameters.Pint("pageSize"); iPageSize = iPageSize <= 0 ? 5 : iPageSize; iPageSize = iPageSize > 100 ? 100 : iPageSize; //总记录数量 int iTotalRecord = 0; #region 查询条件 var searchCondition = new ConditionModel(); var WhereList = new List <WhereCondition>(); Guid welfareCentreId = Utits.WelfareCentreID; if (welfareCentreId != Guid.Empty) { var whereCondition = new WhereCondition(); whereCondition.FieldName = "WelfareCentreID"; whereCondition.FieldValue = welfareCentreId; whereCondition.FieldOperator = EnumOper.Equal; WhereList.Add(whereCondition); } string Name = RequestParameters.Pstring("Name"); if (Name.Length > 0) { var whereCondition = new WhereCondition(); whereCondition.FieldName = "DeptName"; whereCondition.FieldValue = Name; whereCondition.FieldOperator = EnumOper.Contains; WhereList.Add(whereCondition); } int?IsValid = RequestParameters.PintNull("IsValid"); if (IsValid != null) { if (IsValid == 1) { var whereCondition = new WhereCondition(); whereCondition.FieldName = "IsValid"; whereCondition.FieldValue = IsValid; whereCondition.FieldOperator = EnumOper.Equal; WhereList.Add(whereCondition); } else { var whereCondition = new WhereCondition(); whereCondition.FieldName = "IsValid"; whereCondition.FieldValue = 1; whereCondition.FieldOperator = EnumOper.ExclamationEqual; WhereList.Add(whereCondition); } } searchCondition.WhereList = WhereList; var OrderList = new List <OrderCondition>(); string sortfield = RequestParameters.Pstring("sortfield"); if (sortfield.Length <= 0) { sortfield = "OperateDate"; } var orderCondition = new OrderCondition(); orderCondition.FiledOrder = sortfield; orderCondition.Ascending = RequestParameters.Pstring("sorttype") == "asc" ? true : false; OrderList.Add(orderCondition); searchCondition.OrderList = OrderList; #endregion var cBll = new DeptsBll(); var list = cBll.SearchByPageCondition(iPageIndex, iPageSize, ref iTotalRecord, searchCondition); iPageSize = iPageSize == 0 ? iTotalRecord : iPageSize; int pageCount = iTotalRecord % iPageSize == 0 ? iTotalRecord / iPageSize : iTotalRecord / iPageSize + 1; var sReturnModel = new ResultList(); sReturnModel.ErrorType = 1; sReturnModel.CurrentPage = iCurrentPage; sReturnModel.PageSize = iPageSize; sReturnModel.TotalRecord = iTotalRecord; sReturnModel.PageCount = pageCount; sReturnModel.Data = list; return(Json(sReturnModel)); }
protected override void PostInitCondition(char ordType, OrderCondition condition) { }
internal static string FormatCondition(OrderCondition condition) { return condition == null ? string.Empty : condition.Parameters.Select(p => "{Key} = {Value}".PutEx(p)).Join(Environment.NewLine); }
public PageParameters(int pageIndex, int pageSize) { PageIndex = pageIndex; PageSize = pageSize; OrderConditions = new OrderCondition[] { }; }
public PagedRequest() { PageIndex = 1; PageRow = 10; OrderConditions = new OrderCondition[] { }; }
/// <summary> /// 1 /// </summary> /// <returns></returns> public JsonResult LoadPageList1() { var sReturnModel = new ReturnListModel(); #region 登录验证 var currentUser = Utits.CurrentUser; if (currentUser == null) { sReturnModel.ErrorType = 3; sReturnModel.MessageContent = "登录状态已失效."; return(Json(sReturnModel)); } #endregion #region 参数处理 #region 分页参数 int page = RequestParameters.Pint("page"); int size = RequestParameters.Pint("size"); if (page < 1 || size < 1) { sReturnModel.ErrorType = 0; sReturnModel.MessageContent = "参数错误."; return(Json(sReturnModel)); } #endregion var condition = new ConditionModel(); #region 查询参数 var whereList = new List <WhereCondition>(); //部门名称 string Search = RequestParameters.Pstring("SearchDept"); if (Search.Length > 0) { var where1Condition = new WhereCondition(); where1Condition.FieldName = "Dept_Name"; where1Condition.FieldOperator = EnumOper.Contains; where1Condition.FieldValue = Search; whereList.Add(where1Condition); } condition.WhereList = whereList; #endregion #region 排序参数 var orderList = new List <OrderCondition>(); var orderCondition = new OrderCondition(); orderCondition.Ascending = true; orderCondition.FiledOrder = "OperatTime"; orderList.Add(orderCondition); condition.OrderList = orderList; #endregion #endregion int iTotalRecord = 0, iPageIndex = page - 1, iPageSize = size; var cBll = new BLL_Security(); var list = cBll.GetPageListByCondition1(iPageIndex, iPageSize, ref iTotalRecord, condition); iPageSize = iPageSize == 0 ? iTotalRecord : iPageSize; int pageCount = iTotalRecord % iPageSize == 0 ? iTotalRecord / iPageSize : iTotalRecord / iPageSize + 1; sReturnModel.ErrorType = 1; sReturnModel.CurrentPage = page; sReturnModel.PageSize = iPageSize; sReturnModel.TotalRecord = iTotalRecord; sReturnModel.PageCount = pageCount; if (list != null) { sReturnModel.Data = from a in list select new { a.ID, a.Dept_Name, a.bswz, a.dyxt, a.sfjrzwww, a.sbglryxm, a.lxfs } } ; return(Json(sReturnModel)); }