private void ExtractSupplyInformation(string command) { string[] splitCommand = command.Split(' '); if (splitCommand[0] == "supply") { IItem createdItem = CreateSuppliedItem(splitCommand[1], splitCommand[3]); ShopEngine.supplies.Add(createdItem, int.Parse(splitCommand[2])); } else if (splitCommand[0] == "sell") { ISaleable newSale = SaleItem(splitCommand[1], splitCommand[2]); Sale.AddSale(newSale); } else if (splitCommand[0] == "rent") { IRentable newRent = RentItem(splitCommand[1], splitCommand[2], splitCommand[3]); Rent.AddRent(newRent); } else if (splitCommand[0] == "report") { if (splitCommand[1] == "rents") { var rents = Rent.Rents .Where(rent => rent.RentState == RentStatus.Overdue) .OrderBy(rent => rent.RentFine) .ThenBy(rent => rent.Item.Title); foreach (var report in rents) { Console.WriteLine(report); } } else if (splitCommand[1] == "sales") { string[] splitData = splitCommand[2].Split('-'); DateTime lastSaleDate = new DateTime(int.Parse(splitData[2]), int.Parse(splitData[1]), int.Parse(splitData[0])); decimal sum = Sale.Sales .Where(sale => sale.SaleDate >= lastSaleDate) .Sum(sale => sale.Item.Price); Console.WriteLine("{0:N2}", sum); } } }