Esempio n. 1
0
        /// <summary>
        /// 构造二级域名的Url(开发人员请根据项目需求,确定该处是否该使用本方法)。
        /// </summary>
        /// <param name="sellerSysNo"></param>
        /// <param name="pageSysNo"></param>
        /// <returns></returns>
        public static string BuildStoreUrl(int sellerSysNo, int?pageSysNo)
        {
            List <StoreDomainPage> list      = StoreFacade.GetAllStoreDomainHomePageList();
            StoreDomainPage        storePage = list.Find(f => f.SellerSysNo == sellerSysNo);

            string webDomain = ConstValue.WebDomain.TrimEnd("/".ToCharArray());
            string url       = "#";

            if (storePage == null)
            {
                url = PageHelper.BuildUrl("StorePage", sellerSysNo, pageSysNo, false);
            }
            else
            {
                Uri    uri      = HttpContext.Current.Request.Url;
                string portName = uri.Port == 80 ? "" : ":" + uri.Port.ToString();

                string domainOnlyHost = ConstValue.WebDomainOnlyHost.Trim();

                url = "http://" + storePage.SecondDomain + "." + domainOnlyHost + portName + "/store/" + storePage.SellerSysNo.ToString() + "/" + storePage.HomePageSysNo.ToString();
            }


            return(url);
        }
Esempio n. 2
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. 3
0
        public ActionResult Index()
        {
            var routeValues = RouteData.Values;

            if (routeValues.Keys != null && routeValues.Keys.Count > 0)
            {
                if (routeValues.Keys.ToList <string>().Exists(f => f.ToLower() == "subdomain"))
                {
                    string subdomain = routeValues["subdomain"].ToString();
                    if (string.IsNullOrWhiteSpace(subdomain))
                    {
                        return(View());
                    }

                    var forbiddenSD = AppSettingManager.GetSetting("Store", "ForbiddenSecondDomain").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    if (forbiddenSD.ToList <string>().Exists(f => f.Trim().ToLower() == subdomain.Trim().ToLower()))
                    {
                        //该二级域名为平台专用,不可申请,所以将直接转到首页!
                        return(View());
                    }

                    StoreDomainPage storePage = StoreFacade.GetStoreIndexPageBySubDomain(subdomain.Trim());
                    if (storePage != null)
                    {
                        return(new StoreController().Index(storePage.SellerSysNo, storePage.HomePageSysNo, false));
                    }
                }
            }


            return(View());
        }
Esempio n. 4
0
 public ReadModelGenFacadeTests(ITestOutputHelper h)
 {
     _h       = h;
     _storage = Substitute.For <ISpecificDbStorage>();
     _sut     = new StoreFacade(_storage, Setup.EventStoreSettings(h));
     _config  = new ReadModelGenerationConfig("test");
 }
