Beispiel #1
0
        /// <summary>
        /// 获取品牌信息列表
        /// </summary>
        /// <param name="entity">参数:Brand实体</param>
        /// <param name="pageIndex">参数:当前页</param>
        /// <param name="pageSize">参数:分页个数</param>
        /// <param name="rowCount">参数:数据集的总数</param>
        /// <returns>返回Brand实体信息</returns>
        public BrandViewEntity[] GetList(BrandViewEntity entity, int pageIndex, int pageSize, out int rowCount)
        {
            List <IWhereCondition> wheres = new List <IWhereCondition>();

            if (entity != null && entity.BrandLevel != null && Convert.ToInt32(entity.BrandLevel) > 0)
            {
                wheres.Add(new EqualsCondition()
                {
                    FieldName = "b.BrandLevel", Value = entity.BrandLevel
                });
            }
            if (entity != null && !string.IsNullOrEmpty(entity.BrandName))
            {
                wheres.Add(new LikeCondition()
                {
                    FieldName = "b.BrandName", HasLeftFuzzMatching = true, HasRightFuzzMathing = true, Value = entity.BrandName
                });
            }

            List <OrderBy> orderbys = new List <OrderBy>();

            orderbys.Add(new OrderBy()
            {
                FieldName = "CreateTime", Direction = OrderByDirections.Desc
            });

            PagedQueryResult <BrandViewEntity> pEntity = new BrandDAO(this.CurrentUserInfo).GetList(wheres.ToArray(), orderbys.ToArray(), pageIndex, pageSize);

            rowCount = pEntity.RowCount;
            return(pEntity.Entities);
        }
Beispiel #2
0
        private string GetList(NameValueCollection rParams)
        {
            BrandViewEntity entity    = rParams["form"].DeserializeJSONTo <BrandViewEntity>();
            int             pageSize  = rParams["limit"].ToInt();
            int             pageIndex = rParams["page"].ToInt();
            int             rowCount  = 0;

            return(string.Format("{{\"totalCount\":{1},\"topics\":{0}}}",
                                 new BrandBLL(CurrentUserInfo).GetList(entity, pageIndex, pageSize, out rowCount).ToJSON(),
                                 rowCount));
        }