示例#1
0
 public TruckInsertNewVehicleSubOperations(IGarageManager i_GarageManager)
     : base(i_GarageManager)
 {
     m_GarageManager = i_GarageManager;
     AddWheelsInstructions(Truck.k_NumberOfWheels, Truck.k_MaxAirPressureByManufacturer);
     addCarryingHazardousMaterialsInstruction();
 }
示例#2
0
 protected MotorcycleInsertNewVehicleSubOperations(IGarageManager i_GarageManager)
     : base(i_GarageManager)
 {
     m_GarageManager = i_GarageManager;
     addLicenseTypeInstruction();
     AddWheelsInstructions(Motorcycle.k_NumberOfWheels, Motorcycle.k_MaxAirPressureByManufacturer);
     addEngineVolumeIntruction();
 }
示例#3
0
 protected CarInsertNewVehicleSubOperations(IGarageManager i_GarageManager)
     : base(i_GarageManager)
 {
     m_GarageManager = i_GarageManager;
     addColorInstruction();
     AddWheelsInstructions(Car.k_NumberOfWheels, Car.k_MaxAirPressureByManufacturer);
     addDoorsNumberInstruction();
 }
示例#4
0
        public InflateWheelsAirOperation(IGarageManager i_GarageManager)
        {
            m_GarageManager = i_GarageManager;
            Index           = 4;
            Details         = "Inflate the air in the wheels of a vehicle to a maximum";

            Instructions = new Dictionary <string, Func <string, eOperationStatus> >
            {
                ["Please enter a vehicle license number"] = i_LicenseNumber => insertLicenseNumber(i_LicenseNumber),
            };
        }
        public DisplayVehicleFullDataOperation(IGarageManager i_GarageManager)
        {
            m_GarageManager = i_GarageManager;
            Index           = 7;
            Details         = "View full vehicle data";

            Instructions = new Dictionary <string, Func <string, eOperationStatus> >
            {
                ["Please enter a vehicle license number"] = i_LicenseNumber => insertLicenseNumber(i_LicenseNumber),
            };
        }
示例#6
0
 protected BaseInsertNewVehicleSubOperations(IGarageManager i_GarageManager)
 {
     m_GarageManager     = i_GarageManager;
     SubMenuInstructions = new Dictionary <string, Func <string, eOperationStatus> >
     {
         ["Please enter model name"]        = i_ModelName => insertModelName(i_ModelName),
         ["Please enter your name"]         = i_OwnerName => insertOwnerName(i_OwnerName),
         ["Please enter your phone number"] = i_OwnerPhone => insertOwnerPhone(i_OwnerPhone),
         ["Please enter a license number for the new vehicle"] = i_LicenseNumber => insertLicenseNumber(i_LicenseNumber),
     };
 }
        public ChargeElectricVehicleOperation(IGarageManager i_GarageManager)
        {
            m_GarageManager = i_GarageManager;
            Index           = 6;
            Details         = "Charge an electric vehicle";

            Instructions = new Dictionary <string, Func <string, eOperationStatus> >
            {
                ["Please enter a vehicle license number"] = i_LicenseNumber => insertLicenseNumber(i_LicenseNumber),
                ["Please enter how much battery time in hours you currently have"] = i_CurrentBatteryTimeLeftInHours => insertCurrentBatteryTimeLeftInHours(i_CurrentBatteryTimeLeftInHours),
                ["Please enter how much battery time to charge"] = i_BatteryTimeInHoursToCharge => insertBatteryTimeInHoursToCharge(i_BatteryTimeInHoursToCharge)
            };
        }
 public static VehicleManager Create(IGarageManager garageManager)
 {
     return(new VehicleManager(new Dictionary <Vehicle, ParkingPlaceOutput>
     {
         { new Car
           {
               Manufacturer = "VW",
               Model = "Käfer",
               LicensePlate = "K-GS-01",
               Year = 1965,
               NewPrice = 9999m,
               Capacity = 1000,
               Power = 30,
               PollutantClass = PollutantClasses.Normal
           },
           garageManager?.GetParkingPlace(100) },
         { new Car
           {
               Manufacturer = "Opel",
               Model = "Kadett",
               LicensePlate = "K-GS-02",
               Year = 1964,
               NewPrice = 12000m,
               Capacity = 1600,
               Power = 60,
               PollutantClass = PollutantClasses.Diesel
           },
           garageManager?.GetParkingPlace(101) },
         { new Motorcycle
           {
               Manufacturer = "BMW",
               Model = "R1200r",
               LicensePlate = "K-GS-03",
               Year = 1999,
               NewPrice = 6000m,
               Capacity = 1170
           },
           garageManager?.GetParkingPlace(200) },
         { new Truck
           {
               Manufacturer = "Mercedes",
               Model = "LG 315",
               LicensePlate = "K-GS-04",
               Year = 1960,
               NewPrice = 23000m,
               Axis = 2,
               Payload = 5.5
           },
           garageManager?.GetParkingPlace(300) }
     }));
 }
