Лабораторная работа 2 усложнёнка

This commit is contained in:
nikbel2004@outlook.com 2024-03-11 11:56:35 +04:00
parent 94c3a2a9c5
commit 579ab2c020
6 changed files with 46 additions and 27 deletions

View File

@ -31,7 +31,7 @@
buttonAdd = new Button();
buttonUpdate = new Button();
buttonDelete = new Button();
buttonRef = new Button();
buttonRefresh = new Button();
dataGridView = new DataGridView();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
@ -66,15 +66,15 @@
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonRef
// buttonRefresh
//
buttonRef.Location = new Point(640, 245);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(116, 50);
buttonRef.TabIndex = 3;
buttonRef.Text = "Обновить";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
buttonRefresh.Location = new Point(640, 245);
buttonRefresh.Name = "buttonRef";
buttonRefresh.Size = new Size(116, 50);
buttonRefresh.TabIndex = 3;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
//
// dataGridView
//
@ -92,7 +92,7 @@
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(781, 450);
Controls.Add(dataGridView);
Controls.Add(buttonRef);
Controls.Add(buttonRefresh);
Controls.Add(buttonDelete);
Controls.Add(buttonUpdate);
Controls.Add(buttonAdd);
@ -108,7 +108,7 @@
private Button buttonAdd;
private Button buttonUpdate;
private Button buttonDelete;
private Button buttonRef;
private Button buttonRefresh;
private DataGridView dataGridView;
}
}

View File

@ -118,7 +118,7 @@ namespace FurnitureAssemblyView
}
}
private void ButtonRef_Click(object sender, EventArgs e)
private void ButtonRefresh_Click(object sender, EventArgs e)
{
LoadData();
}

View File

@ -31,7 +31,7 @@
buttonAdd = new Button();
buttonUpdate = new Button();
buttonDelete = new Button();
buttonRef = new Button();
buttonRefresh = new Button();
dataGridView = new DataGridView();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
@ -69,16 +69,16 @@
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonRef
// buttonRefresh
//
buttonRef.Location = new Point(561, 197);
buttonRef.Margin = new Padding(3, 2, 3, 2);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(100, 34);
buttonRef.TabIndex = 3;
buttonRef.Text = "Обновить";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += ButtonRef_Click;
buttonRefresh.Location = new Point(561, 197);
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
buttonRefresh.Name = "buttonRef";
buttonRefresh.Size = new Size(100, 34);
buttonRefresh.TabIndex = 3;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
//
// dataGridView
//
@ -97,7 +97,7 @@
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(683, 338);
Controls.Add(dataGridView);
Controls.Add(buttonRef);
Controls.Add(buttonRefresh);
Controls.Add(buttonDelete);
Controls.Add(buttonUpdate);
Controls.Add(buttonAdd);
@ -114,7 +114,7 @@
private Button buttonAdd;
private Button buttonUpdate;
private Button buttonDelete;
private Button buttonRef;
private Button buttonRefresh;
private DataGridView dataGridView;
}
}

View File

@ -40,7 +40,7 @@ namespace FurnitureAssemblyView
var list = _logic.ReadList(null);
// Растягиваем колонку Название на всю ширину, колонку Id скрываем
if(list != null)
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
@ -49,7 +49,7 @@ namespace FurnitureAssemblyView
_logger.LogInformation("Загрузка заготовок");
}
catch(Exception ex)
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки заготовок");
@ -120,7 +120,7 @@ namespace FurnitureAssemblyView
}
}
private void ButtonRef_Click(object sender, EventArgs e)
private void ButtonRefresh_Click(object sender, EventArgs e)
{
LoadData();
}

View File

@ -29,6 +29,7 @@ namespace FurnitureAssemblyView
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true" internalLogLevel="Info">
<targets>
<target xsi:type="File" name="tofile" fileName="logs/log-${shortdate}.log" />
</targets>
<target name="console" xsi:type="Console" layout="Access Log|${level:uppercase=true}|${logger}|${message}">
<highlight-row condition="true" foregroundColor="red"/>
</target>
<rules>
<logger name="*" minlevel="Info" writeTo="tofile,console" />
</rules>
</nlog>
</configuration>