Beispiel #1
0
        /// <summary>
        /// 根据实体条件查询分页数据
        /// </summary>
        /// <param name="pQueryEntity">以实体形式传入的参数</param>
        /// <returns>符合条件的实体</returns>
        public PagedQueryResult <EclubMicroEntity> MicroIssuePageGet(EclubMicroEntity pQueryEntity, int pageIndex, int pageSize, string sortField, int?sortOrder)
        {
            //Get Micro IDs
            OrderBy[] pOrderBys = null;
            if (!string.IsNullOrEmpty(sortField))
            {
                OrderByDirections dir = OrderByDirections.Asc;
                if (sortOrder != null && sortOrder == 0)
                {
                    dir = OrderByDirections.Desc;
                }
                pOrderBys = new OrderBy[] { new OrderBy()
                                            {
                                                FieldName = sortField, Direction = dir
                                            } };
            }
            //Get Detail Info
            PagedQueryResult <EclubMicroEntity> result = _currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pageSize, pageIndex);

            foreach (EclubMicroEntity entity in result.Entities)
            {
                entity.PublishDate = entity.PublishTime != null?entity.PublishTime.Value.ToString("yyyy-MM-dd") : string.Empty;
            }
            return(result);
        }
 public TQueryBuilder OrderBy(TOrderBy orderByValue, OrderByDirections orderByDirection = OrderByDirections.Ascending)
 {
     Query.OrderBy = new List <Tuple <TOrderBy, OrderByDirections> >()
     {
         Tuple.Create(orderByValue, orderByDirection)
     };
     return(this as TQueryBuilder);
 }
Beispiel #3
0
        /// <summary>
        /// 向后拼接一个排序方法。
        /// </summary>
        /// <param name="orderByDirection">排序方向</param>
        protected virtual void BuildOrderByDirections(OrderByDirections orderByDirection)
        {
            switch (orderByDirection)
            {
            case OrderByDirections.None:
                break;

            case OrderByDirections.ASC:
                BuildCode(Code_Space);
                BuildCode(Code_ASC);
                break;

            case OrderByDirections.DESC:
                BuildCode(Code_Space);
                BuildCode(Code_DESC);
                break;

            default:
                throw new NotSupportedException();
            }
        }
        public PagedResult<object> GetUsers(
            int p,
            string prop,
            OrderByDirections dir,
            string f)
        {
            int pageSize = GetPageSize();

            int total;
            var items = Services
                .UserService
                .GetAll(0, int.MaxValue, out total);

            if (!string.IsNullOrWhiteSpace(f))
            {
                var filteredItems = FilterUsers(items, f);

                return GetOrderedPagedResult(filteredItems, p, pageSize, filteredItems.Count(), prop, dir);
            }

            return GetOrderedPagedResult(items, p, pageSize, total, prop, dir);
        }
Beispiel #5
0
 public DefaultOrderByAttribute(int fieldOrder = 0, OrderByDirections orderByDirection = OrderByDirections.Ascending)
 {
     this.OrderByDirection = orderByDirection;
     this.FieldOrder       = fieldOrder;
 }
        protected override GetAggSetoffForToolByConditionListRD ProcessRequest(APIRequest <GetAggSetoffForToolListRP> pRequest)
        {
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; //登录状态信息
            var rd        = new GetAggSetoffForToolByConditionListRD();
            var parameter = pRequest.Parameters;

            pRequest.Parameters.PageSize = pRequest.Parameters.PageSize == 0 ? 10 : pRequest.Parameters.PageSize;
            Agg_SetoffForToolBLL bll = new Agg_SetoffForToolBLL(loggingSessionInfo);

            //查询参数
            List <IWhereCondition> complexCondition = new List <IWhereCondition> {
            };

            complexCondition.Add(new EqualsCondition()
            {
                FieldName = "a.CustomerID", Value = loggingSessionInfo.ClientID
            });                                                                                                               //默认条件

            if (!string.IsNullOrEmpty(parameter.SetoffRoleId))
            {
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "a.SetoffToolType", Value = parameter.SetoffRoleId
                });
            }

            if (!string.IsNullOrEmpty(parameter.starttime))
            {
                complexCondition.Add(new DirectCondition("a.DateCode>= '" + parameter.starttime + "' "));
            }

            if (!string.IsNullOrEmpty(parameter.endtime))
            {
                complexCondition.Add(new DirectCondition("a.DateCode<= '" + parameter.endtime + "' "));
            }


            if (String.IsNullOrEmpty(parameter.SortName))
            {
                parameter.SortName = "OrderAmount";
            }
            else
            {
                parameter.SortName = parameter.SortName;
            }
            if (String.IsNullOrEmpty(parameter.SortOrder))
            {
                parameter.SortOrder = "0";
            }
            OrderByDirections directionenum = (OrderByDirections)Enum.Parse(typeof(OrderByDirections), parameter.SortOrder);
            List <OrderBy>    lstOrder      = new List <OrderBy> {
                new OrderBy()
                {
                    FieldName = parameter.SortName, Direction = directionenum
                }
            };

            var tempList = bll.FindAllByPage(complexCondition.ToArray(), lstOrder.ToArray(), parameter.PageSize, parameter.PageIndex);

            rd.TotalPageCount = tempList.PageCount;
            rd.TotalCount     = tempList.RowCount;

            rd.aggsetoffforToollist = tempList.Entities.Select(m => new AggSetoffForToolByConditionList()
            {
                ID          = m.ID.ToString(),
                ObjectName  = m.ObjectName,
                SetoffRole  = bll.GetSetoffToolTypeNameBySetoffToolType(m.SetoffToolType),
                ShareCount  = m.ShareCount.ToString(),
                OrderAmount = m.OrderAmount.ToString(),
                SetoffCount = m.SetoffCount.ToString()
            }).ToList();

            return(rd);
        }
 public TQueryBuilder ThenOrderBy(TOrderBy orderByValue, OrderByDirections orderByDirection = OrderByDirections.Ascending)
 {
     Query.OrderBy.Add(Tuple.Create(orderByValue, orderByDirection));
     return(this as TQueryBuilder);
 }
Beispiel #8
0
 /// <summary>
 /// 构建排序信息
 /// </summary>
 /// <param name="column">要排序的列</param>
 /// <param name="direction">排序方向</param>
 public OrderBy(Column column, OrderByDirections direction)
 {
     Column    = column;
     Direction = direction;
 }
 private PagedResult<object> GetOrderedPagedResult(
     IEnumerable<IUser> items,
     int page,
     int pageSize,
     int total,
     string property,
     OrderByDirections direction)
 {
     return new PagedResult<object>(total, page, pageSize)
     {
         Items = items
             .Select(x => new
             {
                 Id = x.Id,
                 Name = x.Name,
                 Email = x.Email,
                 UserType = x.UserType.Name,
                 Active = x.IsApproved && !x.IsLockedOut
             })
             .OrderBy(property, direction)
             .Skip(page * pageSize)
             .Take(pageSize)
     };
 }