Ejemplo n.º 1
0
        private void UpdateRating(string teamCode, NibbleTeamRating rating)
        {
            if (RatingsHt == null)
            {
                RatingsHt = new Hashtable();
            }

            if (!RatingsHt.ContainsKey(teamCode))
            {
                RatingsHt.Add(teamCode, new NibbleTeamRating(0, 0));
            }

            var ratings = (NibbleTeamRating)RatingsHt[teamCode];

            ratings.Offence    += rating.Offence;
            ratings.Defence    += rating.Defence;
            RatingsHt[teamCode] = ratings;
        }
Ejemplo n.º 2
0
        private void UpdateRating(string teamCode, UnitRatings.UnitRating unitRating, string rating)
        {
            var ur = new UnitRatings();

            if (RatingsHt.ContainsKey(teamCode))
            {
                ur = ( UnitRatings )RatingsHt[teamCode];
            }
            else
            {
                RatingsHt.Add(teamCode, ur);
            }

            switch (unitRating)
            {
            case UnitRatings.UnitRating.Po:
                ur.PassOffence = rating;
                break;

            case UnitRatings.UnitRating.Ro:
                ur.RushOffence = rating;
                break;

            case UnitRatings.UnitRating.Pp:
                ur.PassProtection = rating;
                break;

            case UnitRatings.UnitRating.Pr:
                ur.PassRush = rating;
                break;

            case UnitRatings.UnitRating.Rd:
                ur.RunDefence = rating;
                break;

            case UnitRatings.UnitRating.Pd:
                ur.PassDefence = rating;
                break;
            }
            RatingsHt[teamCode] = ur;
        }
Ejemplo n.º 3
0
        private void LoadRatings(DateTime when)
        {
            // load the ratings into RatingsHt for a particular date
            var ds = Utility.TflWs.GetUnitRatings(when);
            var dt = ds.Tables["uratings"];

            foreach (DataRow dr in dt.Rows)
            {
                var teamCode = dr["TEAMCODE"].ToString();
                var ratings  = new UnitRatings(dr["RATINGS"].ToString());
                if (RatingsHt.ContainsKey(teamCode))
                {
                    RatingsHt[teamCode] = ratings;
                }
                else
                {
                    RatingsHt.Add(teamCode, ratings);
                }
            }
            LastDateRanked = when;
        }