예제 #1
0
 public static object GetBrandLiquid(BrandLiquid brandLiquid)
 {
     return(new
     {
         brandLiquid,
         BrandId = brandLiquid.Brand.Id,
         Name = brandLiquid.Brand.Name,
         Description = brandLiquid.Brand.Description
     });
 }
예제 #2
0
        public StoreLiquidResult GetRelatedProductsPartialByBrand(Brand brand,
                                                                  List <Product> products,
                                                                  PageDesign pageDesign,
                                                                  List <ProductCategory> productCategories)
        {
            var result = new StoreLiquidResult();

            result.PageDesingName = pageDesign.Name;
            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            try
            {
                var brandLiquid = new BrandLiquid(brand, ImageWidth, ImageHeight);

                var items = new List <ProductLiquid>();
                foreach (var item in products)
                {
                    var imageWidth  = GetSettingValueInt("BrandProduct_ImageWidth", 50);
                    var imageHeight = GetSettingValueInt("BrandProduct_ImageHeight", 50);
                    var cat         = productCategories.FirstOrDefault(r => r.Id == item.ProductCategoryId);
                    var product     = new ProductLiquid(item, cat, imageWidth, imageHeight);
                    product.Brand = brand;
                    items.Add(product);
                }

                object anonymousObject = new
                {
                    products = LiquidAnonymousObject.GetProductsLiquid(items),
                    brand    = LiquidAnonymousObject.GetBrandLiquid(brandLiquid)
                };

                var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject);


                dic[StoreConstants.PageOutput] = indexPageOutput;
                result.LiquidRenderedResult    = dic;

                return(result);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "GetRelatedProductsPartial");
                return(result);
            }
        }
예제 #3
0
        public StoreLiquidResult GetBrandDetailPage(Brand brand, List <Product> products, PageDesign pageDesign, List <ProductCategory> productCategories)
        {
            var result = new StoreLiquidResult();
            var dic    = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");

            try
            {
                var brandLiquid = new BrandLiquid(brand, ImageWidth, ImageHeight);
                brandLiquid.Products          = products;
                brandLiquid.ProductCategories = productCategories;

                object anonymousObject = new
                {
                    brand             = LiquidAnonymousObject.GetBrandLiquid(brandLiquid),
                    products          = LiquidAnonymousObject.GetProductsLiquid(brandLiquid.ProductLiquidList),
                    productCategories = LiquidAnonymousObject.GetProductCategories(brandLiquid.ProductCategoriesLiquids)
                };
                var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject);


                dic[StoreConstants.PageOutput] = indexPageOutput;
                result.DetailLink = brandLiquid.DetailLink;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }



            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;

            return(result);
        }
예제 #4
0
        public StoreLiquidResult GetBrandsPartial(List <Brand> brands, PageDesign pageDesign)
        {
            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            try
            {
                var items = new List <BrandLiquid>();
                foreach (var item in brands)
                {
                    var blog = new BrandLiquid(item, ImageWidth, ImageHeight);
                    items.Add(blog);
                }


                object anonymousObject = new
                {
                    brands = LiquidAnonymousObject.GetBrandsEnumerable(items)
                };

                var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject);


                dic[StoreConstants.PageOutput] = indexPageOutput;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }


            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }