private Model.GenericPrediction ConvertAPIToGeneric(APIFootballPrediction apiPrediction, Tournament tournament, DateTime date, Uri predictionURL)
    {
      var tournamentEvent = this.fixtureRepository.GetTournamentEventFromTournamentAndDate(date, tournament.TournamentName);

      var footballPrediction = new Model.FootballPrediction()
      {
        TournamentName = tournament.TournamentName,
        TournamentEventName = tournamentEvent.EventName,
        TeamOrPlayerA = apiPrediction.HomeTeam,
        TeamOrPlayerB = apiPrediction.AwayTeam,
        MatchDate = date,
        MatchIdentifier = string.Format("{0}/vs/{1}/{2}/{3}", apiPrediction.HomeTeam, apiPrediction.AwayTeam,
          tournamentEvent.EventName, date.ToShortDateString().Replace("/", "-"))
      };

      footballPrediction.OutcomeProbabilities.Add(Model.Outcome.HomeWin, apiPrediction.ExpectedProbabilities.HomeWinProb);
      footballPrediction.OutcomeProbabilities.Add(Model.Outcome.Draw, apiPrediction.ExpectedProbabilities.DrawProb);
      footballPrediction.OutcomeProbabilities.Add(Model.Outcome.AwayWin, apiPrediction.ExpectedProbabilities.AwayWinProb);

      foreach (var scoreLine in apiPrediction.ScoreProbabilities)
      {
        var key = string.Format("{0}-{1}", scoreLine.HomeGoals.ToString(), scoreLine.AwayGoals.ToString());
        if (!footballPrediction.ScoreLineProbabilities.ContainsKey(key))
          footballPrediction.ScoreLineProbabilities.Add(key, scoreLine.Probability);
      }
      return footballPrediction;
    }
예제 #2
0
 public Uri GetTournamentCouponUrl(Tournament tournament, ExternalSource externalSource)
 {
   var couponData = GetQuery<TournamentCouponURL>(c => c.Tournament.Id == tournament.Id && c.ExternalSource.Id == externalSource.Id)
                     .FirstOrDefault();
   if (couponData == null)
     return null;
   else
     return new Uri(couponData.CouponURL);
 }
예제 #3
0
    public IEnumerable<TournamentEvent> UpdateTournamentEvents()
    {
      var ret = new List<TournamentEvent>();
      var tb365Uri = this.fixtureRepository.GetTennisTournamentCalendar();

      var webRepository = 
        this.webRepositoryProvider.CreateWebRepository(DateTime.Now.Date);

      var tournamentEvents = 
        webRepository.GetJsonObjects<APITennisTourCalendar>(tb365Uri, s => ProgressReporterProvider.Current.ReportProgress(s, ReporterImportance.Medium, ReporterAudience.Admin));

      foreach (var tournamentEvent in tournamentEvents)
      {
        var nameWithoutYear = Reg.Regex.Replace(tournamentEvent.TournamentName, @" 20\d{2}", "");
        var tournament = this.fixtureRepository.GetTournament(nameWithoutYear);
        if (tournament == null)
        {
          tournament = new Tournament()
          {
            TournamentName = nameWithoutYear,
            CompetitionID = this.fixtureRepository.GetCompetition("ATP").Id,
            Slug = nameWithoutYear.RemoveDiacritics().ToHyphenated(),
            Location = "Add later"
          };
          this.fixtureRepository.CreateTournament(tournament);
        }
        var eventName = string.Format("{0} ({1})", nameWithoutYear, tournamentEvent.StartDate.AddDays(3).Year);
        var persistedTournamentEvent = this.fixtureRepository.GetTournamentEventFromTournamentAndYear(tournamentEvent.StartDate.AddDays(3).Year, eventName);
        if (persistedTournamentEvent == null)
        {
          persistedTournamentEvent = new TournamentEvent
          {
            EventName = eventName,
            TournamentID = tournament.Id,
            StartDate = tournamentEvent.StartDate,
            EndDate = tournamentEvent.EndDate,
            Slug = string.Format("{0}-{1}", tournamentEvent.TournamentName.RemoveDiacritics().ToHyphenated(), tournamentEvent.StartDate.AddDays(3).Year),
            TournamentInProgress = tournamentEvent.InProgress,
            TournamentCompleted = tournamentEvent.Completed
          };
          this.fixtureRepository.AddTournamentEvent(persistedTournamentEvent);
        }
        else
        {
          persistedTournamentEvent.StartDate = tournamentEvent.StartDate;
          persistedTournamentEvent.EndDate = tournamentEvent.EndDate;
          persistedTournamentEvent.TournamentInProgress = tournamentEvent.InProgress;
          persistedTournamentEvent.TournamentCompleted = tournamentEvent.Completed;
        }

        ret.Add(persistedTournamentEvent);

        this.fixtureRepository.SaveChanges();
      }
      return ret;
    }
예제 #4
0
    public Uri GetTennisPredictionURL(TeamPlayer playerA, TeamPlayer playerB, Tournament tournament, DateTime date)
    {
      return new Uri(
        string.Format("http://www.tennisbetting365.com/api/getprediction/{0}/{1}/{2}/{3}/vs/{4}/{5}",
        tournament.Slug,
        date.Year,
        playerA.FirstName.RemoveDiacritics().ToLower().Replace(' ','-'),
        playerA.Name.RemoveDiacritics().ToLower().Replace(' ', '-'),
        playerB.FirstName.RemoveDiacritics().ToLower().Replace(' ', '-'),
        playerB.Name.RemoveDiacritics().ToLower().Replace(' ', '-'))
        );

    }
    public async Task<Model.GenericPrediction> FetchSinglePredictionAsync(TeamPlayer teamPlayerA, TeamPlayer teamPlayerB, Tournament tournament, Model.IValueOptions valueOptions)
    {
      var webRepository =
        this.webRepositoryProvider
            .CreateWebRepository(valueOptions.CouponDate);

      var predictionURL =
        this.predictionRepository
            .GetTennisPredictionURL(teamPlayerA, teamPlayerB, tournament, valueOptions.CouponDate);

      var jsonTennisPrediction = await
        webRepository.ParseJson<APITennisPrediction>(predictionURL);

      jsonTennisPrediction.StartTime = valueOptions.CouponDate;

      return ConvertAPIToGeneric(jsonTennisPrediction, predictionURL);
    }
예제 #6
0
 public Tournament CreateTournament(Tournament entity)
 {
   Add<Tournament>(entity);
   Save<Tournament>(entity); //need ID
   return entity;
 }
 public Task<Model.GenericPrediction> FetchSinglePredictionAsync(TeamPlayer teamPlayerA, TeamPlayer teamPlayerB, Tournament tournament, Model.IValueOptions valueOptions)
 {
   throw new NotImplementedException();
 }
            public void CreatesACollectionOfPredictionsForTodaysMatches()
            {
                //Arrange
                matchDate = new DateTime(2013, 02, 02);
                #region Todays matches
                matches = new List <E.Match>()
                {
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "62", Name = "QPR"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "31", Name = "Norwich"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Premier League"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "0", Name = "Arsenal"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "39", Name = "Stoke"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Premier League"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "7", Name = "Everton"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "1", Name = "Aston Villa"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Premier League"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "14", Name = "Newcastle"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "6", Name = "Chelsea"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Premier League"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "35", Name = "Reading"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "16", Name = "Sunderland"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Premier League"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "19", Name = "West Ham"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "88", Name = "Swansea"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Premier League"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "66", Name = "Wigan"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "15", Name = "Southampton"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Premier League"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "8", Name = "Fulham"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "12", Name = "Man United"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Premier League"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "2", Name = "Birmingham"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "32", Name = "Nott'm Forest"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "3", Name = "Blackburn"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "47", Name = "Bristol City"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "45", Name = "Blackpool"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "44", Name = "Barnsley"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "24", Name = "Crystal Palace"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "5", Name = "Charlton"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "25", Name = "Derby"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "53", Name = "Huddersfield"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "28", Name = "Ipswich"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "13", Name = "Middlesboro"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "9", Name = "Leeds"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "48", Name = "Cardiff"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "30", Name = "Millwall"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "77", Name = "Hull"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "59", Name = "Peterboro"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "22", Name = "Burnley"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "38", Name = "Sheffield Weds"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "21", Name = "Brighton"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "41", Name = "Watford"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "4", Name = "Bolton"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "Championship"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "71", Name = "Bury"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "95", Name = "Doncaster"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "52", Name = "Crewe"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "85", Name = "Scunthorpe"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "76", Name = "Hartlepool"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "57", Name = "Notts County"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "42", Name = "Milton Keynes"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "69", Name = "Bournemouth"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "33", Name = "Portsmouth"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "51", Name = "Colchester"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "34", Name = "Preston"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "86", Name = "Shrewsbury"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "2015", Name = "Stevenage"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "79", Name = "Leyton Orient"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "65", Name = "Tranmere"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "73", Name = "Carlisle"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "40", Name = "Walsall"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "58", Name = "Oldham"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "96", Name = "Yeovil"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "46", Name = "Brentford"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "2004", Name = "Crawley Town"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "64", Name = "Swindon"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League One"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "2029", Name = "AFC Wimbledon"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "2002", Name = "Burton"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "49", Name = "Cheltenham"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "89", Name = "Torquay"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "75", Name = "Exeter"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "2000", Name = "Aldershot"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "2033", Name = "Fleetwood Town"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "20", Name = "Bradford"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "60", Name = "Plymouth"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "2005", Name = "Dag and Red"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "61", Name = "Port Vale"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "97", Name = "Accrington"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "83", Name = "Rochdale"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "50", Name = "Chesterfield"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "36", Name = "Rotherham"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "56", Name = "Northampton"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "87", Name = "Southend"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "82", Name = "Oxford"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    },
                    new E.Match()
                    {
                        MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer {
                            ExternalID = "91", Name = "York"
                        }, TeamsPlayerB = new E.TeamPlayer {
                            ExternalID = "2009", Name = "Morecambe"
                        }, TournamentEvent = new E.TournamentEvent {
                            Tournament = new E.Tournament {
                                TournamentName = "League Two"
                            }
                        }
                    }
                };
                #endregion
                this.webRepositoryProvider = new ManifestWebRepositoryProvider();

                this.mockFixtureRepository = BuildFixtureRepository.Create()
                                             .HasFullDaysMatchesByCompetition(matches)
                                             .CanGetTournamentEventFromTournamentAndDate();

                this.mockPredictionRepository = BuildPredictionRepository.Create()
                                                .HasFootballAPIUrl();

                var predictionStrategy = new FootballPredictionStrategy(this.mockPredictionRepository.Object,
                                                                        this.mockFixtureRepository.Object, this.webRepositoryProvider);

                var prem = new E.Tournament()
                {
                    TournamentName = "Premier League"
                };
                var champ = new E.Tournament()
                {
                    TournamentName = "Championship"
                };
                var league1 = new E.Tournament()
                {
                    TournamentName = "League One"
                };
                var league2 = new E.Tournament()
                {
                    TournamentName = "League Two"
                };

                var valueOptions = new Model.ValueOptions()
                {
                    Sport = new E.Sport {
                        SportName = "Football"
                    },
                    OddsSource = new E.ExternalSource {
                        Source = "Not relevant"
                    },
                    CouponDate = matchDate
                };

                var allGenericPredictions = new List <Model.GenericPrediction>();

                //Act
                //Premier league
                valueOptions.Tournament = prem;
                var genericPredictionsPrem = predictionStrategy.FetchPredictions(valueOptions);
                //Championship
                valueOptions.Tournament = champ;
                var genericPredictionsChamp = predictionStrategy.FetchPredictions(valueOptions);
                //League 1
                valueOptions.Tournament = league1;
                var genericPredictionsLeague1 = predictionStrategy.FetchPredictions(valueOptions);
                //League 2
                valueOptions.Tournament = league2;
                var genericPredictionsLeague2 = predictionStrategy.FetchPredictions(valueOptions);
                //All
                allGenericPredictions.AddRange(genericPredictionsPrem);
                allGenericPredictions.AddRange(genericPredictionsChamp);
                allGenericPredictions.AddRange(genericPredictionsLeague1);
                allGenericPredictions.AddRange(genericPredictionsLeague2);

                //Assert
                allGenericPredictions.ForEach(x =>
                {
                    Assert.AreEqual(x.ScoreLineProbabilities.Count(), 121);
                    Assert.AreEqual(x.OutcomeProbabilities.Sum(o => o.Value), 1, 0.01);
                });
                Assert.AreEqual(genericPredictionsPrem.Count(), 8);
                Assert.AreEqual(genericPredictionsChamp.Count(), 11);
                Assert.AreEqual(genericPredictionsLeague1.Count(), 11);
                Assert.AreEqual(genericPredictionsLeague2.Count(), 10);
            }
      public void UpdatesOldListOfTournamentEvents()
      {
        //Arrange
        persistedTournaments = new List<Tournament>();
        persistedTournamentEvents = new List<TournamentEvent>();

        var persistedTournament = new Tournament
        {
          Id = 1,
          TournamentName = "Tóurnament Name",
          Slug = "tournament-name",
          CompetitionID = 1
        };

        var persistedTournamentEvent = new TournamentEvent
        {
          Tournament = persistedTournament,
          EventName = "Tóurnament Name (2013)",
          StartDate = new DateTime(2012, 12, 30),
          EndDate = new DateTime(2013, 01, 07),
          TournamentInProgress = false,
          TournamentCompleted = false
        };

        this.webRepository = BuildWebRepository.Create()
          .HasSingleAPITennisTourCalendar();

        this.webRepositoryProvider = BuildWebRepositoryProvider.Create()
          .ReturnsSpecificWebRepository(webRepository.Object);

        this.fixtureRepository = BuildFixtureRepository.Create()
          .HasAPersistedTournamentEvent(persistedTournamentEvent)
          .HasAPersistedCompetition()
          .HasAPersistedTournament(persistedTournament)
          .CanAddTournament(persistedTournaments);

        //Act
        var fixtureStrategy = new TestableTennisFixtureStrategy(this.fixtureRepository,
          this.storedProcRepository, this.webRepositoryProvider);

        var tournamentEvents = fixtureStrategy.UpdateTournamentEvents();
        var tournamentEvent = tournamentEvents.FirstOrDefault();

        //Assert
        //Returned tournament event
        Assert.AreEqual(1, tournamentEvents.Count());
        Assert.AreEqual("Tóurnament Name (2013)", tournamentEvent.EventName);
        Assert.AreEqual(new DateTime(2012, 12, 31), tournamentEvent.StartDate);
        Assert.AreEqual(new DateTime(2013, 01, 06), tournamentEvent.EndDate);
        Assert.IsTrue(tournamentEvent.TournamentInProgress);
        Assert.IsFalse(tournamentEvent.TournamentCompleted);

        //Tournament
        Assert.AreEqual(0, persistedTournaments.Count());
      }
