public static void SaveTournamentMatch(Kv kv) { TournamentMatch TournamentMatch; int tournamentMatchID = kv.GetInt32("TournamentMatchID"); if (tournamentMatchID > 0) // update existing match { TournamentMatch = new TournamentMatch(kv.Cxt, tournamentMatchID); } else // add new match { TournamentMatch = new TournamentMatch(kv.Cxt, 0); } TournamentMatch.TournamentID = kv.GetInt32("TournamentID"); TournamentMatch.WhiteUserID = kv.GetInt32("WhiteUserID"); TournamentMatch.BlackUserID = kv.GetInt32("BlackUserID"); TournamentMatch.Round = kv.GetInt32("Round"); TournamentMatch.TimeMin = kv.GetInt32("TimeMin"); TournamentMatch.TimeSec = kv.GetInt32("TimeSec"); TournamentMatch.MatchStartDate = kv.GetDateTime("MatchStartDate"); TournamentMatch.MatchStartTime = kv.GetDateTime("MatchStartTime"); TournamentMatch.ParentMatchID = kv.GetInt32("ParentMatchID"); TournamentMatch.TournamentMatchStatusID = kv.GetInt32("TournamentMatchStatusID"); TournamentMatch.TournamentMatchTypeID = kv.GetInt32("TournamentMatchTypeID"); TournamentMatch.StatusID = kv.GetInt32("StatusID"); TournamentMatch.Save(); }