готово

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; return true;
} }
public bool CheckThenSupplyMany(IPrintedModel car, int count) public bool CheckThenSupplyMany(IPrintedModel printed, int count)
{ {
if (count <= 0) if (count <= 0)
{ {
@ -77,7 +77,7 @@ namespace TypographyBusinessLogic.BusinessLogics
if (freeSpace < count) 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; return false;
} }
@ -93,7 +93,7 @@ namespace TypographyBusinessLogic.BusinessLogics
if (freeSpace >= count) 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; count = 0;
else else
{ {
@ -103,7 +103,7 @@ namespace TypographyBusinessLogic.BusinessLogics
} }
if (freeSpace < count) 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; count -= freeSpace;
else else
{ {

View File

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

View File

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

View File

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

View File

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