예제 #1
0
        public StoreLiquidResult GetContentsByContentType(List <Content> contents, List <Category> categories, PageDesign pageDesign, string type)
        {
            var items = new List <ContentLiquid>();

            foreach (var item in contents)
            {
                var category = categories.FirstOrDefault(r => r.Id == item.CategoryId);
                var blog     = new ContentLiquid(item, category, type, ImageWidth, ImageHeight);
                items.Add(blog);
            }

            var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, new
            {
                items = LiquidAnonymousObject.GetContentLiquid(items)
            }
                                                                );


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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);


            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
예제 #2
0
        public StoreLiquidResult GetRetailers(List <Retailer> labels, PageDesign pageDesign)
        {
            var items = new List <RetailerLiquid>();

            foreach (var item in labels)
            {
                var nav = new RetailerLiquid(item);
                items.Add(nav);
            }


            object anonymousObject = new
            {
                retailers = LiquidAnonymousObject.GetRetailersEnumerable(items)
            };


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


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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);


            var result = new StoreLiquidResult();

            result.PageDesingName       = pageDesign.Name;
            result.LiquidRenderedResult = dic;
            return(result);
        }
        public StoreLiquidResult GetCategoryPage(PageDesign pageDesign, ProductCategory category)
        {
            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            try
            {
                var productCategories = new ProductCategoryLiquid(category);



                object anonymousObject = new
                {
                    category = LiquidAnonymousObject.GetProductCategory(productCategories)
                };

                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);
        }
예제 #4
0
        public StoreLiquidResult GetPhotoGalleryIndexPage(PageDesign pageDesign, StorePagedList <FileManager> fileManagers)
        {
            var cats = new List <FileManagerLiquid>();

            foreach (var item in fileManagers.items)
            {
                cats.Add(new FileManagerLiquid(item, ImageWidth, ImageHeight));
            }

            object anonymousObject = new
            {
                photogalleries = LiquidAnonymousObject.GetFileManagerLiquidEnumerable(cats)
            };

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


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

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

            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
        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);
        }
예제 #6
0
        public StoreLiquidResult GetContactIndexPage(PageDesign pageDesign, List <Contact> contacts)
        {
            var result = new StoreLiquidResult();
            var dic    = new Dictionary <String, String>();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            dic.Add(StoreConstants.PageOutput, "");

            try
            {
                var items = new List <ContactLiquid>();
                foreach (var item in contacts)
                {
                    var i = new ContactLiquid(item, ImageWidth, ImageHeight);
                    items.Add(i);
                }


                object anonymousObject = new
                {
                    contacts = LiquidAnonymousObject.GetContactEnumerable(items)
                };

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


                dic[StoreConstants.PageOutput] = indexPageOutput;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
            return(result);
        }
예제 #7
0
        public StoreLiquidResult GetRelatedContentsPartial(Category category, List <Content> contents, PageDesign pageDesign, String type)
        {
            var items = new List <ContentLiquid>();

            foreach (var item in contents)
            {
                var blog = new ContentLiquid(item, category, type, ImageWidth, ImageHeight);
                items.Add(blog);
            }

            var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, new
            {
                items = LiquidAnonymousObject.GetContentLiquid(items)
            }
                                                                );


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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);


            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
예제 #8
0
        public StoreLiquidResult GetMainLayoutFooterLink(List <Navigation> navigations, PageDesign pageDesign)
        {
            var items = new List <NavigationLiquid>();

            foreach (var item in navigations)
            {
                var nav = new NavigationLiquid(item);
                items.Add(nav);
            }


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


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


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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);



            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
