PIbd-21 Potapov N.S. LabWork06 #7

Closed
ns.potapov wants to merge 36 commits from LabWork06 into LabWork05
7 changed files with 79 additions and 17 deletions
Showing only changes of commit 4b1cc73321 - Show all commits

View File

@ -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;
}
}

View File

@ -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();
}
}
}
}

View File

@ -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;
}
}

View File

@ -14,7 +14,7 @@ namespace SecuritySystemView.Implementer
public int Id { set { _id = value; } }
public FormImplementer(ILogger<FormImplementer> 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 = "Заполните квалификацию";

View File

@ -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);
}

View File

@ -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("Загрузка исполнителей");
}

View File

@ -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<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<ISecureStorage, SecureStorage>();
services.AddTransient<IImplementerStorage, ImplementerStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<ISecureLogic, SecureLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IImplementerLogic, ImplementerLogic>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
@ -59,6 +62,8 @@ namespace SecuritySystemView
services.AddTransient<FormReportOrders>();
services.AddTransient<FormReportSecureComponents>();
services.AddTransient<FormClients>();
services.AddTransient<FormImplementer>();
services.AddTransient<FormImplementers>();
}
}
}