Пример #1
0
 private Review GetSingleReview(int productId, RowOrder ratingOrder)
 {
     return(GetByWhere(x => x.ProductId == productId && x.Published, x => x.Rating, ratingOrder)
            .OrderBy(x => x.CreatedOn, RowOrder.Descending)
            .SelectNested(1, 1)
            .FirstOrDefault());
 }
Пример #2
0
        public override IEnumerable <Order> Get(out int totalResults, Expression <Func <Order, bool> > @where, Expression <Func <Order, object> > orderBy = null,
                                                RowOrder rowOrder = RowOrder.Ascending, int page = 1, int count = Int32.MaxValue)
        {
            var query = GetByWhere(where);

            return(query.OrderBy(orderBy, rowOrder)
                   .SelectNestedWithTotalMatches(out totalResults, page, count));
        }
Пример #3
0
 public override IEnumerable <UserPoint> Get(out int totalResults, Expression <Func <UserPoint, bool> > @where, Expression <Func <UserPoint, object> > orderBy = null,
                                             RowOrder rowOrder = RowOrder.Ascending, int page = 1, int count = Int32.MaxValue)
 {
     return(Repository.Join <User>("ActivatorUserId", "Id", joinType: JoinType.LeftOuter)
            .Relate(RelationTypes.OneToOne <UserPoint, User>())
            .Where(where)
            .OrderBy(orderBy, rowOrder)
            .SelectNestedWithTotalMatches(out totalResults, page, count));
 }
