public double ParkingCost(string parkingSpace, string parkingLevel) { GeneralParking generalParking = new GeneralParking(); ValetParking valetParking = new ValetParking(); FrequentFlyerParking frequentFlyerParking = new FrequentFlyerParking(); var parkingDetails = ParkingSpots.Find(x => x.ParkingSpotNumber == parkingSpace && x.ParkingStructureLevel == parkingLevel); var minutesParked = (DateTime.Now - parkingDetails.StartTime).TotalMinutes; double totalCost = 0; switch (parkingDetails.GetParkingType) { case ParkingType.General: totalCost = (minutesParked / 60) * generalParking.ParkingPrice; break; case ParkingType.Valet: totalCost = (minutesParked / 60) * valetParking.ParkingPrice; break; case ParkingType.FrequentFlyer: totalCost = (minutesParked / 60) * frequentFlyerParking.ParkingPrice; break; default: throw new Exception("Time error"); } return(totalCost); }
public void AddCar(string newMake, string newModel, string newYear) { Car newCar = new Car(); newCar.NewCar(newMake, newModel, newYear); ParkingSpots.Add(newCar); }
public bool RemoveParkingSpot(ParkingSpot parkingSpot) { if (parkingSpot == null) { throw new ArgumentNullException("parkingspot"); } return(ParkingSpots.Remove(parkingSpot)); }
public void FreeSpots() { foreach (var parkingSpot in ParkingSpots) { parkingSpot.RemoveVehicle(); } ParkingSpots.Clear(); }
public bool RemoveParkingSpot(string spotname) { ParkingSpot parkingSpot = FindParkingSpot(spotname); if (spotname != "" && parkingSpot != null) { return(ParkingSpots.Remove(parkingSpot)); } return(false); }
public bool RemoveParkingSpot(int parkingSpotID) { ParkingSpot parkingSpot = FindParkingSpot(parkingSpotID); if (parkingSpotID > 0 && parkingSpot != null) { return(ParkingSpots.Remove(parkingSpot)); } return(false); }
public bool AddParkingSpot(ParkingSpot parkingSpot) { if (parkingSpot == null) { throw new ArgumentNullException("parkingSpot"); } if (FindParkingSpot(parkingSpot.ID) == null) { ParkingSpots.Add(parkingSpot); return(true); } return(false); }
public void RemoveCar(ParkingType parkingType, Driver parking, ParkingSpot parkingSpot) { switch (parkingType) { case ParkingType.General: GeneralParkingSpotOwners.Remove(parking); break; case ParkingType.Valet: ValetParkingSpotOwners.Remove(parking); break; case ParkingType.FrequentFlyer: FrequentFlyerParkingSpotOwners.Remove(parking); break; default: throw new Exception("Car not found"); } ParkingSpots.Remove(parkingSpot); }
public void RemoveCar(int whichCar) { ParkingSpots.Remove(ParkingSpots[whichCar]); }
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); }
public static ParkingSpots AssignRandomParkingSpot(this ObservableCollection <ParkingSpots> filteredAvailableParkingSpots, ref ParkingSpots selectedParkingSpot) { //Skriva om den till en generic??? //Blir null varje gång if (selectedParkingSpot == null) { int randomNumber = Randomizer.GetRandomNumber(filteredAvailableParkingSpots); selectedParkingSpot = filteredAvailableParkingSpots[randomNumber]; return(selectedParkingSpot); } return(selectedParkingSpot); }
public void ParkInSpot(ParkingSpot parkingSpot) => ParkingSpots.Add(parkingSpot);