示例#9
0
        public DisplayVehiclesLicenseNumberOperation(IGarageManager i_GarageManager)
        {
            m_GarageManager = i_GarageManager;
            Index           = 2;
            Details         = "Display the list of vehicle license numbers in the garage";

            Instructions = new Dictionary <string, Func <string, eOperationStatus> >
            {
                ["Please enter 1 to get all vehicles during fix\n" +
                 "Please enter 2 to get all fixed vehicles\n" +
                 "Please enter 3 to get all paid vehicles\n" +
                 "Please enter * to get all vehicles\n"] = i_VehiclesFilter => getVehicles(i_VehiclesFilter)
            };
        }
示例#10
0
        /// <summary>
        /// Skapar eller läser in ett garage från disk.
        /// </summary>
        /// <returns>Returnerar false om användaren väljer att avsluta.</returns>
        public bool Create()
        {
            bool inputOk = false;

            while (!inputOk)
            {
                Console.Clear();
                Console.Write(
                    "{0}Hantera garage{0}{0}" +
                    " 0) Avsluta{0}" +
                    " 1) Skapa ett nytt garage{0}" +
                    " 2) Läs in ett sparat garage{0}{0}" +
                    "> ",
                    Environment.NewLine
                    );

                switch (Console.ReadKey(true).KeyChar)
                {
                case '0':
                    Console.Clear();
                    return(false);

                case '1':
                    Console.Clear();
                    int size = promptForNumberInput("Ange hur många platser garaget skall ha: ");
                    if (size > 0)
                    {
                        _garageManager = ManagerFactory.Create(size);
                        inputOk        = true;
                    }

                    Console.WriteLine("Antalet platser måste vara ett heltal större än 0.");
                    break;

                case '2':
                    _garageManager = new GarageManager(1);
                    if (LoadGarage())
                    {
                        inputOk = true;
                    }
                    promptForAnyKey();
                    break;

                default:
                    ShowInvalidInput();
                    break;
                }
            }
            return(true);
        }
示例#11
0
        public ChangeVehicleConditionOperation(IGarageManager i_GarageManager)
        {
            m_GarageManager = i_GarageManager;
            Index           = 3;
            Details         = "Change the condition of a vehicle in the garage";

            Instructions = new Dictionary <string, Func <string, eOperationStatus> >
            {
                ["Please enter a vehicle license number"] = i_LicenseNumber => insertLicenseNumber(i_LicenseNumber),
                ["Please enter 1 to change state to - during fix\n" +
                 "Please enter 2 to change state to - fix\n" +
                 "Please enter 3 to change state to - paid\n"] = i_VehicleState => changeVehicleState(i_VehicleState),
            };
        }
        public InsertNewVehicleOperation(IGarageManager i_GarageManager)
        {
            m_GarageManager = i_GarageManager;
            Index           = 1;
            Details         = "Insert a new vehicle";

            Instructions = new Dictionary <string, Func <string, eOperationStatus> >
            {
                ["Please enter 1 for regular motorcycle\n" +
                 "Please enter 2 for electric motorcycle\n" +
                 "Please enter 3 for regular car\n" +
                 "Please enter 4 for electric car\n" +
                 "Please enter 5 for truck"] = i_VehicleType => insertNewVehicle(i_VehicleType)
            };
        }
