public override string ToString() { parking.ActualiseParking(); return("Hi administrator, yesterday receipts of the parking were : $" + Tarification.calculateYesterdayReceipts(parking.ArchiveCustomers).ToString()); }
public void ActualiseParking() { foreach (var customer in Customers) { if (Tarification.GetHours(customer.ArrivalTime) > 24) { Remove(customer); } } (Customers, ArchiveCustomers) = Tarification.calculateAllCharges(Customers, ArchiveCustomers); }
static void Main(string[] args) { Parking parking = new Parking(); parking.Add(new Customer("00-M0-7630", parking.AddID)); parking.Add(new Customer("01-M1-7631", parking.AddID)); parking.Add(new Customer("02-M2-7632", parking.AddID)); parking.Add(new Customer("03-M3-7633", parking.AddID)); (parking.Customers, parking.ArchiveCustomers) = Tarification.calculateAllCharges(parking.Customers, parking.ArchiveCustomers); Console.WriteLine(new InterfaceAdminstrator(parking)); Console.WriteLine(new InterfaceUser(parking, "00-M0-7630")); //test 5 hours old customer parking.Customers[1].ArrivalTime = DateTime.Now.AddHours(-5); (parking.Customers, parking.ArchiveCustomers) = Tarification.calculateAllCharges(parking.Customers, parking.ArchiveCustomers); Console.WriteLine(new InterfaceUser(parking, "01-M1-7631")); //test 22 hours old customer parking.Customers[2].ArrivalTime = DateTime.Now.AddHours(-22); (parking.Customers, parking.ArchiveCustomers) = Tarification.calculateAllCharges(parking.Customers, parking.ArchiveCustomers); Console.WriteLine(new InterfaceUser(parking, "02-M2-7632")); }