в програм добавлены нужные зависимости, нужно изменить форму магазина и везде прописать логику
This commit is contained in:
parent
85e2c1f027
commit
7f730736d9
15
SushiBar/FormMain.Designer.cs
generated
15
SushiBar/FormMain.Designer.cs
generated
@ -38,6 +38,7 @@
|
|||||||
buttonOrderReady = new Button();
|
buttonOrderReady = new Button();
|
||||||
buttonOrderIssued = new Button();
|
buttonOrderIssued = new Button();
|
||||||
buttonRefreshOrders = new Button();
|
buttonRefreshOrders = new Button();
|
||||||
|
магазиныToolStripMenuItem = new ToolStripMenuItem();
|
||||||
menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -54,7 +55,7 @@
|
|||||||
//
|
//
|
||||||
// ToolStripMenuItemRef
|
// ToolStripMenuItemRef
|
||||||
//
|
//
|
||||||
ToolStripMenuItemRef.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, сушиToolStripMenuItem });
|
ToolStripMenuItemRef.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, сушиToolStripMenuItem, магазиныToolStripMenuItem });
|
||||||
ToolStripMenuItemRef.Name = "ToolStripMenuItemRef";
|
ToolStripMenuItemRef.Name = "ToolStripMenuItemRef";
|
||||||
ToolStripMenuItemRef.Size = new Size(117, 24);
|
ToolStripMenuItemRef.Size = new Size(117, 24);
|
||||||
ToolStripMenuItemRef.Text = "Справочники";
|
ToolStripMenuItemRef.Text = "Справочники";
|
||||||
@ -62,14 +63,14 @@
|
|||||||
// компонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
компонентыToolStripMenuItem.Size = new Size(182, 26);
|
компонентыToolStripMenuItem.Size = new Size(224, 26);
|
||||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
|
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// сушиToolStripMenuItem
|
// сушиToolStripMenuItem
|
||||||
//
|
//
|
||||||
сушиToolStripMenuItem.Name = "сушиToolStripMenuItem";
|
сушиToolStripMenuItem.Name = "сушиToolStripMenuItem";
|
||||||
сушиToolStripMenuItem.Size = new Size(182, 26);
|
сушиToolStripMenuItem.Size = new Size(224, 26);
|
||||||
сушиToolStripMenuItem.Text = "Суши";
|
сушиToolStripMenuItem.Text = "Суши";
|
||||||
сушиToolStripMenuItem.Click += сушиToolStripMenuItem_Click;
|
сушиToolStripMenuItem.Click += сушиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
@ -134,6 +135,13 @@
|
|||||||
buttonRefreshOrders.Text = "Обновить заказы";
|
buttonRefreshOrders.Text = "Обновить заказы";
|
||||||
buttonRefreshOrders.UseVisualStyleBackColor = true;
|
buttonRefreshOrders.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// магазиныToolStripMenuItem
|
||||||
|
//
|
||||||
|
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||||
|
магазиныToolStripMenuItem.Size = new Size(224, 26);
|
||||||
|
магазиныToolStripMenuItem.Text = "Магазины";
|
||||||
|
магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
@ -170,5 +178,6 @@
|
|||||||
private Button buttonRefreshOrders;
|
private Button buttonRefreshOrders;
|
||||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||||
private ToolStripMenuItem сушиToolStripMenuItem;
|
private ToolStripMenuItem сушиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem магазиныToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@
|
|||||||
using SushiBar;
|
using SushiBar;
|
||||||
using SushiBarContracts.BindingModel;
|
using SushiBarContracts.BindingModel;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
using SushiBarView.Shops;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -64,6 +65,12 @@ namespace SushiBarView
|
|||||||
if (service is FormSushis formSushis) { formSushis.ShowDialog(); }
|
if (service is FormSushis formSushis) { formSushis.ShowDialog(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||||
|
if(service is FormShops formShops) { formShops.ShowDialog(); }
|
||||||
|
}
|
||||||
|
|
||||||
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||||
@ -148,7 +155,5 @@ namespace SushiBarView
|
|||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using SushiBarContracts.BusinessLogicsContracts;
|
|||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarListImplements.Implements;
|
using SushiBarListImplements.Implements;
|
||||||
using SushiBarView;
|
using SushiBarView;
|
||||||
|
using SushiBarView.Shops;
|
||||||
|
|
||||||
namespace SushiBar
|
namespace SushiBar
|
||||||
{
|
{
|
||||||
@ -51,6 +52,8 @@ namespace SushiBar
|
|||||||
services.AddTransient<FormSushi>();
|
services.AddTransient<FormSushi>();
|
||||||
services.AddTransient<FormSushiComponent>();
|
services.AddTransient<FormSushiComponent>();
|
||||||
services.AddTransient<FormSushis>();
|
services.AddTransient<FormSushis>();
|
||||||
|
services.AddTransient<FormShop>();
|
||||||
|
services.AddTransient<FormShops>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,8 @@
|
|||||||
using System;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
using SushiBarContracts.SearchModel;
|
||||||
|
using SushiBarDataModels.Models;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -7,14 +11,77 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
|
|
||||||
namespace SushiBarView.Shops
|
namespace SushiBarView.Shops
|
||||||
{
|
{
|
||||||
public partial class FormShop : Form
|
public partial class FormShop : Form
|
||||||
{
|
{
|
||||||
public FormShop()
|
private readonly ILogger _logger;
|
||||||
|
private readonly IShopLogic _logic;
|
||||||
|
private int? _id;
|
||||||
|
public int Id
|
||||||
{
|
{
|
||||||
|
set { _id = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dictionary<int, (ISushiModel, int)> _shopSushis;
|
||||||
|
public FormShop(ILogger logger, IShopLogic shopLogic)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_logic = shopLogic;
|
||||||
|
_shopSushis = new Dictionary<int, (ISushiModel, int)>();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FormShop_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_id.HasValue)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var view = _logic.ReadElement(new ShopSearchModel { Id = _id.Value });
|
||||||
|
if (view != null)
|
||||||
|
{
|
||||||
|
textBoxName.Text = view.Name;
|
||||||
|
textBoxAddress.Text = view.Address;
|
||||||
|
dateTimePickerDateOpening.Text = view.DateOpening.ToString();
|
||||||
|
_shopSushis = view.ShopSushis ?? new Dictionary<int, (ISushiModel, int)>();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки магазина");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData() {
|
||||||
|
_logger.LogInformation("Загрузка изделий магазина");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_shopSushis != null)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Clear();
|
||||||
|
foreach (var elem in _shopPlanes)
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Add(new object[]
|
||||||
|
{
|
||||||
|
elem.Key,
|
||||||
|
elem.Value.Item1.PlaneName,
|
||||||
|
elem.Value.Item2
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки изделий магазина");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
90
SushiBar/Shops/FormShops.Designer.cs
generated
90
SushiBar/Shops/FormShops.Designer.cs
generated
@ -28,12 +28,94 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
dataGridView = new DataGridView();
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
buttonRefresh = new Button();
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
buttonRemove = new Button();
|
||||||
this.Text = "FormShops";
|
buttonUpdate = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridView.BackgroundColor = Color.FromArgb(150, 190, 255);
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Dock = DockStyle.Left;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.MultiSelect = false;
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.ReadOnly = true;
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridView.Size = new Size(566, 543);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonRefresh
|
||||||
|
//
|
||||||
|
buttonRefresh.Font = new Font("Candara", 12F);
|
||||||
|
buttonRefresh.Location = new Point(626, 453);
|
||||||
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
|
buttonRefresh.Size = new Size(121, 46);
|
||||||
|
buttonRefresh.TabIndex = 8;
|
||||||
|
buttonRefresh.Text = "Обновить";
|
||||||
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonRemove
|
||||||
|
//
|
||||||
|
buttonRemove.Font = new Font("Candara", 12F);
|
||||||
|
buttonRemove.Location = new Point(626, 316);
|
||||||
|
buttonRemove.Name = "buttonRemove";
|
||||||
|
buttonRemove.Size = new Size(121, 46);
|
||||||
|
buttonRemove.TabIndex = 7;
|
||||||
|
buttonRemove.Text = "Удалить";
|
||||||
|
buttonRemove.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonUpdate
|
||||||
|
//
|
||||||
|
buttonUpdate.Font = new Font("Candara", 12F);
|
||||||
|
buttonUpdate.Location = new Point(626, 176);
|
||||||
|
buttonUpdate.Name = "buttonUpdate";
|
||||||
|
buttonUpdate.Size = new Size(121, 46);
|
||||||
|
buttonUpdate.TabIndex = 6;
|
||||||
|
buttonUpdate.Text = "Изменить";
|
||||||
|
buttonUpdate.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.Font = new Font("Candara", 12F);
|
||||||
|
buttonAdd.Location = new Point(626, 44);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(121, 46);
|
||||||
|
buttonAdd.TabIndex = 5;
|
||||||
|
buttonAdd.Text = "Добавить";
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// FormShops
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackColor = Color.FromArgb(190, 220, 255);
|
||||||
|
ClientSize = new Size(800, 543);
|
||||||
|
Controls.Add(buttonRefresh);
|
||||||
|
Controls.Add(buttonRemove);
|
||||||
|
Controls.Add(buttonUpdate);
|
||||||
|
Controls.Add(buttonAdd);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormShops";
|
||||||
|
Text = "Магазины";
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonRefresh;
|
||||||
|
private Button buttonRemove;
|
||||||
|
private Button buttonUpdate;
|
||||||
|
private Button buttonAdd;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,20 +1,18 @@
|
|||||||
using System;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
using System.ComponentModel;
|
using SushiBarContracts.SearchModel;
|
||||||
using System.Data;
|
using SushiBarDataModels.Models;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace SushiBarView.Shops
|
namespace SushiBarView.Shops
|
||||||
{
|
{
|
||||||
public partial class FormShops : Form
|
public partial class FormShops : Form
|
||||||
{
|
{
|
||||||
public FormShops()
|
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user