diff --git a/ProjectGarage/Entities/Driver.cs b/ProjectGarage/Entities/Driver.cs index 506df4b..3c4dd3c 100644 --- a/ProjectGarage/Entities/Driver.cs +++ b/ProjectGarage/Entities/Driver.cs @@ -15,8 +15,6 @@ public class Driver public string Last_name { get;private set; } = string.Empty; - public string Phone_Number { get;private set; } = string.Empty; - public int TruckId { get;private set; } public static Driver CreateDriver(int id, string fname, string lname, int tryckid) diff --git a/ProjectGarage/Forms/FormDriver.cs b/ProjectGarage/Forms/FormDriver.cs index ea1a7f6..5bdc702 100644 --- a/ProjectGarage/Forms/FormDriver.cs +++ b/ProjectGarage/Forms/FormDriver.cs @@ -82,6 +82,6 @@ namespace ProjectGarage.Forms private void ButtonCancelDriver_Click(object sender, EventArgs e) => Close(); private Driver CreateDriver(int id) => Driver.CreateDriver(id, textBoxFirstName.Text, - textBoxLastName.Text, textBoxPhoneNum.Text, (int)comboBoxTruckID.SelectedIndex!);// + textBoxLastName.Text, (int)comboBoxTruckID.SelectedIndex!);// } } diff --git a/ProjectGarage/Forms/FormDrivers.cs b/ProjectGarage/Forms/FormDrivers.cs index b5444ad..cf1853d 100644 --- a/ProjectGarage/Forms/FormDrivers.cs +++ b/ProjectGarage/Forms/FormDrivers.cs @@ -36,7 +36,6 @@ namespace ProjectGarage.Forms } } - private void ButtonAddDriver_Click(object sender, EventArgs e) { try diff --git a/ProjectGarage/Forms/FormTruck.cs b/ProjectGarage/Forms/FormTruck.cs index b1878a1..d6a6a03 100644 --- a/ProjectGarage/Forms/FormTruck.cs +++ b/ProjectGarage/Forms/FormTruck.cs @@ -24,6 +24,7 @@ namespace ProjectGarage.Forms textBoxTruckNumbers.Text = truck.Numbers; comboBoxTruckType.SelectedItem = truck.Type; numericUpDownMaxFuel.Value = truck.MaxFuel; + _truckId = value; } catch (Exception ex) { diff --git a/ProjectGarage/Forms/FormTrucks.cs b/ProjectGarage/Forms/FormTrucks.cs index c135a16..41a2e7f 100644 --- a/ProjectGarage/Forms/FormTrucks.cs +++ b/ProjectGarage/Forms/FormTrucks.cs @@ -32,7 +32,7 @@ namespace ProjectGarage.Forms } catch (Exception ex) { - MessageBox.Show(ex.Message, "Ошибка при закгрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -56,7 +56,7 @@ namespace ProjectGarage.Forms return; } - if (MessageBox.Show("Удалить звпись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } diff --git a/ProjectGarage/ProjectGarage.csproj b/ProjectGarage/ProjectGarage.csproj index 0e8c74c..c4cc11c 100644 --- a/ProjectGarage/ProjectGarage.csproj +++ b/ProjectGarage/ProjectGarage.csproj @@ -40,7 +40,7 @@ - + PreserveNewest diff --git a/ProjectGarage/Repositories/Implementations/DriverRepository.cs b/ProjectGarage/Repositories/Implementations/DriverRepository.cs index b7d753e..047c8a5 100644 --- a/ProjectGarage/Repositories/Implementations/DriverRepository.cs +++ b/ProjectGarage/Repositories/Implementations/DriverRepository.cs @@ -79,7 +79,7 @@ WHERE id_driver=@Id"; using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var queryDelete = @" DELETE FROM driver -WHERE id_driver=@id"; +WHERE id_driver=@driverId"; connection.Execute(queryDelete, new { driverId }); } catch (Exception ex) @@ -98,8 +98,8 @@ WHERE id_driver=@id"; { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var querySelect = @" -SELECT * FROM route_list -WHERE id=@routeListId"; +SELECT * FROM driver +WHERE id_driver=@driverId"; var driver = connection.QueryFirst(querySelect, new { driverId }); _logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(driver)); @@ -119,9 +119,9 @@ WHERE id=@routeListId"; { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var querySelect = @"SELECT * FROM driver"; - var driver = connection.Query(querySelect); - _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(driver)); - return driver; + var drivers = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(drivers)); + return drivers; } catch (Exception ex) { diff --git a/ProjectGarage/Resources/appsettings.json b/ProjectGarage/appsettings.json similarity index 100% rename from ProjectGarage/Resources/appsettings.json rename to ProjectGarage/appsettings.json