[TestMethod] public async Task TestProductSearch()
        {
            int           pageNum = 1;
            int           perPage = 10;
            DateTime      dateUtc = new DateTime(2021, 10, 15);
            ProductSearch result  = await client.GetUpdatedProducts(dateUtc, pageNum, perPage);

            if (result == null)
            {
                Console.WriteLine($"Failed to get products list.");
                return;
            }

            Console.WriteLine();
            Console.WriteLine($"Start date: {dateUtc:yyyy-MM-dd}");
            Console.WriteLine($"Page number: {result.pageInfo.page}");
            Console.WriteLine($"Items per page: {result.pageInfo.perPage}");
            Console.WriteLine($"Total items: {result.pageInfo.total}");

            int counter = 0;

            Console.WriteLine();
            foreach (Product product in result.items)
            {
                counter++;
                Console.WriteLine($"{counter}. Product {product.id} ({product.code})");
                Console.WriteLine($"{product.name} is MDLP = {product.isMdlp}");
                Console.WriteLine($"Last updated: {product.updatedAt:yyyy-MM-dd HH:mm:ss}");
                foreach (GtinCode gtin in product.gtinCodes)
                {
                    Console.WriteLine($"- {gtin.code}");
                }
                Console.WriteLine();
            }
        }
Example #2
0
        public PartialViewResult ProductSearchMulti()
        {
            MultiOptions settings = new MultiOptions();

            if (this.WidgetPayload is MultiOptions)
            {
                settings = (MultiOptions)this.WidgetPayload;
                settings.LoadData();
            }

            //ProductSearch model = new ProductSearch();
            //using (var db = new NorthwindDataContext()) {
            //	if (settings.CategoryIDs.Any()) {
            //		model.Options = (from c in db.Categories
            //						 where settings.CategoryIDs.Contains(c.CategoryID)
            //						 select c).ToList();

            //		model.Results = (from p in db.Products
            //						 where settings.CategoryIDs.Contains(p.CategoryID.Value)
            //						 select p).ToList();
            //	}
            //}

            ProductSearch model = settings.GetData();

            if (String.IsNullOrEmpty(settings.AlternateViewFile))
            {
                return(PartialView(model));
            }
            else
            {
                model.AltViewName = settings.AlternateViewFile;
                return(PartialView(settings.AlternateViewFile, model));
            }
        }
Example #3
0
 public Task <ResponseResult <List <ProductWeb> > > GetProductList(ProductSearch search)
 {
     return(Task.Run(() =>
     {
         return GetProductListAsync(search);
     }));
 }
Example #4
0
        public IHttpActionResult SearchPriceAndMake(ProductSearch searchEntity)
        {
            IHttpActionResult ret = null;
            PTCViewModel      vm  = new PTCViewModel();

            //Search for Products
            vm.SearchEntity = searchEntity;
            vm.SearchPriceAndMake();

            var priceRange        = vm.ProductsMaxPrice.Intersect(vm.ProductsMinPrice);
            var makeAndPriceRange = priceRange.Intersect(vm.Products);

            vm.Products = makeAndPriceRange.ToList();

            if (vm.Products.Count > 0)
            {
                ret = Ok(vm.Products);
            }
            else
            {
                ret = NotFound();
            }

            return(ret);
        }
        public PageResponse <ProductDto> Execute(ProductSearch search)
        {
            var query = context.Products.AsQueryable();

            if (!string.IsNullOrEmpty(search.Name) || !string.IsNullOrWhiteSpace(search.Name))
            {
                query = query.Where(x => x.Name.ToLower().Contains(search.Name.ToLower()));
            }

            var skipCount = search.PerPage * (search.Page - 1);


            var reponse = new PageResponse <ProductDto>
            {
                CurrentPage  = search.Page,
                ItemsPerPage = search.PerPage,
                TotalCount   = query.Count(),
                Items        = query.Skip(skipCount).Take(search.PerPage).Select(x => new ProductDto
                {
                    Id          = x.Id,
                    Name        = x.Name,
                    Description = x.Description,
                    Price       = x.Price,
                    CategoryId  = x.CategoryId,
                    Quantity    = x.Quantity
                }).ToList()
            };

            return(reponse);
        }
