diff --git a/SecuritySystem/SecuritySystemView/FormMain.Designer.cs b/SecuritySystem/SecuritySystemView/FormMain.Designer.cs index 272fac9..0bcb425 100644 --- a/SecuritySystem/SecuritySystemView/FormMain.Designer.cs +++ b/SecuritySystem/SecuritySystemView/FormMain.Designer.cs @@ -32,6 +32,7 @@ справочникиToolStripMenuItem = new ToolStripMenuItem(); ComponentsToolStripMenuItem = new ToolStripMenuItem(); SecuresToolStripMenuItem = new ToolStripMenuItem(); + клиентыToolStripMenuItem = new ToolStripMenuItem(); отчетыToolStripMenuItem = new ToolStripMenuItem(); списокКомпонентовToolStripMenuItem = new ToolStripMenuItem(); компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem(); @@ -42,7 +43,7 @@ buttonOrderReady = new Button(); button4 = new Button(); buttonRefresh = new Button(); - клиентыToolStripMenuItem = new ToolStripMenuItem(); + исполнителиToolStripMenuItem = new ToolStripMenuItem(); menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); @@ -59,7 +60,7 @@ // // справочникиToolStripMenuItem // - справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ComponentsToolStripMenuItem, SecuresToolStripMenuItem, клиентыToolStripMenuItem }); + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ComponentsToolStripMenuItem, SecuresToolStripMenuItem, клиентыToolStripMenuItem, исполнителиToolStripMenuItem }); справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; справочникиToolStripMenuItem.Size = new Size(117, 24); справочникиToolStripMenuItem.Text = "Справочники"; @@ -78,6 +79,13 @@ SecuresToolStripMenuItem.Text = "Изделия"; SecuresToolStripMenuItem.Click += SecuresToolStripMenuItem_Click; // + // клиентыToolStripMenuItem + // + клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; + клиентыToolStripMenuItem.Size = new Size(224, 26); + клиентыToolStripMenuItem.Text = "Клиенты"; + клиентыToolStripMenuItem.Click += ClientsToolStripMenuItem_Click; + // // отчетыToolStripMenuItem // отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem }); @@ -175,12 +183,12 @@ buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.Click += ButtonRefresh_Click; // - // клиентыToolStripMenuItem + // исполнителиToolStripMenuItem // - клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; - клиентыToolStripMenuItem.Size = new Size(224, 26); - клиентыToolStripMenuItem.Text = "Клиенты"; - клиентыToolStripMenuItem.Click += ClientsToolStripMenuItem_Click; + исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem"; + исполнителиToolStripMenuItem.Size = new Size(224, 26); + исполнителиToolStripMenuItem.Text = "Исполнители"; + исполнителиToolStripMenuItem.Click += ImplementersToolStripMenuItem_Click; // // FormMain // @@ -222,5 +230,6 @@ private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem; private ToolStripMenuItem клиентыToolStripMenuItem; + private ToolStripMenuItem исполнителиToolStripMenuItem; } } \ No newline at end of file diff --git a/SecuritySystem/SecuritySystemView/FormMain.cs b/SecuritySystem/SecuritySystemView/FormMain.cs index 2b55023..512fd0b 100644 --- a/SecuritySystem/SecuritySystemView/FormMain.cs +++ b/SecuritySystem/SecuritySystemView/FormMain.cs @@ -2,6 +2,7 @@ using SecuritySystemContracts.BindingModels; using SecuritySystemContracts.BusinessLogicsContracts; using SecuritySystemView.Client; +using SecuritySystemView.Implementer; using SecuritySystemView.Report; namespace SecuritySystemView @@ -195,5 +196,14 @@ namespace SecuritySystemView form.ShowDialog(); } } + + private void ImplementersToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormImplementers)); + if (service is FormImplementers form) + { + form.ShowDialog(); + } + } } } diff --git a/SecuritySystem/SecuritySystemView/Implementer/FormImplementer.Designer.cs b/SecuritySystem/SecuritySystemView/Implementer/FormImplementer.Designer.cs index e754381..cfff41e 100644 --- a/SecuritySystem/SecuritySystemView/Implementer/FormImplementer.Designer.cs +++ b/SecuritySystem/SecuritySystemView/Implementer/FormImplementer.Designer.cs @@ -36,12 +36,14 @@ textBoxFIO = new TextBox(); textBoxWorkExp = new TextBox(); textBoxQualification = new TextBox(); + labelPassword = new Label(); + textBoxPassword = new TextBox(); SuspendLayout(); // // buttonCancel // buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonCancel.Location = new Point(438, 141); + buttonCancel.Location = new Point(438, 191); buttonCancel.Name = "buttonCancel"; buttonCancel.Size = new Size(122, 29); buttonCancel.TabIndex = 5; @@ -52,7 +54,7 @@ // buttonSave // buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonSave.Location = new Point(301, 141); + buttonSave.Location = new Point(301, 191); buttonSave.Name = "buttonSave"; buttonSave.Size = new Size(115, 29); buttonSave.TabIndex = 4; @@ -72,7 +74,7 @@ // labelWorkExp // labelWorkExp.AutoSize = true; - labelWorkExp.Location = new Point(12, 57); + labelWorkExp.Location = new Point(12, 96); labelWorkExp.Name = "labelWorkExp"; labelWorkExp.Size = new Size(105, 20); labelWorkExp.TabIndex = 7; @@ -81,7 +83,7 @@ // labelQualification // labelQualification.AutoSize = true; - labelQualification.Location = new Point(12, 97); + labelQualification.Location = new Point(12, 136); labelQualification.Name = "labelQualification"; labelQualification.Size = new Size(114, 20); labelQualification.TabIndex = 8; @@ -98,24 +100,43 @@ // textBoxWorkExp // textBoxWorkExp.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - textBoxWorkExp.Location = new Point(157, 54); + textBoxWorkExp.Location = new Point(135, 93); textBoxWorkExp.Name = "textBoxWorkExp"; - textBoxWorkExp.Size = new Size(180, 27); + textBoxWorkExp.Size = new Size(202, 27); textBoxWorkExp.TabIndex = 10; // // textBoxQualification // textBoxQualification.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - textBoxQualification.Location = new Point(157, 94); + textBoxQualification.Location = new Point(135, 133); textBoxQualification.Name = "textBoxQualification"; - textBoxQualification.Size = new Size(180, 27); + textBoxQualification.Size = new Size(202, 27); textBoxQualification.TabIndex = 11; // + // labelPassword + // + labelPassword.AutoSize = true; + labelPassword.Location = new Point(12, 57); + labelPassword.Name = "labelPassword"; + labelPassword.Size = new Size(65, 20); + labelPassword.TabIndex = 12; + labelPassword.Text = "Пароль:"; + // + // textBoxPassword + // + textBoxPassword.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + textBoxPassword.Location = new Point(83, 54); + textBoxPassword.Name = "textBoxPassword"; + textBoxPassword.Size = new Size(477, 27); + textBoxPassword.TabIndex = 13; + // // FormImplementer // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(577, 182); + ClientSize = new Size(577, 232); + Controls.Add(textBoxPassword); + Controls.Add(labelPassword); Controls.Add(textBoxQualification); Controls.Add(textBoxWorkExp); Controls.Add(textBoxFIO); @@ -141,5 +162,7 @@ private TextBox textBoxFIO; private TextBox textBoxWorkExp; private TextBox textBoxQualification; + private Label labelPassword; + private TextBox textBoxPassword; } } \ No newline at end of file diff --git a/SecuritySystem/SecuritySystemView/Implementer/FormImplementer.cs b/SecuritySystem/SecuritySystemView/Implementer/FormImplementer.cs index c6a781f..a28c009 100644 --- a/SecuritySystem/SecuritySystemView/Implementer/FormImplementer.cs +++ b/SecuritySystem/SecuritySystemView/Implementer/FormImplementer.cs @@ -14,7 +14,7 @@ namespace SecuritySystemView.Implementer public int Id { set { _id = value; } } public FormImplementer(ILogger logger, IImplementerLogic logic) { - InitializeImplementer(); + InitializeComponent(); _logger = logger; _logic = logic; } @@ -31,6 +31,7 @@ namespace SecuritySystemView.Implementer textBoxFIO.Text = view.ImplementerFIO; textBoxQualification.Text = view.Qualification.ToString(); textBoxWorkExp.Text = view.WorkExperience.ToString(); + textBoxPassword.Text = view.Password.ToString(); } } catch (Exception ex) @@ -56,6 +57,7 @@ namespace SecuritySystemView.Implementer ImplementerFIO = textBoxFIO.Text, WorkExperience = Convert.ToInt32(textBoxWorkExp.Text), Qualification = Convert.ToInt32(textBoxQualification.Text), + Password = textBoxPassword.Text, }; var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); if (!operationResult) @@ -85,6 +87,10 @@ namespace SecuritySystemView.Implementer { errMsg = "Заполните ФИО"; } + else if (string.IsNullOrEmpty(textBoxPassword.Text)) + { + errMsg = "Заполните пароль"; + } else if (string.IsNullOrEmpty(textBoxQualification.Text)) { errMsg = "Заполните квалификацию"; diff --git a/SecuritySystem/SecuritySystemView/Implementer/FormImplementers.Designer.cs b/SecuritySystem/SecuritySystemView/Implementer/FormImplementers.Designer.cs index cc1a893..59f89cd 100644 --- a/SecuritySystem/SecuritySystemView/Implementer/FormImplementers.Designer.cs +++ b/SecuritySystem/SecuritySystemView/Implementer/FormImplementers.Designer.cs @@ -61,6 +61,7 @@ buttonRefresh.TabIndex = 8; buttonRefresh.Text = "Обновить"; buttonRefresh.UseVisualStyleBackColor = true; + buttonRefresh.Click += ButtonRefresh_Click; // // buttonDelete // @@ -71,6 +72,7 @@ buttonDelete.TabIndex = 7; buttonDelete.Text = "Удалить"; buttonDelete.UseVisualStyleBackColor = true; + buttonDelete.Click += ButtonDelete_Click; // // buttonEdit // @@ -81,6 +83,7 @@ buttonEdit.TabIndex = 6; buttonEdit.Text = "Изменить"; buttonEdit.UseVisualStyleBackColor = true; + buttonEdit.Click += ButtonEdit_Click; // // buttonAdd // @@ -91,6 +94,7 @@ buttonAdd.TabIndex = 5; buttonAdd.Text = "Добавить"; buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; // // FormImplementers // @@ -104,6 +108,7 @@ Controls.Add(dataGridView); Name = "FormImplementers"; Text = "Исполнители"; + Load += Form_Load; ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); } diff --git a/SecuritySystem/SecuritySystemView/Implementer/FormImplementers.cs b/SecuritySystem/SecuritySystemView/Implementer/FormImplementers.cs index bd5e9ae..4f9ac3d 100644 --- a/SecuritySystem/SecuritySystemView/Implementer/FormImplementers.cs +++ b/SecuritySystem/SecuritySystemView/Implementer/FormImplementers.cs @@ -26,6 +26,10 @@ namespace SecuritySystemView.Implementer if (list != null) { dataGridView.DataSource = list; + dataGridView.Columns["Id"].Visible = false; + dataGridView.Columns["WorkExperience"].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; + dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["Qualification"].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; } _logger.LogInformation("Загрузка исполнителей"); } diff --git a/SecuritySystem/SecuritySystemView/Program.cs b/SecuritySystem/SecuritySystemView/Program.cs index 9d5f6c1..47a55ba 100644 --- a/SecuritySystem/SecuritySystemView/Program.cs +++ b/SecuritySystem/SecuritySystemView/Program.cs @@ -8,6 +8,7 @@ using SecuritySystemContracts.BusinessLogicsContracts; using SecuritySystemContracts.StoragesContracts; using SecuritySystemDatabaseImplement.Implements; using SecuritySystemView.Client; +using SecuritySystemView.Implementer; using SecuritySystemView.Report; namespace SecuritySystemView @@ -40,12 +41,14 @@ namespace SecuritySystemView 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(); services.AddTransient(); @@ -59,6 +62,8 @@ namespace SecuritySystemView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file