Exemplo n.º 1
0
        /// <summary>
        /// One off.Player status and user cumulative
        /// </summary>
        /// <returns></returns>
        public ActionResult PlayerUserStatsUpdater()
        {
            Caching.ClearAllCaches();
            var timer = Stopwatch.StartNew();

            //Update player info
            _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("PlayerUserStatsUpdater time: " + timer.Elapsed);
            // For PROD only
            SendMessage("FrequentPlayerUserStatsUpdater", "Success", timer.Elapsed.ToString()); // fail will be sent by LogError
            return(RedirectToAction("Index", "Home", new { Area = "Common" }));
        }