Exemplo n.º 1
0
        private Rankings[] changeInRegularSeason(Rankings teamsStrength)
        {
            Rankings[]           points  = new Rankings[6];
            List <List <Match> > matches = getMatchesFromFile(_currentSeason.ToString());

            matches.RemoveAt(6); //remove PlayOffs
            Rankings pointsInMonth;
            int      i = 0;

            foreach (List <Match> month in matches)
            {
                pointsInMonth = MonthCalculations.changeInMonth(month, allTeams, teamsStrength);
                points[i]     = pointsInMonth;
                i++;
            }
            return(points);
        }
Exemplo n.º 2
0
        private Rankings changeInPlayoffs(Rankings[] pointsRegularSeason)
        {
            //Calculate strength --start--
            Rankings teamStrength = new Rankings();

            foreach (Rankings item in pointsRegularSeason)
            {
                foreach (Teams team in allTeams)
                {
                    PropertyInfo propInfo = teamStrength.GetType().GetProperty(team.Name.Replace(' ', '_').Replace('.', '_'));
                    propInfo.SetValue(teamStrength, Convert.ToInt32(propInfo.GetValue(teamStrength)) + Convert.ToInt32(propInfo.GetValue(item)));
                }
            }
            foreach (Teams team in allTeams)
            {
                PropertyInfo propInfo = teamStrength.GetType().GetProperty(team.Name.Replace(' ', '_').Replace('.', '_'));
                propInfo.SetValue(teamStrength, (Convert.ToInt32(propInfo.GetValue(teamStrength)) / 5));
            }
            //--end--
            List <Match> matches = getMatchesFromFile(_currentSeason.ToString()).ElementAt(6);
            Rankings     points  = MonthCalculations.changeInMonth(matches, allTeams, teamStrength);

            return(points);
        }