Exemple #1
0
    public void Open(List <string> line)
    {
        var race = raceFactory.CreateRace(line.Skip(1).ToList());

        if (race != null)
        {
            int id = int.Parse(line[0]);
            races.Add(id, race);
        }
    }
Exemple #2
0
    public void Open(int id, string type, int length, string route, int prizePool, int goldTime)
    {
        var raceFactory  = new RaceFactory();
        var producedRace = raceFactory.CreateRace(type, length, route, prizePool, goldTime);

        if (producedRace != null)
        {
            this.Races.Add(id, producedRace);
        }
    }
Exemple #3
0
    public void Open(int id, string type, int length, string route, int prizePool, int bonus)
    {
        if (!this.Races.ContainsKey(id))
        {
            Race newRace;

            newRace = RaceFactory.CreateRace(type, length, route, prizePool, bonus);

            this.Races.Add(id, newRace);
        }
    }
        public string OpenRace(int distance, int windSpeed, int oceanCurrentSpeed, bool allowsMotorboats)
        {
            IRace race = RaceFactory.CreateRace(distance, windSpeed, oceanCurrentSpeed, allowsMotorboats);

            this.ValidateRaceIsEmpty();
            this.CurrentRace = race;
            return
                (string.Format(
                     "A new race with distance {0} meters, wind speed {1} m/s and ocean current speed {2} m/s has been set.",
                     distance,
                     windSpeed,
                     oceanCurrentSpeed));
        }
        public void AddRace(IAddRaceView inForm)
        {
            RaceRepository  raceRepository  = RaceRepository.GetInstance();
            TrackRepository trackRepository = TrackRepository.GetInstance();

            if (inForm.ShowViewModal(trackRepository.GetAllActiveTracks()) == true)
            {
                try
                {
                    string Name = inForm.RaceName;
                    if (string.IsNullOrEmpty(Name))
                    {
                        throw new ArgumentException("Race name is not selected!");
                    }

                    DateTime Date = inForm.RaceDate;
                    if (Date < DateTime.Today)
                    {
                        throw new ArgumentException("Selected date is in the past!");
                    }

                    string RaceTrackName = inForm.RaceTrackName;
                    if (string.IsNullOrEmpty(RaceTrackName))
                    {
                        throw new ArgumentException("Track name is not properly selected!");
                    }

                    Track RaceTrack = trackRepository.GetTrackByName(RaceTrackName);

                    int ID = raceRepository.GetNewID();

                    Race newRace = RaceFactory.CreateRace(ID, Name, Date, RaceTrack);

                    raceRepository.AddRace(newRace);
                }
                catch (TrackNotFoundException)
                {
                    MessageBox.Show("Selected track not found! Try again.");
                }
                catch (RaceAlreadyExistsException)
                {
                    MessageBox.Show("Race already exists! Try again.");
                }
                catch (ArgumentException ex)
                {
                    MessageBox.Show(ex.Message + " Try again.");
                }
            }
        }
 public void Open(int id, string type, int length, string route, int prizePool, int specialParam)
 {
     this.races.Add(id, RaceFactory.CreateRace(type, length, route, prizePool, specialParam));
 }
    public void Open(int id, string type, int length, string route, int prizePool)
    {
        var race = RaceFactory.CreateRace(type, length, route, prizePool);

        races[id] = race;
    }
Exemple #8
0
 public void Open(int id, string type, int length, string route, int prize, int param)
 {
     openRaces.Add(id, RaceFactory.CreateRace(type, length, route, prize, param));
 }
    public void Open(int id, string type, int length, string route, int prizePool, int lastParameter)
    {
        Race race = RaceFactory.CreateRace(type, length, route, prizePool, lastParameter);

        this.Races[id] = race;
    }
    public void Open(int id, string type, int length, string route, int prizePool)
    {
        IRace race = RaceFactory.CreateRace(type, length, route, prizePool);

        this.raceById[id] = race;
    }
Exemple #11
0
    public void Open(int id, string type, int length, string route, int prizePool)
    {
        Race race = RaceFactory.CreateRace(id, type, length, route, prizePool);

        races.Add(id, race);
    }
    public void Open(int id, string type, int length, string route, int prizePool)
    {
        var race = raceFactory.CreateRace(type, length, route, prizePool);

        this.races.Add(id, race);
    }