public void PutRating( HillenPowerRating stat ) { if ( stat.Quantity == 0.0M ) return; IsDirty = true; if ( TheHt.ContainsKey( stat.FormatKey() ) ) { TheHt[ stat.FormatKey() ] = stat; #if DEBUG //Utility.Announce( string.Format( "HillenMaster:Putting Stat {0}", stat.FormatKey() ) ); #endif return; } TheHt.Add( stat.FormatKey(), stat ); #if DEBUG //Utility.Announce( string.Format( "HillenMaster:Adding Stat {0}", stat.FormatKey() ) ); #endif }
public override decimal GetStat( string theKey ) { var season = theKey.Substring( 0, 4 ); var week = theKey.Substring( 5, 2 ); var teamCode = theKey.Substring( 8, 2 ); var stat = new HillenPowerRating { Season = season, Week = week, TeamCode = teamCode, Quantity = 0.0M }; #if DEBUG Utility.Announce( string.Format( "HillenMaster:Getting Stat {0}", stat.FormatKey() ) ); #endif var key = stat.FormatKey(); if ( TheHt.ContainsKey( key ) ) { stat = (HillenPowerRating) TheHt[ key ]; CacheHits++; } else { // new it up #if DEBUG Utility.Announce( string.Format( "HillenMaster:Instantiating Stat {0}", stat.FormatKey() ) ); #endif PutRating( stat ); IsDirty = true; CacheMisses++; } return stat.Quantity; }