Ejemplo n.º 1
0
        private void ExecuteRentCommand(IItem item, DateTime rentDate, DateTime deadline)
        {
            if (this.supplies[item] == 0)
            {
                throw new InsufficientSuppliesException("There are not enough supplies to sell this item.");
            }

            RentManager.AddRent(item, rentDate, deadline);
            this.supplies[item]--;
        }
Ejemplo n.º 2
0
        private void ExecuteReportCommand(string[] commandArgs)
        {
            var reportType = commandArgs[0];

            switch (reportType)
            {
            case "sales":
                var startDate   = ToDateTime(commandArgs[1]);
                var salesIncome = SaleManager.ReportSalesIncome(startDate);

                Console.WriteLine($"{salesIncome:F2}");
                break;

            case "rents":
                var overdueRents = RentManager.ReportOverdueRents();

                Console.WriteLine(string.Join(Environment.NewLine, overdueRents));
                break;

            default:
                throw new ArgumentException("Invalid report type.");
            }
        }