Пример #4
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Rows != null)
         {
             hashCode = hashCode * 59 + Rows.GetHashCode();
         }
         if (RowOrder != null)
         {
             hashCode = hashCode * 59 + RowOrder.GetHashCode();
         }
         if (Columns != null)
         {
             hashCode = hashCode * 59 + Columns.GetHashCode();
         }
         if (Subplots != null)
         {
             hashCode = hashCode * 59 + Subplots.GetHashCode();
         }
         if (XAxes != null)
         {
             hashCode = hashCode * 59 + XAxes.GetHashCode();
         }
         if (YAxes != null)
         {
             hashCode = hashCode * 59 + YAxes.GetHashCode();
         }
         if (Pattern != null)
         {
             hashCode = hashCode * 59 + Pattern.GetHashCode();
         }
         if (XGap != null)
         {
             hashCode = hashCode * 59 + XGap.GetHashCode();
         }
         if (YGap != null)
         {
             hashCode = hashCode * 59 + YGap.GetHashCode();
         }
         if (Domain != null)
         {
             hashCode = hashCode * 59 + Domain.GetHashCode();
         }
         if (XSide != null)
         {
             hashCode = hashCode * 59 + XSide.GetHashCode();
         }
         if (YSide != null)
         {
             hashCode = hashCode * 59 + YSide.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #5
0
 public override IEnumerable <Warehouse> Get(out int totalResults, Expression <Func <Warehouse, bool> > @where, Expression <Func <Warehouse, object> > orderBy = null,
                                             RowOrder rowOrder = RowOrder.Ascending, int page = 1, int count = Int32.MaxValue)
 {
     if (orderBy == null)
     {
         orderBy = x => x.Id;
     }
     return(GetWithJoin()
            .Where(where)
            .OrderBy(orderBy)
            .SelectNestedWithTotalMatches(out totalResults, page, count));
 }
Пример #6
0
        public override IEnumerable <ConsentLog> Get(out int totalResults, Expression <Func <ConsentLog, bool> > @where, Expression <Func <ConsentLog, object> > orderBy = null,
                                                     RowOrder rowOrder = RowOrder.Ascending, int page = 1, int count = Int32.MaxValue)
        {
            var query = GetByWhere(where);

            if (orderBy == null)
            {
                orderBy  = log => log.Id;
                rowOrder = RowOrder.Descending;
            }

            query = query.OrderBy(orderBy, rowOrder);
            return(query.SelectNestedWithTotalMatches(out totalResults, page, count));
        }
Пример #7
0
        private IEntitySet <Review> GetByWhere(Expression <Func <Review, bool> > where, Expression <Func <Review, object> > orderBy, RowOrder rowOrder)
        {
            Expression <Func <Product, bool> > productWhere = product => !product.ReviewsDisabled;
            Expression <Func <SeoMeta, bool> > seoMetaWhere = meta => meta.EntityName == nameof(Product);

            return(Repository.Join <User>("UserId", "Id", joinType: JoinType.LeftOuter)
                   .Join <Product>("ProductId", "Id", SourceColumn.Parent, JoinType.LeftOuter)
                   .Join <SeoMeta>("Id", "EntityId", typeof(Product), JoinType.LeftOuter)
                   .Join <ProductMedia>("Id", "ProductId", typeof(Product), JoinType.LeftOuter)
                   .Join <Media>("MediaId", "Id", SourceColumn.Chained, JoinType.LeftOuter)
                   .Relate(RelationTypes.OneToOne <Review, User>())
                   .Relate(RelationTypes.OneToOne <Review, Product>())
                   .Relate <SeoMeta>((review, meta) => { review.Product.SeoMeta = meta; })
                   .Relate <Media>((review, media) =>
            {
                review.Product.MediaItems = review.Product.MediaItems ?? new List <Media>();
                if (!review.Product.MediaItems.Contains(media))
                {
                    review.Product.MediaItems.Add(media);
                }
            })
                   .OrderBy(orderBy, rowOrder)
                   .Where(where)
                   .Where(seoMetaWhere)
                   .Where(productWhere));
        }
Пример #8
0
 public override IEnumerable <Review> Get(out int totalResults, Expression <Func <Review, bool> > @where,
                                          Expression <Func <Review, object> > orderBy = null, RowOrder rowOrder = RowOrder.Ascending, int page = 1,
                                          int count = Int32.MaxValue)
 {
     orderBy = orderBy ?? (review => review.CreatedOn);
     return(GetByWhere(where, orderBy, rowOrder)
            .SelectNestedWithTotalMatches(out totalResults, page, count));
 }
Пример #9
0
        public virtual IEnumerable <T> Get(out int totalResults, Expression <Func <T, bool> > @where, Expression <Func <T, object> > orderBy = null, RowOrder rowOrder = RowOrder.Ascending, int page = 1, int count = Int32.MaxValue)
        {
            if (orderBy == null)
            {
                orderBy = x => x.Id;
            }
            var query = EntitySet <T> .Where(where).OrderBy(orderBy, rowOrder);

            query = _eventPublisherService.Filter(query);
            if (typeof(T).IsAssignableTo(typeof(IStoreEntity)))
            {
                return(query.SelectNestedWithTotalMatches(out totalResults, page, count));
            }
            return(query.SelectWithTotalMatches(out totalResults, page, count));
        }
Пример #10
0
        public bool Equals([AllowNull] Grid other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Rows == other.Rows && Rows != null && other.Rows != null && Rows.Equals(other.Rows)) &&
                   (RowOrder == other.RowOrder && RowOrder != null && other.RowOrder != null && RowOrder.Equals(other.RowOrder)) &&
                   (Columns == other.Columns && Columns != null && other.Columns != null && Columns.Equals(other.Columns)) &&
                   (Equals(Subplots, other.Subplots) || Subplots != null && other.Subplots != null && Subplots.SequenceEqual(other.Subplots)) &&
                   (Equals(XAxes, other.XAxes) || XAxes != null && other.XAxes != null && XAxes.SequenceEqual(other.XAxes)) &&
                   (Equals(YAxes, other.YAxes) || YAxes != null && other.YAxes != null && YAxes.SequenceEqual(other.YAxes)) &&
                   (Pattern == other.Pattern && Pattern != null && other.Pattern != null && Pattern.Equals(other.Pattern)) &&
                   (XGap == other.XGap && XGap != null && other.XGap != null && XGap.Equals(other.XGap)) &&
                   (YGap == other.YGap && YGap != null && other.YGap != null && YGap.Equals(other.YGap)) &&
                   (Domain == other.Domain && Domain != null && other.Domain != null && Domain.Equals(other.Domain)) &&
                   (XSide == other.XSide && XSide != null && other.XSide != null && XSide.Equals(other.XSide)) &&
                   (YSide == other.YSide && YSide != null && other.YSide != null && YSide.Equals(other.YSide)));
        }
Пример #11
0
 IEntitySet <T> IEntitySet <T> .OrderBy(Expression <Func <T, object> > orderBy, RowOrder rowOrder)
 {
     _orderBy.Add(orderBy, rowOrder);
     return(this);
 }
 public virtual IEnumerable <T> Get(out int totalResults, Expression <Func <T, bool> > @where, Expression <Func <T, object> > orderBy = null, RowOrder rowOrder = RowOrder.Ascending, int page = 1, int count = Int32.MaxValue)
 {
     if (orderBy == null)
     {
         orderBy = x => x.Id;
     }
     return(EntitySet <T> .Where(where).OrderBy(orderBy, rowOrder).SelectWithTotalMatches(out totalResults, page, count));
 }