Esempio n. 5
0
        public MainViewTests()
        {
            ErrorMessageView  errorMessageView  = new ErrorMessageView();
            DeleteConfirmView deleteConfirmView = new DeleteConfirmView();

            mainView = new MainView(errorMessageView);

            SettingsPresenter settingsPresenter = new SettingsPresenter(new SettingsUC(errorMessageView), errorMessageView);
            StoreFacade       facade            = ServicesInitialiser.facade;

            UnitsService         unitsService         = ServicesInitialiser.unitsService;
            UnitsDetailUC        unitsDetailUC        = new UnitsDetailUC(errorMessageView);
            UnitsDetailPresenter unitsDetailPresenter = new UnitsDetailPresenter(unitsDetailUC, facade);
            UnitsPresenter       unitsPresenter       = new UnitsPresenter(new UnitsUC(errorMessageView), facade, unitsDetailPresenter, deleteConfirmView, errorMessageView);

            SuppliersService         supplierService          = ServicesInitialiser.suppliersService;
            SuppliersDetailUC        suppliersDetailUC        = new SuppliersDetailUC(errorMessageView);
            SuppliersDetailPresenter suppliersDetailPresenter = new SuppliersDetailPresenter(suppliersDetailUC, facade);
            SuppliersPresenter       suppliersPresenter       = new SuppliersPresenter(new SuppliersUC(errorMessageView), suppliersDetailPresenter, facade, deleteConfirmView, errorMessageView);

            ProductsService         productsService         = ServicesInitialiser.productsService;
            ProductsDetailUC        productsDetailUC        = new ProductsDetailUC(errorMessageView);
            ProductsDetailPresenter productsDetailPresenter = new ProductsDetailPresenter(productsDetailUC, facade);
            ProductsPresenter       productsPresenter       = new ProductsPresenter(new ProductsUC(errorMessageView), productsDetailPresenter,
                                                                                    facade, deleteConfirmView, errorMessageView);

            ParametersService         parametersService         = ServicesInitialiser.parametersService;
            ParametersDetailUC        parametersDetailUC        = new ParametersDetailUC(errorMessageView);
            ParametersDetailPresenter parametersDetailPresenter = new ParametersDetailPresenter(parametersDetailUC, facade);
            ParametersPresenter       parametersPresenter       = new ParametersPresenter(new ParametersUC(errorMessageView),
                                                                                          parametersDetailPresenter, facade, deleteConfirmView, errorMessageView);

            ImagesService         imagesService         = ServicesInitialiser.imagesService;
            ImagesDetailUC        imagesDetailUC        = new ImagesDetailUC(errorMessageView);
            ImagesDetailPresenter imagesDetailPresenter = new ImagesDetailPresenter(imagesDetailUC, facade);
            ImagesPresenter       imagesPresenter       = new ImagesPresenter(new ImagesUC(errorMessageView), imagesDetailPresenter, ServicesInitialiser.facade, deleteConfirmView, errorMessageView);

            GroupsService         groupsService         = ServicesInitialiser.groupsService;
            GroupsDetailUC        groupsDetailUC        = new GroupsDetailUC(errorMessageView);
            GroupsDetailPresenter groupsDetailPresenter = new GroupsDetailPresenter(groupsDetailUC, ServicesInitialiser.facade);
            GroupsPresenter       groupsPresenter       = new GroupsPresenter(new GroupsUC(errorMessageView), groupsDetailPresenter, ServicesInitialiser.facade, deleteConfirmView, errorMessageView);

            CategoriesService         categoriesService         = ServicesInitialiser.categoriesService;
            CategoriesDetailUC        categoriesDetailUC        = new CategoriesDetailUC(errorMessageView);
            CategoriesDetailPresenter categoriesDetailPresenter = new CategoriesDetailPresenter(categoriesDetailUC, facade);
            CategoriesPresenter       categoriesPresenter       = new CategoriesPresenter(new CategoriesUC(errorMessageView), categoriesDetailPresenter, facade, deleteConfirmView, errorMessageView);


            mainPresenter = new MainPresenter(mainView,
                                              settingsPresenter,
                                              unitsPresenter, unitsDetailPresenter,
                                              suppliersPresenter, suppliersDetailPresenter,
                                              productsPresenter, productsDetailPresenter,
                                              parametersPresenter, parametersDetailPresenter,
                                              imagesPresenter, imagesDetailPresenter,
                                              groupsPresenter, groupsDetailPresenter,
                                              categoriesPresenter, categoriesDetailPresenter,
                                              facade, deleteConfirmView);
        }
Esempio n. 6
0
 public MigratingEventsFacadeStoreTests(ITestOutputHelper h)
 {
     _store    = Substitute.For <ISpecificDbStorage>();
     _settings = Setup.EventStoreSettings(h);
     _sut      = new StoreFacade(_store, _settings);
     _dest     = Substitute.For <IStoreEvents>();
     _importer = new FakeImport();
     _dest.Advanced.Returns(_importer);
 }
