コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }