public string InsertCar(VehiclePark3.Carro carro, int s, int p, DateTime t) { if (s > park.sectors) return string.Format("There is no sector {0} in the park", s); if (p > park.places_sec) return string.Format("There is no place {0} in sector {1}", p, s); if (DATA.Park.ContainsKey(string.Format("({0},{1})", s, p))) return string.Format("The place ({0},{1}) is occupied", s, p); if (DATA.números.ContainsKey(carro.LicensePlate)) return string.Format("There is already a vehicle with license plate {0} in the park", carro.LicensePlate); DATA. VehicleInPark[carro] = string.Format("({0},{1})", s, p); ; DATA. Park[string.Format("({0},{1})", s, p)] = carro; DATA. números[carro.LicensePlate] = carro; DATA. d[carro] = t; DATA. ow[carro.Owner].Add(carro); DATA. count[s - 1]--; return string.Format("{0} parked successfully at place ({1},{2})", carro.GetType().Name, s, p); }
public string InsertMotorbike(VehiclePark3.Moto moto, int s, int p, DateTime t) { if (s > layout.sectors) return string.Format("There is no sector {0} in the park", s); if (p > layout.places_sec) return string.Format("There is no place {0} in sector {1}", p, s); if (DATA.park.ContainsKey(string.Format("({0},{1})", s, p))) return string.Format("The place ({0},{1}) is occupied", s, p); if (DATA.números.ContainsKey(moto.LicensePlate)) return string.Format("There is already a vehicle with license plate {0} in the park", moto.LicensePlate); DATA. carros_inpark[moto] = string.Format("({0},{1})", s, p); DATA. park[string.Format("({0},{1})", s, p)] = moto; DATA. números[moto.LicensePlate] = moto; DATA. d[moto] = t; DATA. ow[moto.Owner].Add(moto); DATA. count[s - 1]++; return string.Format("{0} parked successfully at place ({1},{2})", moto.GetType().Name, s, p); }