You can now click on a driver to see its stats
This commit is contained in:
@@ -117,6 +117,32 @@ namespace Test_Merge
|
||||
}
|
||||
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";
|
||||
using (var command = new SQLiteCommand(selectQuery, Connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@driverID", driverId);
|
||||
command.Parameters.AddWithValue("@limit", numberOfLaptimes);
|
||||
try
|
||||
{
|
||||
SQLiteDataReader reader = command.ExecuteReader();
|
||||
while (reader.Read())
|
||||
{
|
||||
int lapTime = reader.GetInt32(0);
|
||||
int lap = reader.GetInt32(1);
|
||||
lapData.Add((lapTime, lap));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//MessageBox.Show("There has been an error while trying to retrieve the ID of a Driver from the database");
|
||||
}
|
||||
}
|
||||
return lapData;
|
||||
}
|
||||
public void AddPitstop(string driverName,int lap,string tyre)
|
||||
{
|
||||
string insertQuery = "INSERT INTO Pitstops (Lap,DriverID,Tyre) VALUES (@Lap,@DriverID,@Tyre)";
|
||||
|
||||
Reference in New Issue
Block a user