Ejemplo n.º 1
0
        private static void ExecuteReportCommand(string[] commandData)
        {
            switch (commandData[1])
            {
            case "rents":
                var rentsToReport = RentManager.GetOverdueRents();
                foreach (var rent in rentsToReport)
                {
                    Console.WriteLine(rent);
                }

                break;

            case "sales":
                DateTime startDate = DateTime.ParseExact(
                    commandData[2],
                    DateFormat,
                    CultureInfo.InvariantCulture);
                decimal purchaseAmount = SaleManager.GetSaleAmountToDate(startDate);
                Console.WriteLine(purchaseAmount);
                break;

            default:
                throw new ArgumentException("Input was not recognized as valid command.", "command");
            }
        }
Ejemplo n.º 2
0
        private static void ExecuteRentCommand(string[] commandData)
        {
            IItem    itemToRent = GetItemById(commandData[1]);
            DateTime dateOfRent = DateTime.ParseExact(
                commandData[2],
                DateFormat,
                CultureInfo.InvariantCulture);
            DateTime returnDeadline = DateTime.ParseExact(
                commandData[3],
                DateFormat,
                CultureInfo.InvariantCulture);

            UpdateSupplies(itemToRent);
            RentManager.AddRent(itemToRent, dateOfRent, returnDeadline);
        }