Ejemplo n.º 1
0
 public static void InsertBoxScores(BoxScoresDTO oBoxScoresDTO)
 => InsertRowPrep(BoxScoresTable, BoxScoresColumns, oBoxScoresDTO, populate_ocValues);
Ejemplo n.º 2
0
        static void populate_ocValues(List <string> ocValues, object DTO)
        {
            // Column Updates Procedure
            // 1) Update Table Columns
            // 2) Select 1000, Cut Column names, Insert in Textpad, run Sql Columns macro, Replace {table}Columns with macro Op
            // 3) Use CodeGeneration.xlsm to generate populate_ocValues entries
            // 4) Update CoversBoxScore.PopulateBoxScoresDTO
            BoxScoresDTO oBoxScoresDTO = (BoxScoresDTO)DTO;

            #region pastedBoxScoresRows

            ocValues.Add(oBoxScoresDTO.Exclude.ToString());
            ocValues.Add(oBoxScoresDTO.LeagueName.ToString());
            ocValues.Add(oBoxScoresDTO.GameDate.ToString());
            ocValues.Add(oBoxScoresDTO.RotNum.ToString());
            ocValues.Add(oBoxScoresDTO.Team.ToString());
            ocValues.Add(oBoxScoresDTO.Opp.ToString());
            ocValues.Add(oBoxScoresDTO.Venue.ToString());
            ocValues.Add(oBoxScoresDTO.GameTime.ToString());
            ocValues.Add(oBoxScoresDTO.Season.ToString());
            ocValues.Add(oBoxScoresDTO.SubSeason.ToString());
            ocValues.Add(oBoxScoresDTO.MinutesPlayed.ToString());
            ocValues.Add(oBoxScoresDTO.OtPeriods.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreReg.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreOT.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreRegUs.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreRegOp.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreOTUs.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreOTOp.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreQ1Us.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreQ1Op.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreQ2Us.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreQ2Op.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreQ3Us.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreQ3Op.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreQ4Us.ToString());
            ocValues.Add(oBoxScoresDTO.ScoreQ4Op.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualMadeUsPt1.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualMadeUsPt2.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualMadeUsPt3.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualMadeOpPt1.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualMadeOpPt2.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualMadeOpPt3.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualAttemptedUsPt1.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualAttemptedUsPt2.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualAttemptedUsPt3.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualAttemptedOpPt1.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualAttemptedOpPt2.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsActualAttemptedOpPt3.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsMadeUsRegPt1.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsMadeUsRegPt2.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsMadeUsRegPt3.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsMadeOpRegPt1.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsMadeOpRegPt2.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsMadeOpRegPt3.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsAttemptedUsRegPt1.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsAttemptedUsRegPt2.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsAttemptedUsRegPt3.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsAttemptedOpRegPt1.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsAttemptedOpRegPt2.ToString());
            ocValues.Add(oBoxScoresDTO.ShotsAttemptedOpRegPt3.ToString());
            ocValues.Add(oBoxScoresDTO.TurnOversUs.ToString());
            ocValues.Add(oBoxScoresDTO.TurnOversOp.ToString());
            ocValues.Add(oBoxScoresDTO.OffRBUs.ToString());
            ocValues.Add(oBoxScoresDTO.OffRBOp.ToString());
            ocValues.Add(oBoxScoresDTO.AssistsUs.ToString());
            ocValues.Add(oBoxScoresDTO.AssistsOp.ToString());
            ocValues.Add(oBoxScoresDTO.Source.ToString());
            ocValues.Add(oBoxScoresDTO.LoadDate.ToString());
            ocValues.Add(oBoxScoresDTO.LoadTimeSeconds.ToString());


            #endregion pastedBoxScoresRows
        }
Ejemplo n.º 3
0
        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