public bool RemoveCustomer(int customerID) { if (customerID < 1) { return(false); } return(CustomersPermanent.Remove(FindCustomer(customerID)));//mag dit?? }
public bool AddCustomer(Customer customer) { if (customer == null) { throw new ArgumentNullException("customer"); } if (FindCustomer(customer.ID) == null) { if (customer.TemporaryCustomer) { CustomersPermanent.Add(customer); } else { CustomersTemporary.Add(customer); } return(true); } return(false); }
public string ToString(TYPE t) { string AcquiredInfo = "Nothing Found"; string objects = "No objects found"; int index = 0; switch (t) { case TYPE.Customer: index = CustomersPermanent.Count() + CustomersPermanent.Count(); if (index > 0) { objects = ""; foreach (Customer c in CustomersPermanent) { objects += CustomersPermanent.IndexOf(c).ToString() + ") " + c.ToString() + "\n"; } foreach (Customer c in CustomersTemporary) { objects += (CustomersPermanent.Count() + CustomersTemporary.IndexOf(c)).ToString() + ") " + c.ToString() + "\n"; } } else { objects = "No customers found"; } AcquiredInfo = "Customers<" + index + ">: \n" + objects; break; case TYPE.ParkingSpot: index = ParkingSpots.Count(); if (index > 0) { objects = ""; foreach (ParkingSpot p in ParkingSpots) { objects += ParkingSpots.IndexOf(p).ToString() + ") " + p.ToString() + "\n"; } } else { objects = "No parkingSpots found"; } AcquiredInfo = "ParkingSpots<" + index + ">: \n" + objects; break; case TYPE.Reservation: index = Reservations.Count(); if (index > 0) { objects = ""; foreach (Reservation r in Reservations) { objects += Reservations.IndexOf(r).ToString() + ") " + r.ToString() + "\n"; } } else { objects = "No Reservations found"; } AcquiredInfo = "Reservations<" + index + ">: \n" + objects; break; } return(AcquiredInfo); }