Example #6
0
        public IHttpActionResult SearchProducts(string storeId, ProductSearch criteria)
        {
            var responseGroup = EnumUtility.SafeParse <ItemResponseGroup>(criteria.ResponseGroup, ItemResponseGroup.ItemLarge & ~ItemResponseGroup.ItemProperties);
            var result        = SearchProducts(_searchConnection.Scope, storeId, criteria, responseGroup);

            return(Ok(result));
        }
Example #7
0
        public IEnumerable <Bid> GenerateProductBidsReport(ProductSearch searchData)
        {
            IEnumerable <Bid> bidsFound = new List <Bid>();

            if (searchData.FromDate > searchData.ToDate)
            {
                searchData.ToDate = null;
            }
            if (searchData.FromDate > DateTime.Now)
            {
                searchData.FromDate = DateTime.Now;
            }

            DateTime actualToDate = DateTime.Now;

            if (searchData.ToDate.HasValue)
            {
                DateTime endDate = searchData.ToDate.Value;
                actualToDate = endDate.AddDays(1);
            }

            if (searchData.FromDate != null && searchData.ToDate != null)
            {
                bidsFound = GetAllProductsBidsSoldBetweenTheSpecifiedDates(Convert.ToDateTime(searchData.FromDate), Convert.ToDateTime(actualToDate));
            }

            return(bidsFound);
        }
        public IViewComponentResult Invoke(ProductSearch search)
        {
            ViewBag.Vendors    = _VendorRepo.GetAll();
            ViewBag.Categories = _CategoryRepo.GetAll();

            return(View(search));
        }
        public PageResponse <ProductDtoSearch> Execute(ProductSearch search)
        {
            var query = _context.Products.AsQueryable();

            if (!string.IsNullOrEmpty(search.Name) || !string.IsNullOrWhiteSpace(search.Name))
            {
                query = query.Where(x => x.Name.ToLower().Contains(search.Name.ToLower()) || x.Description.ToLower().Contains(search.Name.ToLower()));
            }
            if (search.CategoryId != 0)
            {
                if (_context.Categories.Any(c => c.Id == search.CategoryId))
                {
                    query = query.Where(p => p.CategoryId == search.CategoryId);
                }
                else
                {
                    query = query.Take(0);
                }
            }
            if (search.Stock)
            {
                query = query.Where(p => p.Stock > 0);
            }


            query = query.Include(pr => pr.Prices);

            return(query.Paged <ProductDtoSearch, Product>(search, _mapper));
        }
Example #10
0
        public void sut_should_takes_product_correctly(
            string expectedName)
        {
            // Arrange
            var builder = new Fixture();
            var product = builder.Build <Product> ()
                          .With(x => x.Name, expectedName)
                          .Create();
            var unExpected  = builder.Create <Product> ();
            var productList = new List <Product> {
                product,
                unExpected,
            };
            var sut = new ProductSearch(productList);

            // Act
            var actual = sut.GetProductList(new List <string> {
                expectedName
            });

            // Assert
            actual.Should().NotBeNullOrEmpty();
            actual.Should().HaveCount(1);
            actual.First().Name.Should().Be(expectedName);
        }
