Готовая лаб. работа 1
This commit is contained in:
parent
3e34afb54b
commit
eeffc761e0
@ -73,7 +73,7 @@
|
|||||||
buttonSaveComponent.Location = new Point(211, 80);
|
buttonSaveComponent.Location = new Point(211, 80);
|
||||||
buttonSaveComponent.Name = "buttonSaveComponent";
|
buttonSaveComponent.Name = "buttonSaveComponent";
|
||||||
buttonSaveComponent.Size = new Size(115, 29);
|
buttonSaveComponent.Size = new Size(115, 29);
|
||||||
buttonSaveComponent.TabIndex = 4;
|
buttonSaveComponent.TabIndex = 1;
|
||||||
buttonSaveComponent.Text = "Сохранить";
|
buttonSaveComponent.Text = "Сохранить";
|
||||||
buttonSaveComponent.UseVisualStyleBackColor = true;
|
buttonSaveComponent.UseVisualStyleBackColor = true;
|
||||||
buttonSaveComponent.Click += ButtonSaveComponent_Click;
|
buttonSaveComponent.Click += ButtonSaveComponent_Click;
|
||||||
|
@ -12,8 +12,7 @@ namespace SecuritySystemView
|
|||||||
private readonly IComponentLogic _logic;
|
private readonly IComponentLogic _logic;
|
||||||
private int? _id;
|
private int? _id;
|
||||||
public int Id { set { _id = value; } }
|
public int Id { set { _id = value; } }
|
||||||
public FormComponent(ILogger<FormComponent> logger, IComponentLogic
|
public FormComponent(ILogger<FormComponent> logger, IComponentLogic logic)
|
||||||
logic)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
buttonSave.Location = new Point(370, 118);
|
buttonSave.Location = new Point(370, 118);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(94, 29);
|
buttonSave.Size = new Size(94, 29);
|
||||||
buttonSave.TabIndex = 6;
|
buttonSave.TabIndex = 1;
|
||||||
buttonSave.Text = "Сохранить";
|
buttonSave.Text = "Сохранить";
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
buttonSave.Click += ButtonSave_Click;
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
@ -79,8 +79,10 @@
|
|||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Location = new Point(12, 31);
|
dataGridView.Location = new Point(12, 31);
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersVisible = false;
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dataGridView.Size = new Size(775, 296);
|
dataGridView.Size = new Size(775, 296);
|
||||||
dataGridView.TabIndex = 1;
|
dataGridView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
@ -134,7 +136,7 @@
|
|||||||
buttonRefresh.Location = new Point(816, 290);
|
buttonRefresh.Location = new Point(816, 290);
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
buttonRefresh.Size = new Size(216, 29);
|
buttonRefresh.Size = new Size(216, 29);
|
||||||
buttonRefresh.TabIndex = 6;
|
buttonRefresh.TabIndex = 1;
|
||||||
buttonRefresh.Text = "Обновить список";
|
buttonRefresh.Text = "Обновить список";
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
buttonRefresh.Click += ButtonRefresh_Click;
|
buttonRefresh.Click += ButtonRefresh_Click;
|
||||||
|
@ -143,6 +143,7 @@
|
|||||||
dataGridView.RowHeadersVisible = false;
|
dataGridView.RowHeadersVisible = false;
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dataGridView.Size = new Size(627, 285);
|
dataGridView.Size = new Size(627, 285);
|
||||||
dataGridView.TabIndex = 0;
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
@ -173,7 +174,7 @@
|
|||||||
buttonSave.Location = new Point(537, 409);
|
buttonSave.Location = new Point(537, 409);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(108, 29);
|
buttonSave.Size = new Size(108, 29);
|
||||||
buttonSave.TabIndex = 5;
|
buttonSave.TabIndex = 1;
|
||||||
buttonSave.Text = "Сохранить";
|
buttonSave.Text = "Сохранить";
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
buttonSave.Click += ButtonSave_Click;
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
@ -123,18 +123,16 @@ namespace SecuritySystemView
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Удаление компонента: {ComponentName} - {Count}", dataGridView.SelectedRows[0].Cells[1].Value);
|
_logger.LogInformation("Удаление компонента: {ComponentName} - {Count}", dataGridView.SelectedRows[0].Cells[1].Value, dataGridView.SelectedRows[0].Cells[2].Value);
|
||||||
_secureComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
_secureComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Ошибка",
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
}
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
buttonSave.Location = new Point(230, 84);
|
buttonSave.Location = new Point(230, 84);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(94, 29);
|
buttonSave.Size = new Size(94, 29);
|
||||||
buttonSave.TabIndex = 4;
|
buttonSave.TabIndex = 1;
|
||||||
buttonSave.Text = "Сохранить";
|
buttonSave.Text = "Сохранить";
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
buttonSave.Click += ButtonSave_Click;
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
@ -61,6 +61,12 @@ namespace SecuritySystemView
|
|||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Count <= 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Количество должно быть больше 0", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (comboBoxComponents.SelectedValue == null)
|
if (comboBoxComponents.SelectedValue == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Выберите компонент", "Ошибка",
|
MessageBox.Show("Выберите компонент", "Ошибка",
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
buttonAdd.Location = new Point(739, 12);
|
buttonAdd.Location = new Point(739, 12);
|
||||||
buttonAdd.Name = "buttonAdd";
|
buttonAdd.Name = "buttonAdd";
|
||||||
buttonAdd.Size = new Size(94, 29);
|
buttonAdd.Size = new Size(94, 29);
|
||||||
buttonAdd.TabIndex = 5;
|
buttonAdd.TabIndex = 1;
|
||||||
buttonAdd.Text = "Добавить";
|
buttonAdd.Text = "Добавить";
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
buttonAdd.Click += ButtonAddSecure_Click;
|
buttonAdd.Click += ButtonAddSecure_Click;
|
||||||
@ -104,7 +104,7 @@
|
|||||||
Controls.Add(buttonAdd);
|
Controls.Add(buttonAdd);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "FormSecures";
|
Name = "FormSecures";
|
||||||
Text = "Иделия";
|
Text = "Изделия";
|
||||||
Load += FormSecures_Load;
|
Load += FormSecures_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user