示例#1
0
        /// <summary>
        /// Insert last purchase of product in stock
        /// </summary>
        /// <param name="purchase"></param>
        private void InsertPurchaseInStock(Purchase purchase)
        {
            var productInStock = _repository.GetList <ProductInStock>(
                ps => ps.ProductId == purchase.ProductId &&
                ps.ProviderId == purchase.ProviderId &&
                ps.State == StateEnum.Available)
                                 .FirstOrDefault();

            if (productInStock == null)
            {
                productInStock = new ProductInStock()
                {
                    Amount     = purchase.Amount,
                    PriceInput = purchase.PriceInput,
                    ProductId  = purchase.ProductId,
                    ProviderId = purchase.ProviderId,
                    State      = StateEnum.Available
                };
                var code = GenerateCode(productInStock);
                productInStock.Code = code;
                _repository.AddEntity(productInStock);
            }
            else
            {
                productInStock.Amount += purchase.Amount;
                _repository.UpdateEntity(productInStock);
            }
        }
        public IActionResult EditQuantity(int ID)
        {
            ProductInStock p = Storage.GetFromCart(ID);

            Storage.SetProductEditing(p);
            return(View(p));
        }
示例#3
0
 public string AddToStock(ProductInStock product)
 {
     product.AddDate = DateTime.Now;
     db.Stock.Add(product);
     db.SaveChanges();
     return("Готово!");
 }
示例#4
0
 /// <summary>
 /// Конвертация в остатки на складе БД
 /// </summary>
 /// <param name="product">остатки на складе</param>
 /// <returns>остатки на складе БД</returns>
 public static ProductInStockEnt Convert(ProductInStock product)
 {
     if (product != null)
     {
         var x = Unit.ProductInStockRepository.GetItem(product.Id);
         if (x != null)
         {
             return(x);
         }
         else
         {
             Dictionary <ProductEnt, int> pairs = new Dictionary <ProductEnt, int>();
             foreach (var item in product.NumberOfItems)
             {
                 pairs.Add(Convert(item.Key), item.Value);
             }
             ProductInStockEnt productInStock = new ProductInStockEnt
             {
                 DateInventory = product.DateInventory,
                 Id            = product.Id,
                 NumberOfItems = pairs
             };
             return(productInStock);
         }
     }
     else
     {
         return(null);
     }
 }
示例#5
0
 /// <summary>
 /// Конвертация в остатки на складе
 /// </summary>
 /// <param name="product">остатки на складе БД</param>
 /// <returns>остатки на складе</returns>
 public static ProductInStock Convert(ProductInStockEnt product, bool logic = true)
 {
     if (product != null)
     {
         Dictionary <Product, int> pairs = null;
         if (logic == true)
         {
             pairs = new Dictionary <Product, int>();
             foreach (var item in product.NumberOfItems)
             {
                 pairs.Add(Convert(item.Key, false), item.Value);
             }
         }
         ProductInStock productInStock = new ProductInStock
         {
             DateInventory = product.DateInventory,
             Id            = product.Id,
             NumberOfItems = pairs
         };
         return(productInStock);
     }
     else
     {
         return(null);
     }
 }
        public async Task Handle(ProductInStockUpdateCommand notification, CancellationToken cancellationToken)
        {
            var products = notification.Items.Select(x => x.ProductId);
            var stocks   = await _context.Stocks.Where(x => products.Contains(x.ProductId)).ToListAsync();


            foreach (var item in notification.Items)
            {
                var entry = stocks.SingleOrDefault(x => x.ProductId == item.ProductId);

                if (item.Action == Common.Enums.ProductInStockAction.Substract)
                {
                    if (entry == null || item.Stock > entry.Stock)
                    {
                        throw new Exception($"Product {entry.ProductId} - doesn't have enough stock");
                    }
                    entry.Stock -= item.Stock;
                }
                else
                {
                    if (entry == null)
                    {
                        entry = new ProductInStock
                        {
                            ProductId = item.ProductId
                        };

                        await _context.AddAsync(entry);
                    }

                    entry.Stock += item.Stock;
                }
            }
            await _context.SaveChangesAsync();
        }
