You can now see up to 4 of the battles that are going on (You can even click on the drivers to see them on the bottom of the screen)

This commit is contained in:
2023-05-24 13:54:42 +02:00
parent e4edd71adc
commit f356d90c35
5 changed files with 189 additions and 53 deletions
+26 -1
View File
@@ -117,11 +117,36 @@ namespace Test_Merge
}
return result;
}
public List<int> GetSectorsFromLapTime(string driverName,int lap)
{
int driverId = GetDriverID(driverName);
string selectQuery = "SELECT Sector1,Sector2,Sector3 FROM Stats WHERE DriverID = @driverID AND Lap = @Lap";
List<int> result = new List<int>();
using (var command = new SQLiteCommand(selectQuery, Connection))
{
command.Parameters.AddWithValue("@driverID", driverId);
command.Parameters.AddWithValue("@lap", lap);
try
{
SQLiteDataReader reader = command.ExecuteReader();
while (reader.Read())
{
int sectorTime = reader.GetInt32(0);
result.Add(sectorTime);
}
}
catch
{
//MessageBox.Show("There has been an error while trying to retrieve the ID of a Driver from the database");
}
}
return result;
}
public List<(int LapTime, int Lap)> GetDriverLaptimes(string driverName,int numberOfLaptimes)
{
int driverId = GetDriverID(driverName);
List<(int LapTime, int Lap)> lapData = new List<(int LapTime, int Lap)>();
string selectQuery = "Select LapTime,Lap from Stats WHERE DriverID = @driverID LIMIT @limit";
string selectQuery = "Select LapTime,Lap from Stats WHERE DriverID = @driverID ORDER BY Lap DESC LIMIT @limit";
using (var command = new SQLiteCommand(selectQuery, Connection))
{
command.Parameters.AddWithValue("@driverID", driverId);