Exemple #1
0
        private Dictionary <int, List <NBAGameStats> > GetPredictData(string awayId, string homeId, int year, DateTime gameTime, bool fromDB)
        {
            NBATeamInfo         teamInfoById1 = this.handler.GetTeamInfoById(awayId);
            NBATeamInfo         teamInfoById2 = this.handler.GetTeamInfoById(homeId);
            string              name1         = teamInfoById1.Name;
            string              name2         = teamInfoById2.Name;
            List <NBAGameStats> gameStats     = new List <NBAGameStats>();
            Dictionary <int, List <NBAGameStats> > dictionary = new Dictionary <int, List <NBAGameStats> >();
            List <NBAGameStats> list1 = this.PrepareTeamsData(awayId, name1, homeId, name2, year, gameTime, GamePos.None, 4);

            dictionary.Add(0, list1);
            List <NBAGameStats> list2 = this.PrepareTeamsData(awayId, name1, homeId, name2, year, gameTime, GamePos.All, 4);

            dictionary.Add(1, list2);
            List <NBAGameStats> list3 = this.PrepareTeamsData(awayId, name1, homeId, name2, year, gameTime, GamePos.All, 6);

            dictionary.Add(2, list3);
            List <NBAGameStats> list4 = this.PrepareTeamsData(awayId, name1, homeId, name2, year, gameTime, GamePos.All, 10);

            dictionary.Add(3, list4);
            List <NBAGameStats> list5 = this.PrepareTeamsData(awayId, name1, homeId, name2, year, gameTime, GamePos.All, 0);

            dictionary.Add(5, list5);
            foreach (KeyValuePair <int, List <NBAGameStats> > keyValuePair in (IEnumerable <KeyValuePair <int, List <NBAGameStats> > >)Enumerable.OrderBy <KeyValuePair <int, List <NBAGameStats> >, int>((IEnumerable <KeyValuePair <int, List <NBAGameStats> > >)dictionary, (Func <KeyValuePair <int, List <NBAGameStats> >, int>)(d => d.Key)))
            {
                gameStats.AddRange((IEnumerable <NBAGameStats>)keyValuePair.Value);
            }
            if (!fromDB)
            {
                this.ExportFourFactorsPerTeamToCSV(gameTime.ToString("yyyy-MM-dd"), true);
                this.ExportFourFactorsToPredict(gameStats, gameTime.ToString("yyyy-MM-dd"), teamInfoById1.Abbreviate, teamInfoById2.Abbreviate);
            }
            return(dictionary);
        }
 public NBATeamInfo GetTeamInfoByAbbr(string abbr)
 {
     using (IDataReader dataReader = (IDataReader)this._helper.ExecuteReader(CommandType.Text, string.Format("select * from TeamInfo where abbr='{0}'", (object)abbr), new SqlParameter[0]))
     {
         NBATeamInfo nbaTeamInfo = new NBATeamInfo();
         while (dataReader.Read())
         {
             nbaTeamInfo.Id         = dataReader.GetInt32(0);
             nbaTeamInfo.Name       = dataReader.GetString(2);
             nbaTeamInfo.EnName     = dataReader.GetString(3);
             nbaTeamInfo.Division   = dataReader.GetInt32(4);
             nbaTeamInfo.Abbreviate = dataReader.GetString(5);
         }
         return(nbaTeamInfo);
     }
 }