示例#7
0
        public string GenerateCode(ProductInStock productInStock)
        {
            var code = productInStock.ProductId.ToString() +
                       productInStock.ProviderId.ToString() +
                       productInStock.State.ToString();

            return(code);
        }
        private long UpdateProductQuantity(string productName, int quantity)
        {
            var productInStock = items[productName];
            var id             = productInStock.Id;

            items[productName] = new ProductInStock(id, productName, productInStock.Quantity + quantity);
            return(id);
        }
        public IActionResult GetAddToCart(int ID)
        {
            Location _currentLocation = DatabaseControl.GetLocation(ID, _context);

            Storage.SetLocation(_currentLocation);
            ProductInStock productInStock = DatabaseControl.GetProductInStock(Storage.GetProduct().ProductID, _currentLocation, _context);

            Storage.SetProductToBuy(productInStock);
            return(View("AddToCart", productInStock));
        }
        private void DeductInventory(string productName, int quantity)
        {
            var productInStock = items[productName];
            var balanceInStock = productInStock.Quantity - quantity;

            if (balanceInStock > 0)
            {
                items[productName] = new ProductInStock(productInStock.Id, productName, balanceInStock);
            }
        }
示例#11
0
 public static void CleanAfterOrder()
 {
     ProductToBuy   = null;
     ShoppingCart   = null;
     product        = null;
     ProductEditing = null;
     CardUsing      = null;
     Addy           = null;
     Order          = null;
 }
示例#12
0
        public async Task Handle(ProductInStockUpdateStockCommand command, CancellationToken cancellationToken)
        {
            _logger.LogInformation("--- ProductInStockUpdateStockCommand started");

            var products = command.Items.Select(x => x.ProductId);
            var stocks   = await _context.Stocks.Where(x => products.Contains(x.ProductId)).ToListAsync();

            _logger.LogInformation("--- Retrieve products from database");

            foreach (var item in command.Items)
            {
                var entry = stocks.SingleOrDefault(x => x.ProductId == item.ProductId);
                if (item.Action == Enums.ProductInStockAction.Substract)
                {
                    if (entry == null)
                    {
                        _logger.LogError($"--- This Product: {item.ProductId} - doesn't exist");

                        throw new ProductInStockUpdateStockCommandException($"This Product: {item.ProductId} - doesn't exist");
                    }

                    if (item.Stock > entry.Stock)
                    {
                        _logger.LogError($"--- Product {entry.ProductId} - doesn´t have enough stock");

                        throw new ProductInStockUpdateStockCommandException($"Product {entry.ProductId} - doesn´t have enough stock");
                    }

                    entry.Stock -= item.Stock;
                    _logger.LogInformation($"--- Product {entry.ProductId} - its stocks was substracted and its new stock is {entry.Stock}");
                }
                else
                {
                    if (entry == null)
                    {
                        entry = new ProductInStock
                        {
                            ProductId = item.ProductId
                        };

                        await _context.AddAsync(entry);

                        _logger.LogInformation($"--- New stock record was created for {entry.ProductId} because didn't exists before");
                    }

                    entry.Stock += item.Stock;
                    _logger.LogInformation($"--- Product {entry.ProductId} - its stocks was increased and its new stock is {entry.Stock}");
                }
            }

            await _context.SaveChangesAsync();

            _logger.LogInformation("--- ProductInStockUpdateStockCommand ended");
        }
示例#13
0
 public static void Clean()
 {
     location       = null;
     ProductToBuy   = null;
     ShoppingCart   = null;
     product        = null;
     ProductEditing = null;
     CardUsing      = null;
     Addy           = null;
     Order          = null;
 }
示例#14
0
 public static void DeleteProductInCart(int ID)
 {
     if (ShoppingCart.Count == 1)
     {
         ShoppingCart = null;
     }
     else
     {
         ProductInStock p = GetFromCart(ID);
         ShoppingCart.Remove(p);
     }
 }
