コード例 #1
0
        public StoreLiquidResult GetProductCategoriesPartial(List <ProductCategory> categories, PageDesign pageDesign)
        {
            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            try
            {
                var cats = new List <ProductCategoryLiquid>();
                foreach (var item in categories)
                {
                    cats.Add(new ProductCategoryLiquid(item));
                }

                object anonymousObject = new
                {
                    categories = LiquidAnonymousObject.GetProductCategories(cats)
                };

                var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject);
                dic[StoreConstants.PageOutput] = indexPageOutput;
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "GetProductCategoriesPartial");
            }

            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
コード例 #2
0
        public StoreLiquidResult GetProductsIndexPage(StorePagedList <Product> products,
                                                      PageDesign pageDesign, List <ProductCategory> categories)
        {
            var items = new List <ProductLiquid>();
            var cats  = new List <ProductCategoryLiquid>();

            foreach (var item in products.items)
            {
                var category = categories.FirstOrDefault(r => r.Id == item.ProductCategoryId);
                if (category != null)
                {
                    var blog = new ProductLiquid(item, category, ImageWidth, ImageHeight);
                    items.Add(blog);
                }
            }
            foreach (var category in categories)
            {
                var catLiquid = new ProductCategoryLiquid(category);
                catLiquid.Count = products.items.Count(r => r.ProductCategoryId == category.Id);
                cats.Add(catLiquid);
            }

            object anonymousObject = new
            {
                products   = LiquidAnonymousObject.GetProductsLiquid(items),
                categories = LiquidAnonymousObject.GetProductCategories(cats)
            };

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


            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, indexPageOutput);
            dic.Add(StoreConstants.PageSize, products.pageSize.ToStr());
            dic.Add(StoreConstants.PageNumber, products.page.ToStr());
            dic.Add(StoreConstants.TotalItemCount, products.totalItemCount.ToStr());



            var result = new StoreLiquidResult();

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

            return(result);
        }
コード例 #3
0
        public StoreLiquidResult GetCategoriesIndexPage(PageDesign pageDesign, StorePagedList <ProductCategory> categories)
        {
            var result = new StoreLiquidResult();

            result.PageDesingName = pageDesign.Name;

            try
            {
                if (pageDesign == null)
                {
                    throw new Exception("PageDesing is null");
                }

                var cats = new List <ProductCategoryLiquid>();
                foreach (var item in categories.items)
                {
                    cats.Add(new ProductCategoryLiquid(item));
                }

                object anonymousObject = new
                {
                    categories = LiquidAnonymousObject.GetProductCategories(cats)
                };

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


                var dic = new Dictionary <String, String>();
                dic.Add(StoreConstants.PageOutput, indexPageOutput);
                dic.Add(StoreConstants.PageSize, categories.pageSize.ToStr());
                dic.Add(StoreConstants.PageNumber, categories.page.ToStr());
                dic.Add(StoreConstants.TotalItemCount, categories.totalItemCount.ToStr());
                //dic.Add(StoreConstants.IsPagingUp, pageDesign.IsPagingUp ? Boolean.TrueString : Boolean.FalseString);
                //dic.Add(StoreConstants.IsPagingDown, pageDesign.IsPagingDown ? Boolean.TrueString : Boolean.FalseString);

                result.LiquidRenderedResult = dic;
            }
            catch (Exception exception)
            {
                Logger.Error(exception, "GetCategoriesIndexPage : categories and pageDesign", String.Format("Categories Items Count : {0}", categories.items.Count));
            }

            return(result);
        }
コード例 #4
0
        public StoreLiquidResult GetRetailerDetailPage(Retailer retailer, List <Product> products, PageDesign pageDesign, List <ProductCategory> productCategories)
        {
            var result = new StoreLiquidResult();
            var dic    = new Dictionary <String, String>();

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

            try
            {
                var retailerLiquid = new RetailerLiquid(retailer, ImageWidth, ImageHeight);
                retailerLiquid.Products          = products;
                retailerLiquid.ProductCategories = productCategories;

                object anonymousObject = new
                {
                    retailer          = LiquidAnonymousObject.GetRetailer(retailerLiquid),
                    products          = LiquidAnonymousObject.GetProductsLiquid(retailerLiquid.ProductLiquidList),
                    productCategories = LiquidAnonymousObject.GetProductCategories(retailerLiquid.ProductCategoriesLiquids)
                };
                var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject);


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



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

            return(result);
        }
コード例 #5
0
        public StoreLiquidResult GetHomePageDesign(PageDesign pageDesing, List <FileManager> sliderImages, List <Product> products, List <Content> blogs, List <Content> news,
                                                   List <Category> categories, List <ProductCategory> productCategories)
        {
            var result = new StoreLiquidResult();
            var dic    = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesing.Name;
            try
            {
                if (pageDesing == null)
                {
                    throw new Exception("PageDesing is null");
                }


                var home = new HomePageLiquid(pageDesing, sliderImages);
                home.Products           = products;
                home.ImageWidthProduct  = GetSettingValueInt("ProductsHomePage_ImageWidth", 50);
                home.ImageHeightProduct = GetSettingValueInt("ProductsHomePage_ImageHeight", 50);

                home.Blogs           = blogs;
                home.ImageWidthBlog  = GetSettingValueInt("BlogsHomePage_ImageWidth", 50);
                home.ImageHeightBlog = GetSettingValueInt("BlogsHomePage_ImageHeight", 50);


                home.News            = news;
                home.ImageWidthNews  = GetSettingValueInt("NewsHomePage_ImageWidth", 50);
                home.ImageHeightNews = GetSettingValueInt("NewsHomePage_ImageHeight", 50);


                home.ImageWidthSlider  = GetSettingValueInt("SliderHomePage_ImageWidth", 500);
                home.ImageHeightSlider = GetSettingValueInt("SliderHomePage_ImageHeight", 500);


                home.Categories        = categories;
                home.ProductCategories = productCategories;

                object anonymousObject = new
                {
                    blogs             = LiquidAnonymousObject.GetContentLiquid(home.BlogsLiquidList),
                    products          = LiquidAnonymousObject.GetProductsLiquid(home.ProductLiquidList),
                    news              = LiquidAnonymousObject.GetContentLiquid(home.NewsLiquidList),
                    productCategories = LiquidAnonymousObject.GetProductCategories(home.ProductCategoriesLiquids),
                    categories        = LiquidAnonymousObject.GetCategoriesLiquid(home.CategoriesLiquids),
                    sliders           = LiquidAnonymousObject.GetSliderImagesLiquidList(home.SliderImagesLiquid),
                };


                var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesing, anonymousObject);
                dic[StoreConstants.PageOutput] = indexPageOutput;
            }
            catch (Exception ex)
            {
                dic[StoreConstants.PageOutput] = ex.StackTrace;
                Logger.Error(ex, ex.StackTrace);
            }

            return(result);
        }