private NFLStatsUpdate(IHubConnectionContext<dynamic> clients) {

            Clients = clients;

            _playersStats.Clear();
            //try an isLive bool, pull currentweek schedule
            using (var db = new FF()) {
                var currentWeekSchedule = db.NFLGame.Where(g => Convert.ToInt16(g.Week) == currentWeekServ && g.Year == currentYear);
                
                //Compare	DateTime t1,DateTime t2, Less than zero t1 is earlier than t2.Zero t1 is the same as t2.Greater than zero t1 is later than t2.
                foreach (var game in currentWeekSchedule) {
                    var UTCNFLgametime = TimeZoneInfo.ConvertTimeToUtc(game.DateEST);
                    if ((DateTime.Compare(DateTime.UtcNow, UTCNFLgametime)) < 0) { }   //game earlier than local time
                    else { }    //game later
                }

                livePlayerList = db.NFLPlayer.ToList();
            }

            foreach (NFLPlayer n in livePlayerList) {
                //Creating a new StatsYearWeek to track Stats with and connect with NFLPlayer
                StatsYearWeek s = new StatsYearWeek();
                SetSYWToZero(s);
                //Remember im doing this live not for stupid class demo, so ill need to make statid off of player
                s.PlayerID = n.id;
                s.Year = currentYear;     //passed in from where?
                s.Week = currentWeekServ;     //passed in from where?
                s.currentPts = 0;
                string statID = (s.Year.ToString() + s.Week.ToString() + s.PlayerID).ToString();   //YearWeekPlayerID is StatID
                s.id = Convert.ToInt32(statID);

                liveStatsList.Add(s);   //list  
                _playersStats.TryAdd(s.id, s);  //dict
            }

            livePlayerList.Clear();     //empty list

            //make a list of players that got updated and send to updatePlayer?
            //livePlayerList.ForEach(player => _players.TryAdd(player.id, player));

            r = new ReadJSONDatafromNFL("2015101200_gtd.json", "2015101200");
            r2 = new ReadJSONDatafromNFL("2015101108_gtd.json", "2015101108");
            /*****
             * NOTE- For stupid demo I have to null/comment out stats in ReadJSON
             *****/
            r.QuickParseAfterLive();
            r2.QuickParseAfterLive();
            //if timer needed
            //_timer = new Timer(UpdatePlayerStats, null, _updateInterval, _updateInterval);
        }
        //set all class members to 0, default null
        public void SetSYWToZero(StatsYearWeek Stats) {

            Type m1 = Stats.PassingStats.GetType();
            Type m2 = Stats.RushingStats.GetType();
            Type m3 = Stats.ReceivingStats.GetType();
            Type m4 = Stats.KickingStats.GetType();
            Type m5 = Stats.FumbleStats.GetType();
            PropertyInfo[] myProps1 = m1.GetProperties();
            PropertyInfo[] myProps2 = m2.GetProperties();
            PropertyInfo[] myProps3 = m3.GetProperties();
            PropertyInfo[] myProps4 = m4.GetProperties();
            PropertyInfo[] myProps5 = m5.GetProperties();
            foreach (PropertyInfo p in myProps1) {
                p.SetValue(Stats.PassingStats, 0);
            }
            foreach (PropertyInfo p in myProps2) {
                p.SetValue(Stats.RushingStats, 0);
            }
            foreach (PropertyInfo p in myProps3) {
                p.SetValue(Stats.ReceivingStats, 0);
            }
            foreach (PropertyInfo p in myProps4) {
                p.SetValue(Stats.KickingStats, 0);
            }
            foreach (PropertyInfo p in myProps5) {
                p.SetValue(Stats.FumbleStats, 0);
            }
        }
        public StatsYearWeek UpdateStat(PlayersVM fromPlay, StatsYearWeek fromSYWList, string note) {
            //Take fromPlayer statID and find stat
            //Add in fumbles later, confusing, 
            //whenever a pass, 4 with no playerId comes up, 7 with no playerID -> these will get screened out because no playerID   figure out later
            //Penalties could f**k up yardage

            switch (fromPlay.StatId) {
                case 10:
                    //rush yds
                    fromSYWList.RushingStats.RushAtt += 1;
                    fromSYWList.RushingStats.RushYds += fromPlay.Yards;

                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    //RushLng Don't add in right now

                    break;
                case 11:
                    //rushTDyds
                    fromSYWList.RushingStats.RushAtt += 1;
                    fromSYWList.RushingStats.RushYds += fromPlay.Yards;

                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    //RushLngTD Don't add in right now
                    if (note == "TD") {
                        fromSYWList.RushingStats.RushTds += 1;
                        fromSYWList.currentPts += 6;
                    }
                    else
                        throw new Exception("Has RushingTDYards but note is not TD <- check play");
                    break;
                case 14:
                    //passInc
                    fromSYWList.PassingStats.PassAtt += 1;
                    break;
                case 15:
                    //PassYrds
                    fromSYWList.PassingStats.PassYds += fromPlay.Yards;
                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    break;
                case 16:
                    //PassYrdsTD
                    fromSYWList.PassingStats.PassYds += fromPlay.Yards;
                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));

                    if (note == "TD") {
                        fromSYWList.PassingStats.PassTds += 1;
                        fromSYWList.currentPts += 6;
                    }
                    else
                        throw new Exception("Has PassTDYards but note is not TD <- check play");
                    break;
                case 19:
                    //PassINT
                    if (note == "INT") {
                        fromSYWList.PassingStats.PassInts += 1;
                        fromSYWList.currentPts += -2;
                    }
                    //add int Exception it triggers on chargersvssteelers

                    break;
                case 20:
                    //QBSack
                    fromSYWList.PassingStats.PassAtt += 1;
                    //sack yardage goes in to team total but qb indv stats do not change

                    break;
                case 21:
                    //RecYds
                    fromSYWList.ReceivingStats.Rec += 1;
                    fromSYWList.ReceivingStats.RecYds += fromPlay.Yards;

                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    //add in RecLng Later
                    break;
                case 22:
                    //RecYrdsTD
                    fromSYWList.ReceivingStats.Rec += 1;
                    fromSYWList.ReceivingStats.RecYds += fromPlay.Yards;
                    fromSYWList.ReceivingStats.RecTds += 1;

                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    fromSYWList.currentPts += 6;
                    //add in RecLngTD later
                    break;
                case 69:
                    //FGMiss
                    if (note == "FGM") {
                        fromSYWList.KickingStats.Fga += 1;
                        fromSYWList.KickingStats.Fgyds += fromPlay.Yards;
                    }
                    else
                        throw new Exception("statID says FGM, but note doesn't <- check play");
                    break;
                case 70:
                    //FG
                    if (note == "FG") {
                        fromSYWList.KickingStats.Fga += 1;
                        fromSYWList.KickingStats.Fgm += 1;
                        fromSYWList.KickingStats.Fgyds += fromPlay.Yards;

                        fromSYWList.currentPts += Convert.ToDecimal(Math.Floor(fromPlay.Yards / 10.00));
                    }
                    else
                        throw new Exception("statID says FG, but note doesn't <- check play");
                    break;
                case 71:
                    //Guessing this is XPMISS
                    if (note == "XPM")
                        throw new Exception("THIS IS XPMISSED");
                    break;
                case 72:
                    //XP
                    if (note == "XP") {
                        fromSYWList.KickingStats.Xpa += 1;
                        fromSYWList.KickingStats.Xpmade += 1;
                        fromSYWList.KickingStats.Xptot += 1;

                        fromSYWList.currentPts += 1;
                    }
                    else
                        throw new Exception("statID says XP, but note doesn't <- check play");
                    break;
                case 111:
                    //yrds thrown cmp
                    fromSYWList.PassingStats.PassAtt += 1;
                    fromSYWList.PassingStats.PassCmp += 1;
                    break;
                case 112:
                    //yrds thrown inc
                    fromSYWList.PassingStats.PassAtt += 1;
                    break;
                case 113:
                    //YAC (For AdvStats)
                    break;
                case 115:
                    //PassTarget
                    fromSYWList.ReceivingStats.RecTrg += 1;
                    break;
                default:
                    //write out to file with plays that don't get flagged later after adding in fumbles, ko's, penalty, etc.
                    break;
            }

            return fromSYWList;
        }
        //uses PlayersIDS to get List NFLPlayer objects
        //in-Ienum<int> PlayersID out-List<StatsYearWeek>
        public List<StatsYearWeek> GetAllStatsFromPlayersID(IEnumerable<int> PlayersID) {
            List<StatsYearWeek> PlayersOnTeamCol = new List<StatsYearWeek>();

            using (var FFContext = new FF()) {

                foreach (var playerID in PlayersID) {
                    StatsYearWeek st = new StatsYearWeek();
                    //changed to StatsYearWeek, key changed, need to update to new key
                    //old key- PlayerID, new key- Year+week+playerid

                    int SYWID = ConvertPlayerIDToSYWID(playerID);   //ID conversion

                    if (_playersStats.TryGetValue(SYWID, out st))  //from stats dict created in init
                        PlayersOnTeamCol.Add(st);
                    else
                        throw new Exception("PlayeronTeam in DB, not found pulling from statsdict created in init");
                }
            }

            return PlayersOnTeamCol;
        }
 private void BroadcastPlayers(StatsYearWeek player) {
     Clients.All.updatePlayers(player);
 }
        private bool TryUpdateAwayPlayerPoint(StatsYearWeek statPlayer) {
            bool found = false;
            StatsYearWeek awayPlayer;

            if (_awayPlayers.TryGetValue(statPlayer.id, out awayPlayer)) {
                _awayPlayers[statPlayer.id] = statPlayer;
                found = true;
            }

            return found;

        }
        public bool ProcessPlay(PlaysVM currPlay) {
            StatsYearWeek s = new StatsYearWeek();
            bool playStatus = true;

            foreach (PlayersVM p in currPlay.Players) {
                int SYWID = ConvertPlayerIDToSYWID(p.id);   //id conversion

                if (_playersStats.TryGetValue(SYWID, out s)) {
                    //do update on player in allLive dict
                    StatsYearWeek copy = UpdateStat(p, s, currPlay.Note);
                    //update dict value
                    _playersStats[SYWID] = copy;
                    liveUpdateList.Add(copy.id);
                }
                else { }
                //punter, defensive player, will have to figure out that later, but still need to display play
            }
            return playStatus;
        }