Beispiel #1
0
    private static void PerformSellStock(Stock stock)
    {
        int     quantity;
        decimal price;

        Console.WriteLine($"Quantity of {stock.Name} sold: ");
        quantity = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine($"Sale price per item sold: ");
        price = Convert.ToDecimal(Console.ReadLine());

        // Creating sale transaction:
        StockSaleTransaction sale = new StockSaleTransaction(stock, price, quantity);

        sale.Execute();
        sale.PrintSummary();
    }
Beispiel #2
0
    private static void PerformSellStock(Warehouse toWarehouse)
    {
        int     quantity;
        decimal price;

        Console.WriteLine("---- SELL STOCK ----");

        Stock stock = FindStockItem(toWarehouse);

        if (stock == null)
        {
            return;
        }

        quantity = ReadInteger($"Quantity of {stock.Name} sold: ");
        price    = ReadDecimal("Price: ");

        StockSaleTransaction sale = new StockSaleTransaction(stock, quantity, price);

        toWarehouse.ExecuteTransaction(sale);
        sale.PrintSummary();
    }