コード例 #1
0
 public bool Add(MongoProduct prod)
 {
     if (!this.Contains(prod.ProductId))
     {
         this.products.Insert(prod);
         return true;
     }
     else
     {
         return false;
     }
 }
コード例 #2
0
 public bool Add(MongoProduct prod)
 {
     if (!this.Contains(prod.ProductId))
     {
         this.products.Insert(prod);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
        public void AddProducts(IQueryable <SalesReport> reports)
        {
            var productIDs = reports.Select(x => x.ProductId).Distinct();

            foreach (var productId in productIDs)
            {
                var productSales = reports.Where(x => x.ProductId == productId);
                var currentProd  = entDb.Products.First(p => p.Id == productId);

                double  productQuantity = 0;
                decimal income          = 0;
                foreach (var sale in productSales)
                {
                    productQuantity += sale.Quantity;
                    income          += sale.Sum;
                }

                MongoProduct product = new MongoProduct((int)currentProd.OldId,
                                                        currentProd.ProductName, currentProd.Vendor.VendorName, productQuantity, income);

                this.products.Insert(product);
            }
        }
コード例 #4
0
        public void AddProducts(IQueryable<SalesReport> reports)
        {
            var productIDs = reports.Select(x => x.ProductId).Distinct();

            foreach (var productId in productIDs)
            {
                var productSales = reports.Where(x => x.ProductId == productId);
                var currentProd = entDb.Products.First(p => p.Id == productId);

                double productQuantity = 0;
                decimal income = 0;
                foreach (var sale in productSales)
                {
                    productQuantity += sale.Quantity;
                    income += sale.Sum;
                }

                MongoProduct product = new MongoProduct((int)currentProd.OldId,
                    currentProd.ProductName, currentProd.Vendor.VendorName, productQuantity, income);

                this.products.Insert(product);
            }
        }