예제 #9
0
        public StoreLiquidResult GetContentsIndexPage(
            StorePagedList <Content> contents,
            PageDesign pageDesign,
            List <Category> categories, String type)
        {
            var items = new List <ContentLiquid>();
            var cats  = new List <CategoryLiquid>();

            foreach (var item in contents.items)
            {
                var category = categories.FirstOrDefault(r => r.Id == item.CategoryId);
                if (category != null)
                {
                    var blog = new ContentLiquid(item, category, type, ImageWidth, ImageHeight);
                    items.Add(blog);
                }
            }
            foreach (var category in categories)
            {
                var catLiquid = new CategoryLiquid(category, type);
                catLiquid.Count = contents.items.Count(r => r.CategoryId == category.Id);
                cats.Add(catLiquid);
            }

            var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, new
            {
                items      = LiquidAnonymousObject.GetContentLiquid(items),
                categories = LiquidAnonymousObject.GetCategoriesLiquid(cats)
            }
                                                                );


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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);
            dic.Add(StoreConstants.PageSize, contents.pageSize.ToStr());
            dic.Add(StoreConstants.PageNumber, contents.page.ToStr());
            dic.Add(StoreConstants.TotalItemCount, contents.totalItemCount.ToStr());
            //dic.Add(StoreConstants.IsPagingUp, pageDesign.IsPagingUp ? Boolean.TrueString : Boolean.FalseString);
            //dic.Add(StoreConstants.IsPagingDown, pageDesign.IsPagingDown ? Boolean.TrueString : Boolean.FalseString);

            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
예제 #10
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);
        }
예제 #11
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);
            }
        }
        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);
        }
예제 #13
0
        public StoreLiquidResult GetCommentsPartial(List <Comment> comments, PageDesign pageDesign)
        {
            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            try
            {
                if (pageDesign == null)
                {
                    throw new Exception("PageDesing is null");
                }


                var items = new List <CommentLiquid>();
                foreach (var item in comments)
                {
                    var c = new CommentLiquid(item, ImageWidth, ImageHeight);
                    items.Add(c);
                }


                object anonymousObject = new
                {
                    comments = LiquidAnonymousObject.GetCommentsEnumerable(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);
        }
예제 #14
0
        public StoreLiquidResult GetHomePageDesign(PageDesign pageDesing, List <FileManager> sliderImages)
        {
            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.ImageWidthSlider  = GetSettingValueInt("SliderHomePage_ImageWidth", 500);
                home.ImageHeightSlider = GetSettingValueInt("SliderHomePage_ImageHeight", 500);



                object anonymousObject = new
                {
                    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);
        }
예제 #15
0
        public StoreLiquidResult GetRelatedProductsPartialByCategory(ProductCategory category,
                                                                     List <Product> products,
                                                                     PageDesign pageDesign
                                                                     )
        {
            var result = new StoreLiquidResult();

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

            try
            {
                var items = new List <ProductLiquid>();
                foreach (var item in products)
                {
                    var blog = new ProductLiquid(item, category, ImageWidth, ImageHeight);
                    items.Add(blog);
                }

                var indexPageOutput = LiquidEngineHelper.RenderPage(pageDesign, new
                {
                    products = LiquidAnonymousObject.GetProductsLiquid(items)
                }
                                                                    );


                dic[StoreConstants.PageOutput] = indexPageOutput;



                result.LiquidRenderedResult = dic;
                return(result);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "GetRelatedProductsPartial");
                return(result);
            }
        }
예제 #16
0
        public StoreLiquidResult GetContentDetailPage(Content content, PageDesign pageDesign, Category category, String type)
        {
            var items         = new List <ContentLiquid>();
            var contentLiquid = new ContentLiquid(content, category, type, ImageWidth, ImageHeight);

            var anonymousObject = LiquidAnonymousObject.GetContentAnonymousObject(contentLiquid);

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



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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);


            var result = new StoreLiquidResult();

            result.LiquidRenderedResult = dic;
            result.PageDesingName       = pageDesign.Name;
            return(result);
        }
예제 #17
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);
        }