示例#13
0
        internal static IGarageManager Create(int size)
        {
            var            value   = ConfigurationManager.AppSettings["Manager"];
            IGarageManager manager = null;

            switch (value)
            {
            case "MyGarage.GarageManager":

                var type = Assembly.GetExecutingAssembly().GetType(value);
                manager = (GarageManager)Activator.CreateInstance(type, size);
                break;
            }

            return(manager ?? null);
        }
示例#14
0
        public FuelVehicleOperation(IGarageManager i_GarageManager)
        {
            m_GarageManager = i_GarageManager;
            Index           = 5;
            Details         = "Fuel a vehicle driven by fuel";

            Instructions = new Dictionary <string, Func <string, eOperationStatus> >
            {
                ["Please enter a vehicle license number"] = i_LicenseNumber => insertLicenseNumber(i_LicenseNumber),
                ["Please enter 1 for " + eFuelType.Octan95 + " fuel\n" +
                 "Please enter 2 for " + eFuelType.Octan96 + " fuel\n" +
                 "Please enter 3 for " + eFuelType.Octan98 + " fuel\n" +
                 "Please enter 4 for " + eFuelType.Soler + " fuel"] = i_FuelType => insertFuelType(i_FuelType),
                ["Please enter how much fuel you currently have"]   = i_FuelQuantity => insertCurrentFuelQuantity(i_FuelQuantity),
                ["Please enter how much fuel to fill"] = i_FuelQuantity => insertFuelQuantity(i_FuelQuantity)
            };
        }
 public CommandExecuterFactory(
     IVehicleManager vehilceManager,
     IConsoleInputOutput console,
     IVehicleParser vehicleParser,
     IGarageManager garageManager,
     IGarageParser garageParser,
     ICsvImporter csvImporter,
     IFileInputOutput file)
 {
     this.vehicleParser  = vehicleParser;
     this.vehilceManager = vehilceManager;
     this.console        = console;
     this.garageManager  = garageManager;
     this.garageParser   = garageParser;
     this.csvImporter    = csvImporter;
     this.file           = file;
 }
示例#16
0
 public CommandExecuter(IVehicleManager vehicleManager,
                        IConsoleInputOutput consoleInputOutput,
                        IVehicleParser vehicleParser,
                        IGarageManager garageManager,
                        IGarageParser garageParser,
                        ICsvImporter csvImporter,
                        IFileInputOutput file
                        )
 {
     this.selectedVehicles = new Dictionary <Vehicle, ParkingPlaceOutput>();
     this.vehicleManager   = vehicleManager;
     this.console          = consoleInputOutput;
     this.vehicleParser    = vehicleParser;
     this.garageManager    = garageManager;
     this.garageParser     = garageParser;
     this.csvImporter      = csvImporter;
     this.file             = file;
 }
示例#17
0
 public MotorcycleRegularleInsertNewVehicleSubOperations(IGarageManager i_GarageManager)
     : base(i_GarageManager)
 {
 }
 public CarElectricInsertNewVehicleSubOperations(IGarageManager i_GarageManager)
     : base(i_GarageManager)
 {
 }
示例#19
0
 //Används ej?
 public UserInterface(GarageManager gm)
 {
     _garageManager = gm;
 }
示例#20
0
 /// <summary>
 /// initialize method
 /// </summary>
 private void Init()
 {
     garage = GarageManager.Instance;
 }
示例#21
0
 public CarRegularInsertNewVehicleSubOperations(IGarageManager i_GarageManager)
     : base(i_GarageManager)
 {
 }