//----------------------------------------------------------------------------------------
        // Saving
        //----------------------------------------------------------------------------------------

        public void SaveNonCommitMatchHistory(TCommitType commitType) // see SQLiteMatchDAO/saveNonCommitMatchHistory
        {
            MatchPlayedThisEvent m = this;

            m.AddCommitHistory(new Commit(m.NewCommitInstant, commitType));
            DateTimeOffset commitTime = m.CommitHistoryLatest.Ts;

            // BLOCK
            {
                var psHistory = Database.Tables.QualsCommitHistory.NewRow();
                psHistory.MatchNumber.Value   = m.MatchNumber;
                psHistory.Ts.Value            = commitTime;
                psHistory.Start.Value         = m.StartTime;
                psHistory.Randomization.Value = (int)m.Randomization;
                psHistory.CommitType.Value    = (int?)commitType;
                psHistory.Insert();
            }

            foreach (var s in new [] { m.RedScores, m.BlueScores })
            {
                int alliance = s == m.RedScores ? 0 : 1;

                // BLOCK
                {
                    var psScoresHistory = Database.Tables.QualsScoresHistory.NewRow();
                    psScoresHistory.MatchNumber.Value = MatchNumber;
                    psScoresHistory.Ts.Value          = commitTime;
                    psScoresHistory.Alliance.Value    = alliance;
                    s.Save(psScoresHistory);
                    psScoresHistory.Insert();
                }

                // BLOCK
                {
                    var psGameHistory = Database.Tables.QualsGameSpecificHistory.NewRow();
                    psGameHistory.MatchNumber.Value = MatchNumber;
                    psGameHistory.Ts.Value          = commitTime;
                    psGameHistory.Alliance.Value    = alliance;
                    s.Save(psGameHistory);
                    psGameHistory.Insert();
                }
            }
        }
Ejemplo n.º 2
0
 public Commit(DateTimeOffset ts, TCommitType commitType)
 {
     Ts         = ts;
     CommitType = commitType;
 }