внесены изменения в главную форму и форму для создания заказов для работы с клиентами
This commit is contained in:
parent
73dd6bbdfc
commit
6f43ee7027
11
SushiBar/FormMain.Designer.cs
generated
11
SushiBar/FormMain.Designer.cs
generated
@ -36,6 +36,7 @@
|
||||
списокКомпонентовToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
|
||||
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
||||
клиентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
dataGridView = new DataGridView();
|
||||
buttonCreateOrder = new Button();
|
||||
buttonTakeOrderInWork = new Button();
|
||||
@ -49,7 +50,7 @@
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenuItemRef, отчетыToolStripMenuItem });
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenuItemRef, отчетыToolStripMenuItem, клиентыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1140, 28);
|
||||
@ -105,6 +106,13 @@
|
||||
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
|
||||
//
|
||||
// клиентыToolStripMenuItem
|
||||
//
|
||||
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||
клиентыToolStripMenuItem.Size = new Size(83, 24);
|
||||
клиентыToolStripMenuItem.Text = "Клиенты";
|
||||
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = Color.White;
|
||||
@ -206,5 +214,6 @@
|
||||
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using SushiBar;
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.BusinessLogicsContracts;
|
||||
using SushiBarView.Clients;
|
||||
using SushiBarView.Reports;
|
||||
|
||||
namespace SushiBarView
|
||||
@ -33,6 +34,8 @@ namespace SushiBarView
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["SushiId"].Visible = false;
|
||||
dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["ClientId"].Visible = false;
|
||||
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
}
|
||||
@ -173,5 +176,14 @@ namespace SushiBarView
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||
if(service is FormClients form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
39
SushiBar/Orders/FormCreateOrder.Designer.cs
generated
39
SushiBar/Orders/FormCreateOrder.Designer.cs
generated
@ -36,6 +36,8 @@
|
||||
comboBoxSushi = new ComboBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
comboBoxClients = new ComboBox();
|
||||
labelClient = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelSushi
|
||||
@ -51,7 +53,7 @@
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(30, 102);
|
||||
labelCount.Location = new Point(30, 159);
|
||||
labelCount.Margin = new Padding(4, 0, 4, 0);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(112, 24);
|
||||
@ -61,7 +63,7 @@
|
||||
// labelSum
|
||||
//
|
||||
labelSum.AutoSize = true;
|
||||
labelSum.Location = new Point(30, 174);
|
||||
labelSum.Location = new Point(30, 231);
|
||||
labelSum.Margin = new Padding(4, 0, 4, 0);
|
||||
labelSum.Name = "labelSum";
|
||||
labelSum.Size = new Size(68, 24);
|
||||
@ -70,7 +72,7 @@
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(227, 94);
|
||||
textBoxCount.Location = new Point(227, 151);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(326, 32);
|
||||
textBoxCount.TabIndex = 3;
|
||||
@ -79,7 +81,7 @@
|
||||
// textBoxSum
|
||||
//
|
||||
textBoxSum.Enabled = false;
|
||||
textBoxSum.Location = new Point(227, 166);
|
||||
textBoxSum.Location = new Point(227, 223);
|
||||
textBoxSum.Name = "textBoxSum";
|
||||
textBoxSum.Size = new Size(326, 32);
|
||||
textBoxSum.TabIndex = 4;
|
||||
@ -96,7 +98,7 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(227, 231);
|
||||
buttonSave.Location = new Point(227, 304);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(140, 49);
|
||||
buttonSave.TabIndex = 6;
|
||||
@ -106,7 +108,7 @@
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(413, 231);
|
||||
buttonCancel.Location = new Point(413, 304);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(140, 49);
|
||||
buttonCancel.TabIndex = 7;
|
||||
@ -114,12 +116,33 @@
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// comboBoxClients
|
||||
//
|
||||
comboBoxClients.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxClients.FormattingEnabled = true;
|
||||
comboBoxClients.Location = new Point(227, 93);
|
||||
comboBoxClients.Name = "comboBoxClients";
|
||||
comboBoxClients.Size = new Size(326, 32);
|
||||
comboBoxClients.TabIndex = 9;
|
||||
//
|
||||
// labelClient
|
||||
//
|
||||
labelClient.AutoSize = true;
|
||||
labelClient.Location = new Point(30, 101);
|
||||
labelClient.Margin = new Padding(4, 0, 4, 0);
|
||||
labelClient.Name = "labelClient";
|
||||
labelClient.Size = new Size(72, 24);
|
||||
labelClient.TabIndex = 8;
|
||||
labelClient.Text = "Клиент";
|
||||
//
|
||||
// FormCreateOrder
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 192, 255);
|
||||
ClientSize = new Size(595, 302);
|
||||
ClientSize = new Size(595, 387);
|
||||
Controls.Add(comboBoxClients);
|
||||
Controls.Add(labelClient);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxSushi);
|
||||
@ -147,5 +170,7 @@
|
||||
private ComboBox comboBoxSushi;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private ComboBox comboBoxClients;
|
||||
private Label labelClient;
|
||||
}
|
||||
}
|
@ -10,18 +10,18 @@ namespace SushiBarView
|
||||
private readonly ILogger _logger;
|
||||
private readonly ISushiLogic _logicSushi;
|
||||
private readonly IOrderLogic _logicO;
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, ISushiLogic logicSushi, IOrderLogic logicO)
|
||||
private readonly IClientLogic _logicC;
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, ISushiLogic logicSushi, IOrderLogic logicO, IClientLogic logicC)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicSushi = logicSushi;
|
||||
_logicO = logicO;
|
||||
_logicC = logicC;
|
||||
}
|
||||
|
||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Загрузка изделий для заказа");
|
||||
|
||||
try
|
||||
{
|
||||
var list = _logicSushi.ReadList(null);
|
||||
@ -31,7 +31,7 @@ namespace SushiBarView
|
||||
comboBoxSushi.ValueMember = "Id";
|
||||
comboBoxSushi.DataSource = list;
|
||||
comboBoxSushi.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка изделий для заказа");
|
||||
_logger.LogInformation("Загрузка суши для заказа");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -39,7 +39,24 @@ namespace SushiBarView
|
||||
_logger.LogError(ex, "Ошибка загрузки списка изделий");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
// прописать логику
|
||||
|
||||
try
|
||||
{
|
||||
var list = _logicC.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxClients.DisplayMember = "ClientFIO";
|
||||
comboBoxClients.ValueMember = "Id";
|
||||
comboBoxClients.DataSource = list;
|
||||
comboBoxClients.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка клиентов для заказа");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки списка клиентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxSushi_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@ -64,12 +81,18 @@ namespace SushiBarView
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxClients.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||
{
|
||||
SushiId = Convert.ToInt32(comboBoxSushi.SelectedValue),
|
||||
ClientId = Convert.ToInt32(comboBoxClients.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.Text),
|
||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||
});
|
||||
@ -115,4 +138,4 @@ namespace SushiBarView
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ using SushiBarContracts.BusinessLogicsContracts;
|
||||
using SushiBarContracts.StoragesContracts;
|
||||
using SushiBarDatabaseImplement.Implements;
|
||||
using SushiBarView;
|
||||
using SushiBarView.Clients;
|
||||
using SushiBarView.Reports;
|
||||
using System.Text;
|
||||
|
||||
@ -48,10 +49,12 @@ namespace SushiBar
|
||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<ISushiStorage, SushiStorage>();
|
||||
services.AddTransient<IClientStorage, ClientStorage>();
|
||||
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<ISushiLogic, SushiLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
|
||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
@ -65,6 +68,7 @@ namespace SushiBar
|
||||
services.AddTransient<FormSushi>();
|
||||
services.AddTransient<FormSushiComponent>();
|
||||
services.AddTransient<FormSushis>();
|
||||
services.AddTransient<FormClients>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormReportSushiComponent>();
|
||||
|
||||
|
@ -13,9 +13,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarBusinessLogic", "..
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarListImplements", "..\SushiBarListImplements\SushiBarListImplements.csproj", "{BAA05DBA-C77F-4CF6-9998-4C150FA5797C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarFileImplement", "..\SushiBarFileImplement\SushiBarFileImplement.csproj", "{15B17431-20EB-4A87-9088-C19E5C2DD209}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarFileImplement", "..\SushiBarFileImplement\SushiBarFileImplement.csproj", "{15B17431-20EB-4A87-9088-C19E5C2DD209}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDatabaseImplement", "..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj", "{920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDatabaseImplement", "..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj", "{920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarRestApi", "..\SushiBarRestApi\SushiBarRestApi.csproj", "{F7905836-1FF4-48B5-9565-7C03BA76AB96}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -51,6 +53,10 @@ Global
|
||||
{920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{920F7D63-E1A0-4629-8322-AAD4A5F5ECAF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F7905836-1FF4-48B5-9565-7C03BA76AB96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F7905836-1FF4-48B5-9565-7C03BA76AB96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F7905836-1FF4-48B5-9565-7C03BA76AB96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F7905836-1FF4-48B5-9565-7C03BA76AB96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Loading…
Reference in New Issue
Block a user