Example #1
0
        public void InsertInfo(Dictionary <eQuestions, object> i_FilledDictionary, string io_LicenseNumber)
        {
            //// For UI - gets FILLED dictionary that was given to UI by Garage::GetExtraInfo
            //// and license number of car needed for extra information.
            //// If value is invalid - an exception will be thrown.

            SupportedVehicles.FillVehicleInfo(r_Vehicles[io_LicenseNumber].Vehicle, i_FilledDictionary);
        }
Example #2
0
        public Dictionary <eQuestions, object> GetExtraInfo(int io_VehicleChoice)
        {
            //// For UI - gets vehicle choice out of supported vehicles.
            //// Return a dictionary where key is Enum of eQusetion and data is object for the UI to insert.
            //// eQusetion helps UI to know what information is needed from user.
            //// Enum of eQusetion can be found in SupportedVehicles Class.

            SupportedVehicles.GetInfo(out Dictionary <eQuestions, object> DicToFill, io_VehicleChoice);
            return(DicToFill);
        }
Example #3
0
        public static Vehicle CreatingNewVehicleToGarage(string i_LicennseNumber, SupportedVehicles.eSupportedVehicles i_VehicleType)
        {
            Vehicle newVehicle = null;

            switch (i_VehicleType)
            {
            case SupportedVehicles.eSupportedVehicles.FuelMotorcycle:
            {
                FuelTank FuelTank = new FuelTank();
                newVehicle = new Motorcycle(i_LicennseNumber, FuelTank);
                break;
            }

            case SupportedVehicles.eSupportedVehicles.ElectricMotorcycle:
            {
                Battery battery = new Battery();
                newVehicle = new Motorcycle(i_LicennseNumber, battery);
                break;
            }

            case SupportedVehicles.eSupportedVehicles.FuelCar:
            {
                FuelTank fuelTank = new FuelTank();
                newVehicle = new Car(i_LicennseNumber, fuelTank);
                break;
            }

            case SupportedVehicles.eSupportedVehicles.ElectricCar:
            {
                Battery battery = new Battery();
                newVehicle = new Car(i_LicennseNumber, battery);
                break;
            }

            case SupportedVehicles.eSupportedVehicles.FuelTruck:
            {
                FuelTank fuelTank = new FuelTank();
                newVehicle = new Truck(i_LicennseNumber, fuelTank);
                break;
            }
            }

            SupportedVehicles.UpdateSupportedValues(newVehicle);

            return(newVehicle);
        }
Example #4
0
        public bool AddNewVehicle(string io_CustomerName, string io_CustomerPhoneNumber, int io_Choice, string io_LicenseNumber)
        {
            //// Gets new customer (name, phone number and license plate number) and choice out of
            //// the garage supported vehicles.
            //// Two possible cases:
            //// 1. New license plate number - add it to the garage.
            //// 2. Existing license plate number - change state of car to - "In-Repair"
            //// Return T/F if insertion succeeded.

            bool isAdded = false;

            if (isExist(io_LicenseNumber))
            {
                try
                {
                    r_Vehicles[io_LicenseNumber].VehicleStatus = eServiceStatuses.InRepair;
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format("License number {0} is not the system.", io_LicenseNumber), ex);
                }
            }
            else
            {
                if (Enum.IsDefined(typeof(eSupportVehicles), io_Choice))
                {
                    Vehicle  newVehicle  = SupportedVehicles.CreateVehicle((eSupportVehicles)io_Choice, io_LicenseNumber);
                    Customer newCustomer = new Customer(io_CustomerName, io_CustomerPhoneNumber, eServiceStatuses.InRepair, newVehicle);
                    r_Vehicles.Add(io_LicenseNumber, newCustomer);
                    isAdded = true;
                }
                else
                {
                    Exception ex = new Exception("Choice of supported vehicle is invalid");
                    throw new ValueOutOfRangeException(ex, (float)NumOfSupportedVehicles(), 1f);
                }
            }

            return(isAdded);
        }
Example #5
0
 public string ShowSupportedVehicles()
 {
     return(SupportedVehicles.ShowSupportedVehiclesTypes());
 }
Example #6
0
        public static string GetVehicleTypeMessage()
        {
            return(string.Format(@"Please select one of the following vehicle types :
{0} ", SupportedVehicles.SupportedVehiclesToString()));
        }