public void StorePrediction(string method, NFLGame game, NFLResult result)
        {
            //  Validate prediction
            if (!result.IsValid())
            {
                Utility.Announce("Invalid prediction - " + game.GameName());
            }

            //  See if we have this prediction already
            var ds = Utility.TflWs.GetPrediction(method, game.Season, game.Week, game.GameCode);

            if (ds.Tables[0].Rows.Count == 1)
            {
                //  if yes just update
                Utility.TflWs.UpdatePrediction(
                    method, game.Season, game.Week, game.GameCode, result.HomeScore, result.AwayScore,
                    result.HomeTDp, result.HomeTDr, result.HomeTDd, result.HomeTDs, result.HomeFg,
                    result.AwayTDp, result.AwayTDr, result.AwayTDd, result.AwayTDs, result.AwayFg,
                    result.HomeYDp, result.HomeYDr, result.AwayYDp, result.AwayYDr
                    );
            }
            else
            {
                //  otherwise insert
                Utility.TflWs.InsertPrediction(
                    method, game.Season, game.Week, game.GameCode, result.HomeScore, result.AwayScore,
                    result.HomeTDp, result.HomeTDr, result.HomeTDd, result.HomeTDs, result.HomeFg,
                    result.AwayTDp, result.AwayTDr, result.AwayTDd, result.AwayTDs, result.AwayFg,
                    result.HomeYDp, result.HomeYDr, result.AwayYDp, result.AwayYDr
                    );
            }
        }
        public void StorePrediction(string method, NFLGame game, NFLResult result)
        {
            //  Validate prediction
            if ( !result.IsValid() )
                Utility.Announce( "Invalid prediction - " + game.GameName() );

            //  See if we have this prediction already
            var ds = Utility.TflWs.GetPrediction(method, game.Season, game.Week, game.GameCode);

            if (ds.Tables[0].Rows.Count == 1)
                //  if yes just update
                Utility.TflWs.UpdatePrediction(
                    method, game.Season, game.Week, game.GameCode, result.HomeScore, result.AwayScore,
                    result.HomeTDp, result.HomeTDr, result.HomeTDd, result.HomeTDs, result.HomeFg,
                    result.AwayTDp, result.AwayTDr, result.AwayTDd, result.AwayTDs, result.AwayFg,
             					result.HomeYDp, result.HomeYDr, result.AwayYDp, result.AwayYDr
                    );
            else
                //  otherwise insert
                Utility.TflWs.InsertPrediction(
                    method, game.Season, game.Week, game.GameCode, result.HomeScore, result.AwayScore,
                    result.HomeTDp, result.HomeTDr, result.HomeTDd, result.HomeTDs, result.HomeFg,
                    result.AwayTDp, result.AwayTDr, result.AwayTDd, result.AwayTDs, result.AwayFg,
             					result.HomeYDp, result.HomeYDr, result.AwayYDp, result.AwayYDr
                  );
        }
        public void TestMarginForTeam()
        {
            var result = new NFLResult("SF", 30, "GB", 22);

            Assert.AreEqual(8, result.MarginForTeam("SF"), "SF margin should be +8");
            Assert.AreEqual(-8, result.MarginForTeam("GB"), "GB margin should be -8");
        }
        public void TestAtsResultTie()
        {
            var prediction = new NFLResult {
                HomeTeam = "IC", AwayTeam = "MV", AwayScore = 22, HomeScore = 21
            };
            var game      = new NFLGame("2012:02-E");           //  BR @ PE
            var atsResult = game.EvaluatePredictionAts(prediction, game.Spread);

            Assert.AreEqual("ATS:PUSH", atsResult);
        }
        public void TestResultIsValid()
        {
            var sut = new NFLResult(home: "BB", homePts: 20, away: "NE", awayPts: 31);

            sut.AwayFg  = 1;
            sut.AwayTDr = 2;
            sut.AwayTDp = 2;
            sut.HomeTDp = 1;
            sut.HomeTDd = 1;
            sut.HomeFg  = 2;
            var isValid = sut.IsValid();

            Assert.IsTrue(isValid);
        }
        public void TestDbfPredictionStorer()
        {
            var game   = new NFLGame("2006:02-A");             // BB @ MD
            var result = new NFLResult("MD", 24, "BB", 20);

            result.HomeYDp = 250;
            result.HomeYDr = 116;
            result.AwayYDp = 350;
            result.AwayYDr = 68;
            result.AwayTDr = 1;
            var storer = new DbfPredictionStorer();

            storer.StorePrediction("test", game, result);
            var getter     = new DbfPredictionQueryMaster();
            var prediction = getter.Get("test", "2006", "02", "A");

            Assert.IsTrue(prediction.HomeScore.Equals(24), "Home score should be 24");
            Assert.IsTrue(prediction.AwayScore.Equals(20), "Away score should be 20");
            Assert.IsTrue(prediction.NflResult.AwayTDr.Equals(1), "Away TDr should be 1");
            Assert.IsTrue(prediction.NflResult.AwayYDr.Equals(68), "Away YDr should be 68");
        }
        public void StorePrediction(string method, NFLGame game, NFLResult result)
        {
            //  Validate prediction
            if (!result.IsValid())
            {
                Utility.Announce("Invalid prediction - " + game.GameName());
            }

            //  See if we have this prediction already
            var ds = Utility.TflWs.GetPrediction(method, game.Season, game.Week, game.GameCode);

            if (ds.Tables[0].Rows.Count == 1)
            {
                //  if yes just update
                Utility.TflWs.UpdatePrediction(
                    method, game.Season, game.Week, game.GameCode, result.HomeScore, result.AwayScore,
                    result.HomeTDp, result.HomeTDr, result.HomeTDd, result.HomeTDs, result.HomeFg,
                    result.AwayTDp, result.AwayTDr, result.AwayTDd, result.AwayTDs, result.AwayFg,
                    result.HomeYDp, result.HomeYDr, result.AwayYDp, result.AwayYDr
                    );
            }
            else
            {
                //  otherwise insert
                Utility.TflWs.InsertPrediction(
                    method, game.Season, game.Week, game.GameCode, result.HomeScore, result.AwayScore,
                    result.HomeTDp, result.HomeTDr, result.HomeTDd, result.HomeTDs, result.HomeFg,
                    result.AwayTDp, result.AwayTDr, result.AwayTDd, result.AwayTDs, result.AwayFg,
                    result.HomeYDp, result.HomeYDr, result.AwayYDp, result.AwayYDr
                    );
            }

            //TODO:  this stuffs up the scores if using the Miller predictions
            //// also update Game projections (used by Starters())
            //Utility.TflWs.StoreResult(game.Season, game.Week, game.GameCode, result.AwayScore, result.HomeScore, result.HomeTDp,
            //                          result.AwayTDp, result.HomeTDr, result.AwayTDr, result.HomeFg, result.AwayFg,
            //                          result.AwayTDd, result.HomeTDd, result.AwayTDs, result.HomeTDs);
        }
Exemple #8
0
 public void StorePrediction(string method, NFLGame game, NFLResult result)
 {
 }
 public void StorePrediction( string method, NFLGame game, NFLResult result )
 {
 }