Example #1
0
        private void AddVehicle()
        {
            string name;
            string maxSpeed;
            string startSpeed;
            string maxRange;
            string message = "";

            _view.GetData(out name, out startSpeed, out maxSpeed, out maxRange);
            if (_verificatinService.VerificationDataForMuscleVehicle(name, maxSpeed, startSpeed, maxRange, ref message))
            {
                MuscleVehicle motorVehicle = _creator.Creator(name, Double.Parse(startSpeed), Double.Parse(maxSpeed), Double.Parse(maxRange));
                Vehicle       vehicle      = motorVehicle;
                if (!_transportService.AddVehicle(vehicle, ref message))
                {
                    _view.ShowMessage(message);
                }
                else
                {
                    _view.Close();
                }
            }
            else
            {
                _view.ShowMessage(message);
            }
        }
Example #2
0
        private void AddVehicle()
        {
            string name;
            string index;
            string maxSpeed;
            string startSpeed;
            string tankCapacity;
            string fuelConsumption;
            string message = "";

            _view.GetData(out name, out index, out maxSpeed, out startSpeed, out tankCapacity, out fuelConsumption);

            if (_verificatinService.VerificationDataForMotorVehicle(name, maxSpeed, startSpeed, tankCapacity, fuelConsumption, ref message))
            {
                Fuel fuel = null;
                if (Int32.Parse(index) >= 0)
                {
                    fuel = _fuelService.GetFuelFromList(Int32.Parse(index));
                    MotorVehicle motorVehicle = _creator.Creator(name, fuel, Double.Parse(maxSpeed), Double.Parse(startSpeed), Double.Parse(tankCapacity), Double.Parse(fuelConsumption));
                    Vehicle      vehicle      = motorVehicle;
                    if (!_transportService.AddVehicle(vehicle, ref message))
                    {
                        _view.ShowMessage(message);
                    }
                    else
                    {
                        _view.Close();
                    }
                }
                else
                {
                    _view.ShowMessage("Добавте топливо!");
                }
            }
            else
            {
                _view.ShowMessage(message);
            }
        }