Ejemplo n.º 1
0
 public CarDetails(ECarType type, string brand, string color, string vin, string plate)
 {
     this.CarBrand     = brand;
     this.CarType      = type;
     this.Color        = color;
     this.VIN          = vin;
     this.LicensePlate = plate;
     CarFaultsManager  = new CarFaultsManager();
 }
Ejemplo n.º 2
0
        public ICar Enhance(Car car, ECarType type)
        {
            CarDecorator decorator = null;

            switch (type)
            {
            case ECarType.Basic: { decorator = new BasicCarDecorator(car, car.Id); } break;

            case ECarType.Family: { decorator = new FamilyCarDecorator(car, car.Id); } break;

            case ECarType.Luxury: { decorator = new LuxuryCarDecorator(car, car.Id); } break;
            }

            decorator.Assemble();

            return(car);
        }
Ejemplo n.º 3
0
        public int OrderCar(int price, string brand, string color, ECarType type)
        {
            Car car = null;

            if (type == ECarType.EAuto)
            {
                AutomobilFactory factory = new AutomobilFactory();
                car = factory.GetCar(price, brand, color);
            }
            else
            {
                TruckFactory factory = new TruckFactory();
                car = factory.GetCar(price, brand, color);
            }
            OrderedCars[car.ID] = car;
            return(car.ID);
        }
Ejemplo n.º 4
0
        public int OrderCar(string brand, string color, int price, ECarType type)
        {
            CarFactory carFactory;
            Car        car = null;

            switch (type)
            {
            case ECarType.EAuto:
                carFactory = new AutomobilFactory();
                car        = carFactory.GetCar(brand, color, price);
                orderedCars.Add(car.ID, car);
                break;

            case ECarType.ETruck:
                carFactory = new TruckFactory();
                car        = carFactory.GetCar(brand, color, price);
                orderedCars.Add(car.ID, car);
                break;
            }
            return(car.ID);
        }
Ejemplo n.º 5
0
        public int OrderCar(string brand, string color, int price, ECarType type)
        {
            AbstractCarFactory carFactory;
            Car car = null;

            switch (brand)
            {
            case "MercedesBenz":
                carFactory = new MercedesBenzCarFactory();
                if (type == ECarType.EAuto)
                {
                    car = carFactory.GetAutomobile(color, price);
                    orderedCars.Add(car.ID, car);
                }
                if (type == ECarType.ETruck)
                {
                    car = carFactory.GetTruck(color, price);
                    orderedCars.Add(car.ID, car);
                }
                break;

            case "Volvo":
                carFactory = new VolvoCarFactory();
                if (type == ECarType.EAuto)
                {
                    car = carFactory.GetAutomobile(color, price);
                    orderedCars.Add(car.ID, car);
                }
                if (type == ECarType.ETruck)
                {
                    car = carFactory.GetTruck(color, price);
                    orderedCars.Add(car.ID, car);
                }
                break;

            case "Volkswagen":
                carFactory = new VolkswagenCarFactory();
                if (type == ECarType.EAuto)
                {
                    car = carFactory.GetAutomobile(color, price);
                    orderedCars.Add(car.ID, car);
                }
                if (type == ECarType.ETruck)
                {
                    car = carFactory.GetTruck(color, price);
                    orderedCars.Add(car.ID, car);
                }
                break;

            case "Renault":
                carFactory = new RenaultCarFactory();
                if (type == ECarType.EAuto)
                {
                    car = carFactory.GetAutomobile(color, price);
                    orderedCars.Add(car.ID, car);
                }
                if (type == ECarType.ETruck)
                {
                    car = carFactory.GetTruck(color, price);
                    orderedCars.Add(car.ID, car);
                }
                break;
            }
            if (car == null)
            {
                return(0);
            }
            return(car.ID);
        }