готово

This commit is contained in:
Алексей Крюков 2024-04-22 04:55:33 +04:00
parent 7ac18ed69d
commit 558f70c3d8
5 changed files with 23 additions and 15 deletions

View File

@ -57,7 +57,7 @@ namespace TypographyBusinessLogic.BusinessLogics
}
return true;
}
public bool CheckThenSupplyMany(IPrintedModel car, int count)
public bool CheckThenSupplyMany(IPrintedModel printed, int count)
{
if (count <= 0)
{
@ -77,7 +77,7 @@ namespace TypographyBusinessLogic.BusinessLogics
if (freeSpace < count)
{
_logger.LogWarning("Check then supply operation error. There's no place for new cars in shops.");
_logger.LogWarning("Check then supply operation error. There's no place for new printeds in shops.");
return false;
}
@ -93,7 +93,7 @@ namespace TypographyBusinessLogic.BusinessLogics
if (freeSpace >= count)
{
if (_shopLogic.MakeShipment(new ShopSearchModel() { Id = shop.Id }, car, count))
if (_shopLogic.MakeShipment(new ShopSearchModel() { Id = shop.Id }, printed, count))
count = 0;
else
{
@ -103,7 +103,7 @@ namespace TypographyBusinessLogic.BusinessLogics
}
if (freeSpace < count)
{
if (_shopLogic.MakeShipment(new ShopSearchModel() { Id = shop.Id }, car, freeSpace))
if (_shopLogic.MakeShipment(new ShopSearchModel() { Id = shop.Id }, printed, freeSpace))
count -= freeSpace;
else
{

View File

@ -111,7 +111,7 @@ namespace TypographyListImplement.Implements
}
return null;
}
public bool SellPrinted(IPrintedModel car, int count)
public bool SellPrinted(IPrintedModel printed, int count)
{
throw new NotImplementedException();
}

View File

@ -32,7 +32,7 @@ namespace TypographyView
{
if (_id.HasValue)
{
_logger.LogInformation("Shop loading");
_logger.LogInformation("Загрузка магазина");
try
{
var view = _logic.ReadElement(new ShopSearchModel { Id = _id.Value });
@ -41,13 +41,14 @@ namespace TypographyView
textBoxName.Text = view.ShopName;
textBoxAddress.Text = view.Address;
dateTimePicker.Value = view.DateOpening;
textBoxMaxCount.Text= view.MaxCountPrinteds.ToString();
_shopPrinteds = view.ShopPrinteds ?? new Dictionary<int, (IPrintedModel, int)>();
LoadData();
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Shop loading error");
_logger.LogError(ex, "Ошибка загрузки магазина");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@ -55,7 +56,7 @@ namespace TypographyView
private void LoadData()
{
_logger.LogInformation("Shop printeds loading");
_logger.LogInformation("Загрузка магазина");
try
{
if (_shopPrinteds != null)
@ -86,12 +87,17 @@ namespace TypographyView
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (string.IsNullOrEmpty(textBoxMaxCount.Text))
{
MessageBox.Show("Заполните макс. количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (string.IsNullOrEmpty(dateTimePicker.Text))
{
MessageBox.Show("Заполните дату", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Shop saving");
_logger.LogInformation("Сохранение магазина");
try
{
var model = new ShopBindingModel
@ -99,6 +105,7 @@ namespace TypographyView
Id = _id ?? 0,
ShopName = textBoxName.Text,
Address = textBoxAddress.Text,
MaxCountPrinteds = Convert.ToInt32(textBoxMaxCount.Text),
DateOpening = dateTimePicker.Value,
ShopPrinteds = _shopPrinteds
};

View File

@ -41,18 +41,18 @@
labelPrinted.AutoSize = true;
labelPrinted.Location = new Point(14, 12);
labelPrinted.Name = "labelPrinted";
labelPrinted.Size = new Size(59, 20);
labelPrinted.Size = new Size(71, 20);
labelPrinted.TabIndex = 0;
labelPrinted.Text = "Printed:";
labelPrinted.Text = "Изделие:";
//
// labelCount
//
labelCount.AutoSize = true;
labelCount.Location = new Point(14, 51);
labelCount.Name = "labelCount";
labelCount.Size = new Size(51, 20);
labelCount.Size = new Size(93, 20);
labelCount.TabIndex = 1;
labelCount.Text = "Count:";
labelCount.Text = "Количество:";
//
// comboBoxPrinted
//

View File

@ -1,11 +1,12 @@
using TypographyBusinessLogic.BusinessLogics;
using TypographyContracts.BusinessLogicsContracts;
using TypographyContracts.StoragesContracts;
using TypographyListImplement.Implements;
using TypographyFileImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using TypographyBusinessLogic;
using AutomobilePlantView;
namespace TypographyView
{
@ -54,7 +55,7 @@ namespace TypographyView
services.AddTransient<FormMakeShipment>();
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormShopSell>();
}
}
}