示例#15
0
        public async Task Handle(ProductInStockUpdateStockCommand notification, CancellationToken cancellationToken)
        {
            // I use https://papertrailapp.com/ for logging the messsages
            _logger.LogInformation("--- ProductInStockUpdateStockCommand started");

            var products = notification.Items.Select(x => x.ProductId);
            var stocks   = await _context.Stocks.Where(x => products.Contains(x.ProductId)).ToListAsync();

            _logger.LogInformation("--- Products retrieved from database");

            foreach (var item in notification.Items)
            {
                var entry = stocks.SingleOrDefault(x => x.ProductId == item.ProductId);

                if (item.Action == Enums.ProductInStockAction.Subtract)
                {
                    if (entry == null || item.Stock > entry.Stock)
                    {
                        var errorMsg = $"--- Product {entry?.ProductId} doesn't have enough stock";
                        _logger.LogError(errorMsg);
                        throw new Exception(errorMsg);
                    }

                    entry.Stock -= item.Stock;

                    _logger.LogInformation($"--- Product {entry?.ProductId} - The stock has been subtracted - new stock {entry?.Stock}");
                }
                else
                {
                    if (entry == null)
                    {
                        entry = new ProductInStock()
                        {
                            ProductId = item.ProductId
                        };

                        await _context.AddAsync(entry);

                        _logger.LogInformation($"--- New stock record was created for {entry?.ProductId} because didn't exist");
                    }

                    entry.Stock += item.Stock;
                    _logger.LogInformation($"--- Product {entry?.ProductId} - The stock was updated and the new stock is {entry?.Stock}");
                }
            }

            await _context.SaveChangesAsync();

            _logger.LogInformation("--- ProductInStockUpdateStockCommand ended");
        }
        public async Task <IActionResult> SaveProductStockDetails(ProductInStockModel productInStockModel)
        {
            var productInStock = new ProductInStock()
            {
                InStock   = productInStockModel.ProductInStock,
                Quantity  = productInStockModel.ProductQuantity,
                ProductId = productInStockModel.ProductNameId
            };
            await _context.ProductInStocks.AddAsync(productInStock);

            await _context.SaveChangesAsync();

            return(Ok(productInStock));
        }
示例#17
0
        public static ProductInStock GetFromCart(int ID)
        {
            ProductInStock prodInStock = new ProductInStock();

            foreach (ProductInStock ps in ShoppingCart)
            {
                if (ps.ProductID == ID)
                {
                    prodInStock = ps;
                    break;
                }
            }
            return(prodInStock);
        }
        public IActionResult AddToCart(int id)
        {
            _currentLocation = Storage.GetLocation();
            ProductInStock productInStock = DatabaseControl.GetProductInStock(id, _currentLocation, _context);

            if (Storage.ShoppingCartHas(productInStock))
            {
                return(View("ProductAlreadyInCart", productInStock));
            }
            else
            {
                Storage.SetProductToBuy(productInStock);
                return(View(productInStock));
            }
        }
示例#19
0
        public async Task Handle(ProductInStockUpdateStockCommand notification, CancellationToken cancellationToken)
        {
            logger.LogInformation("---ProductInStockUpdateStockCommand stared");

            var products = notification.Items.Select(x => x.ProductId);
            var stocks   = await dbContext.Stocks.Where(x => products.Contains(x.ProductInStockId)).ToListAsync();

            logger.LogInformation("---Retrieved products from database");

            foreach (var item in notification.Items)
            {
                var entry = stocks.SingleOrDefault(x => x.ProductInStockId == item.ProductId);
                switch (item.Action)
                {
                case Common.Enums.ProductInStockAction.Add:
                    if (entry == null)
                    {
                        entry = new ProductInStock()
                        {
                            ProductId = item.ProductId
                        };
                        await dbContext.AddAsync(entry);

                        logger.LogInformation($"--- New stock record was created for {entry.ProductId} because didn't exists before");
                    }
                    entry.Stock += item.Stock;
                    logger.LogInformation($"---Product {entry.ProductId} - its stock was increased and its new stock is {entry.Stock}");


                    break;

                case Common.Enums.ProductInStockAction.Substract:

                    if (entry == null || item.Stock > entry.Stock)
                    {
                        logger.LogError($"---Product {entry.ProductId} - doesn't have enough stock");
                        throw new Exception($"Product {entry.ProductId} - doesn't have enough stock");
                    }
                    logger.LogInformation($"---Product {entry.ProductId} - its stock was subtracted and its new stock is {entry.Stock}");
                    entry.Stock -= item.Stock;
                    break;
                }

                await dbContext.SaveChangesAsync();

                logger.LogInformation("---ProductInStockUpdateStockCommand ended");
            }
        }
        internal static List <Order> GetPastOrdersFromCustomer(Customer customer, P1Context _context)
        {
            List <Order> OrdersByCustomer = new List <Order>();

            var DB = _context;

            OrderDAO.LoadOrdersList(DB);
            OrderProductsDAO.LoadOrderProductsList(DB);
            ProductDAO.LoadProductsList(DB);
            LocationDAO.LoadLocationsList(DB);
            BillingDAO.LoadBillingList(DB);
            CustomerDAO.LoadCustomersList(DB);
            ShippingDAO.LoadShippingInfomrationList(DB);

            OrdersByCustomer = DB.OrdersList.Where(o => o.CustomerID == customer.CustomerID).ToList();

            for (int i = 0; i < OrdersByCustomer.Count; i++)
            {
                Order o = OrdersByCustomer[i];

                List <ProductInStock> prodsOrdered = new List <ProductInStock>();

                List <OrderProducts> prodIDsAndQuantityInOrder = DB.OrderProductsList.Where(op => op.OrderID == OrdersByCustomer[i].OrderID).ToList();
                foreach (OrderProducts OP in prodIDsAndQuantityInOrder)
                {
                    ProductInStock prodOrdered = new ProductInStock();
                    Product        p           = DB.ProductsList.First(p => p.ProductID == OP.ProductID);
                    prodOrdered.Name        = p.Name;
                    prodOrdered.Price       = p.Price;
                    prodOrdered.Description = p.Description;
                    prodOrdered.Quantity    = OP.Quantity;
                    prodsOrdered.Add(prodOrdered);
                }

                o.ShoppingCart = prodsOrdered;

                o.Billing = DB.BillingInformationList.First(b => b.BillingID == OrdersByCustomer[i].BillingID);

                o.Shipping = DB.ShippingInformation.First(s => s.ShippingID == OrdersByCustomer[i].ShippingID);

                o.Location = DB.LocationList.First(l => l.LocationID == OrdersByCustomer[i].LocationID);

                o.Customer = DB.CustomersList.First(c => c.CustomerID == OrdersByCustomer[i].CustomerID);

                OrdersByCustomer[i] = o;
            }
            return(OrdersByCustomer);
        }
