done
This commit is contained in:
parent
2b4db4f5f4
commit
9b6e58a265
@ -17,9 +17,7 @@ namespace FurnitureAssemblyView
|
|||||||
public partial class FormCreateOrder : Form
|
public partial class FormCreateOrder : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private readonly IFurnitureLogic _logicM;
|
private readonly IFurnitureLogic _logicM;
|
||||||
|
|
||||||
private readonly IOrderLogic _logicO;
|
private readonly IOrderLogic _logicO;
|
||||||
private readonly IClientLogic _logicC;
|
private readonly IClientLogic _logicC;
|
||||||
|
|
||||||
@ -31,7 +29,6 @@ namespace FurnitureAssemblyView
|
|||||||
_logicM = logicM;
|
_logicM = logicM;
|
||||||
_logicO = logicO;
|
_logicO = logicO;
|
||||||
_logicC = logicC;
|
_logicC = logicC;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||||
@ -56,22 +53,6 @@ namespace FurnitureAssemblyView
|
|||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка клиентов для заказа");
|
_logger.LogInformation("Загрузка клиентов для заказа");
|
||||||
try
|
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);
|
var list = _logicC.ReadList(null);
|
||||||
|
|
||||||
@ -97,16 +78,17 @@ namespace FurnitureAssemblyView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logicM.ReadList(null);
|
int id = Convert.ToInt32(comboBoxFurniture.SelectedValue);
|
||||||
int id = list.Where(l => l.FurnitureName == comboBoxFurniture.SelectedValue.ToString())
|
|
||||||
.Select(l => l.Id).First();
|
|
||||||
var furniture = _logicM.ReadElement(new FurnitureSearchModel
|
var furniture = _logicM.ReadElement(new FurnitureSearchModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id
|
||||||
FurnitureName = comboBoxFurniture.Text
|
|
||||||
});
|
});
|
||||||
|
|
||||||
int count = Convert.ToInt32(textBoxCount.Text);
|
int count = Convert.ToInt32(textBoxCount.Text);
|
||||||
|
|
||||||
textBoxSum.Text = Math.Round(count * (furniture?.Price ?? 0), 2).ToString();
|
textBoxSum.Text = Math.Round(count * (furniture?.Price ?? 0), 2).ToString();
|
||||||
|
|
||||||
_logger.LogInformation("Расчет суммы заказа");
|
_logger.LogInformation("Расчет суммы заказа");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -49,6 +49,7 @@ namespace FurnitureAssemblyView
|
|||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["FurnitureId"].Visible = false;
|
dataGridView.Columns["FurnitureId"].Visible = false;
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
|
Loading…
Reference in New Issue
Block a user