Esempio n. 7
0
        public ActionResult AjaxSellerRegister()
        {
            var vendorBasicInfo = new VendorBasicInfo();

            this.TryUpdateModel <VendorBasicInfo>(vendorBasicInfo);
            if (CookieHelper.GetCookie <String>("VerifyCode").ToLower() == vendorBasicInfo.ValidatedCode.ToLower())
            {
                if (string.IsNullOrEmpty(vendorBasicInfo.VendorName))
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "f", Data = "商家名称不能为空"
                    }, JsonRequestBehavior.AllowGet));
                }
                if (vendorBasicInfo.VendorName.Trim().Length > 100)
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "f", Data = "商家名称长度不能超过100"
                    }, JsonRequestBehavior.AllowGet));
                }
                if (vendorBasicInfo.EnglishName.Trim().Length > 100)
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "f", Data = "商家英文名称长度不能超过100"
                    }, JsonRequestBehavior.AllowGet));
                }
                if (StoreFacade.CheckExistsVendor(vendorBasicInfo.VendorName))
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "f", Data = "该商家名称已存在,如果您已经申请,请耐心等待,我们将尽快与您联系"
                    }, JsonRequestBehavior.AllowGet));
                }
                StoreFacade.CreateVendor(vendorBasicInfo);
                return(Json(new JsonResult()
                {
                    ContentType = "s", Data = "申请成功,请耐心等待,我们将尽快与您联系"
                }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new JsonResult()
            {
                ContentType = "y", Data = "验证码不正确"
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
        /// <summary>
        /// 一周排行10个
        /// </summary>
        /// <param name="sellerSysNo"></param>
        /// <returns></returns>
        public List <StoreWeekRankingProductModel> QueryWeekRankingForCategoryCode(int sellerSysNo)
        {
            List <RecommendProduct> WeekRankingProduct = StoreFacade.QueryWeekRankingForCategoryCode(sellerSysNo, null, 10, ConstValue.LanguageCode, ConstValue.CompanyCode);

            return(EntityConverter <List <RecommendProduct>, List <StoreWeekRankingProductModel> > .Convert(WeekRankingProduct));
        }
Esempio n. 10
0
        /// <summary>
        /// 店铺新品商品10个
        /// </summary>
        /// <param name="sellerSysNo"></param>
        /// <returns></returns>
        public List <StoreNewProductRecommendModel> QueryStoreNewRecommendProduct(int sellerSysNo)
        {
            List <RecommendProduct> newStoreRecommendList = StoreFacade.QueryStoreNewRecommendProduct(sellerSysNo, null, 10, ConstValue.LanguageCode, ConstValue.CompanyCode);

            return(EntityConverter <List <RecommendProduct>, List <StoreNewProductRecommendModel> > .Convert(newStoreRecommendList));
        }
Esempio n. 11
0
        public GetEventsAndSnapshotTests(ITestOutputHelper h)
        {
            _storage = Substitute.For <ISpecificDbStorage>();

            _sut = new StoreFacade(_storage, Setup.EventStoreSettings(h));
        }
Esempio n. 12
0
        /// <summary>
        /// 获取商品详情
        /// </summary>
        /// <param name="id">系统编号</param>
        /// <param name="isGroupBuy">0--标识id为商品系统编号,1--标识id为团购活动系统编号</param>
        /// <returns></returns>
        public ProductDetailModel GetProductDetails(int id, int isGroupBuy)
        {
            int             productSysNo = 0;
            GroupBuyingInfo groupBuyInfo = null;

            if (isGroupBuy == 1)
            {
                groupBuyInfo = GroupBuyingFacade.GetGroupBuyingInfoBySysNo(id);
                if (groupBuyInfo == null)
                {
                    //提示团购活动找不到
                    throw new BusinessException("团购活动找不到啦,请选购其它商品,谢谢。");
                }
                productSysNo = groupBuyInfo.ProductSysNo;
            }
            else
            {
                productSysNo = id;
            }


            //商品基本信息
            ProductBasicInfo basicInfo = ProductFacade.GetProductBasicInfoBySysNo(productSysNo);

            //商品销售信息
            ProductSalesInfo salesInfo = ProductFacade.GetProductSalesInfoBySysNo(productSysNo);

            if (basicInfo == null || salesInfo == null)
            {
                //提示商品找不到
                throw new BusinessException("商品找不到啦,请选购其它商品,谢谢。");
            }
            //如果是不展示或下架
            if (basicInfo.ProductStatus == ProductStatus.NotShow || basicInfo.ProductStatus == ProductStatus.Abandon)
            {
                //提示商品状态已下架或已作废
                throw new BusinessException("商品已下架或已作废,请选购其它商品,谢谢。");
            }
            //商品组信息
            List <ProductPropertyView> propertyView = ProductFacade.GetProductPropetyView(productSysNo, basicInfo.ProductCommonInfoSysNo);

            //商品附件
            List <ProductItemInfo> attachmentList = ProductFacade.GetProductAttachmentList(productSysNo);

            //商品配件
            List <ProductAccessories> accessoriesList = ProductFacade.GetProductAccessoriesList(productSysNo);

            //商家信息
            StoreBasicInfo storeinfo = StoreFacade.QueryStoreBasicInfo(basicInfo.VendorSysno);

            //商品促销信息
            ProductPromotionInfo promotionInfo = Nesoft.ECWeb.Facade.Product.ProductFacade.GetProductPromotionInfo(productSysNo);

            //商品组图片信息
            List <ProductImage> productImages = ProductFacade.GetProductImages(basicInfo.ProductCommonInfoSysNo);

            //商品内容(商品详情,规格参数,售后服务,购买须知等)
            List <ProductContent> contentList = ProductFacade.GetProductContentList(basicInfo);

            ProductDetailModel result = new ProductDetailModel();

            //基本信息
            result.BasicInfo = TransformBasicInfo(basicInfo);
            //商品销售(价格,库存等)信息
            result.SalesInfo = TransformSalesInfo(basicInfo, salesInfo);

            //商品图片列表
            result.ImageList = TransformImageList(productImages);
            //商品描述信息
            result.DescInfo = TransformDescInfo(contentList);
            //if (result.DescInfo != null && basicInfo != null)
            //    result.DescInfo.Performance = basicInfo.Performance;


            //分组属性
            result.GroupPropertyInfo = TransformGroupProperty(propertyView);
            //附件信息
            result.AttachmentInfo = TransformAttachmentInfo(attachmentList);
            //配件信息
            result.AccessoryList = TransformAccessoryInfo(accessoriesList);

            //商家信息
            result.StoreBasicInfo = Transformstoreinfo(storeinfo);


            //限时抢购,赠品,套餐等促销信息
            result.PromoInfo = TransformPromoInfo(promotionInfo);

            //如果是团购商品进一步加载团购详情
            if (promotionInfo != null && promotionInfo.GroupBuySysNo > 0)
            {
                if (groupBuyInfo == null)
                {
                    groupBuyInfo = GroupBuyingFacade.GetGroupBuyingInfoBySysNo(promotionInfo.GroupBuySysNo);
                }
                if (groupBuyInfo == null)
                {
                    result.PromoInfo.GroupBuyingSysNo = 0;
                }
                else
                {
                    //团购图片特殊处理,用活动设置的图片
                    result.BasicInfo.DefaultImageUrl = groupBuyInfo.GroupBuyingPicUrl;
                    result.ImageList.Clear();
                    ProductImageModel groupBuyImage = new ProductImageModel();
                    groupBuyImage.ImageUrlBig  = groupBuyInfo.GroupBuyingPicUrl;
                    groupBuyImage.ImageUrlHuge = groupBuyInfo.GroupBuyingPicUrl;
                    result.ImageList.Add(groupBuyImage);
                    //海外团购商品,算税
                    if (groupBuyInfo.GroupBuyingTypeSysNo == 0)
                    {
                        result.SalesInfo.TariffPrice = salesInfo.CurrentPrice * salesInfo.TariffRate;

                        if (result.SalesInfo.TariffPrice <= ConstValue.TariffFreeLimit)
                        {
                            result.SalesInfo.FreeEntryTax = true;
                            result.SalesInfo.TotalPrice   = salesInfo.CurrentPrice;
                        }
                        else
                        {
                            result.SalesInfo.FreeEntryTax = false;
                            result.SalesInfo.TotalPrice   = salesInfo.CurrentPrice + result.SalesInfo.TariffPrice;
                        }
                        decimal snapShotTariffPrice = groupBuyInfo.SnapShotCurrentPrice * salesInfo.TariffRate;
                        if (snapShotTariffPrice <= ConstValue.TariffFreeLimit)
                        {
                            snapShotTariffPrice = 0;
                        }
                        result.SalesInfo.BasicPrice = groupBuyInfo.SnapShotCurrentPrice + groupBuyInfo.SnapShotCashRebate + snapShotTariffPrice;
                    }
                    else
                    {
                        result.SalesInfo.BasicPrice   = groupBuyInfo.SnapShotCurrentPrice + groupBuyInfo.SnapShotCashRebate;
                        result.SalesInfo.TotalPrice   = salesInfo.CurrentPrice;
                        result.SalesInfo.TariffPrice  = 0;
                        result.SalesInfo.FreeEntryTax = false;
                    }
                    groupBuyInfo.MarketPrice = result.SalesInfo.BasicPrice;

                    result.GroupBuyInfo = MapGroupBuyInfo(groupBuyInfo);
                }
            }
            if (promotionInfo != null && promotionInfo.Countdown != null)
            {
                //限时抢购重算市场价
                decimal snapShotTariffPrice = promotionInfo.Countdown.SnapShotCurrentPrice * salesInfo.TariffRate;
                if (snapShotTariffPrice <= ConstValue.TariffFreeLimit)
                {
                    snapShotTariffPrice = 0;
                }
                result.SalesInfo.BasicPrice = promotionInfo.Countdown.SnapShotCurrentPrice + promotionInfo.Countdown.SnapShotCashRebate + snapShotTariffPrice;
            }

            result.ActionInfo = MapActionInfo(result);

            return(result);
        }