示例#21
0
        public static bool ShoppingCartHas(ProductInStock ps)
        {
            bool contains = false;

            if (ShoppingCart != null)
            {
                foreach (ProductInStock productInStock in ShoppingCart)
                {
                    if (productInStock.ProductID == ps.ProductID)
                    {
                        contains = true;
                    }
                }
            }
            return(contains);
        }
        public async Task Handle(ProductInStockUpdateStockCommand notification, CancellationToken cancellationToken)
        {
            _logger.LogInformation(" --- ProductInStockUpdateStockCommand started");

            var products = notification.Items.Select(x => x.ProductId);
            var stocks   = await _context.Stocks.Where(x => products.Contains(x.ProductId)).ToListAsync();

            _logger.LogInformation(" --- Retrieve products from database");

            foreach (var item in notification.Items)
            {
                var entry = stocks.SingleOrDefault(x => x.ProductId == item.ProductId);

                if (item.Action == ProductInStockAction.Substract)
                {
                    if (entry == null || item.Stock > entry.Stock)
                    {
                        _logger.LogError($"Product {entry.ProductId} - doesn´t have enough stock");
                        throw new Exception($"Product {entry.ProductId} - doesn´t have enough stock");
                    }

                    _logger.LogInformation($"Product {entry.ProductId} - its stock was substracted / New stock: { entry.Stock}");
                    entry.Stock -= item.Stock;
                }
                else
                {
                    if (entry == null)
                    {
                        entry = new ProductInStock
                        {
                            ProductId = item.ProductId
                        };

                        await _context.AddAsync(entry);

                        _logger.LogInformation($"New stock record was created for {entry.ProductId}");
                    }

                    entry.Stock += item.Stock;
                    _logger.LogInformation($"Product {entry.ProductId} - its stock was increased / New stock: { entry.Stock}");
                }
            }

            await _context.SaveChangesAsync();

            _logger.LogInformation(" --- ProductInStockUpdateStockCommand finished");
        }
