Beispiel #1
0
        private string CreateVehicleDetails(string i_PlateNumber)
        {
            if (r_VehiclesStorage.ContainsKey(i_PlateNumber) == true)
            {
                GarageVehicleInfo currentVehicleInfo = r_VehiclesStorage[i_PlateNumber];
                Vehicle           currentvehicle     = currentVehicleInfo.Vehicle;

                string Details = string.Format(
                    @"
Owner Name is: {0}
OWner phone number is: {1}
Vehicle status is: {2}
{3}",
                    currentVehicleInfo.OwnerName,
                    currentVehicleInfo.PhoneNumber,
                    currentVehicleInfo.Status,
                    currentvehicle.CreateDetails());

                return(Details);
            }
            else
            {
                throw new ArgumentException("Vehicle does not exist in the garage!");
            }
        }
Beispiel #2
0
        public void InsertVehicle(string i_OwnerName, string i_OwnerPhone, eVehicleType i_VehicleType, string i_plateNumber)
        {
            bool isExist = false;

            foreach (string key in r_VehiclesStorage.Keys)
            {
                if (key == i_plateNumber)
                {
                    r_VehiclesStorage[key].Status = eVehicleStatus.InProgress;
                    throw new ArgumentException("Vehicle already in the garage! Changing vehicle status to 'In-Progress'");
                }
            }

            if (isExist == false)
            {
                Vehicle           i_NewVehicle   = VehicleCreator.CreateNewVehicle(i_VehicleType, i_plateNumber);
                GarageVehicleInfo NewVehicleData = new GarageVehicleInfo(i_OwnerName, i_OwnerPhone, i_NewVehicle);
                r_VehiclesStorage.Add(i_plateNumber, NewVehicleData);
            }
        }