Остались понты.

This commit is contained in:
Programmist73 2023-05-10 22:12:56 +04:00
parent 3cb983b7dc
commit d00e014de5
2 changed files with 42 additions and 3 deletions

View File

@ -95,10 +95,48 @@ namespace TransportCompamyMongoDBImplementer.Implements
List<Transport> models = model.Select(x => Transport.Create(new() List<Transport> models = model.Select(x => Transport.Create(new()
{ {
Tranport = x.Tranport, Tranport = x.Tranport
TransportationType = "Что-то"
})).ToList(); })).ToList();
//цикл для перезаписи типа грузоперевозки
foreach (var transport in models)
{
if (transport.TransportType.Equals("Баржа"))
{
transport.TransportationType = "Грузовая";
}
if (transport.TransportType.Equals("Вертолёт"))
{
transport.TransportationType = "Пассажирская";
}
if (transport.TransportType.Equals("Самолёт"))
{
transport.TransportationType = "Пассажирская";
}
if (transport.TransportType.Equals("Легковой автомобиль"))
{
transport.TransportationType = "Пассажирская";
}
if (transport.TransportType.Equals("Фура"))
{
transport.TransportationType = "Грузовая";
}
if (transport.TransportType.Equals("Минивен"))
{
transport.TransportationType = "Грузовая";
}
if (transport.TransportType.Equals("Открытый грузовик"))
{
transport.TransportationType = "Перевозка животных";
}
}
transportCollection.InsertMany(models); transportCollection.InsertMany(models);
return true; return true;

View File

@ -51,6 +51,7 @@ namespace TransportCompany
{ {
dataGridView.Columns["Id"].Visible = true; dataGridView.Columns["Id"].Visible = true;
dataGridView.Columns["MongoId"].Visible = false; dataGridView.Columns["MongoId"].Visible = false;
dataGridView.Columns["TransportationType"].Visible = false;
} }
else else
{ {
@ -58,7 +59,7 @@ namespace TransportCompany
dataGridView.Columns["MongoId"].Visible = true; dataGridView.Columns["MongoId"].Visible = true;
} }
dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
} }
_logger.LogInformation("Загрузка транспортных средств"); _logger.LogInformation("Загрузка транспортных средств");