Exemplo n.º 1
0
        public ActionResult FrequentPlayerUserStatsUpdater()
        {
            Caching.ClearAllCaches();
            var timer = Stopwatch.StartNew();
            var api   = new MySportsFeedApiTransactions();
            var data  = api.SplitDataTeamLists();

            // Update PlayerInfo table team per team
            foreach (var playerInfoList in data)
            {
                _playerInfoServices.Update(playerInfoList);
            }
            _playerInfoServices.UpdateStatus();
            _playerInfoServices.UpdateAvg();
            //_playerInfoServices.UpdateInjuryStatus(); // no need to be frequent

            // Update UserIfo Table
            _userInfoServices.UpdateAll();
            //_userInfoServices.UpdateBestMonth(); // no need to be frequent
            //_userInfoServices.UpdateBestDay(); // no need to be frequent // best day must be call last after all other updates

            // Update TeamSchedule table -> who play today
            //_teamScheduleServices.Update(); // no need to be frequent - daily

            // Udpate Config Table - set last update time -> NOW
            _configServices.SetLastUpdate(DateTime.Now);

            Caching.ClearAllCaches();
            // For PROD only
            SendMessage("FrequentPlayerUserStatsUpdater", "Success", timer.Elapsed.ToString()); // fail will be sent by LogError
            return(RedirectToAction("Index", "Home", new { Area = "Common" }));
        }
Exemplo n.º 2
0
        public ActionResult CreateAllPlayerInfo()
        {
            Caching.ClearAllCaches();
            var timer = Stopwatch.StartNew();
            var api   = new MySportsFeedApiTransactions();
            var data  = api.SplitDataTeamLists();

            // Create PlayerInfo table team per team
            foreach (var playerInfoList in data)
            {
                _playerInfoServices.CreateList(playerInfoList);
            }

            Caching.ClearAllCaches();
            // for DEBUG only
            //Debug.WriteLine("CreateAllPlayerInfo time: " + timer.Elapsed);
            // For PROD only
            SendMessage("DailyPastStatsFiller", "Success", timer.Elapsed.ToString()); // fail will be sent by LogError
            return(RedirectToAction("Index", "Home", new { Area = "Common" }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create PastPlayerInfo and update PlayerInfo. Then RUn user info routines, injury routine and team sched routine.
        /// </summary>
        /// <returns></returns>
        public ActionResult DailyFullUpdater()
        {
            Caching.ClearAllCaches();
            var timer = Stopwatch.StartNew();
            var api   = new MySportsFeedApiTransactions();
            var data  = api.SplitDataTeamLists();

            // Update PlayerInfo table team per team
            foreach (var playerInfoList in data)
            {
                _pastPlayerInfoServices.Create(playerInfoList);
                _playerInfoServices.Update(playerInfoList);
            }
            _playerInfoServices.UpdateStatus();
            _playerInfoServices.UpdateAvg();
            _playerInfoServices.UpdateInjuryStatus();

            // Update UserIfo Table
            _userInfoServices.UpdateAll();
            _userInfoServices.UpdateBestMonth();
            _userInfoServices.UpdateBestDay(); //// best day must be call last after all other updates

            // Update TeamSchedule table -> who play today
            _teamScheduleServices.Update();

            // Udpate Config Table - set last update time -> NOW
            _configServices.SetLastUpdate(DateTime.Now);

            Caching.ClearAllCaches();
            // for DEBUG only
            //Debug.WriteLine("DailyFullUpdater time: " + timer.Elapsed);
            // For PROD only
            SendMessage("DailyFullUpdater", "Success", timer.Elapsed.ToString()); // fail will be sent by LogError
            HttpRuntime.UnloadAppDomain();                                        // hardcore clear app recycle!
            return(RedirectToAction("Index", "Home", new { Area = "Common" }));
        }