Esempio n. 1
0
        //
        // GET: /Store/

        /// <summary>
        /// 如果是预览则PageSysNo是StorePageInfo中的sysno
        /// </summary>
        /// <param name="SellerSysNo"></param>
        /// <param name="PageSysNo"></param>
        /// <param name="Preview"></param>
        /// <returns></returns>
        public ActionResult Index(int SellerSysNo, int?PageSysNo, bool Preview)
        {
            if (!PageSysNo.HasValue)
            {
                var home = StoreFacade.QueryHomePage(SellerSysNo);
                if (home != null)
                {
                    PageSysNo = home.SysNo;
                }
            }

            var page = StoreFacade.QueryStorePage(new StorePageFilter
            {
                SellerSysNo      = SellerSysNo,
                PublishPageSysNo = PageSysNo,
                IsPreview        = Preview
            });

            ViewBag.SellerSysNo       = page.SellerSysNo;
            ViewBag.PageSysNo         = PageSysNo;
            ViewBag.Theme             = page.StorePageTemplate.StorePageThemeCssUrl;
            ViewBag.PageTypeClassName = page.StorePageType.ClassName;
            ViewBag.Preview           = Preview;

            return(View("~/Views/Store/Index.cshtml", page));
        }
Esempio n. 2
0
        /// <summary>
        /// 获得商铺详细信息
        /// </summary>
        /// <param name="sellerSysNo"></param>
        /// <returns></returns>
        public StoreDetailModel GetStoreDetailInfo(int sellerSysNo)
        {
            //商家信息
            StoreBasicInfo storeinfo = StoreFacade.QueryStoreBasicInfo(sellerSysNo);

            if (storeinfo == null)
            {
                //提示商品找不到
                throw new BusinessException("商家找不到啦,请进入其他店铺,谢谢。");
            }



            //头部信息
            string header = StoreFacade.QueryStorePageHeader(storeinfo.SellerSysNo.Value);

            //导航
            QueryResult <StoreNavigation> StoreNavigation = StoreFacade.QueryStoreNavigationList(new StorePageListQueryFilter
            {
                PageIndex = 0,
                PageSize  = 100
            }, storeinfo.SellerSysNo.Value);

            //店铺网页的主信息
            StorePage homeinfo = StoreFacade.QueryHomePage(storeinfo.SellerSysNo.Value);

            //获得店铺的页面,如果是预览则查询ECStore..StorePageInfo,否则查询ECStore..[PublishedStorePageInfo]
            StorePage pageinfo = StoreFacade.QueryStorePage(new StorePageFilter
            {
                SellerSysNo      = storeinfo.SellerSysNo.Value,
                PublishPageSysNo = homeinfo.SysNo,
                IsPreview        = false
            });

            bool IfDecorate = false;//如果按照装修元素确定店铺新品和一周排行设置为true,否则设置为false
            //店铺新品商品10个
            List <RecommendProduct> newStoreRecommendList = new List <RecommendProduct>();
            //一周排行10个
            List <RecommendProduct> WeekRankingProduct = new List <RecommendProduct>();

            if (IfDecorate)
            {
                //店铺新品
                bool NewProducts = false;
                //一周排行
                bool WeekRanking = false;
                if (pageinfo != null)
                {
                    if (pageinfo.StorePageTemplate.StorePageLayouts.Count > 0)
                    {
                        foreach (var item in pageinfo.StorePageTemplate.StorePageLayouts)
                        {
                            //店铺新品
                            if (item.StorePageElements.Exists(x => x.Key == "NewProducts"))
                            {
                                NewProducts = true;
                            }
                            //一周排行
                            if (item.StorePageElements.Exists(x => x.Key == "WeekRanking"))
                            {
                                WeekRanking = true;
                            }
                        }
                    }
                }
                if (NewProducts)
                {
                    newStoreRecommendList = StoreFacade.QueryStoreNewRecommendProduct(storeinfo.SellerSysNo.Value, null, 10, ConstValue.LanguageCode, ConstValue.CompanyCode);
                }

                if (WeekRanking)
                {
                    WeekRankingProduct = StoreFacade.QueryWeekRankingForCategoryCode(storeinfo.SellerSysNo.Value, null, 10, ConstValue.LanguageCode, ConstValue.CompanyCode);
                }
            }
            else
            {
                //店铺新品商品10个
                newStoreRecommendList = StoreFacade.QueryStoreNewRecommendProduct(storeinfo.SellerSysNo.Value, null, 10, ConstValue.LanguageCode, ConstValue.CompanyCode);

                //一周排行10个
                WeekRankingProduct = StoreFacade.QueryWeekRankingForCategoryCode(storeinfo.SellerSysNo.Value, null, 10, ConstValue.LanguageCode, ConstValue.CompanyCode);
            }

            StoreDetailModel result = new StoreDetailModel();

            //商铺基本信息
            result.StoreBasicInfo = Transformstoreinfo(storeinfo);

            //头部信息
            result.HeaderInfo = header;
            //导航
            if (StoreNavigation.ResultList.Count > 0)
            {
                result.StoreNavigationInfo = Transformsstorenavigation(StoreNavigation);
            }
            //店铺新品商品10个
            if (newStoreRecommendList.Count > 0)
            {
                result.StoreNewProductRecommendInfo = Transformsnewstorerecommend(newStoreRecommendList);
            }
            //一周排行10个
            if (WeekRankingProduct.Count > 0)
            {
                result.StoreWeekRankingProductInfo = TransformsWeekrankingproduct(WeekRankingProduct);
            }
            return(result);
        }