예제 #10
0
    public SeedData()
    {
      //bookmakers
      var bFootballDataBestAvailable = new Bookmaker { BookmakerName = "Football Data Odds Best Available", Slug = "football-data-best-available", IsExchange = false, BookmakerURL = "http://www.football-data.co.uk", CurrentCommission = null };
      var bTennisDataBestAvailable = new Bookmaker { BookmakerName = "Tennis Data Odds Best Available", Slug = "tennis-data-best-available", IsExchange = false, BookmakerURL = "http://www.tennis-data.co.uk", CurrentCommission = null };
      var bOddsCheckerWebBestAvailable = new Bookmaker { BookmakerName = "Odds Checker Web Best Available", Slug = "odds-checker-web-best-available", IsExchange = false, BookmakerURL = "http://www.oddschecker.com", CurrentCommission = null };
      var bOddsCheckerMobiBestAvailable = new Bookmaker { BookmakerName = "Odds Checker Mobi Best Available", Slug = "odds-checker-mobi-best-available", IsExchange = false, BookmakerURL = "http://www.oddschecker.mobi", CurrentCommission = null };
      var bBestBettingBestAvailable = new Bookmaker { BookmakerName = "Best Betting Best Available", Slug = "best-betting-best-available", IsExchange = false, BookmakerURL = "http://odds.bestbetting.com", CurrentCommission = null };

      var b10bet = new Bookmaker { BookmakerName = "10Bet", Slug = "10bet", IsExchange = false, BookmakerURL = "http://www.10bet.com", CurrentCommission = null, OddsCheckerShortID = null, Priority = 15 };
      var b188bet = new Bookmaker { BookmakerName = "188Bet", Slug = "188bet", IsExchange = false, BookmakerURL = "http://www.188bet.com/en-gb/sports", CurrentCommission = null, OddsCheckerShortID = "EB", Priority = 26 };
      var b32red_bet = new Bookmaker { BookmakerName = "32Red bet", Slug = "32red-bet", IsExchange = false, BookmakerURL = "http://www.32redbet.com/UI/Default.aspx", CurrentCommission = null, OddsCheckerShortID = "RD", Priority = 16 };
      var b888sport = new Bookmaker { BookmakerName = "888sport", Slug = "888sport", IsExchange = false, BookmakerURL = "http://www.888sport.com/bet", CurrentCommission = null, OddsCheckerShortID = "EE", Priority = 28 };
      var bbet_365 = new Bookmaker { BookmakerName = "Bet 365", Slug = "bet-365", IsExchange = false, BookmakerURL = "http://www.bet365.com", CurrentCommission = null, OddsCheckerShortID = "B3", Priority = 11 };
      var bbet_victor = new Bookmaker { BookmakerName = "Bet Victor", Slug = "bet-victor", IsExchange = false, BookmakerURL = "http://www.betvictor.com", CurrentCommission = null, OddsCheckerShortID = null, Priority = 8 };
      var bbet770 = new Bookmaker { BookmakerName = "Bet770", Slug = "bet770", IsExchange = false, BookmakerURL = "http://bet.770.com/", CurrentCommission = null, OddsCheckerShortID = null, Priority = 17 };
      var bbetdaq = new Bookmaker { BookmakerName = "BETDAQ", Slug = "betdaq", IsExchange = false, BookmakerURL = "https://www.betdaq.com/UI/", CurrentCommission = 0.05m, OddsCheckerShortID = "BD", Priority = 21 };
      var bbetfair = new Bookmaker { BookmakerName = "Betfair", Slug = "betfair", IsExchange = true, BookmakerURL = "http://www.betfair.com/", CurrentCommission = 0.05m, OddsCheckerShortID = "BF", Priority = 20 };
      var bbetfred = new Bookmaker { BookmakerName = "Betfred", Slug = "betfred", IsExchange = false, BookmakerURL = "http://www.betfred.com/", CurrentCommission = null, OddsCheckerShortID = "FR", Priority = 10 };
      var bbetinternet = new Bookmaker { BookmakerName = "Betinternet", Slug = "betinternet", IsExchange = false, BookmakerURL = "http://www.betinternet.com/en/Sports.bet", CurrentCommission = null, OddsCheckerShortID = null, Priority = 12 };
      var bbetvictor = new Bookmaker { BookmakerName = "BetVictor", Slug = "betvictor", IsExchange = false, BookmakerURL = "http://www.betvictor.com/sports/en", CurrentCommission = null, OddsCheckerShortID = "VC", Priority = 30 };

      var bblue_square = new Bookmaker { BookmakerName = "Blue Square", Slug = "blue-square", IsExchange = false, BookmakerURL = "http://www.bluesq.com/bet", CurrentCommission = null, OddsCheckerShortID = "BS", Priority = 9 };
      var bbodog = new Bookmaker { BookmakerName = "Bodog", Slug = "bodog", IsExchange = false, BookmakerURL = "http://www.bodog.co.uk/", CurrentCommission = null, OddsCheckerShortID = "BO", Priority = 18 };
      var bboylesports = new Bookmaker { BookmakerName = "Boylesports", Slug = "boylesports", IsExchange = false, BookmakerURL = "http://www.boylesports.com/betting", CurrentCommission = null, OddsCheckerShortID = "BY", Priority = 7 };
      var bbwin = new Bookmaker { BookmakerName = "Bwin", Slug = "bwin", IsExchange = false, BookmakerURL = "https://www.bwin.com/", CurrentCommission = null, OddsCheckerShortID = "BW", Priority = 31 };
      var bcoral = new Bookmaker { BookmakerName = "Coral", Slug = "coral", IsExchange = false, BookmakerURL = "http://www.coral.co.uk/splash", CurrentCommission = null, OddsCheckerShortID = "CE", Priority = 26 };
      var bcorbetts = new Bookmaker { BookmakerName = "Corbetts", Slug = "corbetts", IsExchange = false, BookmakerURL = "http://corbettsports.info/", CurrentCommission = null, OddsCheckerShortID = null, Priority = 25 };
      var bladbrokes = new Bookmaker { BookmakerName = "Ladbrokes", Slug = "ladbrokes", IsExchange = false, BookmakerURL = "http://www.ladbrokes.com/home/en", CurrentCommission = null, OddsCheckerShortID = "LD", Priority = 3 };
      var bmatchbook_com = new Bookmaker { BookmakerName = "Matchbook.com", Slug = "matchbook-com", IsExchange = true, BookmakerURL = "http://matchbook.com/index.xml", CurrentCommission = 0.05m, OddsCheckerShortID = null, Priority = 22 };
      var bmarathonbet_co_uk = new Bookmaker { BookmakerName = "Marathonbet.co.uk", Slug = "marathonbet-co-uk", IsExchange = false, BookmakerURL = "http://www.marathonbet.co.uk/en/", CurrentCommission = null, OddsCheckerShortID = null, Priority = 32 };
      var bpaddy_power = new Bookmaker { BookmakerName = "Paddy Power", Slug = "paddy-power", IsExchange = false, BookmakerURL = "http://www.paddypower.com/bet", CurrentCommission = null, OddsCheckerShortID = "PP", Priority = 1 };
      var bpanbet = new Bookmaker { BookmakerName = "Panbet", Slug = "panbet", IsExchange = false, BookmakerURL = "http://www.marathonbet.co.uk/en/", CurrentCommission = null, OddsCheckerShortID = null, Priority = 14 };
      var bpinnacle_sports = new Bookmaker { BookmakerName = "Pinnacle Sports", Slug = "pinnacle-sports", IsExchange = false, BookmakerURL = "http://www.pinnaclesports.com/", CurrentCommission = null, OddsCheckerShortID = "PN", Priority = 19 };
      var bsky_bet = new Bookmaker { BookmakerName = "Sky Bet", Slug = "sky-bet", IsExchange = false, BookmakerURL = "http://www.skybet.com/", CurrentCommission = null, OddsCheckerShortID = "SK", Priority = 4 };
      var bsmarkets = new Bookmaker { BookmakerName = "Smarkets", Slug = "smarkets", IsExchange = true, BookmakerURL = "https://smarkets.com/", CurrentCommission = 0.02m, OddsCheckerShortID = null, Priority = 24 };
      var bsporting_bet = new Bookmaker { BookmakerName = "Sporting Bet", Slug = "sporting-bet", IsExchange = false, BookmakerURL = "http://www.sportingbet.com/", CurrentCommission = null, OddsCheckerShortID = "SO", Priority = 5 };
      var bspreadex = new Bookmaker { BookmakerName = "Spreadex", Slug = "spreadex", IsExchange = false, BookmakerURL = "http://www.spreadex.com/", CurrentCommission = null, OddsCheckerShortID = null, Priority = 29 };
      var bstan_james = new Bookmaker { BookmakerName = "Stan James", Slug = "stan-james", IsExchange = false, BookmakerURL = "http://www.stanjames.com/UK/541/Homepage", CurrentCommission = null, OddsCheckerShortID = "SJ", Priority = 2 };
      var btotesport = new Bookmaker { BookmakerName = "Totesport", Slug = "totesport", IsExchange = false, BookmakerURL = "http://www.totesport.com/Welcome/", CurrentCommission = null, OddsCheckerShortID = "BX", Priority = 6 };
      var bwbx = new Bookmaker { BookmakerName = "WBX", Slug = "wbx", IsExchange = true, BookmakerURL = "http://www.wbx.com/default.ashx", CurrentCommission = 0.05m, OddsCheckerShortID = "WB", Priority = 33 };
      var bwilliam_hill = new Bookmaker { BookmakerName = "William Hill", Slug = "william-hill", IsExchange = false, BookmakerURL = "http://www.williamhill.com/", CurrentCommission = null, OddsCheckerShortID = "WH", Priority = 23 };
      var byouwin = new Bookmaker { BookmakerName = "youwin", Slug = "youwin", IsExchange = false, BookmakerURL = "http://www.youwin.com/en", CurrentCommission = null, OddsCheckerShortID = "YW", Priority = 13 };
      var bbet_win = new Bookmaker { BookmakerName = "Bet & Win", Slug = "bet-win", IsExchange = false, BookmakerURL = "https://www.bwin.com/default.aspx", CurrentCommission = null, OddsCheckerShortID = null, Priority = 34 };
      var bgamebookers = new Bookmaker { BookmakerName = "Gamebookers", Slug = "gamebookers", IsExchange = false, BookmakerURL = "https://sports.gamebookers.com/en/sports", CurrentCommission = null, OddsCheckerShortID = null, Priority = 35 };
      var binterwetten = new Bookmaker { BookmakerName = "Interwetten", Slug = "interwetten", IsExchange = false, BookmakerURL = "https://www.interwetten.com/en/Default.aspx", CurrentCommission = null, OddsCheckerShortID = null, Priority = 36 };
      var bstanleybet = new Bookmaker { BookmakerName = "Stanleybet", Slug = "stanleybet", IsExchange = false, BookmakerURL = "http://web.stanleybet.ro/", CurrentCommission = null, OddsCheckerShortID = null, Priority = 37 };
      var bsporting_odds = new Bookmaker { BookmakerName = "Sporting Odds", Slug = "sporting-odds", IsExchange = false, BookmakerURL = "www.sportingodds.co.uk", CurrentCommission = null, OddsCheckerShortID = null, Priority = 38 };
      var bexpekt = new Bookmaker { BookmakerName = "Expekt", Slug = "expekt", IsExchange = false, BookmakerURL = "http://www.expekt.com", CurrentCommission = null, OddsCheckerShortID = null, Priority = 39 };
      var bbetway = new Bookmaker { BookmakerName = "Betway", Slug = "betway", IsExchange = false, BookmakerURL = "http://new.betway.com/en/sports/", CurrentCommission = null, OddsCheckerShortID = "WA", Priority = 40 };
      var bcome_on = new Bookmaker { BookmakerName = "Come On", Slug = "comeon", IsExchange = false, BookmakerURL = "https://www.comeon.com/", CurrentCommission = null, OddsCheckerShortID = null, Priority = 41 };
      var bunibet = new Bookmaker { BookmakerName = "Unibet", Slug = "unibet", IsExchange = false, BookmakerURL = "https://www.unibet.co.uk", CurrentCommission = null, OddsCheckerShortID = "UN", Priority = 42 };
      //sport
      var football = new Sport { SportName = "Football" };
      var tennis = new Sport { SportName = "Tennis" };

      //surface
      var hard = new Surface { SurfaceName = "Hard" };
      var clay = new Surface { SurfaceName = "Clay" };
      var grass = new Surface { SurfaceName = "Grass" };

      //competition
      var premierLeague = new Competition { Sport = football, CompetitionName = "Premier League", Slug = "premier-league", EdgeRequired = 0.1M };
      var championship = new Competition { Sport = football, CompetitionName = "Championship", Slug = "championship", EdgeRequired = 0.1M };
      var leagueOne = new Competition { Sport = football, CompetitionName = "League One", Slug = "league-one", EdgeRequired = 0.1M };
      var leagueTwo = new Competition { Sport = football, CompetitionName = "League Two", Slug = "league-two", EdgeRequired = 0.1M };
      var atp = new Competition { Sport = tennis, CompetitionName = "ATP", Slug = "atp", EdgeRequired = 0.2M, GamesRequiredForBet = 70 };
      var masters = new Competition { Sport = tennis, CompetitionName = "Masters", Slug = "masters", EdgeRequired = 0.2M, GamesRequiredForBet = 70 };
      var grandSlam = new Competition { Sport = tennis, CompetitionName = "Grand Slam", Slug = "grand-slam", EdgeRequired = 0.2M, GamesRequiredForBet = 70 };

      //tournament
      var t_premierLeague = new Tournament { Competition = premierLeague, TournamentName = "Premier League", Slug = "premier-league", Location = "England" };
      var t_championship = new Tournament { Competition = championship, TournamentName = "Championship", Slug = "championship", Location = "England" };
      var t_leagueOne = new Tournament { Competition = leagueOne, TournamentName = "League One", Slug = "league-one", Location = "England" };
      var t_leagueTwo = new Tournament { Competition = leagueTwo, TournamentName = "League Two", Slug = "league-two", Location = "England" };

      var brisbane_international = new Tournament { Competition = atp, TournamentName = "Brisbane International", Slug = "brisbane-international", Location = "Australia" };
      var aircel_chennai_open = new Tournament { Competition = atp, TournamentName = "Aircel Chennai Open", Slug = "aircel-chennai-open", Location = "India" };
      var qatar_exxonmobil_open = new Tournament { Competition = atp, TournamentName = "Qatar ExxonMobil Open", Slug = "qatar-exxonmobil-open", Location = "Qatar" };
      var apia_international_sydney = new Tournament { Competition = atp, TournamentName = "Apia International Sydney", Slug = "apia-international-sydney", Location = "Australia" };
      var heineken_open = new Tournament { Competition = atp, TournamentName = "Heineken Open", Slug = "heineken-open", Location = "New Zealand" };
      var australian_open = new Tournament { Competition = atp, TournamentName = "Australian Open", Slug = "australian-open", Location = "Australia" };
      var open_sud_de_france = new Tournament { Competition = atp, TournamentName = "Open Sud de France", Slug = "open-sud-de-france", Location = "France" };
      var pbz_zagreb_indoors = new Tournament { Competition = atp, TournamentName = "PBZ Zagreb Indoors", Slug = "pbz-zagreb-indoors", Location = "Croatia" };
      var vtr_open = new Tournament { Competition = atp, TournamentName = "VTR Open", Slug = "vtr-open", Location = "Chile" };
      var abn_amro_world_tennis_tournament = new Tournament { Competition = atp, TournamentName = "ABN AMRO World Tennis Tournament", Slug = "abn-amro-world-tennis-tournament", Location = "The Netherlands" };
      var brasil_open_2012 = new Tournament { Competition = atp, TournamentName = "Brasil Open 2012", Slug = "brasil-open-2012", Location = "Brazil" };
      var sap_open = new Tournament { Competition = atp, TournamentName = "SAP Open", Slug = "sap-open", Location = "CA, U.S.A." };
      var regions_morgan_keegan_championships = new Tournament { Competition = atp, TournamentName = "Regions Morgan Keegan Championships", Slug = "regions-morgan-keegan-championships", Location = "TN, U.S.A." };
      var copa_claro = new Tournament { Competition = atp, TournamentName = "Copa Claro", Slug = "copa-claro", Location = "Argentina" };
      var open_13 = new Tournament { Competition = atp, TournamentName = "Open 13", Slug = "open-13", Location = "France" };
      var dubai_duty_free_tennis_championships = new Tournament { Competition = atp, TournamentName = "Dubai Duty Free Tennis Championships", Slug = "dubai-duty-free-tennis-championships", Location = "U.A.E." };
      var delray_beach_international_tennis_championships = new Tournament { Competition = atp, TournamentName = "Delray Beach International Tennis Championships", Slug = "delray-beach-international-tennis-championships", Location = "FL, U.S.A." };
      var abierto_mexicano_telcel = new Tournament { Competition = atp, TournamentName = "Abierto Mexicano Telcel", Slug = "abierto-mexicano-telcel", Location = "Mexico" };
      var bnp_paribas_open = new Tournament { Competition = atp, TournamentName = "BNP Paribas Open", Slug = "bnp-paribas-open", Location = "CA, U.S.A." };
      var sony_ericsson_open = new Tournament { Competition = atp, TournamentName = "Sony Ericsson Open", Slug = "sony-ericsson-open", Location = "FL, U.S.A." };
      var grand_prix_hassan_ii = new Tournament { Competition = atp, TournamentName = "Grand Prix Hassan II", Slug = "grand-prix-hassan-ii", Location = "Morocco" };
      var us_mens_clay_court_championship = new Tournament { Competition = atp, TournamentName = "US Men's Clay Court Championship", Slug = "us-mens-clay-court-championship", Location = "TX, U.S.A." };
      var monte_carlo_rolex_masters = new Tournament { Competition = atp, TournamentName = "Monte-Carlo Rolex Masters", Slug = "monte-carlo-rolex-masters", Location = "Monaco" };
      var brd_nastase_tiriac_trophy = new Tournament { Competition = atp, TournamentName = "BRD Nastase Tiriac Trophy", Slug = "brd-nastase-tiriac-trophy", Location = "Romania" };
      var barcelona_open_banc_sabadell = new Tournament { Competition = atp, TournamentName = "Barcelona Open Banc Sabadell", Slug = "barcelona-open-banc-sabadell", Location = "Spain" };
      var bmw_open = new Tournament { Competition = atp, TournamentName = "BMW Open", Slug = "bmw-open", Location = "Germany" };
      var serbia_open_2012 = new Tournament { Competition = atp, TournamentName = "Serbia Open 2012", Slug = "serbia-open-2012", Location = "Serbia" };
      var estoril_open = new Tournament { Competition = atp, TournamentName = "Estoril Open", Slug = "estoril-open", Location = "Portugal" };
      var mutua_madrid_open = new Tournament { Competition = atp, TournamentName = "Mutua Madrid Open", Slug = "mutua-madrid-open", Location = "Spain" };
      var internazionali_bnl_ditalia = new Tournament { Competition = atp, TournamentName = "Internazionali BNL d'Italia", Slug = "internazionali-bnl-ditalia", Location = "Italy" };
      var open_de_nice_cote_dazur = new Tournament { Competition = atp, TournamentName = "Open de Nice Côte d’Azur", Slug = "open-de-nice-cote-dazur", Location = "France" };
      var roland_garros = new Tournament { Competition = atp, TournamentName = "Roland Garros", Slug = "roland-garros", Location = "France" };
      var gerry_weber_open = new Tournament { Competition = atp, TournamentName = "Gerry Weber Open ", Slug = "gerry-weber-open", Location = "Germany" };
      var aegon_championships = new Tournament { Competition = atp, TournamentName = "AEGON Championships", Slug = "aegon-championships", Location = "Great Britain" };
      var unicef_open = new Tournament { Competition = atp, TournamentName = "UNICEF Open", Slug = "unicef-open", Location = "The Netherlands" };
      var aegon_international = new Tournament { Competition = atp, TournamentName = "AEGON International", Slug = "aegon-international", Location = "Great Britain" };
      var wimbledon = new Tournament { Competition = atp, TournamentName = "Wimbledon", Slug = "wimbledon", Location = "Wimbledon, Great Britain" };
      var mercedescup = new Tournament { Competition = atp, TournamentName = "MercedesCup", Slug = "mercedescup", Location = "Stuttgart, Germany" };
      var campbells_hall_of_fame_tennis_championships = new Tournament { Competition = atp, TournamentName = "Campbell’s Hall of Fame Tennis Championships", Slug = "campbells-hall-of-fame-tennis-championships", Location = "Newport, U.S.A." };
      var skistar_swedish_open = new Tournament { Competition = atp, TournamentName = "SkiStar Swedish Open", Slug = "skistar-swedish-open", Location = "Båstad, Sweden" };
      var atp_vegeta_croatia_open_umag = new Tournament { Competition = atp, TournamentName = "ATP Vegeta Croatia Open Umag", Slug = "atp-vegeta-croatia-open-umag", Location = "Umag, Croatia" };
      var bet_at_home_open___german_tennis_championships_2012 = new Tournament { Competition = atp, TournamentName = "bet-at-home Open - German Tennis Championships 2012", Slug = "bet-at-home-open---german-tennis-championships-2012", Location = "Hamburg, Germany" };
      var bbt_atlanta_open = new Tournament { Competition = atp, TournamentName = "BB&T Atlanta Open", Slug = "bbt-atlanta-open", Location = "Atlanta, U.S.A." };
      var credit_agricole_suisse_open_gstaad = new Tournament { Competition = atp, TournamentName = "Crédit Agricole Suisse Open Gstaad", Slug = "credit-agricole-suisse-open-gstaad", Location = "Gstaad, Switzerland" };
      var bet_at_home_cup_kitzbuhel = new Tournament { Competition = atp, TournamentName = "bet-at-home Cup Kitzbühel", Slug = "bet-at-home-cup-kitzbuhel", Location = "Kitzbühel, Austria" };
      var farmers_classic = new Tournament { Competition = atp, TournamentName = "Farmers Classic", Slug = "farmers-classic", Location = "Los Angeles, U.S.A.  " };
      var london_2012_olympics = new Tournament { Competition = atp, TournamentName = "London 2012 Olympics", Slug = "london-2012-olympics", Location = "London" };
      var legg_mason_tennis_classic = new Tournament { Competition = atp, TournamentName = "Legg Mason Tennis Classic", Slug = "legg-mason-tennis-classic", Location = "Washington D.C., U.S.A." };
      var rogers_cup = new Tournament { Competition = atp, TournamentName = "Rogers Cup", Slug = "rogers-cup", Location = "Toronto, Canada" };
      var western__southern_open = new Tournament { Competition = atp, TournamentName = "Western & Southern Open", Slug = "western--southern-open", Location = "Cincinnati, U.S.A" };
      var winston_salem_open = new Tournament { Competition = atp, TournamentName = "Winston-Salem Open", Slug = "winston-salem-open", Location = "Winston Salem, U.S.A." };
      var us_open = new Tournament { Competition = atp, TournamentName = "US Open", Slug = "us-open", Location = "NY, U.S.A." };
      var moselle_open = new Tournament { Competition = atp, TournamentName = "Moselle Open", Slug = "moselle-open", Location = "Metz, France" };
      var st_petersburg_open = new Tournament { Competition = atp, TournamentName = "St. Petersburg Open", Slug = "st-petersburg-open", Location = "St. Petersburg, Russia" };
      var ptt_thailand_open = new Tournament { Competition = atp, TournamentName = "PTT Thailand Open", Slug = "ptt-thailand-open", Location = "Bangkok, Thailand" };
      var malaysian_open_kuala_lumpur = new Tournament { Competition = atp, TournamentName = "Malaysian Open, Kuala Lumpur", Slug = "malaysian-open-kuala-lumpur", Location = "Kuala Lumpur, Malaysia" };
      var china_open = new Tournament { Competition = atp, TournamentName = "China Open", Slug = "china-open", Location = "Beijing, China" };
      var rakuten_japan_open_tennis_championships = new Tournament { Competition = atp, TournamentName = "Rakuten Japan Open Tennis Championships", Slug = "rakuten-japan-open-tennis-championships", Location = "Tokyo, Japan" };
      var shanghai_rolex_masters = new Tournament { Competition = atp, TournamentName = "Shanghai Rolex Masters", Slug = "shanghai-rolex-masters", Location = "Shanghai, China" };
      var erste_bank_open = new Tournament { Competition = atp, TournamentName = "Erste Bank Open", Slug = "erste-bank-open", Location = "Vienna, Austria" };
      var if_stockholm_open = new Tournament { Competition = atp, TournamentName = "If Stockholm Open", Slug = "if-stockholm-open", Location = "Stockholm, Sweden" };
      var kremlin_cup = new Tournament { Competition = atp, TournamentName = "Kremlin Cup", Slug = "kremlin-cup", Location = "Moscow, Russia " };
      var valencia_open_500 = new Tournament { Competition = atp, TournamentName = "Valencia Open 500", Slug = "valencia-open-500", Location = "Valencia, Spain" };
      var swiss_indoors_basel = new Tournament { Competition = atp, TournamentName = "Swiss Indoors Basel", Slug = "swiss-indoors-basel", Location = "Basel, Switzerland" };
      var bnp_paribas_masters = new Tournament { Competition = atp, TournamentName = "BNP Paribas Masters", Slug = "bnp-paribas-masters", Location = "Paris, France" };
      var barclays_atp_world_tour_finals = new Tournament { Competition = atp, TournamentName = "Barclays ATP World Tour Finals", Slug = "barclays-atp-world-tour-finals", Location = "London" };

      //tournament events
      var s2011_t_premierLeague = new TournamentEvent { Tournament = t_premierLeague, EventName = "Premier League (2011/12 season)", Slug = "premier-league-2011-2012", StartDate = new DateTime(2011, 8, 18), EndDate = new DateTime(2012, 5, 19) };
      var s2012_t_premierLeague = new TournamentEvent { Tournament = t_premierLeague, EventName = "Premier League (2012/13 season)", Slug = "premier-league-2012-2013", StartDate = new DateTime(2012, 8, 18), EndDate = new DateTime(2013, 5, 19) };
      var s2012_t_championship = new TournamentEvent { Tournament = t_championship, EventName = "Championship (2012/13 season)", Slug = "championship-2012-2013", StartDate = new DateTime(2012, 8, 17), EndDate = new DateTime(2013, 5, 4) };
      var s2012_t_leagueOne = new TournamentEvent { Tournament = t_leagueOne, EventName = "League One (2012/13 season)", Slug = "league-one-2012-2013", StartDate = new DateTime(2012, 8, 18), EndDate = new DateTime(2013, 5, 4) };
      var s2012_t_leagueTwo = new TournamentEvent { Tournament = t_leagueTwo, EventName = "League Two (2012/13 season)", Slug = "league-two-2012-2013", StartDate = new DateTime(2012, 8, 18), EndDate = new DateTime(2013, 5, 4) };
      var s2012_brisbane_international = new TournamentEvent { Tournament = brisbane_international, EventName = "Brisbane International (2012)", Slug = "brisbane-international-2012-2013", StartDate = new DateTime(2012, 1, 2), EndDate = new DateTime(2012, 1, 8) };
      var s2012_aircel_chennai_open = new TournamentEvent { Tournament = aircel_chennai_open, EventName = "Aircel Chennai Open (2012)", Slug = "aircel-chennai-open-2012-2013", StartDate = new DateTime(2012, 1, 2), EndDate = new DateTime(2012, 1, 8) };
      var s2012_qatar_exxonmobil_open = new TournamentEvent { Tournament = qatar_exxonmobil_open, EventName = "Qatar ExxonMobil Open (2012)", Slug = "qatar-exxonmobil-open-2012-2013", StartDate = new DateTime(2012, 1, 2), EndDate = new DateTime(2012, 1, 8) };
      var s2012_apia_international_sydney = new TournamentEvent { Tournament = apia_international_sydney, EventName = "Apia International Sydney (2012)", Slug = "apia-international-sydney-2012-2013", StartDate = new DateTime(2012, 1, 9), EndDate = new DateTime(2012, 1, 15) };
      var s2012_heineken_open = new TournamentEvent { Tournament = heineken_open, EventName = "Heineken Open (2012)", Slug = "heineken-open-2012-2013", StartDate = new DateTime(2012, 1, 9), EndDate = new DateTime(2012, 1, 15) };
      var s2012_australian_open = new TournamentEvent { Tournament = australian_open, EventName = "Australian Open (2012)", Slug = "australian-open-2012-2013", StartDate = new DateTime(2012, 1, 16), EndDate = new DateTime(2012, 1, 29) };
      var s2012_open_sud_de_france = new TournamentEvent { Tournament = open_sud_de_france, EventName = "Open Sud de France (2012)", Slug = "open-sud-de-france-2012-2013", StartDate = new DateTime(2012, 1, 30), EndDate = new DateTime(2012, 2, 5) };
      var s2012_pbz_zagreb_indoors = new TournamentEvent { Tournament = pbz_zagreb_indoors, EventName = "PBZ Zagreb Indoors (2012)", Slug = "pbz-zagreb-indoors-2012-2013", StartDate = new DateTime(2012, 1, 30), EndDate = new DateTime(2012, 2, 5) };
      var s2012_vtr_open = new TournamentEvent { Tournament = vtr_open, EventName = "VTR Open (2012)", Slug = "vtr-open-2012-2013", StartDate = new DateTime(2012, 1, 30), EndDate = new DateTime(2012, 2, 5) };
      var s2012_abn_amro_world_tennis_tournament = new TournamentEvent { Tournament = abn_amro_world_tennis_tournament, EventName = "ABN AMRO World Tennis Tournament (2012)", Slug = "abn-amro-world-tennis-tournament-2012-2013", StartDate = new DateTime(2012, 2, 13), EndDate = new DateTime(2012, 2, 19) };
      var s2012_brasil_open_2012 = new TournamentEvent { Tournament = brasil_open_2012, EventName = "Brasil Open 2012 (2012)", Slug = "brasil-open-2012-2012-2013", StartDate = new DateTime(2012, 2, 13), EndDate = new DateTime(2012, 2, 19) };
      var s2012_sap_open = new TournamentEvent { Tournament = sap_open, EventName = "SAP Open (2012)", Slug = "sap-open-2012-2013", StartDate = new DateTime(2012, 2, 13), EndDate = new DateTime(2012, 2, 19) };
      var s2012_regions_morgan_keegan_championships = new TournamentEvent { Tournament = regions_morgan_keegan_championships, EventName = "Regions Morgan Keegan Championships (2012)", Slug = "regions-morgan-keegan-championships-2012-2013", StartDate = new DateTime(2012, 2, 20), EndDate = new DateTime(2012, 2, 26) };
      var s2012_copa_claro = new TournamentEvent { Tournament = copa_claro, EventName = "Copa Claro (2012)", Slug = "copa-claro-2012-2013", StartDate = new DateTime(2012, 2, 20), EndDate = new DateTime(2012, 2, 26) };
      var s2012_open_13 = new TournamentEvent { Tournament = open_13, EventName = "Open 13 (2012)", Slug = "open-13-2012-2013", StartDate = new DateTime(2012, 2, 20), EndDate = new DateTime(2012, 2, 26) };
      var s2012_dubai_duty_free_tennis_championships = new TournamentEvent { Tournament = dubai_duty_free_tennis_championships, EventName = "Dubai Duty Free Tennis Championships (2012)", Slug = "dubai-duty-free-tennis-championships-2012-2013", StartDate = new DateTime(2012, 2, 27), EndDate = new DateTime(2012, 3, 4) };
      var s2012_delray_beach_international_tennis_championships = new TournamentEvent { Tournament = delray_beach_international_tennis_championships, EventName = "Delray Beach International Tennis Championships (2012)", Slug = "delray-beach-international-tennis-championships-2012-2013", StartDate = new DateTime(2012, 2, 27), EndDate = new DateTime(2012, 3, 4) };
      var s2012_abierto_mexicano_telcel = new TournamentEvent { Tournament = abierto_mexicano_telcel, EventName = "Abierto Mexicano Telcel (2012)", Slug = "abierto-mexicano-telcel-2012-2013", StartDate = new DateTime(2012, 2, 27), EndDate = new DateTime(2012, 3, 4) };
      var s2012_bnp_paribas_open = new TournamentEvent { Tournament = bnp_paribas_open, EventName = "BNP Paribas Open (2012)", Slug = "bnp-paribas-open-2012-2013", StartDate = new DateTime(2012, 3, 5), EndDate = new DateTime(2012, 3, 18) };
      var s2012_sony_ericsson_open = new TournamentEvent { Tournament = sony_ericsson_open, EventName = "Sony Ericsson Open (2012)", Slug = "sony-ericsson-open-2012-2013", StartDate = new DateTime(2012, 3, 19), EndDate = new DateTime(2012, 4, 1) };
      var s2012_grand_prix_hassan_ii = new TournamentEvent { Tournament = grand_prix_hassan_ii, EventName = "Grand Prix Hassan II (2012)", Slug = "grand-prix-hassan-ii-2012-2013", StartDate = new DateTime(2012, 4, 9), EndDate = new DateTime(2012, 4, 15) };
      var s2012_us_mens_clay_court_championship = new TournamentEvent { Tournament = us_mens_clay_court_championship, EventName = "US Men's Clay Court Championship (2012)", Slug = "us-mens-clay-court-championship-2012-2013", StartDate = new DateTime(2012, 4, 9), EndDate = new DateTime(2012, 4, 15) };
      var s2012_monte_carlo_rolex_masters = new TournamentEvent { Tournament = monte_carlo_rolex_masters, EventName = "Monte-Carlo Rolex Masters (2012)", Slug = "monte-carlo-rolex-masters-2012-2013", StartDate = new DateTime(2012, 4, 16), EndDate = new DateTime(2012, 4, 22) };
      var s2012_brd_nastase_tiriac_trophy = new TournamentEvent { Tournament = brd_nastase_tiriac_trophy, EventName = "BRD Nastase Tiriac Trophy (2012)", Slug = "brd-nastase-tiriac-trophy-2012-2013", StartDate = new DateTime(2012, 4, 23), EndDate = new DateTime(2012, 4, 29) };
      var s2012_barcelona_open_banc_sabadell = new TournamentEvent { Tournament = barcelona_open_banc_sabadell, EventName = "Barcelona Open Banc Sabadell (2012)", Slug = "barcelona-open-banc-sabadell-2012-2013", StartDate = new DateTime(2012, 4, 23), EndDate = new DateTime(2012, 4, 29) };
      var s2012_bmw_open = new TournamentEvent { Tournament = bmw_open, EventName = "BMW Open (2012)", Slug = "bmw-open-2012-2013", StartDate = new DateTime(2012, 4, 30), EndDate = new DateTime(2012, 5, 6) };
      var s2012_serbia_open_2012 = new TournamentEvent { Tournament = serbia_open_2012, EventName = "Serbia Open 2012 (2012)", Slug = "serbia-open-2012-2012-2013", StartDate = new DateTime(2012, 4, 30), EndDate = new DateTime(2012, 5, 6) };
      var s2012_estoril_open = new TournamentEvent { Tournament = estoril_open, EventName = "Estoril Open (2012)", Slug = "estoril-open-2012-2013", StartDate = new DateTime(2012, 4, 30), EndDate = new DateTime(2012, 5, 6) };
      var s2012_mutua_madrid_open = new TournamentEvent { Tournament = mutua_madrid_open, EventName = "Mutua Madrid Open (2012)", Slug = "mutua-madrid-open-2012-2013", StartDate = new DateTime(2012, 5, 7), EndDate = new DateTime(2012, 5, 13) };
      var s2012_internazionali_bnl_ditalia = new TournamentEvent { Tournament = internazionali_bnl_ditalia, EventName = "Internazionali BNL d'Italia (2012)", Slug = "internazionali-bnl-ditalia-2012-2013", StartDate = new DateTime(2012, 5, 14), EndDate = new DateTime(2012, 5, 20) };
      var s2012_open_de_nice_cote_dazur = new TournamentEvent { Tournament = open_de_nice_cote_dazur, EventName = "Open de Nice Côte d’Azur (2012)", Slug = "open-de-nice-cote-dazur-2012-2013", StartDate = new DateTime(2012, 5, 21), EndDate = new DateTime(2012, 5, 27) };
      var s2012_roland_garros = new TournamentEvent { Tournament = roland_garros, EventName = "Roland Garros (2012)", Slug = "roland-garros-2012-2013", StartDate = new DateTime(2012, 5, 28), EndDate = new DateTime(2012, 6, 10) };
      var s2012_gerry_weber_open = new TournamentEvent { Tournament = gerry_weber_open, EventName = "Gerry Weber Open  (2012)", Slug = "gerry-weber-open-2012-2013", StartDate = new DateTime(2012, 6, 11), EndDate = new DateTime(2012, 6, 17) };
      var s2012_aegon_championships = new TournamentEvent { Tournament = aegon_championships, EventName = "AEGON Championships (2012)", Slug = "aegon-championships-2012-2013", StartDate = new DateTime(2012, 6, 11), EndDate = new DateTime(2012, 6, 17) };
      var s2012_unicef_open = new TournamentEvent { Tournament = unicef_open, EventName = "UNICEF Open (2012)", Slug = "unicef-open-2012-2013", StartDate = new DateTime(2012, 6, 18), EndDate = new DateTime(2012, 6, 24) };
      var s2012_aegon_international = new TournamentEvent { Tournament = aegon_international, EventName = "AEGON International (2012)", Slug = "aegon-international-2012-2013", StartDate = new DateTime(2012, 6, 18), EndDate = new DateTime(2012, 6, 24) };
      var s2012_wimbledon = new TournamentEvent { Tournament = wimbledon, EventName = "Wimbledon (2012)", Slug = "wimbledon-2012-2013", StartDate = new DateTime(2012, 6, 25), EndDate = new DateTime(2012, 7, 8) };
      var s2012_mercedescup = new TournamentEvent { Tournament = mercedescup, EventName = "MercedesCup (2012)", Slug = "mercedescup-2012-2013", StartDate = new DateTime(2012, 7, 9), EndDate = new DateTime(2012, 7, 15) };
      var s2012_campbells_hall_of_fame_tennis_championships = new TournamentEvent { Tournament = campbells_hall_of_fame_tennis_championships, EventName = "Campbell’s Hall of Fame Tennis Championships (2012)", Slug = "campbells-hall-of-fame-tennis-championships-2012-2013", StartDate = new DateTime(2012, 7, 9), EndDate = new DateTime(2012, 7, 15) };
      var s2012_skistar_swedish_open = new TournamentEvent { Tournament = skistar_swedish_open, EventName = "SkiStar Swedish Open (2012)", Slug = "skistar-swedish-open-2012-2013", StartDate = new DateTime(2012, 7, 9), EndDate = new DateTime(2012, 7, 15) };
      var s2012_atp_studena_croatia_open = new TournamentEvent { Tournament = atp_vegeta_croatia_open_umag, EventName = "ATP Vegeta Croatia Open Umag (2012)", Slug = "atp-vegeta-croatia-open-umag-2012-2013", StartDate = new DateTime(2012, 7, 9), EndDate = new DateTime(2012, 7, 15) };
      var s2012_bet_at_home_open___german_tennis_championships_2012 = new TournamentEvent { Tournament = bet_at_home_open___german_tennis_championships_2012, EventName = "bet-at-home Open - German Tennis Championships 2012 (2012)", Slug = "bet-at-home-open---german-tennis-championships-2012-2012-2013", StartDate = new DateTime(2012, 7, 16), EndDate = new DateTime(2012, 7, 22) };
      var s2012_atlanta_tennis_championships = new TournamentEvent { Tournament = bbt_atlanta_open, EventName = "Atlanta Tennis Championships (2012)", Slug = "atlanta-tennis-championships-2012-2013", StartDate = new DateTime(2012, 7, 16), EndDate = new DateTime(2012, 7, 22) };
      var s2012_credit_agricole_suisse_open_gstaad = new TournamentEvent { Tournament = credit_agricole_suisse_open_gstaad, EventName = "Crédit Agricole Suisse Open Gstaad (2012)", Slug = "credit-agricole-suisse-open-gstaad-2012-2013", StartDate = new DateTime(2012, 7, 16), EndDate = new DateTime(2012, 7, 22) };
      var s2012_bet_at_home_cup_kitzbuhel = new TournamentEvent { Tournament = bet_at_home_cup_kitzbuhel, EventName = "bet-at-home Cup Kitzbühel (2012)", Slug = "bet-at-home-cup-kitzbuhel-2012-2013", StartDate = new DateTime(2012, 7, 22), EndDate = new DateTime(2012, 7, 28) };
      var s2012_farmers_classic = new TournamentEvent { Tournament = farmers_classic, EventName = "Farmers Classic (2012)", Slug = "farmers-classic-2012-2013", StartDate = new DateTime(2012, 7, 23), EndDate = new DateTime(2012, 7, 29) };
      var s2012_london_2012_olympics = new TournamentEvent { Tournament = london_2012_olympics, EventName = "London 2012 Olympics (2012)", Slug = "london-2012-olympics-2012", StartDate = new DateTime(2012, 07, 28), EndDate = new DateTime(2012, 08, 05) };
      var s2012_legg_mason_tennis_classic = new TournamentEvent { Tournament = legg_mason_tennis_classic, EventName = "Legg Mason Tennis Classic (2012)", Slug = "legg-mason-tennis-classic-2012-2013", StartDate = new DateTime(2012, 7, 30), EndDate = new DateTime(2012, 8, 5) };
      var s2012_rogers_cup = new TournamentEvent { Tournament = rogers_cup, EventName = "Rogers Cup (2012)", Slug = "rogers-cup-2012-2013", StartDate = new DateTime(2012, 8, 6), EndDate = new DateTime(2012, 8, 12) };
      var s2012_western__southern_open = new TournamentEvent { Tournament = western__southern_open, EventName = "Western & Southern Open (2012)", Slug = "western--southern-open-2012-2013", StartDate = new DateTime(2012, 8, 13), EndDate = new DateTime(2012, 8, 19) };
      var s2012_winston_salem_open = new TournamentEvent { Tournament = winston_salem_open, EventName = "Winston-Salem Open (2012)", Slug = "winston-salem-open-2012-2013", StartDate = new DateTime(2012, 8, 19), EndDate = new DateTime(2012, 8, 25) };
      var s2012_us_open = new TournamentEvent { Tournament = us_open, EventName = "US Open (2012)", Slug = "us-open-2012-2013", StartDate = new DateTime(2012, 8, 27), EndDate = new DateTime(2012, 9, 9), TournamentInProgress = true };
      var s2012_moselle_open = new TournamentEvent { Tournament = moselle_open, EventName = "Moselle Open (2012)", Slug = "moselle-open-2012-2013", StartDate = new DateTime(2012, 9, 17), EndDate = new DateTime(2012, 9, 23) };
      var s2012_st_petersburg_open = new TournamentEvent { Tournament = st_petersburg_open, EventName = "St. Petersburg Open (2012)", Slug = "st-petersburg-open-2012-2013", StartDate = new DateTime(2012, 9, 17), EndDate = new DateTime(2012, 9, 23) };
      var s2012_ptt_thailand_open = new TournamentEvent { Tournament = ptt_thailand_open, EventName = "PTT Thailand Open (2012)", Slug = "ptt-thailand-open-2012-2013", StartDate = new DateTime(2012, 9, 24), EndDate = new DateTime(2012, 9, 30) };
      var s2012_malaysian_open_kuala_lumpur = new TournamentEvent { Tournament = malaysian_open_kuala_lumpur, EventName = "Malaysian Open, Kuala Lumpur (2012)", Slug = "malaysian-open-kuala-lumpur-2012-2013", StartDate = new DateTime(2012, 9, 24), EndDate = new DateTime(2012, 9, 30) };
      var s2012_china_open = new TournamentEvent { Tournament = china_open, EventName = "China Open (2012)", Slug = "china-open-2012-2013", StartDate = new DateTime(2012, 10, 1), EndDate = new DateTime(2012, 10, 7) };
      var s2012_rakuten_japan_open_tennis_championships = new TournamentEvent { Tournament = rakuten_japan_open_tennis_championships, EventName = "Rakuten Japan Open Tennis Championships (2012)", Slug = "rakuten-japan-open-tennis-championships-2012-2013", StartDate = new DateTime(2012, 10, 1), EndDate = new DateTime(2012, 10, 7) };
      var s2012_shanghai_rolex_masters = new TournamentEvent { Tournament = shanghai_rolex_masters, EventName = "Shanghai Rolex Masters (2012)", Slug = "shanghai-rolex-masters-2012-2013", StartDate = new DateTime(2012, 10, 7), EndDate = new DateTime(2012, 10, 14) };
      var s2012_erste_bank_open = new TournamentEvent { Tournament = erste_bank_open, EventName = "Erste Bank Open (2012)", Slug = "erste-bank-open-2012-2013", StartDate = new DateTime(2012, 10, 15), EndDate = new DateTime(2012, 10, 21) };
      var s2012_if_stockholm_open = new TournamentEvent { Tournament = if_stockholm_open, EventName = "If Stockholm Open (2012)", Slug = "if-stockholm-open-2012-2013", StartDate = new DateTime(2012, 10, 15), EndDate = new DateTime(2012, 10, 21) };
      var s2012_kremlin_cup = new TournamentEvent { Tournament = kremlin_cup, EventName = "Kremlin Cup (2012)", Slug = "kremlin-cup-2012-2013", StartDate = new DateTime(2012, 10, 15), EndDate = new DateTime(2012, 10, 21) };
      var s2012_valencia_open_500 = new TournamentEvent { Tournament = valencia_open_500, EventName = "Valencia Open 500 (2012)", Slug = "valencia-open-500-2012-2013", StartDate = new DateTime(2012, 10, 22), EndDate = new DateTime(2012, 10, 28) };
      var s2012_swiss_indoors_basel = new TournamentEvent { Tournament = swiss_indoors_basel, EventName = "Swiss Indoors Basel (2012)", Slug = "swiss-indoors-basel-2012-2013", StartDate = new DateTime(2012, 10, 22), EndDate = new DateTime(2012, 10, 28) };
      var s2012_bnp_paribas_masters = new TournamentEvent { Tournament = bnp_paribas_masters, EventName = "BNP Paribas Masters (2012)", Slug = "bnp-paribas-masters-2012-2013", StartDate = new DateTime(2012, 10, 29), EndDate = new DateTime(2012, 11, 4) };
      var s2012_barclays_atp_world_tour_finals = new TournamentEvent { Tournament = barclays_atp_world_tour_finals, EventName = "Barclays ATP World Tour Finals (2012)", Slug = "barclays-atp-world-tour-finals-2012", StartDate = new DateTime(2012, 11, 04), EndDate = new DateTime(2012, 11, 11) };
      //funds
      var premierFund = new Fund { FundName = "Premier", Bank = 500M, Competitions = new List<Competition>() { premierLeague }, KellyMultiplier = 0.25M };
      var footballLeagueFund = new Fund { FundName = "Football League", Bank = 500M, Competitions = new List<Competition>() { championship, leagueOne, leagueTwo }, KellyMultiplier = 0.25M };
      var tennisFund = new Fund { FundName = "ATP", Bank = 500M, Competitions = new List<Competition>() { atp }, KellyMultiplier = 0.25M };

      //external source
      var valueSamurai = new ExternalSource { Source = "Value Samurai", OddsSource = false, TheoreticalOddsSource = false, UseByDefault = false };
      var skySports = new ExternalSource { Source = "Sky Sports", OddsSource = false, TheoreticalOddsSource = false, UseByDefault = false };
      var bestBetting = new ExternalSource { Source = "Best Betting", OddsSource = true, TheoreticalOddsSource = false, UseByDefault = true, PrescreenDecider = true };
      var oddsCheckerMobi = new ExternalSource { Source = "Odds Checker Mobi", OddsSource = true, TheoreticalOddsSource = false, UseByDefault = true };
      var oddsCheckerWeb = new ExternalSource { Source = "Odds Checker Web", OddsSource = true, TheoreticalOddsSource = false, UseByDefault = false };
      var tennisDataOdds = new ExternalSource { Source = "Tennis Data Odds", OddsSource = true, TheoreticalOddsSource = true, UseByDefault = false };
      var footballDataOdds = new ExternalSource { Source = "Football Data Odds", OddsSource = true, TheoreticalOddsSource = true, UseByDefault = false };
      var tb365 = new ExternalSource { Source = "Tennis Betting 365", OddsSource = false, TheoreticalOddsSource = false, UseByDefault = false };
      var finkTank = new ExternalSource { Source = "Fink Tank (dectech)", OddsSource = false, TheoreticalOddsSource = false, UseByDefault = false };

      //match outcomes
      var teamOrPlayerAWin = new MatchOutcome { MatchOutcomeString = "Home Win" };
      var draw = new MatchOutcome { MatchOutcomeString = "Draw" };
      var teamOrPlayerBWin = new MatchOutcome { MatchOutcomeString = "Away Win" };

      //score outcomes
      var scoreOutcomesNormal = 
      (
        from scoreA in Enumerable.Range(0, 21)
        from scoreB in Enumerable.Range(0, 21)
        let outcome = (scoreA == scoreB ? draw : (scoreA > scoreB ? teamOrPlayerAWin : teamOrPlayerBWin))
        select new ScoreOutcome
        {
          TeamAScore = scoreA,
          TeamBScore = scoreB,
          MatchOutcome = outcome
        }
      ).ToArray();

      var additionalTennisScoreOutcomes = //handles the situation where a tennis match might be 1-1 and player B retires so A wins.
      (
        from scoreA in Enumerable.Range(0, 4)
        from scoreB in Enumerable.Range(0, 4)
        from playerAWin in Enumerable.Range(1, 2)
        let outcome = (playerAWin == 1 ? teamOrPlayerAWin : teamOrPlayerBWin)
        select new ScoreOutcome
        {
          TeamAScore = scoreA,
          TeamBScore = scoreB,
          MatchOutcome = outcome
        }
      ).ToArray();

      var scoreOutcomes = 
        scoreOutcomesNormal
          .Union(additionalTennisScoreOutcomes)
          .Distinct()
          .ToArray();

      //teams
      var arsenal = new TeamPlayer { Name = "Arsenal", Slug = "arsenal", ExternalID = "0" };
      var astonvilla = new TeamPlayer { Name = "Aston Villa", Slug = "aston-villa", ExternalID = "1" };
      var birmingham = new TeamPlayer { Name = "Birmingham", Slug = "birmingham", ExternalID = "2" };
      var blackburn = new TeamPlayer { Name = "Blackburn", Slug = "blackburn", ExternalID = "3" };
      var blackpool = new TeamPlayer { Name = "Blackpool", Slug = "blackpool", ExternalID = "45" };
      var bolton = new TeamPlayer { Name = "Bolton", Slug = "bolton", ExternalID = "4" };
      var chelsea = new TeamPlayer { Name = "Chelsea", Slug = "chelsea", ExternalID = "6" };
      var everton = new TeamPlayer { Name = "Everton", Slug = "everton", ExternalID = "7" };
      var fulham = new TeamPlayer { Name = "Fulham", Slug = "fulham", ExternalID = "8" };
      var liverpool = new TeamPlayer { Name = "Liverpool", Slug = "liverpool", ExternalID = "10" };
      var mancity = new TeamPlayer { Name = "Man City", Slug = "man-city", ExternalID = "11" };
      var manunited = new TeamPlayer { Name = "Man United", Slug = "man-united", ExternalID = "12" };
      var newcastle = new TeamPlayer { Name = "Newcastle", Slug = "newcastle", ExternalID = "14" };
      var stoke = new TeamPlayer { Name = "Stoke", Slug = "stoke", ExternalID = "39" };
      var sunderland = new TeamPlayer { Name = "Sunderland", Slug = "sunderland", ExternalID = "16" };
      var tottenham = new TeamPlayer { Name = "Tottenham", Slug = "tottenham", ExternalID = "17" };
      var westbrom = new TeamPlayer { Name = "West Brom", Slug = "west-brom", ExternalID = "18" };
      var westham = new TeamPlayer { Name = "West Ham", Slug = "west-ham", ExternalID = "19" };
      var wigan = new TeamPlayer { Name = "Wigan", Slug = "wigan", ExternalID = "66" };
      var wolves = new TeamPlayer { Name = "Wolves", Slug = "wolves", ExternalID = "43" };
      var barnsley = new TeamPlayer { Name = "Barnsley", Slug = "barnsley", ExternalID = "44" };
      var bristolcity = new TeamPlayer { Name = "Bristol City", Slug = "bristol-city", ExternalID = "47" };
      var burnley = new TeamPlayer { Name = "Burnley", Slug = "burnley", ExternalID = "22" };
      var cardiff = new TeamPlayer { Name = "Cardiff", Slug = "cardiff", ExternalID = "48" };
      var coventry = new TeamPlayer { Name = "Coventry", Slug = "coventry", ExternalID = "23" };
      var crystalpalace = new TeamPlayer { Name = "Crystal Palace", Slug = "crystal-palace", ExternalID = "24" };
      var derby = new TeamPlayer { Name = "Derby", Slug = "derby", ExternalID = "25" };
      var doncaster = new TeamPlayer { Name = "Doncaster", Slug = "doncaster", ExternalID = "95" };
      var hull = new TeamPlayer { Name = "Hull", Slug = "hull", ExternalID = "77" };
      var ipswich = new TeamPlayer { Name = "Ipswich", Slug = "ipswich", ExternalID = "28" };
      var leeds = new TeamPlayer { Name = "Leeds", Slug = "leeds", ExternalID = "9" };
      var leicester = new TeamPlayer { Name = "Leicester", Slug = "leicester", ExternalID = "29" };
      var middlesboro = new TeamPlayer { Name = "Middlesboro", Slug = "middlesboro", ExternalID = "13" };
      var millwall = new TeamPlayer { Name = "Millwall", Slug = "millwall", ExternalID = "30" };
      var norwich = new TeamPlayer { Name = "Norwich", Slug = "norwich", ExternalID = "31" };
      var nottmforest = new TeamPlayer { Name = "Nott'm Forest", Slug = "nottm-forest", ExternalID = "32" };
      var portsmouth = new TeamPlayer { Name = "Portsmouth", Slug = "portsmouth", ExternalID = "33" };
      var preston = new TeamPlayer { Name = "Preston", Slug = "preston", ExternalID = "34" };
      var qpr = new TeamPlayer { Name = "QPR", Slug = "qpr", ExternalID = "62" };
      var reading = new TeamPlayer { Name = "Reading", Slug = "reading", ExternalID = "35" };
      var scunthorpe = new TeamPlayer { Name = "Scunthorpe", Slug = "scunthorpe", ExternalID = "85" };
      var sheffieldunited = new TeamPlayer { Name = "Sheffield United", Slug = "sheffield-united", ExternalID = "37" };
      var swansea = new TeamPlayer { Name = "Swansea", Slug = "swansea", ExternalID = "88" };
      var watford = new TeamPlayer { Name = "Watford", Slug = "watford", ExternalID = "41" };
      var bournemouth = new TeamPlayer { Name = "Bournemouth", Slug = "bournemouth", ExternalID = "69" };
      var brentford = new TeamPlayer { Name = "Brentford", Slug = "brentford", ExternalID = "46" };
      var brighton = new TeamPlayer { Name = "Brighton", Slug = "brighton", ExternalID = "21" };
      var bristolrvs = new TeamPlayer { Name = "Bristol Rvs", Slug = "bristol-rvs", ExternalID = "70" };
      var carlisle = new TeamPlayer { Name = "Carlisle", Slug = "carlisle", ExternalID = "73" };
      var charlton = new TeamPlayer { Name = "Charlton", Slug = "charlton", ExternalID = "5" };
      var colchester = new TeamPlayer { Name = "Colchester", Slug = "colchester", ExternalID = "51" };
      var dagandred = new TeamPlayer { Name = "Dag and Red", Slug = "dag-and-red", ExternalID = "2005" };
      var exeter = new TeamPlayer { Name = "Exeter", Slug = "exeter", ExternalID = "75" };
      var hartlepool = new TeamPlayer { Name = "Hartlepool", Slug = "hartlepool", ExternalID = "76" };
      var huddersfield = new TeamPlayer { Name = "Huddersfield", Slug = "huddersfield", ExternalID = "53" };
      var leytonorient = new TeamPlayer { Name = "Leyton Orient", Slug = "leyton-orient", ExternalID = "79" };
      var miltonkeynes = new TeamPlayer { Name = "Milton Keynes", Slug = "milton-keynes", ExternalID = "42" };
      var nottscounty = new TeamPlayer { Name = "Notts County", Slug = "notts-county", ExternalID = "57" };
      var oldham = new TeamPlayer { Name = "Oldham", Slug = "oldham", ExternalID = "58" };
      var peterboro = new TeamPlayer { Name = "Peterboro", Slug = "peterboro", ExternalID = "59" };
      var plymouth = new TeamPlayer { Name = "Plymouth", Slug = "plymouth", ExternalID = "60" };
      var rochdale = new TeamPlayer { Name = "Rochdale", Slug = "rochdale", ExternalID = "83" };
      var sheffieldweds = new TeamPlayer { Name = "Sheffield Weds", Slug = "sheffield-weds", ExternalID = "38" };
      var southampton = new TeamPlayer { Name = "Southampton", Slug = "southampton", ExternalID = "15" };
      var swindon = new TeamPlayer { Name = "Swindon", Slug = "swindon", ExternalID = "64" };
      var tranmere = new TeamPlayer { Name = "Tranmere", Slug = "tranmere", ExternalID = "65" };
      var walsall = new TeamPlayer { Name = "Walsall", Slug = "walsall", ExternalID = "40" };
      var yeovil = new TeamPlayer { Name = "Yeovil", Slug = "yeovil", ExternalID = "96" };
      var accrington = new TeamPlayer { Name = "Accrington", Slug = "accrington", ExternalID = "97" };
      var aldershot = new TeamPlayer { Name = "Aldershot", Slug = "aldershot", ExternalID = "2000" };
      var barnet = new TeamPlayer { Name = "Barnet", Slug = "barnet", ExternalID = "92" };
      var bradford = new TeamPlayer { Name = "Bradford", Slug = "bradford", ExternalID = "20" };
      var burton = new TeamPlayer { Name = "Burton", Slug = "burton", ExternalID = "2002" };
      var bury = new TeamPlayer { Name = "Bury", Slug = "bury", ExternalID = "71" };
      var cheltenham = new TeamPlayer { Name = "Cheltenham", Slug = "cheltenham", ExternalID = "49" };
      var chesterfield = new TeamPlayer { Name = "Chesterfield", Slug = "chesterfield", ExternalID = "50" };
      var crewe = new TeamPlayer { Name = "Crewe", Slug = "crewe", ExternalID = "52" };
      var gillingham = new TeamPlayer { Name = "Gillingham", Slug = "gillingham", ExternalID = "26" };
      var hereford = new TeamPlayer { Name = "Hereford", Slug = "hereford", ExternalID = "98" };
      var lincolncity = new TeamPlayer { Name = "Lincoln City", Slug = "lincoln-city", ExternalID = "80" };
      var macclesfield = new TeamPlayer { Name = "Macclesfield", Slug = "macclesfield", ExternalID = "81" };
      var morecambe = new TeamPlayer { Name = "Morecambe", Slug = "morecambe", ExternalID = "2009" };
      var northampton = new TeamPlayer { Name = "Northampton", Slug = "northampton", ExternalID = "56" };
      var oxford = new TeamPlayer { Name = "Oxford", Slug = "oxford", ExternalID = "82" };
      var portvale = new TeamPlayer { Name = "Port Vale", Slug = "port-vale", ExternalID = "61" };
      var rotherham = new TeamPlayer { Name = "Rotherham", Slug = "rotherham", ExternalID = "36" };
      var shrewsbury = new TeamPlayer { Name = "Shrewsbury", Slug = "shrewsbury", ExternalID = "86" };
      var southend = new TeamPlayer { Name = "Southend", Slug = "southend", ExternalID = "87" };
      var stevenage = new TeamPlayer { Name = "Stevenage", Slug = "stevenage", ExternalID = "2015" };
      var stockport = new TeamPlayer { Name = "Stockport", Slug = "stockport", ExternalID = "63" };
      var torquay = new TeamPlayer { Name = "Torquay", Slug = "torquay", ExternalID = "89" };
      var wycombe = new TeamPlayer { Name = "Wycombe", Slug = "wycombe", ExternalID = "67" };
      var afcwimbledon = new TeamPlayer { Name = "AFC Wimbledon", Slug = "afc-wimbledon", ExternalID = "2029" };
      var crawleytown = new TeamPlayer { Name = "Crawley Town", Slug = "crawley-town", ExternalID = "2004" };
      var fleetwoodtown = new TeamPlayer { Name = "Fleetwood Town", Slug = "fleetwood-town", ExternalID = "2033" };
      var york = new TeamPlayer { Name = "York", Slug = "york", ExternalID = "91" };

      //Alias
      var ocm_manunited = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = manunited, Alias = "Man Utd" };
      var ocm_wolves = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = wolves, Alias = "Wolverhampton" };
      var ocm_middlesboro = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = middlesboro, Alias = "Middlesbrough" };
      var ocm_nottmforest = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = nottmforest, Alias = "Nottingham Forest" };
      var ocm_sheffieldunited = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = sheffieldunited, Alias = "Sheffield Utd" };
      var ocm_bristolrvs = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = bristolrvs, Alias = "Bristol Rovers" };
      var ocm_dagandred = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = dagandred, Alias = "Dagenham & Redbridge" };
      var ocm_miltonkeynes = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = miltonkeynes, Alias = "MK Dons" };
      var ocm_nottscounty = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = nottscounty, Alias = "Notts Co" };
      var ocm_peterboro = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = peterboro, Alias = "Peterborough" };
      var ocm_sheffieldweds = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = sheffieldweds, Alias = "Sheffield Wednesday" };
      var ocm_lincolncity = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = lincolncity, Alias = "Lincoln" };
      var ocm_crawleytown = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerMobi, TeamsPlayer = crawleytown, Alias = "Crawley" };

      var ocw_manunited = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = manunited, Alias = "Man Utd" };
      var ocw_wolves = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = wolves, Alias = "Wolverhampton" };
      var ocw_middlesboro = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = middlesboro, Alias = "Middlesbrough" };
      var ocw_nottmforest = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = nottmforest, Alias = "Nottingham Forest" };
      var ocw_sheffieldunited = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = sheffieldunited, Alias = "Sheffield Utd" };
      var ocw_bristolrvs = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = bristolrvs, Alias = "Bristol Rovers" };
      var ocw_dagandred = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = dagandred, Alias = "Dagenham & Redbridge" };
      var ocw_miltonkeynes = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = miltonkeynes, Alias = "MK Dons" };
      var ocw_nottscounty = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = nottscounty, Alias = "Notts Co" };
      var ocw_peterboro = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = peterboro, Alias = "Peterborough" };
      var ocw_sheffieldweds = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = sheffieldweds, Alias = "Sheffield Wednesday" };
      var ocw_lincolncity = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = lincolncity, Alias = "Lincoln" };
      var ocw_crawleytown = new TeamPlayerExternalSourceAlias { ExternalSource = oddsCheckerWeb, TeamsPlayer = crawleytown, Alias = "Crawley" };


      var bb_birmingham = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = birmingham, Alias = "Birmingham City" };
      var bb_blackburn = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = blackburn, Alias = "Blackburn Rovers" };
      var bb_bolton = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = bolton, Alias = "Bolton Wanderers" };
      var bb_mancity = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = mancity, Alias = "Manchester City" };
      var bb_manunited = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = manunited, Alias = "Manchester United" };
      var bb_newcastle = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = newcastle, Alias = "Newcastle United" };
      var bb_stoke = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = stoke, Alias = "Stoke City" };
      var bb_tottenham = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = tottenham, Alias = "Tottenham Hotspur" };
      var bb_westbrom = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = westbrom, Alias = "West Bromwich Albion" };
      var bb_wigan = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = wigan, Alias = "Wigan Athletic" };
      var bb_wolves = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = wolves, Alias = "Wolverhampton Wanderers" };
      var bb_cardiff = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = cardiff, Alias = "Cardiff City" };
      var bb_coventry = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = coventry, Alias = "Coventry City" };
      var bb_derby = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = derby, Alias = "Derby County" };
      var bb_doncaster = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = doncaster, Alias = "Doncaster Rovers" };
      var bb_hull = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = hull, Alias = "Hull City" };
      var bb_ipswich = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = ipswich, Alias = "Ipswich Town" };
      var bb_leeds = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = leeds, Alias = "Leeds United" };
      var bb_leicester = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = leicester, Alias = "Leicester City" };
      var bb_middlesboro = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = middlesboro, Alias = "Middlesbrough" };
      var bb_norwich = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = norwich, Alias = "Norwich City" };
      var bb_nottmforest = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = nottmforest, Alias = "Nottingham Forest" };
      var bb_preston = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = preston, Alias = "Preston North End" };
      var bb_qpr = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = qpr, Alias = "Queens Park Rangers" };
      var bb_scunthorpe = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = scunthorpe, Alias = "Scunthorpe United" };
      var bb_swansea = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = swansea, Alias = "Swansea City" };
      var bb_bournemouth = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = bournemouth, Alias = "AFC Bournemouth" };
      var bb_brighton = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = brighton, Alias = "Brighton & Hove Albion" };
      var bb_bristolrvs = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = bristolrvs, Alias = "Bristol Rovers" };
      var bb_carlisle = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = carlisle, Alias = "Carlisle United" };
      var bb_charlton = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = charlton, Alias = "Charlton Athletic" };
      var bb_colchester = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = colchester, Alias = "Colchester United" };
      var bb_dagandred = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = dagandred, Alias = "Dagenham & Redbridge" };
      var bb_exeter = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = exeter, Alias = "Exeter City" };
      var bb_hartlepool = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = hartlepool, Alias = "Hartlepool United" };
      var bb_huddersfield = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = huddersfield, Alias = "Huddersfield Town" };
      var bb_miltonkeynes = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = miltonkeynes, Alias = "Milton Keynes Dons" };
      var bb_oldham = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = oldham, Alias = "Oldham Athletic" };
      var bb_peterboro = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = peterboro, Alias = "Peterborough United" };
      var bb_plymouth = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = plymouth, Alias = "Plymouth Argyle" };
      var bb_sheffieldweds = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = sheffieldweds, Alias = "Sheffield Wednesday" };
      var bb_swindon = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = swindon, Alias = "Swindon Town" };
      var bb_tranmere = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = tranmere, Alias = "Tranmere Rovers" };
      var bb_yeovil = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = yeovil, Alias = "Yeovil Town" };
      var bb_accrington = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = accrington, Alias = "Accrington Stanley" };
      var bb_aldershot = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = aldershot, Alias = "Aldershot Town" };
      var bb_bradford = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = bradford, Alias = "Bradford City" };
      var bb_burton = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = burton, Alias = "Burton Albion" };
      var bb_cheltenham = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = cheltenham, Alias = "Cheltenham Town" };
      var bb_crewe = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = crewe, Alias = "Crewe Alexandra" };
      var bb_hereford = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = hereford, Alias = "Hereford United" };
      var bb_lincolncity = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = lincolncity, Alias = "Lincoln City" };
      var bb_macclesfield = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = macclesfield, Alias = "Macclesfield Town" };
      var bb_northampton = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = northampton, Alias = "Northampton Town" };
      var bb_oxford = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = oxford, Alias = "Oxford United" };
      var bb_rotherham = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = rotherham, Alias = "Rotherham United" };
      var bb_shrewsbury = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = shrewsbury, Alias = "Shrewsbury Town" };
      var bb_southend = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = southend, Alias = "Southend United" };
      var bb_stockport = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = stockport, Alias = "Stockport County" };
      var bb_torquay = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = torquay, Alias = "Torquay United" };
      var bb_wycombe = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = wycombe, Alias = "Wycombe Wanderers" };
      var bb_york = new TeamPlayerExternalSourceAlias { ExternalSource = bestBetting, TeamsPlayer = york, Alias = "York City" };

      var ss_astonvilla = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = astonvilla, Alias = "A Villa" };
      var ss_afcwimbledon = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = afcwimbledon, Alias = "AFC W'don" };
      var ss_bournemouth = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = bournemouth, Alias = "Bournemth" };
      var ss_bristolcity = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = bristolcity, Alias = "Bristol C" };
      var ss_bristolrvs = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = bristolrvs, Alias = "Bristol R" };
      var ss_burton = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = burton, Alias = "Burton Alb" };
      var ss_crystalpalace = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = crystalpalace, Alias = "C Palace" };
      var ss_chesterfield = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = chesterfield, Alias = "Chesterfld" };
      var ss_crawleytown = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = crawleytown, Alias = "Crawley" };
      var ss_dagandred = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = dagandred, Alias = "Dag + Red" };
      var ss_fleetwoodtown = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = fleetwoodtown, Alias = "Fleetwood" };
      var ss_huddersfield = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = huddersfield, Alias = "Huddersfld" };
      var ss_hull = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = hull, Alias = "Hull City" };
      var ss_leytonorient = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = leytonorient, Alias = "Leyton Or" };
      var ss_manunited = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = manunited, Alias = "Man Utd" };
      var ss_middlesboro = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = middlesboro, Alias = "Middlesbro'" };
      var ss_miltonkeynes = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = miltonkeynes, Alias = "MK Dons" };
      var ss_nottmforest = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = nottmforest, Alias = "N Forest" };
      var ss_northampton = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = northampton, Alias = "Northamptn" };
      var ss_nottscounty = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = nottscounty, Alias = "Notts Co" };
      var ss_oxford = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = oxford, Alias = "Oxford Utd" };
      var ss_sheffieldunited = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = sheffieldunited, Alias = "Sheff Utd" };
      var ss_sheffieldweds = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = sheffieldweds, Alias = "Sheff Wed" };
      var ss_southampton = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = southampton, Alias = "Southamptn" };
      var ss_stoke = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = stoke, Alias = "Stoke City" };
      var ss_york = new TeamPlayerExternalSourceAlias { ExternalSource = skySports, TeamsPlayer = york, Alias = "York City" };

      var bbb_skybet = new BookmakerExternalSourceAlias { ExternalSource = bestBetting, Bookmaker = bsky_bet, Alias = "Skybet" };
      var bbb_sportingbet = new BookmakerExternalSourceAlias { ExternalSource = bestBetting, Bookmaker = bsporting_bet, Alias = "Sportingbet" };
      var bbb_888sport = new BookmakerExternalSourceAlias { ExternalSource = bestBetting, Bookmaker = b888sport, Alias = "888 Sport" };
      var bbb_totesport = new BookmakerExternalSourceAlias { ExternalSource = bestBetting, Bookmaker = btotesport, Alias = "totesport" };

      var fdbbet_365 = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bbet_365, Alias = "B365" };
      var fdbblue_square = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bblue_square, Alias = "BS" };
      var fdbladbrokes = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bladbrokes, Alias = "LB" };
      var fdbpinnacle_sports = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bpinnacle_sports, Alias = "PS" };
      var fdbsporting_bet = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bsporting_bet, Alias = "SB" };
      var fdbstan_james = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bstan_james, Alias = "SJ" };
      var fdbwilliam_hill = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bwilliam_hill, Alias = "WH" };
      var fdbbet_win = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bbet_win, Alias = "BW" };
      var fdbgamebookers = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bgamebookers, Alias = "GB" };
      var fdbinterwetten = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = binterwetten, Alias = "IW" };
      var fdbsporting_odds = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bsporting_odds, Alias = "SO" };
      var fdbstanleybet = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bstanleybet, Alias = "SY" };
      var fdbbetvictor = new BookmakerExternalSourceAlias { ExternalSource = footballDataOdds, Bookmaker = bbetvictor, Alias = "VC" };

      var tdbbet_365 = new BookmakerExternalSourceAlias { ExternalSource = tennisDataOdds, Bookmaker = bbet_365, Alias = "B365" };
      var tdbexpekt = new BookmakerExternalSourceAlias { ExternalSource = tennisDataOdds, Bookmaker = bexpekt, Alias = "EX" };
      var tdbladbrokes = new BookmakerExternalSourceAlias { ExternalSource = tennisDataOdds, Bookmaker = bladbrokes, Alias = "LB" };
      var tdbpinnacle_sports = new BookmakerExternalSourceAlias { ExternalSource = tennisDataOdds, Bookmaker = bpinnacle_sports, Alias = "PS" };
      var tdbstan_james = new BookmakerExternalSourceAlias { ExternalSource = tennisDataOdds, Bookmaker = bstan_james, Alias = "SJ" };

      var tcb_premierLeague = new TournamentCouponURL { Tournament = t_premierLeague, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/football/england/premier-league/" };
      var tcb_championship = new TournamentCouponURL { Tournament = t_championship, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/football/england/football-league-championship/" };
      var tcb_leagueOne = new TournamentCouponURL { Tournament = t_leagueOne, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/football/england/league-one/" };
      var tcb_leagueTwo = new TournamentCouponURL { Tournament = t_leagueTwo, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/football/england/league-two/" };
      var tcb_us_open = new TournamentCouponURL { Tournament = us_open, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/tennis/u-s-open-men's-singles/" };
      var tcb_western__southern_open = new TournamentCouponURL { Tournament = western__southern_open, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/tennis/cincinnati-masters-men's-singles/" };

      var tcow_premierLeague = new TournamentCouponURL { Tournament = t_premierLeague, ExternalSource = oddsCheckerWeb, CouponURL = "http://www.oddschecker.com/football/english/premier-league" };
      var tcow_championship = new TournamentCouponURL { Tournament = t_championship, ExternalSource = oddsCheckerWeb, CouponURL = "http://www.oddschecker.com/football/english/championship" };
      var tcow_leagueOne = new TournamentCouponURL { Tournament = t_leagueOne, ExternalSource = oddsCheckerWeb, CouponURL = "http://www.oddschecker.com/football/english/league-1" };
      var tcow_leagueTwo = new TournamentCouponURL { Tournament = t_leagueTwo, ExternalSource = oddsCheckerWeb, CouponURL = "http://www.oddschecker.com/football/english/league-2" };

      var tcom_premierLeague = new TournamentCouponURL { Tournament = t_premierLeague, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/football/english/premier-league" };
      var tcom_championship = new TournamentCouponURL { Tournament = t_championship, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/football/english/championship" };
      var tcom_leagueOne = new TournamentCouponURL { Tournament = t_leagueOne, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/football/english/league-1" };
      var tcom_leagueTwo = new TournamentCouponURL { Tournament = t_leagueTwo, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/football/english/league-2" };
      var tcom_us_open = new TournamentCouponURL { Tournament = us_open, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/tennis/us-open/mens-us-open" };
      var tcom_western__southern_open = new TournamentCouponURL { Tournament = western__southern_open, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/tennis/atp-cincinnati" };
      
      var ccb_premierLeague = new CompetitionCouponURL { Competition = premierLeague, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/football/england/premier-league/" };
      var ccb_championship = new CompetitionCouponURL { Competition = championship, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/football/england/football-league-championship/" };
      var ccb_leagueOne = new CompetitionCouponURL { Competition = leagueOne, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/football/england/league-one/" };
      var ccb_leagueTwo = new CompetitionCouponURL { Competition = leagueTwo, ExternalSource = bestBetting, CouponURL = "http://odds.bestbetting.com/football/england/league-two/" };
      var ccow_premierLeague = new CompetitionCouponURL { Competition = premierLeague, ExternalSource = oddsCheckerWeb, CouponURL = "http://www.oddschecker.com/football/english/premier-league" };
      var ccow_championship = new CompetitionCouponURL { Competition = championship, ExternalSource = oddsCheckerWeb, CouponURL = "http://www.oddschecker.com/football/english/championship" };
      var ccow_leagueOne = new CompetitionCouponURL { Competition = leagueOne, ExternalSource = oddsCheckerWeb, CouponURL = "http://www.oddschecker.com/football/english/league-1" };
      var ccow_leagueTwo = new CompetitionCouponURL { Competition = leagueTwo, ExternalSource = oddsCheckerWeb, CouponURL = "http://www.oddschecker.com/football/english/league-2" };
      var ccom_premierLeague = new CompetitionCouponURL { Competition = premierLeague, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/football/english/premier-league" };
      var ccom_championship = new CompetitionCouponURL { Competition = championship, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/football/english/championship" };
      var ccom_leagueOne = new CompetitionCouponURL { Competition = leagueOne, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/football/english/league-1" };
      var ccom_leagueTwo = new CompetitionCouponURL { Competition = leagueTwo, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/football/english/league-2" };

      var ccb_atp = new CompetitionCouponURL { Competition = atp, ExternalSource = oddsCheckerMobi, CouponURL = "http://odds.bestbetting.com/tennis/" };
      var ccow_atp = new CompetitionCouponURL { Competition = atp, ExternalSource = oddsCheckerMobi, CouponURL = "http://www.oddschecker.com/tennis/mens-tour" };
      var ccom_atp = new CompetitionCouponURL { Competition = atp, ExternalSource = oddsCheckerMobi, CouponURL = "http://oddschecker.mobi/tennis/mens-tour" };

      var comsComplete = new OutcomeComment { Comment = "Completed" };
      var comsRetired = new OutcomeComment { Comment = "Retired" };
      var comsWalkOver = new OutcomeComment { Comment = "Walk-over" };

      #region OddsCheckerJavaScript
      var oddsCheckerJavaScript = new KeyValuePair 
      { 
        Key = "OddsCheckerJavaScript",
        Value = "\r\nvar marketCategoryGroupId = 2;\r\nvar repub = 'OC';\r\nvar sportname = 'football';\r\nvar eventdetails = 'something';\r\nvar is_mobile_device = false;\r\nvar mobile_device = 'Full Browser';\r\n\r\nvar eventNameBetslip = \"\";\r\nvar isTotalBSlip = false;\r\nvar numPopUp = 0;\r\n\r\nvar localAffids = new Array();\r\nvar bLinks = new Array();\r\nvar returnUrl = \"\";\r\nvar twoLevelEncodeFlag = new Array(\"BF\", \"VC\");\r\nvar bookieSpecialEncode = new Array(\"NE\");\r\n\r\nlocalAffids['BS'] = '134';\r\nbLinks['BS'] = 'http://ads.bluesq.com/redirect.aspx?pid=5313&bid=1295';\r\nlocalAffids['WH'] = 'oddschecker4';\r\nbLinks['WH'] = 'http://serve.williamhill.com/promoRedirect?member=oddschecker4&campaign=DEFAULT&channel=DEFAULT&zone=908371216&lp=908300452&var3=en/nui/free-bet/%23';\r\nlocalAffids['PP'] = '10065393';\r\nlocalAffids['SO'] = '11849';\r\nbLinks['SO'] = 'http://partner.sbaffiliates.com/processing/clickthrgh.asp?btag=a_23499b_4257'; //LP Special link\r\nlocalAffids['SOX'] = '3528';\r\nlocalAffids['LD'] = '69790';\r\nbLinks['LD'] = 'http://affiliates.score-affiliates.com/processing/clickthrgh.asp?btag=a_69790b_1870';\r\nlocalAffids['VC'] = '2220';\r\nbLinks['VC'] = 'http://www.betvictor.com/offers/sports/?btagid=12398600';\r\nlocalAffids['CE'] = '80201334';\r\nbLinks['CE'] = 'http://affiliates.galacoral.com/processing/clickthrgh.asp?btag=a_554b_2688'; //Normal Link\r\nlocalAffids['B3'] = 'odc10';\r\nbLinks['B3'] = 'http://www.bet365.com?affiliate=odc10';\r\nbLinks['BI'] = 'http://adfarm.mediaplex.com/ad/ck/6730-84307-35849-2';\r\nlocalAffids['BF'] = '63';\r\nbLinks['BF'] = 'http://ads.betfair.com/redirect.aspx?pid=63&bid=6991';\r\nlocalAffids['BD'] = '122';\r\nbLinks['BD'] = 'http://www.betdaq.com/UI/?pc=ALLBDQ04&AFF_ID=10569';\r\nlocalAffids['BX'] = '9';\r\nbLinks['BX'] = 'http://banners.totesport.com/processing/clickthrgh.asp?btag=a_339b_235';\r\nlocalAffids['SI'] = '6875';\r\nbLinks['SI'] = 'http://ad.doubleclick.net/clk;250465053;75322988;n?http://www.sportingindex.com/search/betting/?tpid=6875';\r\nlocalAffids['FR'] = '3478';\r\nbLinks['FR'] = 'http://partners.betfredaffiliates.com/processing/clickthrgh.asp?btag=a_2983b_766';\r\nlocalAffids['SJ'] = '201504';\r\nbLinks['SJ'] = 'http://www.stanjames.com/onlinepromo/oddschecker/default.aspx';\r\nlocalAffids['WB'] = 'ODC001';\r\nbLinks['WB'] = 'http://www.wbx.com?ref=ODC001';\r\nlocalAffids['BY'] = '43';\r\nbLinks['BY'] = 'http://www.boylesports.com/landing/sports/freebet20/index.aspx?idfiadvert=21&fimsoec=1&idfiacampaign=43';\r\nlocalAffids['EE'] = '391705';\r\nbLinks['EE'] = 'http://promo.888.com/888sport/lp/combined_offers/oddschecker_header_oc2.htm?sr=114951';\r\nlocalAffids['BW'] = '67479';\r\nbLinks['BW'] = 'http://adserver.itsfogo.com/click.aspx?zoneid=73857';\r\nlocalAffids['BO'] = '3319084';\r\nbLinks['BO'] = 'http://sports.bodog.co.uk/welcome/3319084';\r\nbLinks['BC'] = 'http://ww392.smartadserver.com/call/cliccommand/3638960/135955/[timestamp]/[reference]?';\r\nbLinks['WI'] = 'http://adserver.itsfogo.com/click.aspx?zoneid=159211';\r\nlocalAffids['RD'] = 'NRF_656027_OC001';\r\nbLinks['RD'] = 'http://resources.32red.com/redirect.aspx?pid=19140&bid=3099';\r\nlocalAffids['NE'] = '10586';\r\nbLinks['NE'] = 'http://www.livepartners.it/affiliate/tracking/click/?id=10586&bid=138&lang=it&home';\r\nlocalAffids['EU'] = '111478';\r\nbLinks['EU'] = 'http://www.eurobet.it/sb.go?page=bannertrack&site=5&origin=111476';\r\nbLinks['SM'] = 'https://sgc.sisal.it/srvpartner/partnershipRedirect?pid=158&camid=9';\r\nbLinks['IZ'] = 'https://www.iziplay.it/registrazione/lp-scommessa-persa?s=confrontaquote';\r\nbLinks['LM'] = 'http://www.clickpoint.it/db/goto.cp?PRO=172307&ID=18998&SUB=';\r\nbLinks['TO'] = 'http://www.clickpoint.it/db/goto.cp?PRO=172308&ID=21334&SUB=';\r\nbLinks['EB'] = 'http://www.188bet.com/en-gb/sports?btag=a_1290b_35';\r\nbLinks['GI'] = 'http://goto.giocodigitale.it/goto/cp/cross_page.html?target=http://lp.giocodigitale.it/lp/lp_scommesse/lp_scommesse.html&cmp=CP_67375_3_confrontaquote_MultiRevenueShare';\r\nbLinks['UI'] = 'http://adserving.unibet.com/redirect.aspx?pid=40242&bid=17368';\r\nbLinks['IN'] = 'http://conversionlab.trackset.com/r/?tx=r&clxm=828ca3a588b4c676a80e47277e018e14&cladix=0caa9055a8d0040c48870f7914de5a1b';\r\nbLinks['NB'] = 'http://affiliates.nordicbetpartners.com/processing/clickthrgh.asp?btag=a_6484b_7978';\r\nbLinks['MB'] = 'https://www.mermaidbet.dk/Default.aspx?Campaign=8207E3BC-F3A5-4074-8759-80F9BFDE9036&campaignname=oddschecker';\r\nbLinks['DS'] = 'https://danskespil.dk/oddset/spil/denlange.html';\r\nbLinks['YW'] = 'http://media.youwin.com/redirect.aspx?pid=4046&bid=2781';\r\nbLinks['PN'] = 'http://affiliates.pinnaclesports.com/processing/clickthrgh.asp?btag=a_6379b_818';\r\nbLinks['HI'] = 'http://serve.williamhill.com/promoRedirect?member=oddscheckerITA&campaign=DEFAULT&channel=DEFAULT&zone=1478837347&lp=0';\r\nbLinks['PI'] = 'http://media.paddypower.com/redirect.aspx?pid=10066147&bid=5536';\r\n\r\n//iPhone/Mobi homepages\r\nbLinks['IPB3'] = 'http://www.bet365.com/home/?affiliate=365_078198';\r\nbLinks['IPBD'] = 'http://mobile.betdaq.com/UI/Classic/default.aspx?AFF_ID=122';\r\nbLinks['IPBF'] = 'http://ads.betfair.com/redirect.aspx?pid=63&bid=7328';\r\nbLinks['IPBS'] = 'http://ads.bluesq.com/redirect.aspx?pid=5313&bid=1295';\r\nlocalAffids['IPBW'] = '120082';\r\nbLinks['IPBW'] = 'http://adserver.itsfogo.com/click.aspx?zoneid=120082';\r\nbLinks['IPBX'] = 'http://banners.totesport.com/processing/clickthrgh.asp?btag=a_339b_235';\r\nbLinks['IPBY'] = 'http://freebet.boylesports.com/?btag=43';\r\nbLinks['IPCE'] = 'http://affiliates.galacoral.com/processing/clickthrgh.asp?btag=a_554b_2688';\r\nlocalAffids['IPEE'] = '865814';\r\nbLinks['IPEE'] = 'http://mobile.888sport.com/m/M322513p62?sr=1271234&fb_id=88810010';\r\nbLinks['IPFR'] = 'https://mobile.betfred.com/Betfred/mobwebapp/entryPoint.html?affid=3478';\r\nbLinks['IPLD'] = 'http://affiliates.score-affiliates.com/processing/clickthrgh.asp?btag=a_69790b_2356';\r\nlocalAffids['IPPP'] = '10063193';\r\nbLinks['IPPP'] = 'http://content.paddypower.mobi/ppc-pages/horse-racing/Oddschecker?AFF_ID=10063193';\r\nbLinks['IPSJ'] = 'https://affiliates.stanjamesaffiliates.com/processing/clickthrgh.asp?btag=a_205550b_3168';\r\nlocalAffids['IPSK'] = '7940';\r\nbLinks['IPSK'] = 'http://www.skybet.com/go/reg?a=7940';\r\nlocalAffids['IPSO'] = '42645';\r\nbLinks['IPSO'] = 'http://partner.sbaffiliates.com/processing/clickthrgh.asp?btag=a_42645b_9389';\r\nlocalAffids['IPVC'] = '12732600';\r\nbLinks['IPVC'] = 'https://www.betvictor.mobi/?btagid=12732600';\r\nbLinks['IPWB'] = 'http://touch.wbx.com/?ref=ODC00008';\r\nlocalAffids['IPWB'] = 'ODC00008';\r\nbLinks['IPWH'] = 'http://serve.williamhill.com/promoRedirect?member=oddschecker4&campaign=DEFAULT&channel=mobile&zone=1139047954&lp=0';\r\n\r\nfunction bSlip(bCode, selID, marketID, odds) {\r\n\r\n    //Set iPad to the same as iPhone for purposes of betslips!\r\n    if (repub != 'IP' && mobile_device == 'iPad') {\r\n        is_mobile_device = 'true';\r\n        mobile_device = 'iphone';\r\n    }\r\n\r\n    // check for evens\r\n    evens = new RegExp('eve?n?s?', 'i');\r\n    decimal = new RegExp('^[0-9]+$', 'i');\r\n    sptest = new RegExp('^SP$', 'i');\r\n\r\n    if (repub == 'IP') {\r\n        var i_odds_dec = odds;\r\n        odds = dec2trad(odds);\r\n    }\r\n\r\n    if (odds == '' || odds == null) return;\r\n\r\n    if (odds.match(\"/\") == null && !sptest.test(odds)) {\r\n        odds = odds + '/1';\r\n    }\r\n\r\n    var parts = odds.split(\"/\");\r\n\r\n    if ((repub == 'IP' || is_mobile_device == 'true') && localAffids['IP' + bCode] != null) finalAffid = localAffids['IP' + bCode];\r\n    else finalAffid = localAffids[bCode];\r\n\r\n    var url_parts = 'www.oddschecker.com'.split(/[.]/);\r\n\r\n    switch (bCode) {\r\n    case 'SK':\r\n        if (sptest.test(odds)) {\r\n            odds = '';\r\n        }\r\n\r\n        var ids = selID.split(\"*\");\r\n\r\n        if (repub == 'IP' || is_mobile_device == 'true') {\r\n            var extra_ids = marketID.split(\"*\");\r\n            var sk_market_id = extra_ids[0];\r\n            var sk_sub_id = extra_ids[1];\r\n            strURL = 'http://www.skybet.mobi/go/event/' + sk_sub_id + '/outcome/' + ids[0] + '?AFF_ID=' + ids[1];\r\n        } else {\r\n            strURL = 'https://www.skybet.com/secure/rbs?action=go_gmulti&ev_oc_id=' + ids[0] + '&lp_num=' + parts[0] + '&lp_den=' + parts[1] + '&AFF_ID=' + ids[1];\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 1000, 600, strURL, 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n        break;\r\n\r\n    case 'BD':\r\n        var num = parts[0] / parts[1] + 1;\r\n        odds_dec = num.toFixed(2);\r\n        var market_sel_arr = selID.split(\"*\");\r\n        marketID = market_sel_arr[1];\r\n        selID = market_sel_arr[2];\r\n        if (repub == 'IP') {\r\n            strURL = 'https://mobile.betdaq.com/UI/Classic/Secure/PlaceBet.aspx?ocId=' + selID + '&evId=&mId=' + marketID + '&Odds=' + odds_dec + '&Stake=&bet=F&AFF_ID=' + finalAffid;\r\n        } else {\r\n            strURL = 'http://www.betdaq.com/UI/BetSlipRedirect.aspx?aff_id=' + finalAffid + '&mktId=' + marketID + '&selId=' + selID + '&odds=' + odds_dec;\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 800, 600, strURL, 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n        break;\r\n\r\n    case 'SO':\r\n        if (marketID == 0) {\r\n            strQueryString = \"selid=\" + selID + \"&price=\" + odds;\r\n        }\r\n        else {\r\n            strQueryString = \"smid=\" + marketID;\r\n        }\r\n        var ids = selID.split(\"*\");\r\n        member_aff = localAffids['SOX'];\r\n        strURL = 'http://www.sportingbet.com/t/mini/betSlip.aspx?affiliate=ia_com&pname=a_' + finalAffid + 'b_991c_' + member_aff + '&sp=' + ids[0] + '&ecId=' + ids[1] + '&evId=' + ids[2] + '&mktId=' + ids[3] + '&selId=' + ids[4] + '&price=' + odds;\r\n        return ocBetSlip(bCode + 'betslip', 600, 550, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n        break;\r\n\r\n    case 'B3':\r\n        if (odds == 'SP/1') odds = 'SP'\r\n        if (repub == 'IP' || is_mobile_device == 'true') {\r\n            //Please note this aff ID is different to the mobile home page one, they requested this so they can track betslip clicks at their end.\r\n            strURL = 'https://mobile.bet365.com/AddToInstantBetSlip.aspx?participantid=' + selID + '&odds=' + odds + '&affiliatecode=365_079452';\r\n        } else {\r\n            strURL = 'http://www.bet365.com/instantbet/default.asp?participantid=' + selID + '&affiliatecode=' + finalAffid + '&odds=' + odds + '&instantbet=1'\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 605, 660, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no', bCode, odds, 'true')\r\n\r\n        break;\r\n\r\n    case 'CE':\r\n\r\n        if (repub == 'IP' || is_mobile_device == 'true') {\r\n            strURL = 'http://mobile.coral.co.uk/sportsbook?action=AddSelection&ev_oc_id=' + selID + '&id=N&member=incomeaccess&profile=1sbxml0000&creferer=BTAG:a_554b_2939';\r\n        } else {\r\n            strURL = 'http://sports.coral.co.uk/bet_coral?action=AddSelection&ev_oc_id=' + selID + '&id=N&member=incomeaccess&profile=1sbxml0000&creferer=BTAG:a_554b_2939';\r\n        }\r\n\r\n        return ocBetSlip(bCode + 'betslip', 800, 600, strURL, ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n\r\n        break;\r\n\r\n    case 'BS':\r\n        var lorsp = 'L';\r\n        if (sptest.test(odds)) {\r\n            lorsp = 'S';\r\n            odds = '';\r\n            parts[0] = '';\r\n            parts[1] = '';\r\n        }\r\n        if (url_parts[2] == \"es\" || url_parts[0] == \"deves\") {\r\n            strURL = 'https://www.apuestauniversal.com/secure/bet-apuesta?action=GoBetAdd&leg=|' + lorsp + '|' + parts[0] + '|' + parts[1] + '|||' + selID + '&remote=Y' + '&AFF_ID=' + finalAffid;\r\n        }\r\n        else if (repub == 'IP' || is_mobile_device == 'true') {\r\n            strURL = 'http://mobile.bluesq.com/m/M3226u3exj?outcome=' + selID + '&AFF_ID=' + finalAffid;\r\n        } else {\r\n            strURL = 'http://www.bluesq.com/bet?action=GoBetAdd&leg=|' + lorsp + '|' + parts[0] + '|' + parts[1] + '|||' + selID + '&remote=Y&AFF_ID=' + finalAffid;\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 450, 642, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n\r\n        break;\r\n\r\n    case 'PP':\r\n        var ids = selID.split(\"*\");\r\n        var pp_subdomain = 'www';\r\n        //IP check has to come first here as others could be null (from Apps perspective)\r\n        if (repub == 'IP') pp_subdomain = 'iphone';\r\n        else if (mobile_device == 'android' || mobile_device == 'iphone') pp_subdomain = mobile_device;\r\n        if (ids.length == 5 && ids[0] == '23') {\r\n            //for racing where you get 5 params\r\n            if (repub == 'IP' || is_mobile_device == 'true') {\r\n                strURL = 'https://' + pp_subdomain + '.paddypower.mobi/bet?action=go_gmulti&ev_oc_id=' + ids[4] + '&lp_num=' + parts[0] + '&lp_den=' + parts[1] + '&AFF_ID=' + finalAffid + '&event_id=' + ids[2];\r\n            } else {\r\n                strURL = 'http://www.paddypower.com/bet?action=go_racing&AFF_ID=' + finalAffid + '&ev_class_id=' + ids[0] + '&ev_type_id=' + ids[1] + '&ev_id=' + ids[2] + '&mrkt_id=' + ids[3] + '&leg=stamp~|hcap_value~|selections~' + ids[4] + '|stake~0&bs_add_leg_to_slip=1';\r\n            }\r\n            return ocBetSlip(bCode + 'betslip', 1024, 800, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no', bCode, odds, 'true')\r\n        }\r\n        else if (ids.length == 2) {\r\n            var affId = 10066777;\r\n\r\n            if (marketCategoryGroupId == 2) affId = 10066773; // football\r\n            else if (marketCategoryGroupId == 3) affId = 10066774; // racing\r\n            else if (marketCategoryGroupId == 6) affId = 10066775; // golf\r\n            else if (marketCategoryGroupId == 15) affId = 10066776; // specials                \r\n            //for when you get 2 params (needed for mobile)\r\n            if (repub == 'IP' || is_mobile_device == 'true') {\r\n                strURL = 'https://' + pp_subdomain + '.paddypower.mobi/bet?action=go_gmulti&ev_oc_id=' + ids[1] + '&lp_num=' + parts[0] + '&lp_den=' + parts[1] + '&AFF_ID=' + finalAffid + '&event_id=' + ids[0];\r\n            } else {\r\n                strURL = 'https://www.paddypower.com/bet?action=go_gmulti&ev_oc_id=' + ids[1] + '&lp_num=' + parts[0] + '&lp_den=' + parts[1] + '&AFF_ID=' + affId;\r\n            }\r\n\r\n            return ocBetSlip(bCode + 'betslip', 500, 530, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no', bCode, odds, 'true')\r\n        }\r\n        else {\r\n            //for when selection id only\r\n            strURL = 'https://www.paddypower.com/bet?action=go_gmulti&ev_oc_id=' + selID + '&lp_num=' + parts[0] + '&lp_den=' + parts[1] + '&AFF_ID=' + finalAffid\r\n            return ocBetSlip(bCode + 'betslip', 500, 530, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no', bCode, odds, 'true')\r\n        }\r\n        break;\r\n\r\n    case 'LD':\r\n        ld_win_width = 1280;\r\n        ld_win_height = 700;\r\n\r\n        if (repub == 'IP' || is_mobile_device == 'true') {\r\n            var params = selID.split(\"/\");\r\n            var ld_marketname = encodeURIComponent(params[4]);\r\n            var ld_eventname = encodeURIComponent(params[3]);\r\n            strURL = 'https://mobile.ladbrokes.mobi/novo/application/en_GB/ladbrokes/wap/dataBrowsingV2?breadcrumbs=Market~' + params[1] + '~' + ld_marketname + '~false~null~null~null|Event~' + params[0] + '~' + ld_eventname + '~false~null~null~null&AFF_ID=' + finalAffid;\r\n        } else {\r\n            if (marketID != '') {\r\n                strURL = 'http://www.ladbrokes.com/sports-betting/oddschecker/?AFF_ID=69790&ASSET_ID=8179&eventID=' + marketID;\r\n            } else {\r\n                strURL = 'http://www.ladbrokes.com/sports-betting/oddschecker/?AFF_ID=69790&ASSET_ID=8179';\r\n            }\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', ld_win_width, ld_win_height, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no', bCode, odds, 'true')\r\n        break;\r\n\r\n    case 'BF':\r\n        if (marketID != '') {\r\n            if (repub == 'IP' || is_mobile_device == 'true') {\r\n                if (marketID.match(/\\d+[&]ex[=]\\d+/g)) {\r\n                    exch = marketID.replace(/\\d+[&]ex[=]/g, '');\r\n                    marketID = marketID.replace(/[&]ex[=]\\d+/g, '');\r\n                    strURL = 'https://touch.betfair.com/?rfr=' + finalAffid + '#/market_' + exch + '_' + marketID;\r\n                }\r\n                else if (marketID.match(/\\d+/g) && (typeof ex != \"undefined\")) {\r\n                    strURL = 'https://touch.betfair.com/?rfr=' + finalAffid + '#/market_' + exch + '_' + marketID;\r\n                }\r\n                else if (marketID.match(/\\d+/g)) {\r\n                    strURL = 'https://touch.betfair.com/?rfr=' + finalAffid + '#/market_1_' + marketID;\r\n                } else {\r\n                    strURL = 'https://touch.betfair.com/?rfr=' + finalAffid;\r\n                }\r\n                //Add mediaplex encoding\r\n                strURL = \"http://adfarm.mediaplex.com/ad/ck/15368-110724-14430-30?mpro=\" + encodeURIComponent(strURL);\r\n            } else {\r\n                if (!marketID.match(/ex[=]\\d+/g)) marketID = marketID + \"1\";\r\n                strURL = 'http://adfarm.mediaplex.com/ad/ck/15368-110724-14430-29?mpro=http://www.betfair.com/?rfr=' + finalAffid + '&mi=' + marketID\r\n            }\r\n            return ocBetSlip(bCode + 'betslip', 0, 0, strURL, ',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n        }\r\n        break;\r\n\r\n    case 'VC':\r\n        if (selID != '') {\r\n            var params = selID.split(\".\");\r\n            if (repub == 'IP') {\r\n                strURL = 'https://www.betvictor.mobi/?btagid=' + finalAffid + '#/betslip/add/' + params[1] + '/' + params[2] + '/' + i_odds_dec + ' /false/' + params[3] + '/1';\r\n            } else if (is_mobile_device == 'true') {\r\n                decOdds = (parts[0] / parts[1]) + 1;\r\n                strURL = 'https://www.betvictor.mobi/?btagid=' + finalAffid + '#/betslip/add/' + params[1] + '/' + params[2] + '/' + decOdds + ' /false/' + params[3] + '/1';\r\n            } else {\r\n                strURL = 'http://altfarm.mediaplex.com/ad/ck/15121-121714-11030-3?mpro=http://www.betvictor.com/sports/en-gb/coupon/remote/' + params[0] + '/' + params[1] + '/' + params[2] + '?OID=' + finalAffid;\r\n            }\r\n            //If rolling back to home page uncomment this\r\n            //strURL = 'http://www.vcbet.com/?OID=' + finalAffid;\r\n            return ocBetSlip(bCode + 'betslip', 0, 0, strURL, ',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n        }\r\n\r\n        break;\r\n\r\n    case 'BX':\r\n        g_test = new RegExp('\\\\*G$', 'i');\r\n        if (sptest.test(odds)) {\r\n            lorsp = 'S';\r\n            odds = '';\r\n            parts[0] = '';\r\n            parts[1] = '';\r\n        } else {\r\n            if (g_test.test(selID)) {\r\n                selID = selID.replace('*G', '');\r\n                lorsp = 'G';\r\n            } else {\r\n                lorsp = 'L';\r\n            }\r\n        }\r\n        if (selID != '') marketID = selID;\r\n        strURL = 'http://www.totesport.com/portal?action=GoEvent&ev_id=' + selID + '&aff_id=' + finalAffid;\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, ',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n        break;\r\n\r\n    case 'WB':\r\n        if (selID != '') marketID = selID;\r\n        if (marketID == '') {\r\n            if (repub == 'IP' || is_mobile_device == 'true') strURL = 'http://touch.wbx.com?ref=' + finalAffid;\r\n            else strURL = 'http://www.wbx.com?ref=' + finalAffid;\r\n        } else {\r\n            if (repub == 'IP' || is_mobile_device == 'true') strURL = 'http://touch.wbx.com/Market.aspx?IM=' + marketID + '&ref=' + finalAffid;\r\n            else strURL = 'http://www.wbx.com/Market.ashx?ref=' + finalAffid + '&MarketID=' + ((marketID == '') ? '1' : marketID);\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, ',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'SJ':\r\n        if (selID.indexOf(\"*\") == -1) selID = selID + \"*NO*NO\";\r\n        var ids = selID.split(\"*\");\r\n        if (repub == 'IP' || is_mobile_device == 'true') {\r\n            var sj_subdomain = 'mobile';\r\n            //IP check has to come first here as others could be null (from Apps perspective)\r\n            if (repub == 'IP') sj_subdomain = 'iphone';\r\n            else if (mobile_device == 'android' || mobile_device == 'iphone') sj_subdomain = mobile_device;\r\n            strURL = 'https://' + sj_subdomain + '.stanjames.com/#!slip_add?marketId=' + Number(marketID) + '&outcomeId=' + Number(ids[0]) + '&priceType=' + ids[1].substr(0, 2) + '&numerator=' + parts[0] + '&denominator=' + parts[1] + '&handicap=' + ids[2];\r\n        } else strURL = 'http://www.stanjames.com/betslip/betsliplanding.asp?btag=a_' + finalAffid + 'b_859c_&selid=' + ids[0] + '&price=' + odds;\r\n        return ocBetSlip(bCode + 'betslip', 1010, 460, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'WH':\r\n        var ids = selID.split(\"*\");\r\n        if (repub == 'IP' || is_mobile_device == 'true') {\r\n            var wh_vars = marketID.split(\"/\");\r\n            var wh_ev_name = decodeURIComponent(wh_vars.pop()).replace('-', '+');\r\n            var wh_ev_id = wh_vars.pop();\r\n            var wh_betname;\r\n            var wh_bettype;\r\n            var wh_ew;\r\n            if (repub == 'IP') {\r\n                wh_betname = encodeURIComponent(ids[2]);\r\n                wh_bettype = encodeURIComponent(ids[3]);\r\n                wh_ew = encodeURIComponent(ids[4]);\r\n            } else {\r\n                wh_betname = ids[2];\r\n                wh_bettype = ids[3];\r\n                wh_ew = ids[4];\r\n            }\r\n            //IP check has to come first here as others could be null (from Apps perspective)\r\n            if (repub == 'IP' || mobile_device == 'android' || mobile_device == 'iphone') {\r\n                strURL = 'https://mobet.williamhill.com/slip?action=add_and_show&denominator=' + parts[1] + '&numerator=' + parts[0] + '&name=' + wh_betname + '&eventName=' + wh_ev_name + '&marketName=' + wh_bettype + '&id=' + ids[0] + '&marketId=' + ids[1] + '&eventId=' + wh_ev_id + '&eachWayAvailable=' + wh_ew + '&member=' + finalAffid + '&channel=mobile';\r\n            } else {\r\n                strURL = 'https://mobet.williamhill.com/wap/en-gb/williamhill_betting_betslip_wap.t?action=add_and_show&denominator=' + parts[1] + '&numerator=' + parts[0] + '&name=' + wh_betname + '&eventName=' + wh_ev_name + '&marketName=' + wh_bettype + '&id=' + ids[0] + '&marketId=' + ids[1] + '&eventId=' + wh_ev_id + '&eachWayAvailable=' + wh_ew + '&member=' + finalAffid + '&channel=mobile';\r\n            }\r\n        } else {\r\n            strURL = 'http://serve.williamhill.com/promoRedirect?member=oddschecker4&campaign=DEFAULT&channel=DEFAULT&zone=908371216&lp=908300452&var3=en/nui/free-bet/%23http%3A//sports.williamhill.com/bet/EN/addtoslip%3Faction%3DBuildSlip%26sel%3D' + ids[0] + '%26price%3Dy%26ew%3Dn%26url%3Dhttp://sports.williamhill.com/bet/en-gb/betting/' + marketID;\r\n        }\r\n\r\n        return ocBetSlip(bCode + 'betslip', 1024, 700, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n\r\n        break;\r\n\r\n    case 'FR':\r\n        var ids = selID.split(\"*\");\r\n        if (url_parts[2] == \"es\" || url_parts[0] == \"deves\") {\r\n            var lang = \"&lang=es\";\r\n            strURL = 'http://es.betfred.com/siteservices/affiliate/tracking.ashx?target=BetslipLanding&affid=' + finalAffid + '&btag=a_2983&selection=' + ids[3] + '&market=' + ids[2] + '&priceup=' + ids[0] + '&pricedown=' + ids[1];\r\n        } else {\r\n            strURL = 'http://www.betfred.com/siteservices/affiliate/tracking.ashx?target=BetslipLanding&affid=' + finalAffid + '&btag=a_2983&selection=' + ids[3] + '&market=' + ids[2] + '&priceup=' + ids[0] + '&pricedown=' + ids[1];\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 1010, 460, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'EE':\r\n        var lorsp = 'L';\r\n        if (sptest.test(odds)) {\r\n            lorsp = 'S';\r\n            odds = '';\r\n            parts[0] = '';\r\n            parts[1] = '';\r\n        }\r\n        if (url_parts[2] == \"es\" || url_parts[0] == \"deves\") {\r\n            var lang = \"&lang=es\";\r\n            strURL = 'http://ad.doubleclick.net/clk;195643246;25556340;j?https://www.888sport.com/secure/bet?action=GoBetAdd&leg=|' + lorsp + '|' + parts[0] + '|' + parts[1] + '|||' + selID + '&remote=Y' + '&sr=' + finalAffid + '&AFF_ID=789850';\r\n        } else if (url_parts[2] == \"de\" || url_parts[0] == \"devde\") {\r\n            var lang = \"&lang=de\";\r\n\r\n            strURL = 'http://ad.doubleclick.net/clk;195643246;25556340;j?https://www.888sport.com/secure/bet?action=GoBetAdd&leg=|' + lorsp + '|' + parts[0] + '|' + parts[1] + '|||' + selID + '&remote=Y' + '&sr=' + finalAffid + '&AFF_ID=789850';\r\n        } else if (repub == 'IP' || is_mobile_device == 'true') {\r\n            strURL = 'https://mobile.888sport.com/w/328cnmt7y6b56hi3t/b/betslip.html?outcome=' + selID + '&sr=' + finalAffid + '&fb_id=88810010';\r\n        } else {\r\n            strURL = 'http://ad.doubleclick.net/clk;195643246;25556340;j?https://www.888sport.com/secure/bet?action=GoBetAdd&leg=|' + lorsp + '|' + parts[0] + '|' + parts[1] + '|||' + selID + '&remote=Y' + '&sr=' + finalAffid + '&AFF_ID=789850';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 500, 642, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true')\r\n        break;\r\n\r\n    case 'BY':\r\n        if (sptest.test(odds)) {\r\n            parts[0] = '0';\r\n            parts[1] = '0';\r\n        }\r\n\r\n        var ids = selID.split(\"*\");\r\n\r\n        strURL = 'http://m.boylesports.com/Betslip/AddToBetslip?idfiadvert=' + ids[1] + '&selid=' + ids[2] + '&idfopricetypeclass=FIXED%%20ODDS&price=' + parts[0] + '%2F' + parts[1] + '&idfiacampaign=' + finalAffid;\r\n        return ocBetSlip(bCode + 'betslip', 754, 600, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'SI':\r\n        var ids = marketID.split(\"*\");\r\n        if (ids[1] == \"football-international\") {\r\n            ids[0] = selID;\r\n            ids[1] = \"football-world-cup\";\r\n        }\r\n        strURL = 'http://ad.doubleclick.net/clk;250465030;75322978;h?http://www.sportingindex.com/spread-betting/' + ids[1] + '/?MeetingID=' + ids[0] + '&Split=1&tpid=' + finalAffid + '&tpid=6875&utm_source=oddschecker.com&utm_medium=livepricesonmarkettabs&utm_campaign=livemarkets';\r\n        return ocBetSlip(bCode + 'betslip', 1024, 700, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'BW':\r\n        var ids = selID.split(\"*\");\r\n        if (repub == 'IP' || is_mobile_device == 'true') {\r\n            strURL = 'https://wap.bwin.com/SportsBook/BetSlip.aspx?gid=' + ids[1] + '&rid=' + ids[2] + '&odds=' + odds + '&zoneid=' + finalAffid + '&RefererID=869XM3R4RE';\r\n        } else {\r\n            strURL = 'https://adserver.itsfogo.com/click.aspx?zoneid=' + finalAffid + '&ResultIDs=' + ids[2] + '&GameIDs=' + ids[1] + '&ResultOdds=' + odds + '&Stake=0.01&page=betsnew.aspx&EventID=' + ids[0];\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 1024, 700, strURL, ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'BO':\r\n        if (marketID == '') {\r\n            strURL = 'http://sports.bodog.co.uk/welcome/' + finalAffid;\r\n        } else {\r\n            var ids = marketID.split(\"*\");\r\n            if (ids[0] == 'basketball' || ids[0] == 'soccer' || ids[0] == 'futsal' || ids[0] == 'ice-hockey' || ids[0] == 'tennis') {\r\n                if (ids[5] == 'outright') {\r\n                    strURL = 'http://sports.bodog.co.uk/welcome/' + finalAffid + '/' + ids[0] + '/' + ids[1] + '/' + ids[2] + '.htm?marketId=-1&eventId=' + ids[4] + '&level=sport&sport=' + ids[0];\r\n                }\r\n                else {\r\n                    strURL = 'http://sports.bodog.co.uk/welcome/' + finalAffid + '/' + ids[0] + '/' + ids[1] + '/' + ids[2] + '.htm?eventId=' + ids[4] + '&marketId=-1';\r\n                }\r\n            }\r\n            else {\r\n                if (ids[5] == 'outright') {\r\n                    strURL = 'http://sports.bodog.co.uk/welcome/' + finalAffid + '/' + ids[0] + '/' + ids[2] + '.htm?marketId=-1&eventId=' + ids[4] + '&level=sport&sport=' + ids[0];\r\n                }\r\n                else {\r\n                    strURL = 'http://sports.bodog.co.uk/welcome/' + finalAffid + '/' + ids[0] + '/' + ids[2] + '.htm?eventId=' + ids[4] + '&marketId=-1';\r\n                }\r\n            }\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'BI':\r\n        var ids = selID.split(\"*\");\r\n        if (selID == '') {\r\n            strURL = 'http://adfarm.mediaplex.com/ad/ck/6730-84307-35849-2';\r\n        }\r\n        else {\r\n            strURL = 'https://www.betfair.it/?sembox_source=confrontaquote&sembox_content=xml&url=http://www.scommessebetfair.it/scommesse-online/goto.php/categoryId/' + ids[0] + '/subcategoryId/' + ids[1] + '/eventId/' + ids[2];\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'BC':\r\n        strURL = bLinks['BC'];\r\n/*\r\n              strURL = 'http://www.betclic.it/partner.aspx?p=ODC3&z=c03&m=' + selID;\r\n              */\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'WI':\r\n        var ids = selID.split(\"*\");\r\n        if (selID == '') {\r\n            strURL = bLinks['WI'];\r\n        } else {\r\n            strURL = 'https://adserver.itsfogo.com/click.aspx?zoneid=' + ids[0] + '&ResultIDs=' + ids[1] + '&GameIDs=' + ids[2] + '&ResultOdds=' + ids[3] + '&Stake=1';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'RD':\r\n        var ids = marketID.split(\"*\");\r\n        if (marketID == '') {\r\n            strURL = bLinks['RD'];\r\n        } else {\r\n            strURL = 'http://www.32redbet.com?ecid=' + ids[0] + '&mktid=' + ids[1] + '&pid=NRF_656027_OC001';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'EU':\r\n        var ids = selID.split(\"*\");\r\n        if (selID == '') {\r\n            strURL = bLinks['EU'];\r\n        } else {\r\n            strURL = 'http://www.eurobet.it/sbit.go?page=bannertrack&origin=' + finalAffid + '&refurl=http%3A%2F%2Fweb.eurobet.it%2Fsport%3Faction%3Drow_comm%26prg_code%3D' + ids[0] + '%26eve_code%3D' + ids[1] + '%26bt_code%3D' + ids[2] + '%26rs_code%3D' + ids[3];\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'SM':\r\n        var ids = selID.split(\"*\");\r\n        if (selID == '') {\r\n            strURL = bLinks['SM'];\r\n        } else {\r\n            strURL = 'https://sgc.sisal.it/srvpartner/partnershipRedirect?pid=158&camid=3&sezione=sport&disciplina=' + ids[0] + '&manifestazione=' + ids[1] + '&palinsesto=' + ids[2] + '&avvenimento=' + ids[3] + '&classe=' + ids[4] + '&esito=' + ids[5];\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'IZ':\r\n        if (marketID == '') {\r\n            strURL = bLinks['IZ'];\r\n        } else {\r\n            strURL = 'https://www.iziplay.it/scommesse/' + marketID + '?s=confrontaquote';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'EB':\r\n        if (marketID == '') {\r\n            strURL = bLinks['EB'];\r\n        } else {\r\n            strURL = 'http://www.188bet.com/en-gb/sports/' + marketID + '?btag=a_1290b_35';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'NB':\r\n        if (marketID == '') {\r\n            strURL = bLinks['NB'];\r\n        } else {\r\n            strURL = 'https://www.nordicbet.dk/selection?cmd=choose&game_id=' + marketID;\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n    case 'MB':\r\n        if (marketID == '') {\r\n            strURL = bLinks['MB'];\r\n        } else {\r\n            strURL = 'https://www.mermaidbet.dk/Default.aspx?Campaign=8207E3BC-F3A5-4074-8759-80F9BFDE9036&campaignname=oddschecker&url=http://betting.mermaidbet.dk/' + marketID + '/';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'DS':\r\n        var ids = marketID.split(\"*\");\r\n        if (marketID == '') {\r\n            strURL = bLinks['DS'];\r\n        } else {\r\n            strURL = 'https://danskespil.dk/oddset/spil/denlange.html?gameId=LNGN&gameEventId=' + ids[0] + '&draw=00000' + ids[1] + '&btag=a_31b_7';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'TO':\r\n        var ids = selID.split(\"*\");\r\n\r\n        if (selID == '') {\r\n            strURL = bLinks['TO'];\r\n        } else {\r\n            strURL = 'https://www.clickpoint.it/db/gotoxml.cp?PRO=' + ids[0] + '&ID=' + ids[1] + '&SUB=XML&GO=http%3A%2F%2Fad-emea.doubleclick.net%2Fclk%3B242865436%3B65695584%3Bb%3Fhttps%3A%2F%2Fwww.totosi.it%2Fscommesse%2Fhome.do%3FcodPal%3D10163%26codAvv%3D1%26codSco%3D3%26codEsi%3D1%26quoVis%3D' + ids[2] + '%26codManif%3D86%26codDisc%3D1';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'LM':\r\n        strURL = bLinks['LM'];\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'IN':\r\n        strURL = bLinks['IN'];\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'UI':\r\n        strURL = bLinks['UI'];\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'GI':\r\n        strURL = bLinks['GI'];\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'NE':\r\n        strURL = bLinks['NE'];\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'YW':\r\n        if (marketID == '') {\r\n            strURL = bLinks['YW'];\r\n        } else {\r\n            strURL = 'http://media.youwin.com/redirect.aspx?pid=4046&bid=2538&redirectURL=http://www.youwin.com/en/betting/evt/' + marketID;\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'PN':\r\n        var ids = marketID.split(\"*\");\r\n\r\n        if (marketID == '') {\r\n            strURL = bLinks['PN'];\r\n        } else {\r\n            strURL = 'http://www.pinnaclesports.com/?language=British&LExt=bri&refer=xodsch2012&leagueid=' + ids[0] + '&periodnumber=' + ids[1];\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'HI':\r\n        strURL = bLinks['HI'];\r\n        return ocBetSlip(bCode + 'betslip', 0, 0, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    case 'PI':\r\n\r\n        if (selID == '') {\r\n            strURL = bLinks['PI'];\r\n        } else {\r\n            strURL = 'https://www.paddypower.it/scommesse?action=go_gmulti&ev_oc_id=' + selID + '&AFF_ID=10066147';\r\n        }\r\n        return ocBetSlip(bCode + 'betslip', 500, 530, strURL, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no', bCode, odds, 'true');\r\n        break;\r\n\r\n    default:\r\n        goBk(bCode);\r\n    }\r\n\r\n}\r\n\r\nfunction ocBetSlip(strWindowName, xWidth, xHeight, strURL, strOptions, bCode, odds, displayAds) {\r\n    var api_betslip_url = '';\r\n    var mydate = new Date();\r\n    strURL = encodeURIComponent(strURL);\r\n    return (api_betslip_url + '/betslip.php?burl=' + strURL + '&repub=' + repub + '&bookie=' + bCode + '&odds=' + odds + '&sport=' + sportname + '&code=' + bCode + '&eventdetails=undefined&displayads=true&Clickouts=1&mpuid=' + mydate.getTime());\r\n}" 
      };
      #endregion

      Bookmakers = new Bookmaker[] { bexpekt, bbetway, bTennisDataBestAvailable, bOddsCheckerWebBestAvailable, bOddsCheckerMobiBestAvailable, bBestBettingBestAvailable, bFootballDataBestAvailable, bmarathonbet_co_uk, b10bet, b188bet, b32red_bet, b888sport, bbet_365, bbet_victor, bbet770, bbetdaq, bbetfair, bbetfred, bbetinternet, bbetvictor, bblue_square, bbodog, bboylesports, bbwin, bcoral, bcorbetts, bladbrokes, bmatchbook_com, bpaddy_power, bpanbet, bpinnacle_sports, bsky_bet, bsmarkets, bsporting_bet, bspreadex, bstan_james, btotesport, bwbx, bwilliam_hill, byouwin, bbet_win, bgamebookers, binterwetten, bstanleybet, bsporting_odds, bcome_on, bunibet };
      Sports = new Sport[] { football, tennis };
      Surfaces = new Surface[] { hard, clay, grass };
      Competitions = new Competition[] { premierLeague, championship, leagueOne, leagueTwo, atp, masters, grandSlam };
      Tournaments = new Tournament[] { t_premierLeague, t_championship, t_leagueOne, t_leagueTwo, brisbane_international, aircel_chennai_open, qatar_exxonmobil_open, apia_international_sydney, heineken_open, australian_open, open_sud_de_france, pbz_zagreb_indoors, vtr_open, abn_amro_world_tennis_tournament, brasil_open_2012, sap_open, regions_morgan_keegan_championships, copa_claro, open_13, dubai_duty_free_tennis_championships, delray_beach_international_tennis_championships, abierto_mexicano_telcel, bnp_paribas_open, sony_ericsson_open, grand_prix_hassan_ii, us_mens_clay_court_championship, monte_carlo_rolex_masters, brd_nastase_tiriac_trophy, barcelona_open_banc_sabadell, bmw_open, serbia_open_2012, estoril_open, mutua_madrid_open, internazionali_bnl_ditalia, open_de_nice_cote_dazur, roland_garros, gerry_weber_open, aegon_championships, unicef_open, aegon_international, wimbledon, mercedescup, campbells_hall_of_fame_tennis_championships, skistar_swedish_open, atp_vegeta_croatia_open_umag, bet_at_home_open___german_tennis_championships_2012, bbt_atlanta_open, credit_agricole_suisse_open_gstaad, bet_at_home_cup_kitzbuhel, farmers_classic, legg_mason_tennis_classic, rogers_cup, western__southern_open, winston_salem_open, us_open, moselle_open, st_petersburg_open, ptt_thailand_open, malaysian_open_kuala_lumpur, china_open, rakuten_japan_open_tennis_championships, shanghai_rolex_masters, erste_bank_open, if_stockholm_open, kremlin_cup, valencia_open_500, swiss_indoors_basel, bnp_paribas_masters, london_2012_olympics, barclays_atp_world_tour_finals };
      TournamentEvents = new TournamentEvent[] { s2011_t_premierLeague, s2012_t_premierLeague, s2012_t_championship, s2012_t_leagueOne, s2012_t_leagueTwo, s2012_brisbane_international, s2012_aircel_chennai_open, s2012_qatar_exxonmobil_open, s2012_apia_international_sydney, s2012_heineken_open, s2012_australian_open, s2012_open_sud_de_france, s2012_pbz_zagreb_indoors, s2012_vtr_open, s2012_abn_amro_world_tennis_tournament, s2012_brasil_open_2012, s2012_sap_open, s2012_regions_morgan_keegan_championships, s2012_copa_claro, s2012_open_13, s2012_dubai_duty_free_tennis_championships, s2012_delray_beach_international_tennis_championships, s2012_abierto_mexicano_telcel, s2012_bnp_paribas_open, s2012_sony_ericsson_open, s2012_grand_prix_hassan_ii, s2012_us_mens_clay_court_championship, s2012_monte_carlo_rolex_masters, s2012_brd_nastase_tiriac_trophy, s2012_barcelona_open_banc_sabadell, s2012_bmw_open, s2012_serbia_open_2012, s2012_estoril_open, s2012_mutua_madrid_open, s2012_internazionali_bnl_ditalia, s2012_open_de_nice_cote_dazur, s2012_roland_garros, s2012_gerry_weber_open, s2012_aegon_championships, s2012_unicef_open, s2012_aegon_international, s2012_wimbledon, s2012_mercedescup, s2012_campbells_hall_of_fame_tennis_championships, s2012_skistar_swedish_open, s2012_atp_studena_croatia_open, s2012_bet_at_home_open___german_tennis_championships_2012, s2012_atlanta_tennis_championships, s2012_credit_agricole_suisse_open_gstaad, s2012_bet_at_home_cup_kitzbuhel, s2012_farmers_classic, s2012_london_2012_olympics, s2012_legg_mason_tennis_classic, s2012_rogers_cup, s2012_western__southern_open, s2012_winston_salem_open, s2012_us_open, s2012_moselle_open, s2012_st_petersburg_open, s2012_ptt_thailand_open, s2012_malaysian_open_kuala_lumpur, s2012_china_open, s2012_rakuten_japan_open_tennis_championships, s2012_shanghai_rolex_masters, s2012_erste_bank_open, s2012_if_stockholm_open, s2012_kremlin_cup, s2012_valencia_open_500, s2012_swiss_indoors_basel, s2012_bnp_paribas_masters, s2012_barclays_atp_world_tour_finals };
      CompetitionCouponURLs = new CompetitionCouponURL[] { ccb_premierLeague, ccb_championship, ccb_leagueOne, ccb_leagueTwo, ccow_premierLeague, ccow_championship, ccow_leagueOne, ccow_leagueTwo, ccom_premierLeague, ccom_championship, ccom_leagueOne, ccom_leagueTwo, ccb_atp, ccow_atp, ccom_atp };
      TournamentCouponURLs = new TournamentCouponURL[] { tcb_western__southern_open, tcom_western__southern_open, tcb_us_open, tcom_us_open, tcb_premierLeague, tcb_championship, tcb_leagueOne, tcb_leagueTwo, tcow_premierLeague, tcow_championship, tcow_leagueOne, tcow_leagueTwo, tcom_premierLeague, tcom_championship, tcom_leagueOne, tcom_leagueTwo };
      Funds = new Fund[] { premierFund, footballLeagueFund, tennisFund };
      ExternalSources = new ExternalSource[] { valueSamurai, skySports, bestBetting, oddsCheckerMobi, oddsCheckerWeb, tennisDataOdds, footballDataOdds, tb365, finkTank };
      MatchOutcomes = new MatchOutcome[] { teamOrPlayerAWin, draw, teamOrPlayerBWin };
      ScoreOutcomes = scoreOutcomes;
      TeamsPlayers = new TeamPlayer[] { arsenal, astonvilla, birmingham, blackburn, blackpool, bolton, chelsea, everton, fulham, liverpool, mancity, manunited, newcastle, stoke, sunderland, tottenham, westbrom, westham, wigan, wolves, barnsley, bristolcity, burnley, cardiff, coventry, crystalpalace, derby, doncaster, hull, ipswich, leeds, leicester, middlesboro, millwall, norwich, nottmforest, portsmouth, preston, qpr, reading, scunthorpe, sheffieldunited, swansea, watford, bournemouth, brentford, brighton, bristolrvs, carlisle, charlton, colchester, dagandred, exeter, hartlepool, huddersfield, leytonorient, miltonkeynes, nottscounty, oldham, peterboro, plymouth, rochdale, sheffieldweds, southampton, swindon, tranmere, walsall, yeovil, accrington, aldershot, barnet, bradford, burton, bury, cheltenham, chesterfield, crewe, gillingham, hereford, lincolncity, macclesfield, morecambe, northampton, oxford, portvale, rotherham, shrewsbury, southend, stevenage, stockport, torquay, wycombe, afcwimbledon, crawleytown, fleetwoodtown, york };
      TeamPlayerExternalSourceAliass = new TeamPlayerExternalSourceAlias[] { ocw_manunited, ocw_wolves, ocw_middlesboro, ocw_nottmforest, ocw_sheffieldunited, ocw_bristolrvs, ocw_dagandred, ocw_miltonkeynes, ocw_nottscounty, ocw_peterboro, ocw_sheffieldweds, ocw_lincolncity, ocw_crawleytown, ocm_manunited, ocm_wolves, ocm_middlesboro, ocm_nottmforest, ocm_sheffieldunited, ocm_bristolrvs, ocm_dagandred, ocm_miltonkeynes, ocm_nottscounty, ocm_peterboro, ocm_sheffieldweds, ocm_lincolncity, ocm_crawleytown, bb_birmingham, bb_blackburn, bb_bolton, bb_mancity, bb_manunited, bb_newcastle, bb_stoke, bb_tottenham, bb_westbrom, bb_wigan, bb_wolves, bb_cardiff, bb_coventry, bb_derby, bb_doncaster, bb_hull, bb_ipswich, bb_leeds, bb_leicester, bb_middlesboro, bb_norwich, bb_nottmforest, bb_preston, bb_qpr, bb_scunthorpe, bb_swansea, bb_bournemouth, bb_brighton, bb_bristolrvs, bb_carlisle, bb_charlton, bb_colchester, bb_dagandred, bb_exeter, bb_hartlepool, bb_huddersfield, bb_miltonkeynes, bb_oldham, bb_peterboro, bb_plymouth, bb_sheffieldweds, bb_swindon, bb_tranmere, bb_yeovil, bb_accrington, bb_aldershot, bb_bradford, bb_burton, bb_cheltenham, bb_crewe, bb_hereford, bb_lincolncity, bb_macclesfield, bb_northampton, bb_oxford, bb_rotherham, bb_shrewsbury, bb_southend, bb_stockport, bb_torquay, bb_wycombe, bb_york, ss_astonvilla, ss_afcwimbledon, ss_bournemouth, ss_bristolcity, ss_bristolrvs, ss_burton, ss_crystalpalace, ss_chesterfield, ss_crawleytown, ss_dagandred, ss_fleetwoodtown, ss_huddersfield, ss_hull, ss_leytonorient, ss_manunited, ss_middlesboro, ss_miltonkeynes, ss_nottmforest, ss_northampton, ss_nottscounty, ss_oxford, ss_sheffieldunited, ss_sheffieldweds, ss_southampton, ss_stoke, ss_york };
      KeyValuePairs = new KeyValuePair[] { oddsCheckerJavaScript };
      BookmakerExternalSourceAliass = new BookmakerExternalSourceAlias[] { tdbbet_365, tdbexpekt, tdbladbrokes, tdbpinnacle_sports, tdbstan_james, bbb_totesport, bbb_888sport, bbb_skybet, bbb_sportingbet, fdbbet_365, fdbblue_square, fdbladbrokes, fdbpinnacle_sports, fdbsporting_bet, fdbstan_james, fdbwilliam_hill, fdbbet_win, fdbgamebookers, fdbinterwetten, fdbsporting_odds, fdbstanleybet, fdbbetvictor };
      OutcomeComments = new OutcomeComment[] { comsComplete, comsRetired, comsWalkOver };
    }
예제 #11
0
 public override Model.GenericPrediction FetchSinglePrediction(TeamPlayer teamPlayerA, TeamPlayer teamPlayerB, Tournament tournament, Model.IValueOptions valueOptions)
 {
   throw new NotImplementedException();
 }
예제 #12
0
 public abstract Model.GenericPrediction FetchSinglePrediction(TeamPlayer teamPlayerA, TeamPlayer teamPlayerB, Tournament tournament, Model.IValueOptions valueOptions);
예제 #13
0
    public override Model.GenericPrediction FetchSinglePrediction(TeamPlayer teamPlayerA, TeamPlayer teamPlayerB, Tournament tournament, Model.IValueOptions valueOptions)
    {
      var webRepository = this.webRepositoryProvider.CreateWebRepository(valueOptions.CouponDate);

      var predictionURL = this.predictionRepository.GetTennisPredictionURL(teamPlayerA, teamPlayerB, tournament, valueOptions.CouponDate);
      
      var jsonTennisPrediction = (APITennisPrediction)webRepository.ParseJson<APITennisPrediction>(
        predictionURL, s => ProgressReporterProvider.Current.ReportProgress(s, Model.ReporterImportance.Low, Model.ReporterAudience.Admin));
      jsonTennisPrediction.StartTime = valueOptions.CouponDate;

      return ConvertAPIToGeneric(jsonTennisPrediction, predictionURL);
    }
      public void CreatesACollectionOfPredictionsForTodaysMatches()
      {
        //Arrange
        matchDate = new DateTime(2013, 02, 02);
        #region Todays matches
        matches = new List<E.Match>()
        {
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "62", Name = "QPR"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "31", Name = "Norwich" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "0", Name = "Arsenal"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "39", Name = "Stoke" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "7", Name = "Everton"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "1", Name = "Aston Villa" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "14", Name = "Newcastle"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "6", Name = "Chelsea" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "35", Name = "Reading"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "16", Name = "Sunderland" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "19", Name = "West Ham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "88", Name = "Swansea" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "66", Name = "Wigan"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "15", Name = "Southampton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "8", Name = "Fulham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "12", Name = "Man United" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2", Name = "Birmingham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "32", Name = "Nott'm Forest" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "3", Name = "Blackburn"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "47", Name = "Bristol City" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "45", Name = "Blackpool"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "44", Name = "Barnsley" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "24", Name = "Crystal Palace"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "5", Name = "Charlton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "25", Name = "Derby"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "53", Name = "Huddersfield" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "28", Name = "Ipswich"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "13", Name = "Middlesboro" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "9", Name = "Leeds"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "48", Name = "Cardiff" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "30", Name = "Millwall"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "77", Name = "Hull" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "59", Name = "Peterboro"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "22", Name = "Burnley" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "38", Name = "Sheffield Weds"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "21", Name = "Brighton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "41", Name = "Watford"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "4", Name = "Bolton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "71", Name = "Bury"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "95", Name = "Doncaster" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "52", Name = "Crewe"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "85", Name = "Scunthorpe" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "76", Name = "Hartlepool"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "57", Name = "Notts County" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "42", Name = "Milton Keynes"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "69", Name = "Bournemouth" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "33", Name = "Portsmouth"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "51", Name = "Colchester" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "34", Name = "Preston"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "86", Name = "Shrewsbury" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2015", Name = "Stevenage"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "79", Name = "Leyton Orient" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "65", Name = "Tranmere"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "73", Name = "Carlisle" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "40", Name = "Walsall"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "58", Name = "Oldham" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "96", Name = "Yeovil"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "46", Name = "Brentford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2004", Name = "Crawley Town"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "64", Name = "Swindon" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2029", Name = "AFC Wimbledon"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2002", Name = "Burton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "49", Name = "Cheltenham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "89", Name = "Torquay" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "75", Name = "Exeter"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2000", Name = "Aldershot" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2033", Name = "Fleetwood Town"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "20", Name = "Bradford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "60", Name = "Plymouth"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2005", Name = "Dag and Red" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "61", Name = "Port Vale"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "97", Name = "Accrington" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "83", Name = "Rochdale"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "50", Name = "Chesterfield" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "36", Name = "Rotherham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "56", Name = "Northampton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "87", Name = "Southend"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "82", Name = "Oxford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}},
          new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "91", Name = "York"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2009", Name = "Morecambe" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}
        };
        #endregion
        this.webRepositoryProvider = new ManifestWebRepositoryProvider();

        this.mockFixtureRepository = BuildFixtureRepository.Create()
          .HasFullDaysMatchesByCompetition(matches)
          .CanGetTournamentEventFromTournamentAndDate();

        this.mockPredictionRepository = BuildPredictionRepository.Create()
          .HasFootballAPIUrl();

        var predictionStrategy = new FootballPredictionStrategy(this.mockPredictionRepository.Object,
          this.mockFixtureRepository.Object, this.webRepositoryProvider);

        var prem = new E.Tournament() { TournamentName = "Premier League" };
        var champ = new E.Tournament() { TournamentName = "Championship" };
        var league1 = new E.Tournament() { TournamentName = "League One" };
        var league2 = new E.Tournament() { TournamentName = "League Two" };

        var valueOptions = new Model.ValueOptions()
        {
          Sport = new E.Sport { SportName = "Football" },
          OddsSource = new E.ExternalSource { Source = "Not relevant" },
          CouponDate = matchDate
        };

        var allGenericPredictions = new List<Model.GenericPrediction>();

        //Act
        //Premier league
        valueOptions.Tournament = prem;
        var genericPredictionsPrem = predictionStrategy.FetchPredictions(valueOptions);
        //Championship
        valueOptions.Tournament = champ;
        var genericPredictionsChamp = predictionStrategy.FetchPredictions(valueOptions);
        //League 1
        valueOptions.Tournament = league1;
        var genericPredictionsLeague1 = predictionStrategy.FetchPredictions(valueOptions);
        //League 2
        valueOptions.Tournament = league2;
        var genericPredictionsLeague2 = predictionStrategy.FetchPredictions(valueOptions);
        //All
        allGenericPredictions.AddRange(genericPredictionsPrem);
        allGenericPredictions.AddRange(genericPredictionsChamp);
        allGenericPredictions.AddRange(genericPredictionsLeague1);
        allGenericPredictions.AddRange(genericPredictionsLeague2);

        //Assert
        allGenericPredictions.ForEach(x => 
          {
            Assert.AreEqual(x.ScoreLineProbabilities.Count(), 121);
            Assert.AreEqual(x.OutcomeProbabilities.Sum(o => o.Value), 1, 0.01);
          });
        Assert.AreEqual(genericPredictionsPrem.Count(), 8);
        Assert.AreEqual(genericPredictionsChamp.Count(), 11);
        Assert.AreEqual(genericPredictionsLeague1.Count(), 11);
        Assert.AreEqual(genericPredictionsLeague2.Count(), 10);
      }
예제 #15
0
 public void AddTournamentCouponURL(ExternalSource source, Tournament tournament, string couponURL)
 {
   var tournamentCoupon = new TournamentCouponURL 
   { 
     ExternalSource = source,
     Tournament = tournament,
     CouponURL = couponURL
   };
   Add<TournamentCouponURL>(tournamentCoupon);
   SaveChanges();
 }