public static void PostTelemetryData(TelemetryTimingData Data, string Version, string IpAddress) { using (SqlConnection Connection = new SqlConnection(MsSqlConnectionString)) { Connection.Open(); using (SqlCommand Command = new SqlCommand("INSERT INTO dbo.[Telemetry.v2] (Action, Result, UserName, Project, Timestamp, Duration, Version, IpAddress) VALUES (@Action, @Result, @UserName, @Project, @Timestamp, @Duration, @Version, @IpAddress)", Connection)) { Command.Parameters.AddWithValue("@Action", Data.Action); Command.Parameters.AddWithValue("@Result", Data.Result); Command.Parameters.AddWithValue("@UserName", Data.UserName); Command.Parameters.AddWithValue("@Project", Data.Project); Command.Parameters.AddWithValue("@Timestamp", Data.Timestamp); Command.Parameters.AddWithValue("@Duration", Data.Duration); Command.Parameters.AddWithValue("@Version", Version); Command.Parameters.AddWithValue("@IPAddress", IpAddress); Command.ExecuteNonQuery(); } } using (SQLiteConnection Connection = new SQLiteConnection(SQLiteConnectionString)) { Connection.Open(); using (SQLiteCommand Command = new SQLiteCommand("INSERT INTO [Telemetry.v2] (Action, Result, UserName, Project, Timestamp, Duration, Version, IpAddress) VALUES (@Action, @Result, @UserName, @Project, @Timestamp, @Duration, @Version, @IpAddress)", Connection)) { Command.Parameters.AddWithValue("@Action", Data.Action); Command.Parameters.AddWithValue("@Result", Data.Result); Command.Parameters.AddWithValue("@UserName", Data.UserName); Command.Parameters.AddWithValue("@Project", Data.Project); Command.Parameters.AddWithValue("@Timestamp", Data.Timestamp); Command.Parameters.AddWithValue("@Duration", Data.Duration); Command.Parameters.AddWithValue("@Version", Version); Command.Parameters.AddWithValue("@IPAddress", IpAddress); Command.ExecuteNonQuery(); } } }
public static void PostTelemetryData(TelemetryTimingData Data, string Version, string IpAddress) { using (MySqlConnection Connection = new MySqlConnection(ConnectionString)) { Connection.Open(); long ProjectId = TryInsertAndGetProject(Connection, Data.Project); using (MySqlCommand Command = new MySqlCommand("INSERT INTO ugs_db.Telemetry_v2 (Action, Result, UserName, Project, Timestamp, Duration, Version, IpAddress, ProjectId) VALUES (@Action, @Result, @UserName, @Project, @Timestamp, @Duration, @Version, @IpAddress, @ProjectId)", Connection)) { Command.Parameters.AddWithValue("@Action", Data.Action); Command.Parameters.AddWithValue("@Result", Data.Result); Command.Parameters.AddWithValue("@UserName", Data.UserName); Command.Parameters.AddWithValue("@Project", Data.Project); Command.Parameters.AddWithValue("@Timestamp", Data.Timestamp); Command.Parameters.AddWithValue("@Duration", Data.Duration); Command.Parameters.AddWithValue("@Version", Version); Command.Parameters.AddWithValue("@IPAddress", IpAddress); Command.Parameters.AddWithValue("@ProjectId", ProjectId); Command.ExecuteNonQuery(); } } }
public void Post([FromBody] TelemetryTimingData Data, string Version, string IpAddress) { SqlConnector.PostTelemetryData(Data, Version, IpAddress); }