Exemplo n.º 1
0
 private void GetProductDetails() {
     for (int i = 0; i < 40; i++) {
         ProductViewModel p = new ProductViewModel();
         p.ProductName = ProductNames[r.Next(ProductNames.Count() - 1)];
         p.Year2008 = r.Next(100, 300);
         p.Year2009 = r.Next(400, 600);
         this.productDetails.Add(p);
     }
 }
Exemplo n.º 2
0
        private ProductViewModel[] GetComplexPropertiesProduct() {
            ProductViewModel[] productVMs = new ProductViewModel[1];

            productVMs[0] = new ProductViewModel();

            productVMs[0].ShippingDays = discount % 2 == 0 ? discount + 32 : discount + 39;
            productVMs[0].ProductId = discount + 26;

            return productVMs;

        }
Exemplo n.º 3
0
        private void PopulateProductVMs(int count) {
            for (int i = 0; i < count; i++) {
                ProductViewModel productVM = new ProductViewModel();

                var productName = ProductNames[r.Next(ProductNames.Count() - 1)];
                var productCollection = ProductDict[productName];
                productVM.ProductId = 10000 + i;
                productVM.UserRating = r.Next(3, 5);
                productVM.ShippingDays = r.Next(1, 5);
                productVM.ProductType = productName;
                productVM.ProductName = productCollection[r.Next(productCollection.Length - 1)];
                var productModel = ProductModelDict[productVM.ProductName];
                productVM.ProductBrand = productVM.ProductName;
                productVM.Availability = r.Next(0, 20) % 5 == 0 ? false : true;
                productVM.Price = ProductPriceDict[productName];
                productVM.ProductModel = productModel[r.Next(productModel.Count())];

                //productVM.ProductName = ProductNames2[r.Next(20)];
                productVM.Year2008 = Convert.ToDecimal(Math.Round(r.Next(2000) + r.NextDouble(), 2));
                productVM.Year2009 = Convert.ToDecimal(Math.Round(r.Next(250) + r.NextDouble(), 2));
                productVM.Year2010 = Convert.ToDecimal(Math.Round(r.Next(300) + r.NextDouble(), 2));
                productVM.Year2011 = Convert.ToDecimal(Math.Round(r.Next(550) + r.NextDouble(), 2));
                productVM.Year2012 = Convert.ToDecimal(Math.Round(r.Next(700) + r.NextDouble(), 2));
                productVM.Year2013 = Convert.ToDecimal(Math.Round(r.Next(1000) + r.NextDouble(), 2));
                productVM.TotalSales = productVM.Year2008 + 
                productVM.Year2009 + productVM.Year2010 + productVM.Year2011 + 
                productVM.Year2012 + productVM.Year2013;

                this.ProductVMs.Add(productVM);
            }
        }