работа над лабой 5 продолжение
This commit is contained in:
parent
12b16be979
commit
3bffef1d0d
@ -36,6 +36,8 @@
|
|||||||
this.textBoxSum = new System.Windows.Forms.TextBox();
|
this.textBoxSum = new System.Windows.Forms.TextBox();
|
||||||
this.ButtonSave = new System.Windows.Forms.Button();
|
this.ButtonSave = new System.Windows.Forms.Button();
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.comboBoxClient = new System.Windows.Forms.ComboBox();
|
||||||
|
this.labelClient = new System.Windows.Forms.Label();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelPastry
|
// labelPastry
|
||||||
@ -43,14 +45,14 @@
|
|||||||
this.labelPastry.AutoSize = true;
|
this.labelPastry.AutoSize = true;
|
||||||
this.labelPastry.Location = new System.Drawing.Point(38, 30);
|
this.labelPastry.Location = new System.Drawing.Point(38, 30);
|
||||||
this.labelPastry.Name = "labelPastry";
|
this.labelPastry.Name = "labelPastry";
|
||||||
this.labelPastry.Size = new System.Drawing.Size(71, 20);
|
this.labelPastry.Size = new System.Drawing.Size(72, 20);
|
||||||
this.labelPastry.TabIndex = 0;
|
this.labelPastry.TabIndex = 0;
|
||||||
this.labelPastry.Text = "Выпечка:";
|
this.labelPastry.Text = "Выпечка:";
|
||||||
//
|
//
|
||||||
// labelCount
|
// labelCount
|
||||||
//
|
//
|
||||||
this.labelCount.AutoSize = true;
|
this.labelCount.AutoSize = true;
|
||||||
this.labelCount.Location = new System.Drawing.Point(38, 67);
|
this.labelCount.Location = new System.Drawing.Point(38, 100);
|
||||||
this.labelCount.Name = "labelCount";
|
this.labelCount.Name = "labelCount";
|
||||||
this.labelCount.Size = new System.Drawing.Size(93, 20);
|
this.labelCount.Size = new System.Drawing.Size(93, 20);
|
||||||
this.labelCount.TabIndex = 1;
|
this.labelCount.TabIndex = 1;
|
||||||
@ -59,7 +61,7 @@
|
|||||||
// labelSum
|
// labelSum
|
||||||
//
|
//
|
||||||
this.labelSum.AutoSize = true;
|
this.labelSum.AutoSize = true;
|
||||||
this.labelSum.Location = new System.Drawing.Point(38, 102);
|
this.labelSum.Location = new System.Drawing.Point(38, 135);
|
||||||
this.labelSum.Name = "labelSum";
|
this.labelSum.Name = "labelSum";
|
||||||
this.labelSum.Size = new System.Drawing.Size(58, 20);
|
this.labelSum.Size = new System.Drawing.Size(58, 20);
|
||||||
this.labelSum.TabIndex = 2;
|
this.labelSum.TabIndex = 2;
|
||||||
@ -76,7 +78,7 @@
|
|||||||
//
|
//
|
||||||
// textBoxCount
|
// textBoxCount
|
||||||
//
|
//
|
||||||
this.textBoxCount.Location = new System.Drawing.Point(150, 60);
|
this.textBoxCount.Location = new System.Drawing.Point(150, 93);
|
||||||
this.textBoxCount.Name = "textBoxCount";
|
this.textBoxCount.Name = "textBoxCount";
|
||||||
this.textBoxCount.Size = new System.Drawing.Size(429, 27);
|
this.textBoxCount.Size = new System.Drawing.Size(429, 27);
|
||||||
this.textBoxCount.TabIndex = 4;
|
this.textBoxCount.TabIndex = 4;
|
||||||
@ -85,14 +87,14 @@
|
|||||||
// textBoxSum
|
// textBoxSum
|
||||||
//
|
//
|
||||||
this.textBoxSum.Enabled = false;
|
this.textBoxSum.Enabled = false;
|
||||||
this.textBoxSum.Location = new System.Drawing.Point(150, 95);
|
this.textBoxSum.Location = new System.Drawing.Point(150, 128);
|
||||||
this.textBoxSum.Name = "textBoxSum";
|
this.textBoxSum.Name = "textBoxSum";
|
||||||
this.textBoxSum.Size = new System.Drawing.Size(429, 27);
|
this.textBoxSum.Size = new System.Drawing.Size(429, 27);
|
||||||
this.textBoxSum.TabIndex = 5;
|
this.textBoxSum.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// ButtonSave
|
// ButtonSave
|
||||||
//
|
//
|
||||||
this.ButtonSave.Location = new System.Drawing.Point(216, 137);
|
this.ButtonSave.Location = new System.Drawing.Point(216, 170);
|
||||||
this.ButtonSave.Name = "ButtonSave";
|
this.ButtonSave.Name = "ButtonSave";
|
||||||
this.ButtonSave.Size = new System.Drawing.Size(94, 29);
|
this.ButtonSave.Size = new System.Drawing.Size(94, 29);
|
||||||
this.ButtonSave.TabIndex = 6;
|
this.ButtonSave.TabIndex = 6;
|
||||||
@ -102,7 +104,7 @@
|
|||||||
//
|
//
|
||||||
// ButtonCancel
|
// ButtonCancel
|
||||||
//
|
//
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(361, 137);
|
this.ButtonCancel.Location = new System.Drawing.Point(361, 170);
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
|
this.ButtonCancel.Size = new System.Drawing.Size(94, 29);
|
||||||
this.ButtonCancel.TabIndex = 7;
|
this.ButtonCancel.TabIndex = 7;
|
||||||
@ -110,11 +112,30 @@
|
|||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
//
|
//
|
||||||
|
// comboBoxClient
|
||||||
|
//
|
||||||
|
this.comboBoxClient.FormattingEnabled = true;
|
||||||
|
this.comboBoxClient.Location = new System.Drawing.Point(150, 59);
|
||||||
|
this.comboBoxClient.Name = "comboBoxClient";
|
||||||
|
this.comboBoxClient.Size = new System.Drawing.Size(429, 28);
|
||||||
|
this.comboBoxClient.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// labelClient
|
||||||
|
//
|
||||||
|
this.labelClient.AutoSize = true;
|
||||||
|
this.labelClient.Location = new System.Drawing.Point(38, 67);
|
||||||
|
this.labelClient.Name = "labelClient";
|
||||||
|
this.labelClient.Size = new System.Drawing.Size(61, 20);
|
||||||
|
this.labelClient.TabIndex = 8;
|
||||||
|
this.labelClient.Text = "Клиент:";
|
||||||
|
//
|
||||||
// FormCreateOrder
|
// FormCreateOrder
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(591, 180);
|
this.ClientSize = new System.Drawing.Size(591, 245);
|
||||||
|
this.Controls.Add(this.comboBoxClient);
|
||||||
|
this.Controls.Add(this.labelClient);
|
||||||
this.Controls.Add(this.ButtonCancel);
|
this.Controls.Add(this.ButtonCancel);
|
||||||
this.Controls.Add(this.ButtonSave);
|
this.Controls.Add(this.ButtonSave);
|
||||||
this.Controls.Add(this.textBoxSum);
|
this.Controls.Add(this.textBoxSum);
|
||||||
@ -141,5 +162,7 @@
|
|||||||
private TextBox textBoxSum;
|
private TextBox textBoxSum;
|
||||||
private Button ButtonSave;
|
private Button ButtonSave;
|
||||||
private Button ButtonCancel;
|
private Button ButtonCancel;
|
||||||
|
private ComboBox comboBoxClient;
|
||||||
|
private Label labelClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,12 +19,14 @@ namespace ConfectioneryView
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IPastryLogic _logicP;
|
private readonly IPastryLogic _logicP;
|
||||||
private readonly IOrderLogic _logicO;
|
private readonly IOrderLogic _logicO;
|
||||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPastryLogic logicP, IOrderLogic logicO)
|
private readonly IClientLogic _logicC;
|
||||||
|
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPastryLogic logicP, IOrderLogic logicO, IClientLogic logicC)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logicP = logicP;
|
_logicP = logicP;
|
||||||
_logicO = logicO;
|
_logicO = logicO;
|
||||||
|
_logicC = logicC;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||||
@ -46,6 +48,23 @@ namespace ConfectioneryView
|
|||||||
_logger.LogError(ex, "Error during loading pastry for order");
|
_logger.LogError(ex, "Error during loading pastry for order");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
|
_logger.LogInformation("Loading clients for order");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var clientList = _logicC.ReadList(null);
|
||||||
|
if (clientList != null)
|
||||||
|
{
|
||||||
|
comboBoxClient.DisplayMember = "ClientFIO";
|
||||||
|
comboBoxClient.ValueMember = "Id";
|
||||||
|
comboBoxClient.DataSource = clientList;
|
||||||
|
comboBoxClient.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error during loading clients for order");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void CalcSum()
|
private void CalcSum()
|
||||||
{
|
{
|
||||||
@ -95,12 +114,18 @@ namespace ConfectioneryView
|
|||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (comboBoxClient.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_logger.LogInformation("Создание заказа");
|
_logger.LogInformation("Создание заказа");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||||
{
|
{
|
||||||
PastryId = Convert.ToInt32(comboBoxPastry.SelectedValue),
|
PastryId = Convert.ToInt32(comboBoxPastry.SelectedValue),
|
||||||
|
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
|
||||||
Count = Convert.ToInt32(textBoxCount.Text),
|
Count = Convert.ToInt32(textBoxCount.Text),
|
||||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||||
});
|
});
|
||||||
|
16
Confectionery/ConfectioneryView/FormMain.Designer.cs
generated
16
Confectionery/ConfectioneryView/FormMain.Designer.cs
generated
@ -32,6 +32,7 @@
|
|||||||
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.компонентыПоИзделиямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.компонентыПоИзделиямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@ -62,7 +63,8 @@
|
|||||||
//
|
//
|
||||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.компонентыToolStripMenuItem,
|
this.компонентыToolStripMenuItem,
|
||||||
this.изделияToolStripMenuItem});
|
this.изделияToolStripMenuItem,
|
||||||
|
this.клиентыToolStripMenuItem});
|
||||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
||||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
this.справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
@ -70,17 +72,24 @@
|
|||||||
// компонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(182, 26);
|
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||||
this.компонентыToolStripMenuItem.Text = "Компоненты";
|
this.компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
|
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// изделияToolStripMenuItem
|
// изделияToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
this.изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
||||||
this.изделияToolStripMenuItem.Size = new System.Drawing.Size(182, 26);
|
this.изделияToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||||
this.изделияToolStripMenuItem.Text = "Изделия";
|
this.изделияToolStripMenuItem.Text = "Изделия";
|
||||||
this.изделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
|
this.изделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// клиентыToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||||
|
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||||
|
this.клиентыToolStripMenuItem.Text = "Клиенты";
|
||||||
|
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.КлиентыToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// отчетыToolStripMenuItem
|
// отчетыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
@ -212,5 +221,6 @@
|
|||||||
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
|
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
|
||||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -41,6 +41,8 @@ namespace ConfectioneryView
|
|||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["PastryId"].Visible = false;
|
dataGridView.Columns["PastryId"].Visible = false;
|
||||||
dataGridView.Columns["PastryName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["PastryName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Orders loading");
|
_logger.LogInformation("Orders loading");
|
||||||
}
|
}
|
||||||
@ -69,6 +71,15 @@ namespace ConfectioneryView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void КлиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||||
|
if (service is FormClients form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void СписокКомпонентовToolStripMenuItem_Click(object sender, EventArgs e)
|
private void СписокКомпонентовToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
|
@ -38,11 +38,13 @@ namespace ConfectioneryView
|
|||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
services.AddTransient<IPastryStorage, PastryStorage>();
|
services.AddTransient<IPastryStorage, PastryStorage>();
|
||||||
|
services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
|
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IPastryLogic, PastryLogic>();
|
services.AddTransient<IPastryLogic, PastryLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
@ -57,6 +59,7 @@ namespace ConfectioneryView
|
|||||||
services.AddTransient<FormPastries>();
|
services.AddTransient<FormPastries>();
|
||||||
services.AddTransient<FormReportPastryComponents>();
|
services.AddTransient<FormReportPastryComponents>();
|
||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportOrders>();
|
||||||
|
services.AddTransient<FormClients>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user