Добавление проверки
This commit is contained in:
parent
34a190211b
commit
a9eafdd585
@ -124,6 +124,19 @@ namespace TransportCompanyView
|
||||
_logger.LogInformation("Создание транспортировки");
|
||||
try
|
||||
{
|
||||
var selectedCargo = _cargoList?.FirstOrDefault(c => c.Id == Convert.ToInt32(comboBoxCargo.SelectedValue));
|
||||
var selectedTransport = _transportList?.FirstOrDefault(t => t.Id == Convert.ToInt32(comboBoxTransport.SelectedValue));
|
||||
|
||||
var cargoWeight = selectedCargo?.Weight ?? 0;
|
||||
var totalCount = Convert.ToInt32(textBoxCount.Text);
|
||||
var totalWeight = cargoWeight * totalCount;
|
||||
|
||||
if (totalWeight > selectedTransport?.LoadCapacity)
|
||||
{
|
||||
MessageBox.Show("Вес груза превышает вместимость выбранной машины", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var operationResult = _logicTt.CreateTransportation(new TransportationBindingModel
|
||||
{
|
||||
DriverId = Convert.ToInt32(comboBoxDriver.SelectedValue),
|
||||
|
@ -100,7 +100,7 @@
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(1305, 381);
|
||||
dataGridView.Size = new Size(1305, 628);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
@ -109,7 +109,7 @@
|
||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
buttonCreateOrder.Size = new Size(247, 29);
|
||||
buttonCreateOrder.TabIndex = 2;
|
||||
buttonCreateOrder.Text = "Создать транспортировку";
|
||||
buttonCreateOrder.Text = "Создать накладную";
|
||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
buttonCreateOrder.Click += ButtonFormCreateTransportation_Click;
|
||||
//
|
||||
@ -157,7 +157,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1594, 425);
|
||||
ClientSize = new Size(1594, 671);
|
||||
Controls.Add(buttonRef);
|
||||
Controls.Add(buttonIssuedOrder);
|
||||
Controls.Add(buttonOrderReady);
|
||||
|
Loading…
Reference in New Issue
Block a user