This commit is contained in:
Danil Markov 2023-05-02 14:41:26 +04:00
parent cfdeca8b93
commit c71a7e4f51
5 changed files with 15 additions and 15 deletions

View File

@ -107,7 +107,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
} }
} }
public bool AddDocument(ShopSearchModel model, IDocumentModel ship, int count) public bool AddDocument(ShopSearchModel model, IDocumentModel document, int count)
{ {
if (model == null) if (model == null)
{ {
@ -126,17 +126,17 @@ namespace LawFirmBusinessLogic.BusinessLogics
} }
_logger.LogInformation("AddDocument find. Id:{Id}", element.Id); _logger.LogInformation("AddDocument find. Id:{Id}", element.Id);
if (element.ShopDocuments.TryGetValue(ship.Id, out var pair)) if (element.ShopDocuments.TryGetValue(document.Id, out var pair))
{ {
element.ShopDocuments[ship.Id] = (ship, count + pair.Item2); element.ShopDocuments[document.Id] = (document, count + pair.Item2);
_logger.LogInformation("AddDocument. Added {count} {ship} to '{ShopName}' shop", _logger.LogInformation("AddDocument. Added {count} {document} to '{ShopName}' shop",
count, ship.DocumentName, element.ShopName); count, document.DocumentName, element.ShopName);
} }
else else
{ {
element.ShopDocuments[ship.Id] = (ship, count); element.ShopDocuments[document.Id] = (document, count);
_logger.LogInformation("AddDocument. Added {count} new ship {ship} to '{ShopName}' shop", _logger.LogInformation("AddDocument. Added {count} new document {document} to '{ShopName}' shop",
count, ship.DocumentName, element.ShopName); count, document.DocumentName, element.ShopName);
} }
_shopStorage.Update(new() _shopStorage.Update(new()
{ {

View File

@ -19,7 +19,7 @@ namespace LawFirmView
private void FormAddDocument_Load(object sender, EventArgs e) private void FormAddDocument_Load(object sender, EventArgs e)
{ {
_logger.LogInformation("Загрузка списка кораблей для пополнения"); _logger.LogInformation("Загрузка списка документов для пополнения");
try try
{ {
var list = _logicDocument.ReadList(null); var list = _logicDocument.ReadList(null);
@ -33,7 +33,7 @@ namespace LawFirmView
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка загрузки списка кораблей"); _logger.LogError(ex, "Ошибка загрузки списка документов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }

View File

@ -45,12 +45,12 @@ namespace LawFirmView
try try
{ {
int id = Convert.ToInt32(comboBoxDocument.SelectedValue); int id = Convert.ToInt32(comboBoxDocument.SelectedValue);
var product = _logicD.ReadElement(new DocumentSearchModel var document = _logicD.ReadElement(new DocumentSearchModel
{ {
Id = id Id = id
}); });
int count = Convert.ToInt32(textBoxCount.Text); int count = Convert.ToInt32(textBoxCount.Text);
textBoxSum.Text = Math.Round(count * (product?.Price ?? 0), 2).ToString(); textBoxSum.Text = Math.Round(count * (document?.Price ?? 0), 2).ToString();
_logger.LogInformation("Расчет суммы заказа"); _logger.LogInformation("Расчет суммы заказа");
} }
catch (Exception ex) catch (Exception ex)

View File

@ -50,7 +50,7 @@ namespace LawFirmView
} }
private void LoadData() private void LoadData()
{ {
_logger.LogInformation("Загрузка кораблей магазина"); _logger.LogInformation("Загрузка документов магазина");
try try
{ {
if (_shopDocuments != null) if (_shopDocuments != null)
@ -64,7 +64,7 @@ namespace LawFirmView
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка загрузки кораблей магазина"); _logger.LogError(ex, "Ошибка загрузки документов магазина");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }

View File

@ -89,7 +89,7 @@ namespace LawFirmView
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка удаления кораблей"); _logger.LogError(ex, "Ошибка удаления документов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }