public string InsertMotorbike(Motorbike motorbike, int sector, int placeNumber, DateTime startTime) { return this.InsertVehicle(motorbike, sector, placeNumber, startTime); }
public string InsertMotorbike(Motorbike motorbike, int sector, int place, DateTime time) { if (sector > this.layout.Sectors) { return string.Format("There is no sector {0} in the park", sector); } if (place > this.layout.PlacesPerSector) { return string.Format("There is no place {0} in sector {1}", place, sector); } if (this.data.VehiclesBySectorAndPlace.ContainsKey(string.Format("({0},{1})", sector, place))) { return string.Format("The place ({0},{1}) is occupied", sector, place); } if (this.data.VehiclesByLicensePlate.ContainsKey(motorbike.LicensePlate)) { return string.Format("There is already a vehicle with license plate {0} in the park", motorbike.LicensePlate); } this.data.SectorAndPlaceByVehicle[motorbike] = string.Format("({0},{1})", sector, place); this.data.VehiclesBySectorAndPlace[string.Format("({0},{1})", sector, place)] = motorbike; this.data.VehiclesByLicensePlate[motorbike.LicensePlate] = motorbike; this.data.TimesByVehicles[motorbike] = time; this.data.VehiclesByOwner[motorbike.Owner].Add(motorbike); //TODO: should be -- this.data.PlacesTakenInSectors[sector - 1]++; return string.Format("{0} parked successfully at place ({1},{2})", motorbike.GetType().Name, sector, place); }
public string InsertMotorbike(Motorbike motorbike, int sector, int placeNumber, DateTime startTime) { return(this.InsertVehicle(motorbike, sector, placeNumber, startTime)); }