Ejemplo n.º 1
0
        public bool CheckViewList(int productId, DateTime time, string ipAdress)
        {
            LastViewedProductCollection lastViewedList = new LastViewedProductCollection();

            lastViewedList.GetMulti(null);
            if (lastViewedList.Any(p => p.ProductId == productId && p.ViewedTime == time && p.IpAdrees == ipAdress))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 2
0
        public LastViewedProductCollection GetLast5ViewedProducts(int storeId)
        {
            LastViewedProductCollection lastViewedProducts = new LastViewedProductCollection();
            RelationCollection          relationsToUse     = new RelationCollection();

            relationsToUse.Add(LastViewedProductEntity.Relations.ProductEntityUsingProductId);
            relationsToUse.Add(ProductEntity.Relations.StoreEntityUsingStoreId);
            PrefetchPath prefetchPath = new PrefetchPath((int)EntityType.LastViewedProductEntity);

            prefetchPath.Add(LastViewedProductEntity.PrefetchPathProduct).SubPath.Add(ProductEntity.PrefetchPathStore);

            PredicateExpression filter = new PredicateExpression();

            filter.Add(StoreFields.Id == storeId);
            SortExpression sorter = new SortExpression();

            sorter.Add(LastViewedProductFields.ViewedTime | SortOperator.Descending);


            lastViewedProducts.GetMulti(filter, 5, sorter, relationsToUse, prefetchPath);

            return(lastViewedProducts);
        }
        public LastViewedProductCollection GetLast5ViewedProducts(int storeId)
        {
            LastViewedProductCollection lastViewedProducts = new LastViewedProductCollection();
            RelationCollection relationsToUse = new RelationCollection();
            relationsToUse.Add(LastViewedProductEntity.Relations.ProductEntityUsingProductId);
            relationsToUse.Add(ProductEntity.Relations.StoreEntityUsingStoreId);
            PrefetchPath prefetchPath = new PrefetchPath((int)EntityType.LastViewedProductEntity);
            prefetchPath.Add(LastViewedProductEntity.PrefetchPathProduct).SubPath.Add(ProductEntity.PrefetchPathStore);

            PredicateExpression filter = new PredicateExpression();
            filter.Add(StoreFields.Id == storeId);
            SortExpression sorter = new SortExpression();
            sorter.Add( LastViewedProductFields.ViewedTime | SortOperator.Descending);

            lastViewedProducts.GetMulti(filter, 5, sorter, relationsToUse, prefetchPath);

            return lastViewedProducts;
        }
 public bool CheckViewList(int productId, DateTime time, string ipAdress)
 {
     LastViewedProductCollection lastViewedList = new LastViewedProductCollection();
     lastViewedList.GetMulti(null);
     if (lastViewedList.Any(p => p.ProductId == productId && p.ViewedTime == time && p.IpAdrees == ipAdress))
         return false;
     else
         return true;
 }