Example #1
0
 private static void WriteStatNode(XmlWriter writer, YahooOutput stat)
 {
     writer.WriteStartElement("stat");
     writer.WriteAttributeString("season", stat.Season);
     writer.WriteAttributeString("week", stat.Week);
     writer.WriteAttributeString("id", stat.PlayerId);
     writer.WriteAttributeString("qty", stat.Quantity.ToString());
     writer.WriteAttributeString("opp", stat.Opponent);
     writer.WriteEndElement();
 }
Example #2
0
        public void PutStat(YahooOutput stat)
        {
            if (stat.Quantity == 0.0M)
            {
                return;
            }

            IsDirty = true;
            if (TheHt.ContainsKey(stat.FormatKey()))
            {
                TheHt[stat.FormatKey()] = stat;
                return;
            }
            TheHt.Add(stat.FormatKey(), stat);
        }
Example #3
0
        public override decimal GetStat(string theKey)
        {
            var season   = theKey.Substring(0, 4);
            var week     = theKey.Substring(5, 2);
            var playerId = theKey.Substring(8, 8);

            var stat = new YahooOutput
            {
                Season   = season,
                Week     = week,
                PlayerId = playerId,
                Quantity = 0.0M
            };

            Announce($"StatMaster:Getting Stat {stat.FormatKey()}");
            var testStat = "2017:05:WATSDE02";

            if (testStat == stat.FormatKey())
            {
                Announce($"StatMaster:Test Stat {stat.FormatKey()}");
            }

            var key = stat.FormatKey();

            if (TheHt.ContainsKey(key))
            {
                stat = ( YahooOutput )TheHt[key];
                CacheHits++;
            }
            else
            {
                //  new it up
                Announce($"StatMaster:Instantiating Stat {stat.FormatKey()}");
                PutStat(stat);
                IsDirty = true;
                CacheMisses++;
            }
            return(stat.Quantity);
        }
Example #4
0
        public override decimal GetStat(string theKey)
        {
            var season   = theKey.Substring(0, 4);
            var week     = theKey.Substring(5, 2);
            var playerId = theKey.Substring(8, 8);

            var stat = new YahooOutput
            {
                Season   = season,
                Week     = week,
                PlayerId = playerId,
                Quantity = 0.0M
            };

#if DEBUG
//			Utility.Announce( string.Format( "StatMaster:Getting Stat {0}", stat.FormatKey() ) );
#endif

            var key = stat.FormatKey();
            if (TheHt.ContainsKey(key))
            {
                stat = (YahooOutput)TheHt[key];
                CacheHits++;
            }
            else
            {
                //  new it up
#if DEBUG
//				Utility.Announce( string.Format( "StatMaster:Instantiating Stat {0}", stat.FormatKey() ) );
#endif
                PutStat(stat);
                IsDirty = true;
                CacheMisses++;
            }
            return(stat.Quantity);
        }
Example #5
0
        public void TallyYahooFor(NflTeam nflTeam, bool announceIt)
        {
            var theWeek = new NFLWeek(Season, WeekNo);

             var scorer = new YahooScorer(theWeek);
             var playerList = LoadLineupPlayers(nflTeam.TeamCode == HomeTeam ? HomeTeam : AwayTeam);
             foreach (var nflPlayer in playerList)
             {
            if (!nflPlayer.IsFantasyPlayer()) continue;
            var qty = scorer.RatePlayer(nflPlayer, theWeek);
            if (qty > 0.0M)
            {
               Announce( string.Format( "{0} for {1} in {2}",
                  qty, nflPlayer.PlayerName, Season + ":" + Week ) );

               var yo = new YahooOutput(
                                 Season,
                                 Week,
                                 nflPlayer.PlayerCode,
                                 qty,
                                 Opponent( nflTeam.TeamCode ));

               Announce( string.Format( "adding {0}",yo.StatOut() ) );

               YahooList.Add(yo);
            }
             }
        }
Example #6
0
        public override decimal GetStat( string theKey )
        {
            var season = theKey.Substring( 0, 4 );
            var week = theKey.Substring( 5, 2 );
            var playerId = theKey.Substring( 8, 8 );

            var stat = new YahooOutput
            {
                Season = season,
                Week = week,
                PlayerId = playerId,
                Quantity = 0.0M
            };

            Announce( string.Format( "StatMaster:Getting Stat {0}", stat.FormatKey() ) );

            var key = stat.FormatKey();
            if ( TheHt.ContainsKey( key ) )
            {
                stat = (YahooOutput) TheHt[ key ];
                CacheHits++;
            }
            else
            {
                //  new it up
                Announce( string.Format( "StatMaster:Instantiating Stat {0}", stat.FormatKey() ) );
                PutStat( stat );
                IsDirty = true;
                CacheMisses++;
            }
            return stat.Quantity;
        }
Example #7
0
 private static void WriteStatNode( XmlWriter writer, YahooOutput stat )
 {
     writer.WriteStartElement( "stat" );
     writer.WriteAttributeString( "season", stat.Season );
     writer.WriteAttributeString( "week", stat.Week );
     writer.WriteAttributeString( "id", stat.PlayerId );
     writer.WriteAttributeString( "qty", stat.Quantity.ToString() );
     writer.WriteAttributeString( "opp", stat.Opponent );
     writer.WriteEndElement();
 }
Example #8
0
        public void PutStat( YahooOutput stat )
        {
            if ( stat.Quantity == 0.0M ) return;

            IsDirty = true;
            if ( TheHt.ContainsKey( stat.FormatKey() ) )
            {
                TheHt[ stat.FormatKey() ] = stat;
                return;
            }
            TheHt.Add( stat.FormatKey(), stat );
        }