лучше
This commit is contained in:
parent
4057a48e0d
commit
9c14058945
33
ProjectFlowerShop/FormCreateOrder.Designer.cs
generated
33
ProjectFlowerShop/FormCreateOrder.Designer.cs
generated
@ -36,6 +36,8 @@
|
||||
textBoxCount = new TextBox();
|
||||
comboBoxProduct = new ComboBox();
|
||||
textBoxSum = new TextBox();
|
||||
comboBoxClient = new ComboBox();
|
||||
labelClient = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelProduct
|
||||
@ -59,7 +61,7 @@
|
||||
// LabelSum
|
||||
//
|
||||
LabelSum.AutoSize = true;
|
||||
LabelSum.Location = new Point(12, 113);
|
||||
LabelSum.Location = new Point(15, 159);
|
||||
LabelSum.Name = "LabelSum";
|
||||
LabelSum.Size = new Size(55, 20);
|
||||
LabelSum.TabIndex = 2;
|
||||
@ -67,7 +69,7 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(292, 158);
|
||||
buttonSave.Location = new Point(295, 222);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(94, 29);
|
||||
buttonSave.TabIndex = 3;
|
||||
@ -77,7 +79,7 @@
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(411, 158);
|
||||
buttonCancel.Location = new Point(408, 222);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(94, 29);
|
||||
buttonCancel.TabIndex = 4;
|
||||
@ -104,18 +106,37 @@
|
||||
//
|
||||
// textBoxSum
|
||||
//
|
||||
textBoxSum.Location = new Point(97, 110);
|
||||
textBoxSum.Location = new Point(97, 156);
|
||||
textBoxSum.Name = "textBoxSum";
|
||||
textBoxSum.ReadOnly = true;
|
||||
textBoxSum.Size = new Size(274, 27);
|
||||
textBoxSum.TabIndex = 7;
|
||||
textBoxSum.TextChanged += textBox2_TextChanged;
|
||||
//
|
||||
// comboBoxClient
|
||||
//
|
||||
comboBoxClient.FormattingEnabled = true;
|
||||
comboBoxClient.Location = new Point(97, 112);
|
||||
comboBoxClient.Name = "comboBoxClient";
|
||||
comboBoxClient.Size = new Size(274, 28);
|
||||
comboBoxClient.TabIndex = 8;
|
||||
//
|
||||
// labelClient
|
||||
//
|
||||
labelClient.AutoSize = true;
|
||||
labelClient.Location = new Point(12, 115);
|
||||
labelClient.Name = "labelClient";
|
||||
labelClient.Size = new Size(58, 20);
|
||||
labelClient.TabIndex = 9;
|
||||
labelClient.Text = "Кол-во";
|
||||
//
|
||||
// FormCreateOrder
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(514, 199);
|
||||
ClientSize = new Size(514, 263);
|
||||
Controls.Add(labelClient);
|
||||
Controls.Add(comboBoxClient);
|
||||
Controls.Add(textBoxSum);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Controls.Add(textBoxCount);
|
||||
@ -141,5 +162,7 @@
|
||||
private TextBox textBoxCount;
|
||||
private ComboBox comboBoxProduct;
|
||||
private TextBox textBoxSum;
|
||||
private ComboBox comboBoxClient;
|
||||
private Label labelClient;
|
||||
}
|
||||
}
|
@ -20,13 +20,15 @@ namespace ProjectFlowerShop
|
||||
private readonly ILogger _logger;
|
||||
private readonly IFlowerLogic _logicF;
|
||||
private readonly IOrderLogic _logicO;
|
||||
private readonly IClientLogic _logicC;
|
||||
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IFlowerLogic logicP, IOrderLogic logicO)
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IFlowerLogic logicP, IOrderLogic logicO, IClientLogic logicC)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicF = logicP;
|
||||
_logicO = logicO;
|
||||
_logicC = logicC;
|
||||
}
|
||||
|
||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@ -64,6 +66,26 @@ namespace ProjectFlowerShop
|
||||
_logger.LogError(ex, "Ошибка загрузки цветов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
_logger.LogInformation("Загрузка клиентов для заказа");
|
||||
try
|
||||
{
|
||||
var list = _logicC.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxClient.DisplayMember = "ClientFIO";
|
||||
comboBoxClient.ValueMember = "Id";
|
||||
comboBoxClient.DataSource = list;
|
||||
comboBoxClient.SelectedItem = null;
|
||||
}
|
||||
_logger.LogInformation("Клиенты загружены");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки клиентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void CalcSum()
|
||||
@ -106,6 +128,12 @@ namespace ProjectFlowerShop
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxClient.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите клиента", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
try
|
||||
{
|
||||
@ -113,7 +141,8 @@ namespace ProjectFlowerShop
|
||||
{
|
||||
FlowerId = Convert.ToInt32(comboBoxProduct.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.Text),
|
||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||
Sum = Convert.ToDouble(textBoxSum.Text),
|
||||
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
|
@ -40,10 +40,12 @@ namespace ProjectFlowerShop
|
||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IFlowerStorage, FlowerStorage>();
|
||||
services.AddTransient<IClientStorage, ClientStorage>();
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IFlowerLogic, FlowerLogic>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<MainForm>();
|
||||
services.AddTransient<ComponentForm>();
|
||||
services.AddTransient<FormComponents>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user