Esempio n. 1
0
        public static string[] GetItemCategoryBrowsingOutlines(this Item item)
        {
            var outline = HttpContext.Current.Items["browsingoutline_" + item.ItemId.ToLower()] as string;

            if (string.IsNullOrEmpty(outline))
            {
                var outlines = OutlineBuilder.BuildCategoryOutline(CustomerSession.CatalogId, item.ItemId);
                HttpContext.Current.Items["browsingoutline_" + item.ItemId.ToLower()] = outline = String.Join(";", outlines.Select(m => new BrowsingOutline(m).ToString()));
            }
            return(outline.Split(';'));
        }
        public void Test()
        {
            var source = SourceText.From(TestGd);
            var tree   = SyntaxTree.Parse(source);

            Assert.That(tree.Diagnostics.Length, Is.EqualTo(0));

            var outlineElement = OutlineBuilder.Build(tree.Root as GuiDescriptionSyntax, detailed: true);

            Assert.That(outlineElement, Is.Not.Null);
            Assert.That(outlineElement.Children.Length, Is.EqualTo(3));
        }
        protected virtual void IndexCategory(ref ResultDocument doc, string catalogId, CategoryBase category)
        {
            doc.Add(new DocumentField("catalog", catalogId.ToLower(), new[] { IndexStore.YES, IndexType.NOT_ANALYZED }));

            // get category path
            var outline = OutlineBuilder.BuildCategoryOutline(catalogId, category).ToString();

            doc.Add(new DocumentField("__outline", outline.ToLower(), new[] { IndexStore.YES, IndexType.NOT_ANALYZED }));

            // Now index all linked categories
            foreach (var linkedCategory in category.LinkedCategories)
            {
                IndexCategory(ref doc, linkedCategory.CatalogId, linkedCategory);
            }
        }
        private LineItem Sku2LineItem(Item sku, decimal quantity)
        {
            var session = CustomerSessionService.CustomerSession;
            var price   = PriceListRepository.FindLowestPrice(session != null ? session.Pricelists : null, sku.ItemId, quantity);
            var retVal  = new LineItem
            {
                CatalogItemId   = sku.ItemId,
                CatalogItemCode = sku.Code,
                DisplayName     = sku.Name,
                Quantity        = quantity,
                Catalog         = sku.CatalogId,
                MaxQuantity     = sku.MaxQuantity,
                MinQuantity     = sku.MinQuantity,
                PlacedPrice     = price != null ? (price.Sale ?? price.List) : 0,
                ListPrice       = price != null ? (price.Sale ?? price.List) : 0,
                CatalogOutline  = OutlineBuilder.BuildCategoryOutline(CustomerSessionService.CustomerSession.CatalogId, sku.ItemId).ToString()
            };

            return(retVal);
        }