示例#23
0
        public async Task Handle(ProductInStockUpdateStockCommand command, CancellationToken cancellationToken)
        {
            _logger.LogInformation("--- ProductInStockUpdateStockCommand started");

            var products = command.Items.Select(item => item.ProductId);
            var stocks   = await _context.Stock
                           .Where(x => products.Contains(x.ProductId))
                           .ToListAsync(cancellationToken);

            _logger.LogInformation("--- Retrieving products from database");

            foreach (var item in command.Items)
            {
                var entry = stocks.SingleOrDefault(x => x.ProductId == item.ProductId);

                if (item.Action == ProductInStockAction.Subtract)
                {
                    if (entry is null || item.Stock > entry.Stock)
                    {
                        _logger.LogError($"Product {entry.ProductId} - does not have enough stock");
                        throw new ArgumentException($"Product {entry.ProductId} - does not have enough stock");
                    }
                    _logger.LogInformation($"--- Product {entry.ProductId} - stock subtracted - new stock {entry.Stock}");
                    entry.Stock -= item.Stock;
                }
                else
                {
                    if (entry is null)
                    {
                        entry = new ProductInStock
                        {
                            ProductId = item.ProductId
                        };

                        await _context.AddAsync(entry, cancellationToken);

                        _logger.LogInformation($"--- New Stock created for {entry.ProductId} - because it has not a previous stock");
                    }
                    entry.Stock += item.Stock;
                    _logger.LogInformation($"--- Product {entry.ProductId} - stock increased - new stock {entry.Stock}");
                }
            }

            await _context.SaveChangesAsync(cancellationToken).ConfigureAwait(false);

            _logger.LogInformation("--- ProductInStockUpdateStockCommand ended");
        }
        public async Task Handle(ProductInStockUpdateStockCommand notification, CancellationToken cancellationToken)
        {
            logger.LogInformation("--- ProductInStockUpdateStockCommand started");

            IEnumerable <int>     products = notification.Items.Select(x => x.ProductId);
            List <ProductInStock> stocks   = await context.Stocks.Where(x => products.Contains(x.ProductId)).ToListAsync();

            logger.LogInformation("--- Retrieve products from database");

            foreach (var item in notification.Items)
            {
                ProductInStock entry = stocks.SingleOrDefault(x => x.ProductId == item.ProductId);

                if (item.Action == ProductInStockAction.Substract)
                {
                    if (entry == null || item.Stock > entry.Stock)
                    {
                        logger.LogError($"--- Product {entry.ProductId} - doesn't have enough stock");
                        throw new ProductInStockUpdateStockCommandException($"Product {entry.ProductId} - doesn't have enough stock");
                    }

                    entry.Stock -= item.Stock;
                    logger.LogInformation($"--- Product {entry.ProductId} - its stock was subtracted and its new stock is {entry.Stock}");
                }
                else
                {
                    if (entry == null)
                    {
                        entry = new ProductInStock
                        {
                            ProductId = item.ProductId
                        };

                        await context.AddAsync(entry);

                        logger.LogInformation($"--- New stock record was created for {entry.ProductId} because didn't exists before");
                    }

                    entry.Stock += item.Stock;
                    logger.LogInformation($"--- Add stock to product {entry.ProductId}");
                }
            }

            await context.SaveChangesAsync();

            logger.LogInformation("--- ProductInStockUpdateStockCommand ended");
        }
        /*internal static List<Customer> GetAllCustomers(P1Context _context)
         * {
         *  List<Customer> CustomerList = new List<Customer>();
         *  var DB = _context;
         *  CustomerDAO.LoadCustomersList(DB);
         *  CustomerList = DB.CustomersList;
         *  return CustomerList;
         * }
         *
         * internal static List<Product> GetAllProducts(P1Context _context)
         * {
         *  List<Product> ProductList;
         *  var DB = _context;
         *  ProductDAO.LoadProductsList(DB);
         *  ProductList = DB.ProductsList;
         *  return ProductList;
         * }*/

        internal static ProductInStock GetProductInStock(int id, Location location, P1Context _context)
        {
            int            max            = FindNumInStockAtLocation(id, location, _context);
            Product        p              = GetProduct(id, _context);
            ProductInStock productInStock = new ProductInStock
            {
                ProductID   = p.ProductID,
                Name        = p.Name,
                Price       = p.Price,
                Type        = p.Type,
                Description = p.Description,
                Max         = max,
                Store       = location
            };

            return(productInStock);
        }
示例#26
0
        public static void ChangeQuantity(int quantity)
        {
            for (int i = 0; i < ShoppingCart.Count; i++)
            {
                if (ShoppingCart[i].ProductID == ProductEditing.ProductID)
                {
                    ProductInStock productEdited = ProductEditing;
                    productEdited.Quantity = quantity;
                    ShoppingCart[i]        = productEdited;
                    break;
                }
            }

            /*ProductInStock productEdited = ProductEditing;
             * productEdited.Quantity = quantity;
             * ShoppingCart.Add(productEdited);
             * ShoppingCart.Remove(ProductEditing);*/
        }