Example #11
0
        public async ValueTask <List <Product> > ProductSearch(ProductSearch dataModel)
        {
            try
            {
                DynamicParameters parameters = new DynamicParameters(new
                {
                    dataModel.Id,
                    dataModel.Brand,
                    dataModel.Model,
                    dataModel.Price,
                    dataModel.CategoryId,
                    dataModel.SubCategoryId
                });
                var result = await connection.QueryAsync <Product, Category, Product>(
                    SpName.ProductsSearch,
                    (p, c) =>
                {
                    Product product  = p;
                    product.Category = c;
                    return(product);
                },
                    param : parameters,
                    commandType : CommandType.StoredProcedure);

                return(result.ToList());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <ProductViewModel> Search(ProductSearch search)
        {
            var query = _context.Products.Include(p => p.ProductCategory).Select(p => new ProductViewModel()
            {
                Id           = p.Id,
                Name         = p.Name,
                CategoryName = p.ProductCategory.Name,
                CategoryId   = p.CategoryId,
                Code         = p.Code,
                Picture      = p.Picture,
                DateCreate   = p.DateCreate.ToPersian(),
            });

            if (!string.IsNullOrWhiteSpace(search.Name))
            {
                query = query.Where(p => p.Name.Contains(search.Name));
            }

            if (!string.IsNullOrWhiteSpace(search.Code))
            {
                query = query.Where(p => p.Code.Contains(search.Code));
            }

            if (search.CategoryId != 0)
            {
                query = query.Where(p => p.CategoryId == search.CategoryId);
            }

            return(query.OrderByDescending(p => p.Id).ToList());
        }
Example #13
0
        // search from https://www.woolworths.com.au/shop/search/products?searchTerm=smith%20chips
        public async Task <IEnumerable <Product> > Search(string productName)
        {
            Uri baseAddress     = new Uri("https://www.woolworths.com.au/apis/ui/Search/");
            var cookieContainer = new CookieContainer();

            using (var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            })
                using (var client = new HttpClient(new LoggingHandler(handler))
                {
                    BaseAddress = baseAddress
                })
                {
                    //SetCookies(cookieContainer);

                    var productSearch = new ProductSearch {
                        SearchTerm = productName
                    };
                    HttpResponseMessage response = await client.PostAsJsonAsync("products", productSearch);

                    var productsn = await response.Content.ReadAsStringAsync();

                    var productList = JObject.Parse(productsn)["Products"].Select(x => x.ToObject <RootObject>());
                    return(productList.Select(x => x.Products.First()));
                }
        }
        public async Task <IActionResult> Index(string productType, string searchString)
        {
            IQueryable <string> typeQuery = _context.Product
                                            .OrderBy(p => p.Type)
                                            .Select(p => p.Type);

            var products = from p in _context.Product
                           select p;

            if (!string.IsNullOrEmpty(searchString))
            {
                products = products.Where(s => s.Name.Contains(searchString));
            }
            if (!string.IsNullOrEmpty(productType))
            {
                products = products.Where(p => p.Type == productType);
            }

            var productSearchVM = new ProductSearch
            {
                Types = new SelectList(await typeQuery.Distinct()
                                       .ToListAsync()
                                       ),
                Products = await products.ToListAsync()
            };

            return(View(productSearchVM));
        }
        public void Can_perf_web_search_products(string providerType)
        {
            var provider = GetSearchProvider(providerType, _scope);

            RebuildIndex(provider, CatalogItemSearchCriteria.DocType);

            var store = GetStore("electronics");

            // find all products in the category
            var criteria = new ProductSearch
            {
                Currency = "USD"
            };

            var context = new Dictionary <string, object>
            {
                { "Store", store },
            };

            var filterService   = GetBrowseFilterService();
            var filters         = filterService.GetFilters(context);
            var serviceCriteria = criteria.AsCriteria <CatalogItemSearchCriteria>(store.Id, store.Catalog, filters);
            var ibs             = GetItemBrowsingService(provider);

            Benchmark.Iterate(() =>
            {
                var searchResults = ibs.SearchItems(_scope, serviceCriteria, ItemResponseGroup.ItemLarge);
                Assert.Equal(true, searchResults.Products.Any());
            });
        }
Example #16
0
        public IEnumerable <ProductDto> Execute(ProductSearch request)
        {
            var query = Context.Products.AsQueryable();

            if (request.MinPrice != null)
            {
                query = query.Where(p => p.Price >= request.MinPrice);
            }
            if (request.MaxPrice != null)
            {
                query = query.Where(p => p.Price <= request.MaxPrice);
            }
            if (request.ProductName != null)
            {
                query = query.Where(p => p.Name.ToLower().Contains(request.ProductName.ToLower()));
            }
            query = query.Where(p => p.IsActive == true);
            return(query.Select(p => new ProductDto
            {
                Id = p.Id,
                Name = p.Name,
                Price = p.Price,
                Description = p.Description,
                CategoryNames = p.ProductCategories.Select(pc => pc.Category.Name)
            }));
        }
Example #17
0
        public async Task <IActionResult> GetProductList(ProductSearch search)
        {
            List <Product> list  = new List <Product>();
            int            total = 0;

            search.PageIndex = search.PageIndex / search.PageSize + 1;
            ResponseResult <List <ProductWeb> > responseResult = await _YoungoServer.GetProductList(search);

            if (responseResult.IsSuccess)
            {
                var data = from m in responseResult.Content
                           select new
                {
                    id            = m.Id,
                    productId     = m.ProductID,
                    name          = m.CnName,
                    type          = m.TypeName,
                    picture       = m.Picture,
                    purchasePrice = m.PurchasePrice.ToString("F2") + "元",
                    salesVolumem  = m.SalesVolume,
                    isTop         = m.IsTop ? "<i class='fa fa-ok fa-fw'></i>" : "<i class='fa fa-ban fa-fw'></i>",
                    state         = m.State ? "有效" : "无效",
                    isClearStock  = m.IsClearStock ? "<i class='fa fa-ok fa-fw'></i>" : "<i class='fa fa-ban fa-fw'></i>",
                    creatTime     = m.CreatTime.ToString("yyyy-MM-dd hh:mm"),
                };
                total = int.Parse(responseResult.Total.ToString());
                return(Json(new { rows = data, total = total }));
            }
            return(Json(new { rows = list, total = total }));
        }
Example #18
0
        private IQueryable <ProductInfo> searchProducts(out int total, string keywords = "", string exp_keywords = "", long cid = 0L, long b_id = 0L, string a_id = "", int orderKey = 1, int orderType = 1, int pageNo = 1, int pageSize = 6)
        {
            ProductSearch productSearch = new ProductSearch()
            {
                shopId     = 0,
                BrandId    = b_id,
                CategoryId = cid,
                Ex_Keyword = exp_keywords,
                Keyword    = keywords,
                OrderKey   = orderKey,
                OrderType  = orderType == 1,
                AttrIds    = new List <string>(),
                PageNumber = pageNo,
                PageSize   = pageSize
            };
            ProductSearch productSearch1 = productSearch;

            string[] strArrays = a_id.Replace("%40", "@").Split(new char[] { '@' });
            for (int i = 0; i < strArrays.Length; i++)
            {
                string str = strArrays[i];
                if (!string.IsNullOrWhiteSpace(str))
                {
                    productSearch1.AttrIds.Add(str);
                }
            }
            PageModel <ProductInfo> pageModel = ServiceHelper.Create <IProductService>().SearchProduct(productSearch1);

            total = pageModel.Total;
            return(pageModel.Models);
        }
Example #19
0
        public async Task SearchProductByTextAsync_ShouldReturnSearchResultForSearchTex()
        {
            var searchItem = new ItemSearch {
                query = "ipod", items = new Item[] { new Item {
                                                         itemId = "42608125"
                                                     } }
            };

            var searchProduct = new ProductSearch {
                queryTime = 3.2, products = new Product[] { new Product {
                                                                productId = "1219661412848"
                                                            } }
            };

            var searchText = "ipod";

            var mock   = new Mock <IWalmartServiceContext>();
            var bbmock = new Mock <IBestbuyServiceContext>();

            mock.Setup(m => m.SearchItemByTextAsync(searchText)).Returns(Task.FromResult(searchItem));

            xStoreRepository = new XStoreRepository(mock.Object, bbmock.Object);


            var result = await xStoreRepository.SearchProductByTextAsync(searchText);

            Assert.AreEqual(result.SearchTerm, searchText);
            mock.VerifyAll();
        }
        protected void lnkDelete_Click(Object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandArgument != null)
                {
                    ProductSearch productSearch = new ProductSearch();
                    productSearch.CategoryId  = Convert.ToInt32(e.CommandArgument);
                    productSearch.ProductName = "";

                    string    jsonProductDetails = JsonConvert.SerializeObject(productSearch);
                    string    data       = _apiAccess.GetProductBySearch(jsonProductDetails);
                    DataTable myObjectDT = JsonConvert.DeserializeObject <DataTable>(data);

                    if (myObjectDT.Rows.Count > 0)
                    {
                        Response.Write("<script>alert('You Can Not Delete This Category, Products Associated')</script>");
                    }

                    else
                    {
                        _apiAccess.DeleteCategory(e.CommandArgument.ToString());
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", " alert('Category Deleted sucessfully'); window.open('Category.aspx');", true);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("StackTrace :" + ex.StackTrace + " Error Mesage : " + ex.Message + "Inner Exception :" + ex.InnerException);
                Response.Write("<script>alert('Something Went Wrong')</script>");
            }
        }
Example #21
0
        public void ProductSearchController_Show_ReturnsProductSearch()
        {
            ProductSearch productSearch = GetProductSearch();

            ViewResult show = _controller.Show(productSearch, new ProductSearchQuery());

            show.Model.Should().BeOfType <ProductSearch>();
        }
Example #22
0
        public ActionResult Products()
        {
            ProductSearch search = new ProductSearch();

            filteredCategories = new List <int>();
            search.filterCats  = new List <int>();
            return(View(search));
        }
Example #23
0
        public override void Init()
        {
            DataCollection = new List <Product>();
            Entity         = new Product();
            SearchEntity   = new ProductSearch();

            base.Init();
        }
Example #24
0
 public WMSProductSearch(ProductSearch wmspro)
     : base(s_metadata)
 {
     SetSqlString(0, wmspro.SKU);
     SetSqlString(1, wmspro.Str8);
     SetSqlString(2, wmspro.Str9);
     SetSqlString(3, wmspro.Str10);
     SetSqlString(4, wmspro.UPC);
 }
        public ActionResult QueryString1()
        {
            var model = new ProductSearch();

            model.Category    = Request.QueryString["category"];
            model.Subcategory = Request.QueryString["subcategory"];

            return(View("SearchResult", model));
        }
        public ActionResult Path1()
        {
            var model = new ProductSearch();

            model.Category    = RouteData.Values["category"].ToString();
            model.Subcategory = RouteData.Values["subcategory"].ToString();

            return(View("SearchResult", model));
        }
        public ActionResult Path2(string category, string subcategory)
        {
            var model = new ProductSearch();

            model.Category    = category;
            model.Subcategory = subcategory;

            return(View("SearchResult", model));
        }
        public ActionResult Form1()
        {
            var model = new ProductSearch();

            model.Category    = Request.Form["category"].ToString();
            model.Subcategory = Request.Form["subcategory"].ToString();

            return(View("SearchResult", model));
        }
Example #29
0
        private void button3_Click(object sender, EventArgs e)
        {
            ProductService.Init();//初始化表

            //得到商品类别
            CategoryService catesService = new CategoryService();
            var             list         = catesService.SelectAll().Where(u => u.Levels == 3);

            Stopwatch sw = new Stopwatch();

            sw.Start();

            List <Task> taskList = new List <Task>();

            foreach (Category cg in list)
            {
                Task task = Task.Factory.StartNew(() =>
                {
                    Stopwatch swShop = new Stopwatch();
                    swShop.Start();
                    LogHelper.WriteLog($"*************商品名称:{cg.Name}开始爬取*************", ConsoleColor.Blue);
                    int pageNum = ProductSearch.GetPageNum(cg.Url);
                    for (int index = 1; index <= pageNum; index++)
                    {
                        LogHelper.WriteLog($"{cg.Name} 页码{index} 总页码{pageNum}");
                        //判断当前是否存在优化可能
                        var productList = ProductSearch.GetPageDataAsync(cg.Url, index, cg.Id);

                        //分组,主要为了分表插入做准备
                        List <ProductGroupInput> groupList = productList.GroupBy(u => u.ProductId % PublicConst.SheetNum).Select(u => new ProductGroupInput
                        {
                            Id           = u.Key,
                            ProductUnits = u.OrderBy(p => p.ProductId).ToList()
                        }).ToList();

                        ProductService.InsertGroupBulk(groupList);
                    }
                    swShop.Stop();
                    return(swShop.ElapsedMilliseconds);
                }).ContinueWith(t =>
                {
                    LogHelper.WriteLog($"*************商品名称:{cg.Name} 结束爬取 耗时:{t.Result / 1000 / 60}分钟*************", ConsoleColor.Blue);
                });

                taskList.Add(task);
                if (taskList.Count > 20)
                {
                    taskList = taskList.Where(t => !t.IsCompleted && !t.IsCanceled && !t.IsFaulted).ToList();
                    Task.WaitAny(taskList.ToArray());
                }
            }

            Task.WaitAll(taskList.ToArray());
            sw.Stop();
            LogHelper.WriteLog($"*************商品爬取结束 耗时:{sw.ElapsedMilliseconds / 1000 / 60}分钟 {sw.ElapsedMilliseconds / 1000 / 60 / 24}小时*************");
        }
Example #30
0
        public async Task <IActionResult> Post([FromBody] ProductSearch productSearch)
        {
            var result = _productRep.SearchProduct(productSearch);

            if (result == null)
            {
                return(BadRequest("Something Went Wrong!"));
            }
            return(Ok(result));
        }
 public ProductControllerTests()
 {
     _documentService = A.Fake<IDocumentService>();
     _productService = A.Fake<IProductService>();
     _categoryService = A.Fake<ICategoryService>();
     _productOptionManager = A.Fake<IProductOptionManager>();
     _fileService = A.Fake<IFileAdminService>();
     _productOptionManagementService = A.Fake<IProductOptionManagementService>();
     _siteSettings = new SiteSettings {DefaultPageSize = 10};
     _uniquePageService = A.Fake<IUniquePageService>();
     _productSearch = new ProductSearch();
     _eTagAdminService = A.Fake<IETagAdminService>();
     A.CallTo(() => _uniquePageService.GetUniquePage<ProductSearch>()).Returns(_productSearch);
     _productController = new ProductController(_productService, _documentService, _categoryService,
         _productOptionManager,
         _fileService, _productOptionManagementService, _siteSettings, _uniquePageService, _eTagAdminService);
 }
Example #32
0
        public PageModel Setup(MediaModel mediaModel)
        {
            var pageModel = new PageModel();

            var productSearch = new ProductSearch
            {
                Name = "Categories",
                UrlSegment = "categories",
                RevealInNavigation = true
            };
            var categoryContainer = new ProductContainer
            {
                Name = "Products",
                UrlSegment = "products",
                RevealInNavigation = false
            };
            _documentService.AddDocument(productSearch);
            _documentService.PublishNow(productSearch);
            _documentService.AddDocument(categoryContainer);
            _documentService.PublishNow(categoryContainer);
            pageModel.ProductSearch = productSearch;

            var now = DateTime.UtcNow;
            var yourBasket = new Cart
            {
                Name = "Your Basket",
                UrlSegment = "basket",
                RevealInNavigation = false,
                PublishOn = now
            };
            _documentService.AddDocument(yourBasket);
            var enterOrderEmail = new EnterOrderEmail
            {
                Name = "Enter Order Email",
                UrlSegment = "enter-order-email",
                RevealInNavigation = false,
                Parent = yourBasket,
                DisplayOrder = 0,
                PublishOn = now,
            };
            _documentService.AddDocument(enterOrderEmail);
            var setPaymentDetails = new PaymentDetails
            {
                Name = "Set Payment Details",
                UrlSegment = "set-payment-details",
                RevealInNavigation = false,
                Parent = yourBasket,
                DisplayOrder = 1,
                PublishOn = now,
            };
            _documentService.AddDocument(setPaymentDetails);
            var setDeliveryDetails = new SetShippingDetails
            {
                Name = "Set Shipping Details",
                UrlSegment = "set-shipping-details",
                RevealInNavigation = false,
                Parent = yourBasket,
                DisplayOrder = 2,
                PublishOn = now,
            };
            _documentService.AddDocument(setDeliveryDetails);
            var orderPlaced = new OrderPlaced
            {
                Name = "Order Placed",
                UrlSegment = "order-placed",
                RevealInNavigation = false,
                Parent = yourBasket,
                DisplayOrder = 3,
                PublishOn = now,
            };
            _documentService.AddDocument(orderPlaced);

            // User Account
            var userAccount = new SitemapPlaceholder
            {
                Name = "User Account",
                UrlSegment = "user-account",
                RevealInNavigation = false,
                PublishOn = now
            };
            _documentService.AddDocument(userAccount);

            var userAccountInfo = new UserAccountInfo
            {
                Name = "Account Details",
                UrlSegment = "user-account-details",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountInfo);

            var userAccountPassword = new UserAccountChangePassword
            {
                Name = "Change Password",
                UrlSegment = "user-account-change-password",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountPassword);

            var userAccountAddresses = new UserAccountAddresses
            {
                Name = "Account Addresses",
                UrlSegment = "user-account-addresses",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountAddresses);

            var editAddress = new UserAccountEditAddress
            {
                Name = "Edit Address",
                UrlSegment = userAccountAddresses.UrlSegment + "/edit-address",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccountAddresses
            };
            _documentService.AddDocument(editAddress);

            var userAccountOrders = new UserAccountOrders
            {
                Name = "Orders",
                UrlSegment = "user-account-orders",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountOrders);

            var userOrder = new UserOrder
            {
                Name = "View Order",
                UrlSegment = "user-account-orders/order",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccountOrders
            };
            _documentService.AddDocument(userOrder);

            var userAccountReviews = new UserAccountReviews
            {
                Name = "Reviews",
                UrlSegment = "user-account-reviews",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountReviews);

            var userAccountRewards = new UserAccountRewardPoints
            {
                Name = "Reward Points",
                UrlSegment = "user-account-reward-points",
                RevealInNavigation = false,
                PublishOn = now,
                Parent = userAccount
            };
            _documentService.AddDocument(userAccountRewards);

            // End User Account


            //Added to cart
            var addedToCart = new ProductAddedToCart
            {
                Name = "Added to Basket",
                UrlSegment = "add-to-basket",
                RevealInNavigation = false,
                PublishOn = now
            };
            _documentService.AddDocument(addedToCart);
            pageModel.ProductAddedToCart = addedToCart;

            var wishlist = new ShowWishlist
            {
                Name = "Wishlist",
                UrlSegment = "wishlist",
                RevealInNavigation = true,
                PublishOn = now
            };
            _documentService.AddDocument(wishlist);

            var newIn = new NewInProducts
            {
                Name = "New In",
                UrlSegment = "new-in",
                RevealInNavigation = true,
                PublishOn = now
            };
            _documentService.AddDocument(newIn);

            var about = new TextPage()
            {
                Name = "About us",
                UrlSegment = "about-us",
                RevealInNavigation = true,
                PublishOn = now,
                BodyContent = EcommerceInstallInfo.AboutUsText
            };
            _documentService.AddDocument(about);

            //update core pages
            var homePage = _documentService.GetDocumentByUrl<TextPage>("home");
            if (homePage != null)
            {
                homePage.BodyContent = EcommerceInstallInfo.HomeCopy;
                var templates = _pageTemplateAdminService.Search(new PageTemplateSearchQuery());
                var homeTemplate = templates.FirstOrDefault(x => x.Name == "Home Page");
                if (homeTemplate != null)
                {
                    homePage.PageTemplate = homeTemplate;
                }

                homePage.SubmitButtonText = "Sign up";
                _documentService.SaveDocument(homePage);
                pageModel.HomePage = homePage;
            }
            var page2 = _documentService.GetDocumentByUrl<TextPage>("page-2");
            if (page2 != null)//demopage in core not needed
                _documentService.DeleteDocument(page2);

            var contactus = _documentService.GetDocumentByUrl<TextPage>("contact-us");
            if (contactus != null)//demopage in core not needed
                _documentService.DeleteDocument(contactus);

            //Added to cart
            var contactUs = new ContactUs()
            {
                Name = "Contact Us",
                UrlSegment = "contact-us",
                RevealInNavigation = true,
                PublishOn = now,
                Latitude = 55.01021m,
                Longitude = -1.44998m,
                Address = EcommerceInstallInfo.Address,
                PinImage = mediaModel.Logo.FileUrl,
                BodyContent = "[form]",
                FormDesign = EcommerceInstallInfo.ContactFormDesign
            };
            _documentService.AddDocument(contactUs);
            GetFormProperties(contactUs);

            var brandListing = new BrandListing
            {
                Name = "Brands",
                UrlSegment = "brands",
                RevealInNavigation = true,
                PublishOn = now,
                BodyContent = ""
            };
            _documentService.AddDocument(brandListing);

            return pageModel;
        }