public void UpdateDMStats(ulong accID, DMStatistics stats) { using (var con = GetConnection()) { using (var cmd = BuildQuery(con, "UPDATE account_dmstats SET Kills=@Kills, KillAssists=@KillA, Deaths=@Deaths, Matches=@Matches, Won=@Won, Lost=@Lost WHERE ID=@ID", "@Kills", stats.TotalKills, "@KillA", stats.TotalKillAssists, "@Deaths", stats.TotalDeaths, "@Matches", stats.TotalMatches, "@Won", stats.Won, "@Lost", stats.Lost, "@ID", accID)) { cmd.ExecuteNonQuery(); } } }
public DMStatistics GetDMStats(ulong accID) { var stats = new DMStatistics(); using (var con = GetConnection()) { using (var cmd = BuildQuery(con, "SELECT * FROM account_dmstats WHERE ID=@ID", "@ID", accID)) { using (var r = cmd.ExecuteReader()) { if (!r.Read()) return stats; stats.TotalKills = r.GetUInt32("Kills"); stats.TotalKillAssists = r.GetUInt32("KillAssists"); stats.TotalDeaths = r.GetUInt32("Deaths"); stats.TotalMatches = r.GetUInt32("Matches"); stats.Won = r.GetUInt32("Won"); stats.Lost = r.GetUInt32("Lost"); } } } return stats; }