예제 #18
0
        public StoreLiquidResult GetProductsDetailPage(Product product, PageDesign pageDesign, ProductCategory category)
        {
            if (product == null)
            {
                throw new Exception("Product is NULL");
            }
            if (pageDesign == null)
            {
                throw new Exception("pageDesign is NULL");
            }

            if (category == null)
            {
                throw new Exception("ProductCategory is NULL");
            }


            var s = new ProductLiquid(product, category, ImageWidth, ImageHeight);

            var anonymousObject = LiquidAnonymousObject.GetProductAnonymousObject(s);

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



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

            dic.Add(StoreConstants.PageOutput, indexPageOutput);


            var result = new StoreLiquidResult();

            result.PageDesingName       = pageDesign.Name;
            result.LiquidRenderedResult = dic;
            result.DetailLink           = s.DetailLink;
            return(result);
        }
예제 #19
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);
        }
예제 #20
0
        public StoreLiquidResult GetPopularProducts(List <Product> products, List <ProductCategory> productCategories, PageDesign pageDesign)
        {
            var result = new StoreLiquidResult();
            var dic    = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            try
            {
                var items = new List <ProductLiquid>();
                foreach (var item in products)
                {
                    var cat     = productCategories.FirstOrDefault(r => r.Id == item.ProductCategoryId);
                    var product = new ProductLiquid(item, cat, this.ImageWidth, this.ImageHeight);
                    items.Add(product);
                }

                object anonymousObject = new
                {
                    products = LiquidAnonymousObject.GetProductsLiquid(items)
                };

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


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

                return(result);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "GetPopularProducts");
                dic.Add(StoreConstants.PageOutput, ex.Message);
                return(result);
            }
        }
예제 #21
0
        public StoreLiquidResult GetBrandsIndexPage(PageDesign pageDesign, StorePagedList <Brand> brands)
        {
            var result = new StoreLiquidResult();

            try
            {
                var brandList = new List <BrandLiquid>();
                foreach (var item in brands.items)
                {
                    brandList.Add(new BrandLiquid(item, this.ImageWidth, this.ImageHeight));
                }

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

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


                var dic = new Dictionary <String, String>();
                dic.Add(StoreConstants.PageOutput, indexPageOutput);
                dic.Add(StoreConstants.PageSize, brands.pageSize.ToStr());
                dic.Add(StoreConstants.PageNumber, brands.page.ToStr());
                dic.Add(StoreConstants.TotalItemCount, brands.totalItemCount.ToStr());

                result.LiquidRenderedResult = dic;
                result.PageDesingName       = pageDesign.Name;
            }
            catch (Exception exception)
            {
                Logger.Error(exception, "GetbrandsIndexPage : brands and pageDesign", String.Format("brands Items Count : {0}", brands.items.Count));
            }

            return(result);
        }
