public void LoadTodaysRotation() { LoadBoxScoreRange(); for (int i = 0; i < 2; i++) // { string _strLoadDateTime = _oSeasonInfo.GameDate.ToString(); SortedList <string, CoversDTO> ocRotation = new SortedList <string, CoversDTO>(); //Trace.Trace.StartEvent($"LoadTodaysRotation.PopulateRotation loop {i}"); RotationDO.PopulateRotation(ocRotation, _oSeasonInfo.GameDate, _oLeagueDTO, _ConnectionString, _strLoadDateTime); //Trace.Trace.StartEvent($"oAdjustments {i}"); AdjustmentsDO oAdjustments = new AdjustmentsDO(_oSeasonInfo.GameDate, _oLeagueDTO.LeagueName, _ConnectionString); oAdjustments.ProcessDailyAdjustments(_oSeasonInfo.GameDate, _oLeagueDTO.LeagueName); _oSeasonInfo.GameDate = _oSeasonInfo.GameDate.AddDays(1); } //Trace.Trace.TurnTraceOff(); }
public int LoadBoxScore(DateTime GameDate) // Return NumOfMatchups { /* * * */ DateTime LoadDateTime = DateTime.Now; string _strLoadDateTime = LoadDateTime.ToString(); SortedList <string, CoversDTO> ocRotation = new SortedList <string, CoversDTO>(); RotationDO.PopulateRotation(ocRotation, _oSeasonInfo.GameDate, _oLeagueDTO, _ConnectionString, _strLoadDateTime); if (ocRotation.Count == 0) { return(0); // No Games for GameDate } foreach (var matchup in ocRotation) { CoversDTO oCoversDTO = matchup.Value; // 1) Get BoxScore from Covers CoversBoxscore oCoversBoxscore = new CoversBoxscore(GameDate, _oLeagueDTO, oCoversDTO); oCoversBoxscore.GetBoxscore(); // Get BoxScore from Covers if (oCoversBoxscore.ReturnCode != 0) { // kdtodo log error continue; } string[] arVenue = new string[] { "Away", "Home" }; for (int i = 0; i < 2; i++) { try { // Write Away & Home rows to BoxScores BoxScoresDTO BoxScoresDTO = new BoxScoresDTO(); oCoversBoxscore.PopulateBoxScoresDTO(BoxScoresDTO, arVenue[i], _oSeasonInfo.oSeasonInfoDTO.Season, _oSeasonInfo.oSeasonInfoDTO.SubSeason, LoadDateTime , oCoversBoxscore.LoadTimeSecound, "Covers"); Bball.DAL.Tables.BoxScoreDO.InsertBoxScores(BoxScoresDTO); } catch (Exception ex) { string msg = $"BoxScore Load Error - " + $"{_oLeagueDTO.LeagueName}: {GameDate} {oCoversDTO.RotNum}:{arVenue[i]} {oCoversDTO.TeamAway}-{oCoversDTO.TeamHome} " + "\n" + oCoversDTO.Url; throw new Exception(SysDAL.DALfunctions.StackTraceFormat(msg, ex, "")); } } // Write Last 5 Minutes stats BoxScoresLast5MinDTO oLast5MinDTOHome = new BoxScoresLast5MinDTO() { LeagueName = oCoversDTO.LeagueName , GameDate = oCoversDTO.GameDate , RotNum = oCoversDTO.RotNum + 1 , Team = oCoversDTO.TeamHome , Opp = oCoversDTO.TeamAway , Venue = "Home" , LoadDate = LoadDateTime }; try { //Bball.DAL.Tables. BoxScoreDO.InsertAwayHomeRowsBoxScoresLast5Min(oLast5MinDTOHome); } catch (Exception ex) { string msg = $"BoxScoreL5Min Load Error - " + $"{_oLeagueDTO.LeagueName}: {GameDate} {oCoversDTO.RotNum}: {oCoversDTO.TeamAway}-{oCoversDTO.TeamHome} " + "\n" + Bball.DAL.Parsing.BoxScoresLast5Min.BuildBoxScoresLast5MinUrl(oLast5MinDTOHome); // throw new Exception(SysDAL.DALfunctions.StackTraceFormat(msg, ex, "")); //Trace.Trace.Log(SysDAL.DALfunctions.StackTraceFormat(msg, ex, "")); } } // foreach AdjustmentsDO oAdjustments = new AdjustmentsDO(GameDate, _oLeagueDTO.LeagueName, _ConnectionString); oAdjustments.ProcessDailyAdjustments(GameDate, _oLeagueDTO.LeagueName); return(ocRotation.Count); // return NumOfMatchups } // LoadBoxScore