diff --git a/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.cs b/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.cs index c680e78..9e6bcc2 100644 --- a/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.cs +++ b/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.cs @@ -17,9 +17,7 @@ namespace FurnitureAssemblyView public partial class FormCreateOrder : Form { private readonly ILogger _logger; - private readonly IFurnitureLogic _logicM; - private readonly IOrderLogic _logicO; private readonly IClientLogic _logicC; @@ -31,7 +29,6 @@ namespace FurnitureAssemblyView _logicM = logicM; _logicO = logicO; _logicC = logicC; - } private void FormCreateOrder_Load(object sender, EventArgs e) @@ -56,22 +53,6 @@ namespace FurnitureAssemblyView } _logger.LogInformation("Загрузка клиентов для заказа"); try - { - var clientList = _logicC.ReadList(null); - if (clientList != null) - { - clientBox.DisplayMember = "Client"; - clientBox.ValueMember = "Id"; - clientBox.DataSource = clientList.Select(c => c.ClientFIO).ToList(); - clientBox.SelectedItem = null; - } - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки списка клиентов"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - try { var list = _logicC.ReadList(null); @@ -97,16 +78,17 @@ namespace FurnitureAssemblyView { try { - var list = _logicM.ReadList(null); - int id = list.Where(l => l.FurnitureName == comboBoxFurniture.SelectedValue.ToString()) - .Select(l => l.Id).First(); + int id = Convert.ToInt32(comboBoxFurniture.SelectedValue); + var furniture = _logicM.ReadElement(new FurnitureSearchModel { - Id = id, - FurnitureName = comboBoxFurniture.Text + Id = id }); + int count = Convert.ToInt32(textBoxCount.Text); + textBoxSum.Text = Math.Round(count * (furniture?.Price ?? 0), 2).ToString(); + _logger.LogInformation("Расчет суммы заказа"); } catch (Exception ex) diff --git a/FurnitureAssembly/FurnitureAssembly/FormMain.cs b/FurnitureAssembly/FurnitureAssembly/FormMain.cs index af90d9d..2c6203d 100644 --- a/FurnitureAssembly/FurnitureAssembly/FormMain.cs +++ b/FurnitureAssembly/FurnitureAssembly/FormMain.cs @@ -49,6 +49,7 @@ namespace FurnitureAssemblyView dataGridView.DataSource = list; dataGridView.Columns["FurnitureId"].Visible = false; dataGridView.Columns["ClientId"].Visible = false; + dataGridView.Columns["ImplementerId"].Visible = false; } _logger.LogInformation("Загрузка заказов");