diff --git a/Pizzeria/Pizzeria/FormComponents.Designer.cs b/Pizzeria/Pizzeria/FormComponents.Designer.cs
new file mode 100644
index 0000000..0117f39
--- /dev/null
+++ b/Pizzeria/Pizzeria/FormComponents.Designer.cs
@@ -0,0 +1,120 @@
+namespace Pizzeria
+{
+ partial class FormComponents
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ dataGridView = new DataGridView();
+ ButtonAdd = new Button();
+ ButtonRef = new Button();
+ ButtonDel = new Button();
+ ButtonUpd = new Button();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ 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.RowTemplate.Height = 29;
+ dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ dataGridView.Size = new Size(628, 450);
+ dataGridView.TabIndex = 0;
+ dataGridView.CellContentClick += dataGridView_CellContentClick;
+ //
+ // ButtonAdd
+ //
+ ButtonAdd.Location = new Point(671, 47);
+ ButtonAdd.Name = "ButtonAdd";
+ ButtonAdd.Size = new Size(94, 29);
+ ButtonAdd.TabIndex = 1;
+ ButtonAdd.Text = "Добавить";
+ ButtonAdd.UseVisualStyleBackColor = true;
+ ButtonAdd.Click += ButtonAdd_Click;
+ //
+ // ButtonRef
+ //
+ ButtonRef.Location = new Point(671, 94);
+ ButtonRef.Name = "ButtonRef";
+ ButtonRef.Size = new Size(94, 29);
+ ButtonRef.TabIndex = 2;
+ ButtonRef.Text = "Изменить";
+ ButtonRef.UseVisualStyleBackColor = true;
+ ButtonRef.Click += ButtonRef_Click;
+ //
+ // ButtonDel
+ //
+ ButtonDel.Location = new Point(671, 144);
+ ButtonDel.Name = "ButtonDel";
+ ButtonDel.Size = new Size(94, 29);
+ ButtonDel.TabIndex = 3;
+ ButtonDel.Text = "Удалить";
+ ButtonDel.UseVisualStyleBackColor = true;
+ ButtonDel.Click += ButtonDel_Click;
+ //
+ // ButtonUpd
+ //
+ ButtonUpd.Location = new Point(671, 191);
+ ButtonUpd.Name = "ButtonUpd";
+ ButtonUpd.Size = new Size(94, 29);
+ ButtonUpd.TabIndex = 4;
+ ButtonUpd.Text = "Обновить";
+ ButtonUpd.UseVisualStyleBackColor = true;
+ ButtonUpd.Click += ButtonUpd_Click;
+ //
+ // FormComponents
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(ButtonUpd);
+ Controls.Add(ButtonDel);
+ Controls.Add(ButtonRef);
+ Controls.Add(ButtonAdd);
+ Controls.Add(dataGridView);
+ Name = "FormComponents";
+ Text = "Компоненты";
+ Load += FormComponent_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button ButtonAdd;
+ private Button ButtonRef;
+ private Button ButtonDel;
+ private Button ButtonUpd;
+ }
+}
\ No newline at end of file
diff --git a/Pizzeria/Pizzeria/FormComponents.cs b/Pizzeria/Pizzeria/FormComponents.cs
new file mode 100644
index 0000000..07c29bc
--- /dev/null
+++ b/Pizzeria/Pizzeria/FormComponents.cs
@@ -0,0 +1,73 @@
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualBasic.Logging;
+using PizzeriaContracts.BusinessLogicsContracts;
+
+namespace Pizzeria
+{
+ public partial class FormComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IComponentLogic _logic;
+ public FormComponents(ILogger logger, IComponentLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormComponent_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ private void LoadData()
+ {
+ try
+ {
+ var list = _logic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["Id"].Visible = false;
+ dataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation("Загрузка компонентов");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки компонентов");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,MessageBoxIcon.Error);
+ }
+ }
+
+ private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
+ {
+
+ }
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
+ if (service is FormComponent form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+
+ }
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
diff --git a/Pizzeria/Pizzeria/FormComponents.resx b/Pizzeria/Pizzeria/FormComponents.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/Pizzeria/Pizzeria/FormComponents.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Pizzeria/Pizzeria/Program.cs b/Pizzeria/Pizzeria/Program.cs
index 25f4942..88a8498 100644
--- a/Pizzeria/Pizzeria/Program.cs
+++ b/Pizzeria/Pizzeria/Program.cs
@@ -1,17 +1,51 @@
+using Microsoft.Extensions.DependencyInjection;
+using PizzeriaContracts.BusinessLogicsContracts;
+using PizzeriaContracts.StorageContracts;
+using System.Drawing;
+using System;
+
namespace Pizzeria
{
internal static class Program
{
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
///
- /// The main entry point for the application.
+ /// The main entry point for the application.
///
[STAThread]
static void Main()
{
- // To customize application configuration such as set high DPI settings or default font,
+ /*/ To customize application configuration such as set high DPI
+ settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ Application.Run(_serviceProvider.GetRequiredService());
+ */
+ }
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddLogging(option =>
+ {
+ option.SetMinimumLevel(LogLevel.Information);
+ option.AddNLog("nlog.config");
+ });
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file