예제 #22
0
        public StoreLiquidResult GetProductsSearchPage(Controller controller,
                                                       ProductsSearchResult productSearchResult,
                                                       PageDesign pageDesign,
                                                       List <ProductCategory> categories,
                                                       String search,
                                                       String filters,
                                                       String headerText,
                                                       String categoryApiId)
        {
            var dic = new Dictionary <String, String>();

            dic.Add(StoreConstants.PageOutput, "");
            var items              = new List <ProductLiquid>();
            var cats               = new List <ProductCategoryLiquid>();
            var products           = productSearchResult.Products;
            var filterGroups       = productSearchResult.FiltersGroups;
            var httpContextRequest = controller.Request;

            foreach (FilterGroup filterGroup in filterGroups)
            {
                foreach (Data.HelpersModel.Filter filter in filterGroup.FiltersHidden)
                {
                    if (string.IsNullOrEmpty(filter.Text))
                    {
                        continue;
                    }

                    filter.FilterLink = filter.Link(httpContextRequest);
                }
            }

            var filtersList = FilterHelper.GetFiltersFromContextRequest(httpContextRequest);

            foreach (var filter in filtersList)
            {
                filter.FilterLink = filter.LinkExclude(httpContextRequest, productSearchResult.Stats.OwnerType);
            }

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

            var selectedCategory = categories.FirstOrDefault(r => r.ApiCategoryId.Equals(categoryApiId, StringComparison.InvariantCultureIgnoreCase));
            ProductCategoryLiquid selectedCategoryLiquid = null;

            if (selectedCategory == null)
            {
                selectedCategory = categories.FirstOrDefault();
            }
            selectedCategoryLiquid = new ProductCategoryLiquid(selectedCategory);


            var categoryTree = controller.RenderPartialToStringCache(
                "pCreateCategoryTree",
                new ViewDataDictionary(categories));



            object anonymousObject = new
            {
                filterExcluded   = LiquidAnonymousObject.GetFilters(filtersList),
                filterGroup      = LiquidAnonymousObject.GetFilterGroup(filterGroups),
                products         = LiquidAnonymousObject.GetProductsLiquid(items),
                selectedCategory = LiquidAnonymousObject.GetProductCategory(selectedCategoryLiquid),
                categoryTree     = categoryTree,
                search           = search,
                filters          = filters,
                headerText       = headerText,
                recordsTotal     = productSearchResult.Stats.RecordsTotal,
                isCleanButton    = !String.IsNullOrEmpty(search) || !String.IsNullOrEmpty(filters)
            };

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

            dic[StoreConstants.PageOutput] = indexPageOutput;
            dic.Add(StoreConstants.PageSize, productSearchResult.PageSize.ToStr());
            dic.Add(StoreConstants.PageNumber, productSearchResult.Stats.PageCurrent.ToStr());
            dic.Add(StoreConstants.TotalItemCount, productSearchResult.Stats.RecordsTotal.ToStr());

            var result = new StoreLiquidResult();

            result.PageDesingName       = pageDesign.Name;
            result.LiquidRenderedResult = dic;
            if (selectedCategory != null)
            {
                result.PageTitle = selectedCategory.Name + " Products";
            }
            else
            {
                result.PageTitle = "Products";
            }
            return(result);
        }
예제 #23
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);
        }
예제 #24
0
        public StoreLiquidResult GetPaging(PageDesign pageDesign)
        {
            var paginator = new PaginatorLiquid();

            paginator.PaginatePath = this.PaginatePath;
            var pageOutputDictionary = PageOutput.LiquidRenderedResult;

            if (pageOutputDictionary.ContainsKey(StoreConstants.PageNumber))
            {
                paginator.Page = pageOutputDictionary[StoreConstants.PageNumber].ToInt();
            }
            else
            {
                Logger.Error("Key NOT FOUND :" + StoreConstants.PageNumber);
            }

            if (pageOutputDictionary.ContainsKey(StoreConstants.TotalItemCount))
            {
                paginator.TotalRecords = pageOutputDictionary[StoreConstants.TotalItemCount].ToInt();
            }
            else
            {
                Logger.Error("Key NOT FOUND :" + StoreConstants.TotalItemCount);
            }

            if (pageOutputDictionary.ContainsKey(StoreConstants.PageSize))
            {
                paginator.PageSize = pageOutputDictionary[StoreConstants.PageSize].ToInt();
            }
            else
            {
                Logger.Error("Key NOT FOUND :" + StoreConstants.PageSize);
            }


            object anonymousObject = new
            {
                paginator = paginator
            };
            var pagingHtml = LiquidEngineHelper.RenderPage(pageDesign, anonymousObject);



            //var pagingDic = new Dictionary<String, String>();
            //pagingDic.Add(StoreConstants.PagingOutput, indexPageOutput);
            //pagingDic = pagingDic.MergeLeft(pageOutputDictionary);
            String html = "";

            if (pageOutputDictionary.ContainsKey(StoreConstants.PageOutput))
            {
                html = pageOutputDictionary[StoreConstants.PageOutput];
            }
            else
            {
                Logger.Error("Key NOT FOUND :" + StoreConstants.PageOutput);
            }


            pageOutputDictionary[StoreConstants.PageOutput] = HtmlAttributeHelper.AddPaging(html, pagingHtml);

            //PageOutput.LiquidRenderedResult = pagingDic;
            return(PageOutput);
        }