public override void addPlayer(Player player)
        {
            if (player.getPosition() == Player.Positions.QB)
            {
                mQBList.Add(player);
            }
            else if (player.getPosition() == Player.Positions.RB)
            {
                mRBList.Add(player);
            }
            else if (player.getPosition() == Player.Positions.WR)
            {
                mWRList.Add(player);
            }
            else if (player.getPosition() == Player.Positions.TE)
            {
                mTEList.Add(player);
            }
            else if (player.getPosition() == Player.Positions.DST)
            {
                mDSTList.Add(player);
            }

            if (player.getPosition() == Player.Positions.WR || player.getPosition() == Player.Positions.TE || player.getPosition() == Player.Positions.RB)
            {
                mFlexList.Add(player);
            }

            if (player.getPosition() == Player.Positions.WR || player.getPosition() == Player.Positions.RB)
            {
                mCollegeFlex.Add(player);
            }
        }
        public override void addPlayer(Player player)
        {
            if (player.getPosition() == Player.Positions.F)
            {
                mForwardList.Add(player);
            }
            else if (player.getPosition() == Player.Positions.G)
            {
                mGuardList.Add(player);
            }

            if (player.getPosition() != Player.Positions.INVALID)
            {
                mUtilList.Add(player);
            }
        }
        private GenerateTeams parseFile(Sports league)
        {
            startTime();

            workingProgressLabel.Text = "Starting Calculations";
            GenerateTeams teamGenerator;
            int salaryCap = Convert.ToInt32(salaryCapTextBox.Text);
            int threshold = Convert.ToInt32(salaryThresholdTextBox.Text);

            if (league == Sports.Football)
            {
                teamGenerator = new FootballTeamGenerator(salaryCap, threshold);
            }
            else if (league == Sports.Hockey) {
                teamGenerator = new NHLTeamGenerator(salaryCap, threshold);
            }
            else if (league == Sports.Basketball)
            {
                teamGenerator = new BasketballTeamGenerator(salaryCap, threshold);
            }
            else if (league == Sports.Golf)
            {
                teamGenerator = new GolfTeamGenerator(salaryCap, threshold);
            }
            else
            {
                throw new NotImplementedException();
            }

            OpenFileDialog file = new OpenFileDialog();
            file.Multiselect = false;

            if (file.ShowDialog() == DialogResult.OK)
            {
                Console.WriteLine(file.FileName);
                var reader = new StreamReader(File.OpenRead(file.FileName));

                while (!reader.EndOfStream)
                {
                    var line = reader.ReadLine();
                    String[] values = line.Split(',');
                    for (int i = 0; i < values.Length; i++)
                    {
                        values[i] = values[i].Replace("\"", String.Empty);
                    }

                    Player.Positions pos = Player.convertToEnum(values[0]);
                    if (pos == Player.Positions.INVALID)
                    {
                        continue;
                    }

                    int salary;
                    Int32.TryParse(values[2], out salary);
                    double points;
                    Double.TryParse(values[4], out points);

                    Player player = new Player(pos, values[1], uniqueID++, salary, points);
                    teamGenerator.addPlayer(player);
                }
                reader.Close();
                return teamGenerator;
            }

            return null;
        }
 public override void addPlayer(Player player)
 {
     mGolferList.Add(player);
 }
Exemple #5
0
 public void removePlayer(Player player)
 {
     mTeamRoster.Remove(player);
 }
Exemple #6
0
 public void addPlayer(Player player)
 {
     mTeamRoster.Add(player);
 }
 public abstract void addPlayer(Player player);