示例#27
0
        public ProductInStockConfiguration(EntityTypeBuilder <ProductInStock> entity)
        {
            entity.HasIndex(x => x.ProductInStockId);
            var stocks = new List <ProductInStock>();
            var random = new Random();

            for (int i = 1; i <= 100; i++)
            {
                var stock = new ProductInStock()
                {
                    ProductId        = i,
                    ProductInStockId = i,
                    Stock            = random.Next(0, 100)
                };
                stocks.Add(stock);
            }


            entity.HasData(stocks);
        }
        internal static List <ProductInStock> GetProductsInStockAtLocation(List <Product> Products, Location Location, P1Context _context)
        {
            List <ProductInStock> prodsInStock = new List <ProductInStock>();

            foreach (Product p in Products)
            {
                int            max         = FindNumInStockAtLocation(p, Location, _context);
                ProductInStock prodInStock = new ProductInStock
                {
                    ProductID   = p.ProductID,
                    Name        = p.Name,
                    Price       = p.Price,
                    Type        = p.Type,
                    Description = p.Description,
                    Store       = Location,
                    Max         = max
                };
                prodsInStock.Add(prodInStock);
            }
            return(prodsInStock);
        }
        public IActionResult PlaceInCart(int quantity)
        {
            int id = Storage.GetProductToBuy().ProductID;

            _currentLocation = Storage.GetLocation();
            ProductInStock productInStock = DatabaseControl.GetProductInStock(id, _currentLocation, _context);

            if (quantity < 1 || quantity > productInStock.Max)
            {
                return(View("GetLocation", _currentLocation));
            }
            else
            {
                productInStock.Quantity = quantity;
                _currentLocation        = Storage.GetLocation();
                List <ProductInStock> shoppingCart = Storage.GetShoppingCart();
                shoppingCart.Add(productInStock);
                Storage.SetShoppingCart(shoppingCart);
                ViewData["itemAdded"] = productInStock.Name + " has been added to your shopping cart!";
                return(View("GetLocation", _currentLocation));
            }
        }
示例#30
0
        static void Main(string[] args)
        {
            int amountSofa, amountChair, amountTable;

            double totalPrice = 0;

            ProductInStock sofa  = new ProductInStock("sofa", 1500, 15);
            ProductInStock chair = new ProductInStock("chair", 90, 20);
            ProductInStock table = new ProductInStock("table", 150, 10);

            Console.Write("Enter the amound of {0}'s you want to buy(there are only {1} {0}'s left): ", sofa.Name, sofa.Quanity, sofa.Price);

            amountSofa = int.Parse(Console.ReadLine());

            Console.Write("Enter the amound of {0}'s you want to buy(there are only {1} {0}'s left): ", chair.Name, chair.Quanity, chair.Price);

            amountChair = int.Parse(Console.ReadLine());

            Console.Write("Enter the amound of {0}'s you want to buy(there are only {1} {0}'s left): ", table.Name, table.Quanity, table.Price);

            amountTable = int.Parse(Console.ReadLine());

            if (amountSofa > sofa.Quanity && amountChair > chair.Quanity && amountTable > table.Quanity)
            {
                Console.WriteLine("Out of stock");
            }
            else
            {
                for (int i = 0; i < amountSofa; i++)
                {
                    sofa.SellOneProduct();

                    Console.WriteLine("{0}'s price is {1} and {2} {3}'s are left", sofa.Name, sofa.Price, sofa.Quanity, sofa.Name);

                    totalPrice += sofa.Price;

                    Console.WriteLine("Total price is: {0}", totalPrice);
                }

                for (int i = 0; i < amountChair; i++)
                {
                    chair.SellOneProduct();

                    Console.WriteLine("{0}'s price is {1} and {2} {3}'s are left", chair.Name, chair.Price, chair.Quanity, chair.Name);

                    totalPrice += chair.Price;

                    Console.WriteLine("Total price is: {0}", totalPrice);
                }

                for (int i = 0; i < amountTable; i++)
                {
                    table.SellOneProduct();

                    Console.WriteLine("{0}'s price is {1} and {2} {3}'s are left", table.Name, table.Price, table.Quanity, table.Name);

                    totalPrice += table.Price;

                    Console.WriteLine("Total price is: {0}", totalPrice);
                }
            }

            Console.WriteLine("At the end, the total price is: {0}", totalPrice);

            Console.WriteLine("Press any Key to Exit");
            Console.ReadKey();
        }