вот теперь первая часть закончена
This commit is contained in:
parent
aacae48a73
commit
840dd087ad
@ -25,9 +25,12 @@ public class Driver
|
||||
|
||||
public string FullName => $"{Fname} {Lname}";
|
||||
|
||||
[DisplayName("Id фуры")]
|
||||
[Browsable(false)]
|
||||
public int TruckId { get;private set; }
|
||||
|
||||
[DisplayName("Номера фуры")]
|
||||
public string TruckNum { get;private set; } = string.Empty;
|
||||
|
||||
public static Driver CreateDriver(int id, string fname, string lname, int truckid)
|
||||
{
|
||||
return new Driver
|
||||
|
@ -24,9 +24,10 @@ public class FuelReplenishment
|
||||
public string Fuel => FuelFuelReplenishments != null ?
|
||||
string.Join(", ", FuelFuelReplenishments.Select(x => $"{x.FuelName} {x.Amount}")) : string.Empty;
|
||||
|
||||
[Browsable(false)]
|
||||
public IEnumerable<FuelFuelReplenishment> FuelFuelReplenishments { get; private set;} = [];
|
||||
|
||||
[Browsable(false)]
|
||||
|
||||
public static FuelReplenishment CreateOpeartion(int id, int driverId, IEnumerable<FuelFuelReplenishment> fuelFuelReplenishments)
|
||||
{
|
||||
return new FuelReplenishment
|
||||
|
@ -29,7 +29,7 @@ public class Transportation
|
||||
[DisplayName("Маршрут")]
|
||||
public string RouteName { get; private set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата кормежки")]
|
||||
[DisplayName("Дата отправки")]
|
||||
public DateTime TransportationDate { get; private set; }
|
||||
|
||||
[DisplayName("Кол-во топлива")]
|
||||
|
@ -94,7 +94,12 @@ namespace ProjectGarage.Forms
|
||||
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewDrivers.DataSource = _driverRepository.ReadDrivers();
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewDrivers.DataSource = _driverRepository.ReadDrivers();
|
||||
dataGridViewDrivers.Columns["Id"].Visible = false;
|
||||
dataGridViewDrivers.Columns["FullName"].Visible = false;
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
|
@ -96,7 +96,11 @@ namespace ProjectGarage.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewFuels.DataSource = _fuelRepository.ReadFuels();
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewFuels.DataSource = _fuelRepository.ReadFuels();
|
||||
dataGridViewFuels.Columns["Id"].Visible = false;
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
|
@ -77,8 +77,13 @@ namespace ProjectGarage.Forms
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridViewReplenishments.DataSource = _replenishmentRepository.ReadFuelReplenishment();
|
||||
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewReplenishments.DataSource = _replenishmentRepository.ReadFuelReplenishment();
|
||||
dataGridViewReplenishments.Columns["Id"].Visible = false;
|
||||
dataGridViewReplenishments.Columns["ReplenishmentDate"].DefaultCellStyle.Format = "dd.MM.yyyy";
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
|
@ -96,7 +96,11 @@ namespace ProjectGarage.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewRoutes.DataSource = _routeRepository.ReadRoute();
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewRoutes.DataSource = _routeRepository.ReadRoute();
|
||||
dataGridViewRoutes.Columns["Id"].Visible = false;
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
|
@ -52,6 +52,11 @@ namespace ProjectGarage.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewTransportations.DataSource = _transportationRepository.ReadTransportation();
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewTransportations.DataSource = _transportationRepository.ReadTransportation();
|
||||
dataGridViewTransportations.Columns["Id"].Visible = false;
|
||||
dataGridViewTransportations.Columns["TransportationDate"].DefaultCellStyle.Format = "dd MMMM yyyy hh:mm";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,12 @@ namespace ProjectGarage.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewTrucks.DataSource = _truckRepository.ReadTrucks();
|
||||
private void LoadList()
|
||||
{
|
||||
dataGridViewTrucks.DataSource = _truckRepository.ReadTrucks();
|
||||
dataGridViewTrucks.Columns["Id"].Visible = false;
|
||||
dataGridViewTrucks.Columns["TruckInfo"].Visible = false;
|
||||
}
|
||||
|
||||
private bool TryGetIDFromSelectedRow(out int id)
|
||||
{
|
||||
|
@ -117,7 +117,10 @@ WHERE Id=@id";
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM driver";
|
||||
var querySelect = @"SELECT d.*,
|
||||
CONCAT(t.Numbers, '') as TruckNum
|
||||
FROM driver d
|
||||
JOIN Truck t ON d.TruckID = t.Id";
|
||||
var drivers = connection.Query<Driver>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(drivers));
|
||||
return drivers;
|
||||
|
Loading…
Reference in New Issue
Block a user