From 816024499fd69eebf47753d3ce31f0f6fbee212d Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Fri, 24 May 2024 21:58:59 +0400 Subject: [PATCH] lab-6 correct some mistakes --- .../ImplementersForm.Designer.cs | 172 +++++++++--------- .../BlacksmithWorkshop/ImplementersForm.cs | 20 +- .../BlacksmithWorkshop/ImplementersForm.resx | 50 ++--- .../Models/IImplementerModel.cs | 3 +- 4 files changed, 125 insertions(+), 120 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.Designer.cs index e1890c9..e16ad69 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.Designer.cs @@ -20,92 +20,98 @@ base.Dispose(disposing); } - #region Windows Form Designer generated code + #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() - { - dataGridView1 = new DataGridView(); - CreateButton = new Button(); - ChangeButton = new Button(); - DeleteButton = new Button(); - RefreshButton = new Button(); - ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit(); - SuspendLayout(); - // - // dataGridView1 - // - dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView1.Location = new Point(12, 12); - dataGridView1.Name = "dataGridView1"; - dataGridView1.RowHeadersWidth = 51; - dataGridView1.RowTemplate.Height = 29; - dataGridView1.Size = new Size(565, 426); - dataGridView1.TabIndex = 0; - // - // CreateButton - // - CreateButton.Location = new Point(583, 12); - CreateButton.Name = "CreateButton"; - CreateButton.Size = new Size(205, 29); - CreateButton.TabIndex = 1; - CreateButton.Text = "Создать"; - CreateButton.UseVisualStyleBackColor = true; - CreateButton.Click += CreateButton_Click; - // - // ChangeButton - // - ChangeButton.Location = new Point(583, 47); - ChangeButton.Name = "ChangeButton"; - ChangeButton.Size = new Size(205, 29); - ChangeButton.TabIndex = 2; - ChangeButton.Text = "Изменить"; - ChangeButton.UseVisualStyleBackColor = true; - ChangeButton.Click += ChangeButton_Click; - // - // DeleteButton - // - DeleteButton.Location = new Point(583, 82); - DeleteButton.Name = "DeleteButton"; - DeleteButton.Size = new Size(205, 29); - DeleteButton.TabIndex = 3; - DeleteButton.Text = "Удалить"; - DeleteButton.UseVisualStyleBackColor = true; - DeleteButton.Click += DeleteButton_Click; - // - // RefreshButton - // - RefreshButton.Location = new Point(583, 117); - RefreshButton.Name = "RefreshButton"; - RefreshButton.Size = new Size(205, 29); - RefreshButton.TabIndex = 4; - RefreshButton.Text = "Обновить"; - RefreshButton.UseVisualStyleBackColor = true; - RefreshButton.Click += RefreshButton_Click; - // - // ImplementersForm - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(RefreshButton); - Controls.Add(DeleteButton); - Controls.Add(ChangeButton); - Controls.Add(CreateButton); - Controls.Add(dataGridView1); - Name = "ImplementersForm"; - Text = "Исполнители"; - Load += ImplementersForm_Load; - ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit(); - ResumeLayout(false); - } + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + CreateButton = new Button(); + ChangeButton = new Button(); + DeleteButton = new Button(); + RefreshButton = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(10, 9); + dataGridView.Margin = new Padding(3, 2, 3, 2); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(494, 320); + dataGridView.TabIndex = 0; + // + // CreateButton + // + CreateButton.Location = new Point(510, 9); + CreateButton.Margin = new Padding(3, 2, 3, 2); + CreateButton.Name = "CreateButton"; + CreateButton.Size = new Size(179, 22); + CreateButton.TabIndex = 1; + CreateButton.Text = "Создать"; + CreateButton.UseVisualStyleBackColor = true; + CreateButton.Click += CreateButton_Click; + // + // ChangeButton + // + ChangeButton.Location = new Point(510, 35); + ChangeButton.Margin = new Padding(3, 2, 3, 2); + ChangeButton.Name = "ChangeButton"; + ChangeButton.Size = new Size(179, 22); + ChangeButton.TabIndex = 2; + ChangeButton.Text = "Изменить"; + ChangeButton.UseVisualStyleBackColor = true; + ChangeButton.Click += ChangeButton_Click; + // + // DeleteButton + // + DeleteButton.Location = new Point(510, 62); + DeleteButton.Margin = new Padding(3, 2, 3, 2); + DeleteButton.Name = "DeleteButton"; + DeleteButton.Size = new Size(179, 22); + DeleteButton.TabIndex = 3; + DeleteButton.Text = "Удалить"; + DeleteButton.UseVisualStyleBackColor = true; + DeleteButton.Click += DeleteButton_Click; + // + // RefreshButton + // + RefreshButton.Location = new Point(510, 88); + RefreshButton.Margin = new Padding(3, 2, 3, 2); + RefreshButton.Name = "RefreshButton"; + RefreshButton.Size = new Size(179, 22); + RefreshButton.TabIndex = 4; + RefreshButton.Text = "Обновить"; + RefreshButton.UseVisualStyleBackColor = true; + RefreshButton.Click += RefreshButton_Click; + // + // ImplementersForm + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(700, 338); + Controls.Add(RefreshButton); + Controls.Add(DeleteButton); + Controls.Add(ChangeButton); + Controls.Add(CreateButton); + Controls.Add(dataGridView); + Margin = new Padding(3, 2, 3, 2); + Name = "ImplementersForm"; + Text = "Исполнители"; + Load += ImplementersForm_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } - #endregion + #endregion - private DataGridView dataGridView1; + private DataGridView dataGridView; private Button CreateButton; private Button ChangeButton; private Button DeleteButton; diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.cs b/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.cs index 7a6934e..56272d1 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.cs @@ -34,12 +34,12 @@ namespace BlacksmithWorkshop var list = _logic.ReadList(null); if (list != null) { - dataGridView1.DataSource = list; - dataGridView1.Columns["Id"].Visible = false; - dataGridView1.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView1.Columns["Password"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView1.Columns["Qualification"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView1.Columns["WorkExperience"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.DataSource = list; + dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["Password"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["Qualification"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["WorkExperience"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation("Загрузка компонентов"); } @@ -62,13 +62,13 @@ namespace BlacksmithWorkshop } private void ChangeButton_Click(object sender, EventArgs e) { - if (dataGridView1.SelectedRows.Count == 1) + if (dataGridView.SelectedRows.Count == 1) { var service = Program.ServiceProvider?.GetService(typeof(ImplementerForm)); if (service is ImplementerForm form) { - form.Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value); + form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); if (form.ShowDialog() == DialogResult.OK) { LoadData(); @@ -78,12 +78,12 @@ namespace BlacksmithWorkshop } private void DeleteButton_Click(object sender, EventArgs e) { - if (dataGridView1.SelectedRows.Count == 1) + if (dataGridView.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value); + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); _logger.LogInformation("Удаление компонента"); try { diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.resx b/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.resx index 1af7de1..af32865 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.resx +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ImplementersForm.resx @@ -1,17 +1,17 @@  - diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IImplementerModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IImplementerModel.cs index c8e1951..cc43277 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IImplementerModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IImplementerModel.cs @@ -6,12 +6,11 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopDataModels.Models { - public interface IImplementerModel + public interface IImplementerModel : IId { string ImplementerFIO { get; } string Password { get; } int WorkExperience { get; } int Qualification { get; } - } }