diff --git a/Lab 4/Belianin_4/Belianin_4.sln b/Lab 4/Belianin_4/Belianin_4.sln
new file mode 100644
index 0000000..e7bdc94
--- /dev/null
+++ b/Lab 4/Belianin_4/Belianin_4.sln
@@ -0,0 +1,55 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34728.123
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopWithMyVisualComponents", "DesktopWithMyVisualComponents\DesktopWithMyVisualComponents.csproj", "{D784BAED-C48F-46F2-A6A0-BBD6CE599A59}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnterpriseContracts", "EnterpriseContracts\EnterpriseContracts.csproj", "{B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnterpriseDataBaseImplement", "EnterpriseDataBaseImplement\EnterpriseDataBaseImplement.csproj", "{D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnterpriseBusinessLogic", "EnterpriseBusinessLogic\EnterpriseBusinessLogic.csproj", "{80D54561-34CE-4DE8-BF20-30A38B393D4B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginsConventionLibrary", "PluginsConventionLibrary\PluginsConventionLibrary.csproj", "{29708637-6FE2-482A-8960-C5A73EBD9F10}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DesktopWithPlugins", "DesktopWithPlugins\DesktopWithPlugins.csproj", "{A2976F63-6DFE-4434-8AB3-7036C8598CA8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D784BAED-C48F-46F2-A6A0-BBD6CE599A59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D784BAED-C48F-46F2-A6A0-BBD6CE599A59}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D784BAED-C48F-46F2-A6A0-BBD6CE599A59}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D784BAED-C48F-46F2-A6A0-BBD6CE599A59}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B07E9BAB-F7E0-4191-A9A5-FECA4127F6FF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D4FEF8DA-7060-4BF5-BB44-E5676DAE83E9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {80D54561-34CE-4DE8-BF20-30A38B393D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {80D54561-34CE-4DE8-BF20-30A38B393D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {80D54561-34CE-4DE8-BF20-30A38B393D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {80D54561-34CE-4DE8-BF20-30A38B393D4B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {29708637-6FE2-482A-8960-C5A73EBD9F10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {29708637-6FE2-482A-8960-C5A73EBD9F10}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {29708637-6FE2-482A-8960-C5A73EBD9F10}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {29708637-6FE2-482A-8960-C5A73EBD9F10}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A2976F63-6DFE-4434-8AB3-7036C8598CA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A2976F63-6DFE-4434-8AB3-7036C8598CA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A2976F63-6DFE-4434-8AB3-7036C8598CA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A2976F63-6DFE-4434-8AB3-7036C8598CA8}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {26502496-F9AE-4E02-986A-76FD9595E9AE}
+ EndGlobalSection
+EndGlobal
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/DesktopWithMyVisualComponents.csproj b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/DesktopWithMyVisualComponents.csproj
new file mode 100644
index 0000000..4d176c1
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/DesktopWithMyVisualComponents.csproj
@@ -0,0 +1,35 @@
+
+
+
+ WinExe
+ net6.0-windows7.0
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.Designer.cs b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.Designer.cs
new file mode 100644
index 0000000..b9bbfb1
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.Designer.cs
@@ -0,0 +1,189 @@
+namespace DesktopWithMyVisualComponents
+{
+ partial class FormEmployee
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #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()
+ {
+ labelFIO = new Label();
+ textBoxFIO = new TextBox();
+ labelPhoneNumber = new Label();
+ barsukovTextBoxPhoneNumber = new BarsukovComponents.VisualComponents.CustomTextBox();
+ labelSkill = new Label();
+ customSelectedCheckedListBoxProperty = new BelianinComponents.CustomSelectedCheckedListBoxProperty();
+ buttonPhoto = new Button();
+ buttonSave = new Button();
+ buttonCancelAdd = new Button();
+ pictureBoxPhoto = new PictureBox();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxPhoto).BeginInit();
+ SuspendLayout();
+ //
+ // labelFIO
+ //
+ labelFIO.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ labelFIO.AutoSize = true;
+ labelFIO.Location = new Point(30, 10);
+ labelFIO.Name = "labelFIO";
+ labelFIO.Size = new Size(45, 20);
+ labelFIO.TabIndex = 0;
+ labelFIO.Text = "ФИО:";
+ //
+ // textBoxFIO
+ //
+ textBoxFIO.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ textBoxFIO.Location = new Point(35, 34);
+ textBoxFIO.Margin = new Padding(3, 4, 3, 4);
+ textBoxFIO.Name = "textBoxFIO";
+ textBoxFIO.Size = new Size(493, 27);
+ textBoxFIO.TabIndex = 1;
+ //
+ // labelPhoneNumber
+ //
+ labelPhoneNumber.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ labelPhoneNumber.AutoSize = true;
+ labelPhoneNumber.Location = new Point(242, 98);
+ labelPhoneNumber.Name = "labelPhoneNumber";
+ labelPhoneNumber.Size = new Size(130, 20);
+ labelPhoneNumber.TabIndex = 2;
+ labelPhoneNumber.Text = "Номер телефона:";
+ //
+ // barsukovTextBoxPhoneNumber
+ //
+ barsukovTextBoxPhoneNumber.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ barsukovTextBoxPhoneNumber.BorderStyle = BorderStyle.FixedSingle;
+ barsukovTextBoxPhoneNumber.Location = new Point(242, 122);
+ barsukovTextBoxPhoneNumber.Margin = new Padding(3, 4, 3, 4);
+ barsukovTextBoxPhoneNumber.Name = "barsukovTextBoxPhoneNumber";
+ barsukovTextBoxPhoneNumber.numberPattern = "";
+ barsukovTextBoxPhoneNumber.Size = new Size(275, 81);
+ barsukovTextBoxPhoneNumber.TabIndex = 3;
+ barsukovTextBoxPhoneNumber.textBoxNumber = "";
+ barsukovTextBoxPhoneNumber.Enter += barsukovTextBoxPhoneNumber_Enter;
+ //
+ // labelSkill
+ //
+ labelSkill.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ labelSkill.AutoSize = true;
+ labelSkill.Location = new Point(35, 65);
+ labelSkill.Name = "labelSkill";
+ labelSkill.Size = new Size(57, 20);
+ labelSkill.TabIndex = 4;
+ labelSkill.Text = "Навык:";
+ //
+ // customSelectedCheckedListBoxProperty
+ //
+ customSelectedCheckedListBoxProperty.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ customSelectedCheckedListBoxProperty.Location = new Point(34, 84);
+ customSelectedCheckedListBoxProperty.Margin = new Padding(3, 4, 3, 4);
+ customSelectedCheckedListBoxProperty.Name = "customSelectedCheckedListBoxProperty";
+ customSelectedCheckedListBoxProperty.SelectedElement = "";
+ customSelectedCheckedListBoxProperty.Size = new Size(202, 207);
+ customSelectedCheckedListBoxProperty.TabIndex = 5;
+ //
+ // buttonPhoto
+ //
+ buttonPhoto.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ buttonPhoto.Location = new Point(35, 615);
+ buttonPhoto.Margin = new Padding(3, 4, 3, 4);
+ buttonPhoto.Name = "buttonPhoto";
+ buttonPhoto.Size = new Size(494, 48);
+ buttonPhoto.TabIndex = 6;
+ buttonPhoto.Text = "Загрузить фото";
+ buttonPhoto.UseVisualStyleBackColor = true;
+ buttonPhoto.Click += buttonPhoto_Click;
+ //
+ // buttonSave
+ //
+ buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonSave.Location = new Point(309, 671);
+ buttonSave.Margin = new Padding(3, 4, 3, 4);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(101, 41);
+ buttonSave.TabIndex = 7;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += buttonSave_Click;
+ //
+ // buttonCancelAdd
+ //
+ buttonCancelAdd.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonCancelAdd.Location = new Point(427, 671);
+ buttonCancelAdd.Margin = new Padding(3, 4, 3, 4);
+ buttonCancelAdd.Name = "buttonCancelAdd";
+ buttonCancelAdd.Size = new Size(102, 41);
+ buttonCancelAdd.TabIndex = 8;
+ buttonCancelAdd.Text = "Отмена";
+ buttonCancelAdd.UseVisualStyleBackColor = true;
+ buttonCancelAdd.Click += buttonCancelAdd_Click;
+ //
+ // pictureBoxPhoto
+ //
+ pictureBoxPhoto.Location = new Point(35, 281);
+ pictureBoxPhoto.Margin = new Padding(3, 4, 3, 4);
+ pictureBoxPhoto.Name = "pictureBoxPhoto";
+ pictureBoxPhoto.Size = new Size(493, 327);
+ pictureBoxPhoto.TabIndex = 9;
+ pictureBoxPhoto.TabStop = false;
+ //
+ // FormEmployee
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(559, 717);
+ Controls.Add(pictureBoxPhoto);
+ Controls.Add(buttonCancelAdd);
+ Controls.Add(buttonSave);
+ Controls.Add(buttonPhoto);
+ Controls.Add(customSelectedCheckedListBoxProperty);
+ Controls.Add(labelSkill);
+ Controls.Add(barsukovTextBoxPhoneNumber);
+ Controls.Add(labelPhoneNumber);
+ Controls.Add(textBoxFIO);
+ Controls.Add(labelFIO);
+ KeyPreview = true;
+ Margin = new Padding(3, 4, 3, 4);
+ Name = "FormEmployee";
+ Text = "Сотрудник";
+ Load += FormEmployee_Load;
+ ((System.ComponentModel.ISupportInitialize)pictureBoxPhoto).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label labelFIO;
+ private TextBox textBoxFIO;
+ private Label labelPhoneNumber;
+ private BarsukovComponents.VisualComponents.CustomTextBox barsukovTextBoxPhoneNumber;
+ private Label labelSkill;
+ private BelianinComponents.CustomSelectedCheckedListBoxProperty customSelectedCheckedListBoxProperty;
+ private Button buttonPhoto;
+ private Button buttonSave;
+ private Button buttonCancelAdd;
+ private PictureBox pictureBoxPhoto;
+ }
+}
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.cs b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.cs
new file mode 100644
index 0000000..742f3e2
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.cs
@@ -0,0 +1,148 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.BusinessLogicContracts;
+using EnterpriseContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace DesktopWithMyVisualComponents
+{
+ public partial class FormEmployee : Form
+ {
+ public int Id { set { id = value; } }
+
+ private readonly IEmployeeLogic _logic;
+
+ private readonly ISkillLogic _logicS;
+
+ private string image = null;
+
+ private int? id;
+
+ public FormEmployee(IEmployeeLogic logic, ISkillLogic logicS)
+ {
+ InitializeComponent();
+ _logic = logic;
+ _logicS = logicS;
+ }
+
+ private void barsukovTextBoxPhoneNumber_Enter(object sender, EventArgs e)
+ {
+ ToolTip tt = new ToolTip();
+
+ // Формат записи телефона
+ tt.Show("X-XXX-XX-XX", barsukovTextBoxPhoneNumber, 30, -20, 1000);
+ }
+
+ private void FormEmployee_Load(object sender, EventArgs e)
+ {
+ barsukovTextBoxPhoneNumber.numberPattern = @"^\d{1}-\d{3}-\d{2}-\d{2}$";
+ List viewS = _logicS.Read(null);
+
+ if (viewS != null)
+ {
+ foreach (SkillViewModel skill in viewS)
+ {
+ customSelectedCheckedListBoxProperty.Items.Add(skill.Name);
+ }
+ }
+
+ if (id.HasValue)
+ {
+ try
+ {
+ EmployeeViewModel view = _logic.Read(new EmployeeBindingModel { Id = id.Value })?[0];
+
+ if (view != null)
+ {
+ textBoxFIO.Text = view.FIO;
+ barsukovTextBoxPhoneNumber.textBoxNumber = view.PhoneNumber;
+ customSelectedCheckedListBoxProperty.SelectedElement = view.Skill;
+
+ pictureBoxPhoto.Image = StringToImage(view.Photo);
+ image = view.Photo;
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private Image StringToImage(string bytes)
+ {
+ byte[] arrayimg = Convert.FromBase64String(bytes);
+ Image imageStr = Image.FromStream(new MemoryStream(arrayimg));
+
+ return imageStr;
+ }
+
+ private string ImageToString(Image image)
+ {
+ using (var ms = new MemoryStream())
+ {
+ image.Save(ms, image.RawFormat);
+ byte[] imageBytes = ms.ToArray();
+
+ // Convert byte[] to Base64 String
+ string base64String = Convert.ToBase64String(imageBytes);
+ return base64String;
+ }
+ }
+
+ private void buttonSave_Click(object sender, EventArgs e)
+ {
+ List viewS = _logicS.Read(null);
+
+ try
+ {
+ _logic.CreateOrUpdate(new EmployeeBindingModel
+ {
+ Id = id,
+ FIO = textBoxFIO.Text,
+ Photo = image,
+ Skill = customSelectedCheckedListBoxProperty.SelectedElement,
+ PhoneNumber = barsukovTextBoxPhoneNumber.textBoxNumber,
+ });
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void buttonCancelAdd_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ private void buttonPhoto_Click(object sender, EventArgs e)
+ {
+ var dialog = new OpenFileDialog();
+
+ dialog.Title = "Выберите изображение";
+ dialog.Filter = "jpg files (*.jpg)|*.jpg";
+
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ var image_new = new Bitmap(dialog.FileName);
+ pictureBoxPhoto.Image = image_new;
+ image = ImageToString(image_new);
+ }
+
+ dialog.Dispose();
+ }
+ }
+}
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.resx b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormEmployee.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.Designer.cs b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.Designer.cs
new file mode 100644
index 0000000..8ed855c
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.Designer.cs
@@ -0,0 +1,183 @@
+namespace DesktopWithMyVisualComponents
+{
+ partial class FormMain
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #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()
+ {
+ components = new System.ComponentModel.Container();
+ menuStrip = new MenuStrip();
+ справочникиToolStripMenuItem = new ToolStripMenuItem();
+ навыкиToolStripMenuItem = new ToolStripMenuItem();
+ действияToolStripMenuItem = new ToolStripMenuItem();
+ добавитьToolStripMenuItem = new ToolStripMenuItem();
+ изменитьToolStripMenuItem = new ToolStripMenuItem();
+ удалитьToolStripMenuItem = new ToolStripMenuItem();
+ документыToolStripMenuItem = new ToolStripMenuItem();
+ wordСФотоToolStripMenuItem = new ToolStripMenuItem();
+ pdfТаблицаToolStripMenuItem = new ToolStripMenuItem();
+ excelГистограммаToolStripMenuItem = new ToolStripMenuItem();
+ wordWithImages = new BelianinComponents.WordWithImages(components);
+ componentTableToPdf = new BarsukovComponents.NotVisualComponents.PdfTable(components);
+ krykovItemTable = new KryukovLib.CustomDataGridView();
+ excelGistogram = new KryukovLib.ExcelGistogram(components);
+ menuStrip.SuspendLayout();
+ SuspendLayout();
+ //
+ // menuStrip
+ //
+ menuStrip.ImageScalingSize = new Size(20, 20);
+ menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, действияToolStripMenuItem, документыToolStripMenuItem });
+ menuStrip.Location = new Point(0, 0);
+ menuStrip.Name = "menuStrip";
+ menuStrip.Padding = new Padding(7, 3, 0, 3);
+ menuStrip.Size = new Size(661, 30);
+ menuStrip.TabIndex = 0;
+ menuStrip.Text = "menuStrip";
+ //
+ // справочникиToolStripMenuItem
+ //
+ справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { навыкиToolStripMenuItem });
+ справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
+ справочникиToolStripMenuItem.Size = new Size(117, 24);
+ справочникиToolStripMenuItem.Text = "Справочники";
+ //
+ // навыкиToolStripMenuItem
+ //
+ навыкиToolStripMenuItem.Name = "навыкиToolStripMenuItem";
+ навыкиToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.I;
+ навыкиToolStripMenuItem.Size = new Size(146, 26);
+ навыкиToolStripMenuItem.Text = "Навыки";
+ навыкиToolStripMenuItem.Click += навыкиToolStripMenuItem_Click;
+ //
+ // действияToolStripMenuItem
+ //
+ действияToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { добавитьToolStripMenuItem, изменитьToolStripMenuItem, удалитьToolStripMenuItem });
+ действияToolStripMenuItem.Name = "действияToolStripMenuItem";
+ действияToolStripMenuItem.Size = new Size(88, 24);
+ действияToolStripMenuItem.Text = "Действия";
+ //
+ // добавитьToolStripMenuItem
+ //
+ добавитьToolStripMenuItem.Name = "добавитьToolStripMenuItem";
+ добавитьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A;
+ добавитьToolStripMenuItem.Size = new Size(213, 26);
+ добавитьToolStripMenuItem.Text = "Добавить";
+ добавитьToolStripMenuItem.Click += добавитьToolStripMenuItem_Click;
+ //
+ // изменитьToolStripMenuItem
+ //
+ изменитьToolStripMenuItem.Name = "изменитьToolStripMenuItem";
+ изменитьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U;
+ изменитьToolStripMenuItem.Size = new Size(213, 26);
+ изменитьToolStripMenuItem.Text = "Изменить";
+ изменитьToolStripMenuItem.Click += изменитьToolStripMenuItem_Click;
+ //
+ // удалитьToolStripMenuItem
+ //
+ удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem";
+ удалитьToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.D;
+ удалитьToolStripMenuItem.Size = new Size(213, 26);
+ удалитьToolStripMenuItem.Text = "Удалить";
+ удалитьToolStripMenuItem.Click += удалитьToolStripMenuItem_Click;
+ //
+ // документыToolStripMenuItem
+ //
+ документыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { wordСФотоToolStripMenuItem, pdfТаблицаToolStripMenuItem, excelГистограммаToolStripMenuItem });
+ документыToolStripMenuItem.Name = "документыToolStripMenuItem";
+ документыToolStripMenuItem.Size = new Size(101, 24);
+ документыToolStripMenuItem.Text = "Документы";
+ //
+ // wordСФотоToolStripMenuItem
+ //
+ wordСФотоToolStripMenuItem.Name = "wordСФотоToolStripMenuItem";
+ wordСФотоToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
+ wordСФотоToolStripMenuItem.Size = new Size(271, 26);
+ wordСФотоToolStripMenuItem.Text = "Word с фото";
+ wordСФотоToolStripMenuItem.Click += wordСФотоToolStripMenuItem_Click;
+ //
+ // pdfТаблицаToolStripMenuItem
+ //
+ pdfТаблицаToolStripMenuItem.Name = "pdfТаблицаToolStripMenuItem";
+ pdfТаблицаToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.T;
+ pdfТаблицаToolStripMenuItem.Size = new Size(271, 26);
+ pdfТаблицаToolStripMenuItem.Text = "Pdf таблица";
+ pdfТаблицаToolStripMenuItem.Click += pdfТаблицаToolStripMenuItem_Click;
+ //
+ // excelГистограммаToolStripMenuItem
+ //
+ excelГистограммаToolStripMenuItem.Name = "excelГистограммаToolStripMenuItem";
+ excelГистограммаToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C;
+ excelГистограммаToolStripMenuItem.Size = new Size(271, 26);
+ excelГистограммаToolStripMenuItem.Text = "Excel гистограмма";
+ excelГистограммаToolStripMenuItem.Click += excelГистограммаToolStripMenuItem_Click;
+ //
+ // krykovItemTable
+ //
+ krykovItemTable.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ krykovItemTable.Location = new Point(14, 36);
+ krykovItemTable.Margin = new Padding(3, 5, 3, 5);
+ krykovItemTable.Name = "krykovItemTable";
+ krykovItemTable.Size = new Size(630, 477);
+ krykovItemTable.TabIndex = 2;
+ //
+ // FormMain
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(661, 529);
+ Controls.Add(krykovItemTable);
+ Controls.Add(menuStrip);
+ MainMenuStrip = menuStrip;
+ Margin = new Padding(3, 4, 3, 4);
+ Name = "FormMain";
+ Text = "Главная";
+ Load += FormMain_Load;
+ menuStrip.ResumeLayout(false);
+ menuStrip.PerformLayout();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private MenuStrip menuStrip;
+ private ToolStripMenuItem справочникиToolStripMenuItem;
+ private ToolStripMenuItem навыкиToolStripMenuItem;
+ private ToolStripMenuItem действияToolStripMenuItem;
+ private ToolStripMenuItem добавитьToolStripMenuItem;
+ private ToolStripMenuItem изменитьToolStripMenuItem;
+ private ToolStripMenuItem удалитьToolStripMenuItem;
+ private ToolStripMenuItem документыToolStripMenuItem;
+ private ToolStripMenuItem wordСФотоToolStripMenuItem;
+ private ToolStripMenuItem pdfТаблицаToolStripMenuItem;
+ private ToolStripMenuItem excelГистограммаToolStripMenuItem;
+ private BelianinComponents.WordWithImages wordWithImages;
+ private BarsukovComponents.NotVisualComponents.PdfTable componentTableToPdf;
+ private KryukovLib.CustomDataGridView krykovItemTable;
+ private KryukovLib.ExcelGistogram excelGistogram;
+ }
+}
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.cs b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.cs
new file mode 100644
index 0000000..e077cb2
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.cs
@@ -0,0 +1,246 @@
+using BelianinComponents;
+using BelianinComponents.Models;
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.BusinessLogicContracts;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using EnterpriseContracts.ViewModels;
+using EnterpriseDataBaseImplement.Models;
+using Unity;
+using BarsukovComponents.NotVisualComponents.Configs;
+
+namespace DesktopWithMyVisualComponents
+{
+ public partial class FormMain : Form
+ {
+ private readonly IEmployeeLogic _employeeLogic;
+
+ private readonly ISkillLogic _skillLogic;
+
+ // Конструктор
+ public FormMain(IEmployeeLogic employeeLogic, ISkillLogic skillLogic)
+ {
+ InitializeComponent();
+ _employeeLogic = employeeLogic;
+
+ krykovItemTable.ConfigColumn(new()
+ {
+ ColumnsCount = 4,
+ NameColumn = new string[] { "Id", "ФИО", "Навык", "Номер телефона" },
+ Width = new int[] { 10, 150, 250, 200 },
+ Visible = new bool[] { false, true, true, true },
+ PropertiesObject = new string[] { "Id", "FIO", "Skill", "PhoneNumber" }
+ });
+
+ _skillLogic = skillLogic;
+ }
+
+ private void FormMain_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ krykovItemTable.ClearDataGrid();
+ // Поиск записей в бд
+ var list = _employeeLogic.Read(null);
+
+ if (list != null)
+ {
+ for (int j = 0; j < list.Count; j++)
+ {
+ krykovItemTable.AddItem(list[j], j);
+ krykovItemTable.Update();
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var form = Program.Container.Resolve();
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+
+ private void изменитьToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var form = Program.Container.Resolve();
+
+ form.Id = Convert.ToInt32(krykovItemTable.GetSelectedObjectInRow().Id);
+
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+
+ private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ int id = Convert.ToInt32(krykovItemTable.GetSelectedObjectInRow().Id);
+
+ try
+ {
+ _employeeLogic.Delete(new EmployeeBindingModel { Id = id });
+ krykovItemTable.ClearDataGrid();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ LoadData();
+ }
+ }
+
+ private void навыкиToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var form = Program.Container.Resolve();
+
+ form.ShowDialog();
+ }
+
+ private byte[] StringToImage(string bytes)
+ {
+ byte[] arrayimg = Convert.FromBase64String(bytes);
+
+ return arrayimg;
+ }
+
+ private void wordСФотоToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ string fileName = "";
+
+ using (var dialog = new SaveFileDialog { Filter = "docx|*.docx" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+ var list = _employeeLogic.Read(null);
+
+ var list_images = new List();
+
+ foreach (var item in list)
+ {
+ var img = StringToImage(item.Photo);
+ list_images.Add(img);
+ }
+
+ wordWithImages.CreateDoc(new WordWithImageConfig
+ {
+ FilePath = fileName,
+ Header = "Фотографии:",
+ Images = list_images
+ });
+ }
+
+ private void pdfТаблицаToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ string fileName = "";
+
+ using (var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ // Вызов метода CreateTable
+ componentTableToPdf.CreateDoc(new ComponentTableToPdfConfig
+ {
+ // Путь к файлу
+ FilePath = fileName,
+ // Заголовок таблицы
+ Header = "Таблица с сотрудниками",
+ UseUnion = true,
+ // Информация о колонках
+ ColumnsRowsWidth = new List<(int, int)> { (20, 0), (20, 0), (20, 0), (20, 0) },
+ // Объединённые ячейки
+ ColumnUnion = new List<(int StartIndex, int Count)> { (2, 2) },
+
+ Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>()
+ {
+ (0, 0, "Идент.", "Id"),
+ (1, 0, "ФИО", "FIO"),
+ (2, 0, "Работа", ""),
+ (2, 1, "Номер телефона", "PhoneNumber"),
+ (3, 1, "Навык", "Skill")
+ },
+
+ // Данные для таблицы
+ Data = _employeeLogic.Read(null)
+ });
+ }
+
+ private void excelГистограммаToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ string fileName = "";
+
+ using (var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
+ MessageBoxIcon.Information);
+ }
+ }
+
+ var list2D = new List<(string Date, double Value)>();
+
+ var emps = _employeeLogic.Read(null);
+ var skills = _skillLogic.Read(null);
+
+ foreach (var skill in skills)
+ {
+ double count = 0;
+
+ foreach (var emp in emps)
+ {
+ if (skill.Name.Equals(emp.Skill))
+ {
+ count++;
+ }
+ }
+
+ var elem = (skill.Name, count);
+ list2D.Add(elem);
+ }
+
+ excelGistogram.CreateDoc(new()
+ {
+ FilePath = fileName,
+ Header = "Chart",
+ ChartTitle = "BarChart",
+ LegendLocation = KryukovLib.Models.Location.Top,
+ Data = new Dictionary>
+ {
+ { "Series 1", list2D }
+ }
+ });
+ }
+ }
+}
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.resx b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.resx
new file mode 100644
index 0000000..5b46608
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormMain.resx
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 508, 17
+
+
+ 145, 17
+
+
+ 349, 17
+
+
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.Designer.cs b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.Designer.cs
new file mode 100644
index 0000000..ad5e50a
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.Designer.cs
@@ -0,0 +1,69 @@
+namespace DesktopWithMyVisualComponents
+{
+ partial class FormSkill
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #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()
+ {
+ dataGridView = new DataGridView();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ dataGridView.AllowUserToAddRows = false;
+ dataGridView.AllowUserToDeleteRows = false;
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Location = new Point(14, 16);
+ dataGridView.Margin = new Padding(3, 4, 3, 4);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 51;
+ dataGridView.RowTemplate.Height = 25;
+ dataGridView.Size = new Size(282, 200);
+ dataGridView.TabIndex = 0;
+ dataGridView.CellEndEdit += dataGridView_CellEndEdit;
+ dataGridView.KeyDown += dataGridView_KeyDown;
+ //
+ // FormSkill
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(310, 240);
+ Controls.Add(dataGridView);
+ KeyPreview = true;
+ Margin = new Padding(3, 4, 3, 4);
+ Name = "FormSkill";
+ Text = "Навыки";
+ Load += FormSkill_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ }
+}
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.cs b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.cs
new file mode 100644
index 0000000..caa847c
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.cs
@@ -0,0 +1,145 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.BusinessLogicContracts;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace DesktopWithMyVisualComponents
+{
+ public partial class FormSkill : Form
+ {
+ private readonly ISkillLogic _skillLogic;
+
+ BindingList list;
+
+ public FormSkill(ISkillLogic skillLogic)
+ {
+ InitializeComponent();
+
+ _skillLogic = skillLogic;
+ dataGridView.AllowUserToDeleteRows = true;
+ list = new BindingList();
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ var list1 = _skillLogic.Read(null);
+ list.Clear();
+
+ foreach (var item in list1)
+ {
+ list.Add(new SkillBindingModel
+ {
+ Id = item.Id,
+ Name = item.Name,
+ });
+ }
+
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns[0].Visible = false;
+ dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void FormSkill_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void dataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
+ {
+ var typeName = (string)dataGridView.CurrentRow.Cells[1].Value;
+
+ if (!string.IsNullOrEmpty(typeName))
+ {
+ if (dataGridView.CurrentRow.Cells[0].Value != null)
+ {
+ _skillLogic.CreateOrUpdate(new SkillBindingModel()
+ {
+ Id = Convert.ToInt32(dataGridView.CurrentRow.Cells[0].Value),
+ Name = (string)dataGridView.CurrentRow.Cells[1].EditedFormattedValue
+ });
+ }
+ else
+ {
+ _skillLogic.CreateOrUpdate(new SkillBindingModel()
+ {
+ Name = (string)dataGridView.CurrentRow.Cells[1].EditedFormattedValue
+ });
+ }
+ }
+ else
+ {
+ MessageBox.Show("Введена пустая строка", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ LoadData();
+ }
+
+ private void dataGridView_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyData == Keys.Insert)
+ {
+ if (dataGridView.Rows.Count == 0)
+ {
+ list.Add(new SkillBindingModel());
+ dataGridView.DataSource = new List(list);
+ dataGridView.CurrentCell = dataGridView.Rows[0].Cells[1];
+
+ return;
+ }
+
+ if (dataGridView.Rows[dataGridView.Rows.Count - 1].Cells[1].Value != null)
+ {
+ list.Add(new SkillBindingModel());
+ dataGridView.DataSource = new List(list);
+ dataGridView.CurrentCell = dataGridView.Rows[dataGridView.Rows.Count - 1].Cells[1];
+
+ return;
+ }
+ }
+
+ if (e.KeyData == Keys.Delete)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+
+ try
+ {
+ if (!_skillLogic.Delete(new SkillBindingModel() { Id = id }))
+ {
+ throw new Exception("Ошибка при удалении");
+ }
+
+ dataGridView.Rows.RemoveAt(dataGridView.SelectedRows[0].Index);
+
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.resx b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/FormSkill.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/PluginsConvention.cs b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/PluginsConvention.cs
new file mode 100644
index 0000000..66949c3
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/PluginsConvention.cs
@@ -0,0 +1,286 @@
+using BarsukovComponents.NotVisualComponents.Configs;
+using BelianinComponents.Models;
+using BelianinComponents;
+using EnterpriseBusinessLogic.BusinessLogics;
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.BusinessLogicContracts;
+using EnterpriseContracts.ViewModels;
+using KryukovLib;
+using PluginsConventionLibrary.Plugins;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using PluginsConventionLibrary;
+using BarsukovComponents.NotVisualComponents;
+
+namespace DesktopWithMyVisualComponents
+{
+ public class PluginsConvention : IPluginsConvention
+ {
+ private CustomDataGridView krykovItemTable;
+
+ private readonly IEmployeeLogic _employeeLogic;
+
+ private readonly ISkillLogic _skillLogic;
+
+ public PluginsConvention()
+ {
+ _employeeLogic = new EmployeeLogic();
+ _skillLogic = new SkillLogic();
+
+ krykovItemTable = new CustomDataGridView();
+ var menu = new ContextMenuStrip();
+
+ var skillMenuItem = new ToolStripMenuItem("Формы");
+ menu.Items.Add(skillMenuItem);
+
+ skillMenuItem.Click += (sender, e) =>
+ {
+ var formSkill = new FormSkill(_skillLogic);
+ formSkill.ShowDialog();
+ };
+
+ krykovItemTable.ContextMenuStrip = menu;
+ ReloadData();
+ }
+
+ /// Название плагина
+ string IPluginsConvention.PluginName => PluginName();
+ public string PluginName()
+ {
+ return "Сотрудники";
+ }
+
+ public UserControl GetControl => krykovItemTable;
+
+ PluginsConventionElement IPluginsConvention.GetElement => GetElement();
+
+ public PluginsConventionElement GetElement()
+ {
+ var employee = krykovItemTable.GetSelectedObjectInRow(); ;
+ MainPluginConventionElement element = null;
+
+ if (krykovItemTable != null)
+ {
+ element = new MainPluginConventionElement
+ {
+ Id = employee.Id,
+ FIO = employee.FIO,
+ PhoneNumber = employee.PhoneNumber,
+ Photo = employee.Photo,
+ Skill = employee.Skill,
+ };
+ }
+
+ return (new PluginsConventionElement { Id = element.Id });
+ }
+
+ public Form GetForm(PluginsConventionElement element)
+ {
+ var formEmployee = new FormEmployee(_employeeLogic, _skillLogic);
+
+ if (element != null)
+ {
+ formEmployee.Id = element.Id;
+ }
+
+ return formEmployee;
+ }
+
+ public bool DeleteElement(PluginsConventionElement element)
+ {
+ try
+ {
+ _employeeLogic.Delete(new EmployeeBindingModel { Id = element.Id });
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
+
+ return true;
+ }
+
+ public void ReloadData()
+ {
+ krykovItemTable.ClearDataGrid();
+ krykovItemTable.ClearDataGrid();
+
+ krykovItemTable.ConfigColumn(new()
+ {
+ ColumnsCount = 4,
+ NameColumn = new string[] { "Id", "ФИО", "Навык", "Номер телефона" },
+ Width = new int[] { 10, 150, 250, 200 },
+ Visible = new bool[] { false, true, true, true },
+ PropertiesObject = new string[] { "Id", "FIO", "Skill", "PhoneNumber" }
+ });
+
+ var list = _employeeLogic.Read(null);
+
+ if (list != null)
+ {
+ for (int j = 0; j < list.Count; j++)
+ {
+ krykovItemTable.AddItem(list[j], j);
+ krykovItemTable.Update();
+ }
+ }
+ }
+
+ private byte[] StringToImage(string bytes)
+ {
+ byte[] arrayimg = Convert.FromBase64String(bytes);
+ return arrayimg;
+ }
+
+ public bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument)
+ {
+ try
+ {
+ string fileName = "";
+
+ using (var dialog = new SaveFileDialog { Filter = "docx|*.docx" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ var list = _employeeLogic.Read(null);
+ var list_images = new List();
+
+ foreach (var item in list)
+ {
+ var img = StringToImage(item.Photo);
+ list_images.Add(img);
+ }
+
+ WordWithImages wordWithImages = new WordWithImages();
+ wordWithImages.CreateDoc(new WordWithImageConfig
+ {
+ FilePath = fileName,
+ Header = "Фотографии:",
+ Images = list_images
+ });
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument)
+ {
+ try
+ {
+ string fileName = "";
+
+ using (var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
+ MessageBoxIcon.Information);
+ }
+ }
+
+ PdfTable componentTableToPdf = new PdfTable();
+ componentTableToPdf.CreateDoc(new ComponentTableToPdfConfig
+ {
+ FilePath = fileName,
+ Header = "Таблица с сотрудниками",
+ UseUnion = true,
+ ColumnsRowsWidth = new List<(int, int)> { (20, 0), (20, 0), (20, 0), (20, 0) },
+ ColumnUnion = new List<(int StartIndex, int Count)> { (2, 2) },
+
+ Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
+ {
+ (0, 0, "Идент.", "Id"),
+ (1, 0, "ФИО", "FIO"),
+ (2, 0, "Работа", ""),
+ (2, 1, "Номер телефона", "PhoneNumber"),
+ (3, 1, "Навык", "Skill")
+ },
+
+ Data = _employeeLogic.Read(null)
+ });
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument)
+ {
+ try
+ {
+ string fileName = "";
+
+ using (var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ var list2D = new List<(string Date, double Value)>();
+
+ var emps = _employeeLogic.Read(null);
+ var skills = _skillLogic.Read(null);
+
+ foreach (var skill in skills)
+ {
+ double count = 0;
+
+ foreach (var emp in emps)
+ {
+ if (skill.Name.Equals(emp.Skill))
+ {
+ count++;
+ }
+ }
+
+ var elem = (skill.Name, count);
+ list2D.Add(elem);
+ }
+
+ ExcelGistogram excelGistogram = new ExcelGistogram();
+
+ excelGistogram.CreateDoc(new()
+ {
+ FilePath = fileName,
+ Header = "Chart",
+ ChartTitle = "BarChart",
+ LegendLocation = KryukovLib.Models.Location.Top,
+ Data = new Dictionary> {
+ { "Series 1", list2D }
+ }
+ });
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public Form GetThesaurus()
+ {
+ return new FormSkill(_skillLogic);
+ }
+ }
+}
diff --git a/Lab 4/Belianin_4/DesktopWithMyVisualComponents/Program.cs b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/Program.cs
new file mode 100644
index 0000000..6e07304
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithMyVisualComponents/Program.cs
@@ -0,0 +1,50 @@
+using EnterpriseBusinessLogic.BusinessLogics;
+using EnterpriseContracts.BusinessLogicContracts;
+using EnterpriseContracts.StorageContracts;
+using EnterpriseDataBaseImplement.Implements;
+using Unity;
+using Unity.Lifetime;
+
+namespace DesktopWithMyVisualComponents
+{
+ internal static class Program
+ {
+ private static IUnityContainer container = null;
+
+ public static IUnityContainer Container
+ {
+ get
+ {
+ if (container == null)
+ {
+ container = BuildUnityContainer();
+ }
+ return container;
+ }
+ }
+
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.SetHighDpiMode(HighDpiMode.SystemAware);
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(Container.Resolve());
+ }
+ private static IUnityContainer BuildUnityContainer()
+ {
+ var currentContainer = new UnityContainer();
+
+ currentContainer.RegisterType(new HierarchicalLifetimeManager());
+ currentContainer.RegisterType(new HierarchicalLifetimeManager());
+
+ currentContainer.RegisterType(new HierarchicalLifetimeManager());
+ currentContainer.RegisterType(new HierarchicalLifetimeManager());
+
+ return currentContainer;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/DesktopWithPlugins.csproj b/Lab 4/Belianin_4/DesktopWithPlugins/DesktopWithPlugins.csproj
new file mode 100644
index 0000000..32236a4
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithPlugins/DesktopWithPlugins.csproj
@@ -0,0 +1,23 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+
+
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.Designer.cs b/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.Designer.cs
new file mode 100644
index 0000000..fd9bcf1
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.Designer.cs
@@ -0,0 +1,184 @@
+namespace DesktopWithPlugins
+{
+ partial class FormMain
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #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()
+ {
+ this.menuStrip = new System.Windows.Forms.MenuStrip();
+ this.ControlsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.ActionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.DocsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.SimpleDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.TableDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.ChartDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.panelControl = new System.Windows.Forms.Panel();
+ this.ThesaurusToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.AddElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.UpdElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.DelElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuStrip.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // menuStrip
+ //
+ this.menuStrip.Items.AddRange(new
+ System.Windows.Forms.ToolStripItem[] {
+ this.ControlsStripMenuItem,
+ this.ActionsToolStripMenuItem,
+ this.DocsToolStripMenuItem});
+ this.menuStrip.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip.Name = "menuStrip";
+ this.menuStrip.Size = new System.Drawing.Size(800, 24);
+ this.menuStrip.TabIndex = 0;
+ this.menuStrip.Text = "Меню";
+ //
+ // ControlsStripMenuItem
+ //
+ this.ControlsStripMenuItem.Name = "ControlsStripMenuItem";
+ this.ControlsStripMenuItem.Size = new System.Drawing.Size(94, 20);
+ this.ControlsStripMenuItem.Text = "Компоненты";
+ //
+ // ActionsToolStripMenuItem
+ //
+ this.ActionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.ThesaurusToolStripMenuItem,
+ this.AddElementToolStripMenuItem,
+ this.UpdElementToolStripMenuItem,
+ this.DelElementToolStripMenuItem});
+ this.ActionsToolStripMenuItem.Name = "ActionsToolStripMenuItem";
+ this.ActionsToolStripMenuItem.Size = new System.Drawing.Size(70, 20);
+ this.ActionsToolStripMenuItem.Text = "Действия";
+ //
+ // DocsToolStripMenuItem
+ //
+ this.DocsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.SimpleDocToolStripMenuItem,
+ this.TableDocToolStripMenuItem,
+ this.ChartDocToolStripMenuItem});
+ this.DocsToolStripMenuItem.Name = "DocsToolStripMenuItem";
+ this.DocsToolStripMenuItem.Size = new System.Drawing.Size(82, 20);
+ this.DocsToolStripMenuItem.Text = "Документы";
+ //
+ // SimpleDocToolStripMenuItem
+ //
+ this.SimpleDocToolStripMenuItem.Name = "SimpleDocToolStripMenuItem";
+ this.SimpleDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
+ this.SimpleDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
+ this.SimpleDocToolStripMenuItem.Text = "Простой документ";
+ this.SimpleDocToolStripMenuItem.Click += new System.EventHandler(this.SimpleDocToolStripMenuItem_Click);
+ //
+ // TableDocToolStripMenuItem
+ //
+ this.TableDocToolStripMenuItem.Name = "TableDocToolStripMenuItem";
+ this.TableDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
+ this.TableDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
+ this.TableDocToolStripMenuItem.Text = "Документ с таблицей";
+ this.TableDocToolStripMenuItem.Click += new System.EventHandler(this.TableDocToolStripMenuItem_Click);
+ //
+ // ChartDocToolStripMenuItem
+ //
+ this.ChartDocToolStripMenuItem.Name = "ChartDocToolStripMenuItem";
+ this.ChartDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
+ this.ChartDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
+ this.ChartDocToolStripMenuItem.Text = "Диаграмма";
+ this.ChartDocToolStripMenuItem.Click += new System.EventHandler(this.ChartDocToolStripMenuItem_Click);
+ //
+ // panelControl
+ //
+ this.panelControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panelControl.Location = new System.Drawing.Point(0, 24);
+ this.panelControl.Name = "panelControl";
+ this.panelControl.Size = new System.Drawing.Size(800, 426);
+ this.panelControl.TabIndex = 1;
+ //
+ // ThesaurusToolStripMenuItem
+ //
+ this.ThesaurusToolStripMenuItem.Name = "ThesaurusToolStripMenuItem";
+ this.ThesaurusToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I)));
+ this.ThesaurusToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.ThesaurusToolStripMenuItem.Text = "Справочник";
+ this.ThesaurusToolStripMenuItem.Click += new System.EventHandler(this.ThesaurusToolStripMenuItem_Click);
+ //
+ // AddElementToolStripMenuItem
+ //
+ this.AddElementToolStripMenuItem.Name = "AddElementToolStripMenuItem";
+ this.AddElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
+ this.AddElementToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.AddElementToolStripMenuItem.Text = "Добавить";
+ this.AddElementToolStripMenuItem.Click += new System.EventHandler(this.AddElementToolStripMenuItem_Click);
+ //
+ // UpdElementToolStripMenuItem
+ //
+ this.UpdElementToolStripMenuItem.Name = "UpdElementToolStripMenuItem";
+ this.UpdElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
+ this.UpdElementToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.UpdElementToolStripMenuItem.Text = "Изменить";
+ this.UpdElementToolStripMenuItem.Click += new System.EventHandler(this.UpdElementToolStripMenuItem_Click);
+ //
+ // DelElementToolStripMenuItem
+ //
+ this.DelElementToolStripMenuItem.Name = "DelElementToolStripMenuItem";
+ this.DelElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
+ this.DelElementToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.DelElementToolStripMenuItem.Text = "Удалить";
+ this.DelElementToolStripMenuItem.Click += new System.EventHandler(this.DelElementToolStripMenuItem_Click);
+ //
+ // FormMain
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.panelControl);
+ this.Controls.Add(this.menuStrip);
+ this.MainMenuStrip = this.menuStrip;
+ this.Name = "FormMain";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Главная форма";
+ this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
+ this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormMain_KeyDown);
+ this.menuStrip.ResumeLayout(false);
+ this.menuStrip.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuStrip menuStrip;
+ private System.Windows.Forms.ToolStripMenuItem ControlsStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem DocsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem SimpleDocToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem TableDocToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem ChartDocToolStripMenuItem;
+ private System.Windows.Forms.Panel panelControl;
+ private System.Windows.Forms.ToolStripMenuItem ActionsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem ThesaurusToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem AddElementToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem UpdElementToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem DelElementToolStripMenuItem;
+ }
+}
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.cs b/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.cs
new file mode 100644
index 0000000..b586cd3
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.cs
@@ -0,0 +1,245 @@
+using BelianinComponents;
+using BelianinComponents.Models;
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.BusinessLogicContracts;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Reflection;
+using PluginsConventionLibrary.Plugins;
+
+namespace DesktopWithPlugins
+{
+ public partial class FormMain : Form
+ {
+ private readonly Dictionary _plugins;
+
+ private string _selectedPlugin;
+
+ public FormMain()
+ {
+ InitializeComponent();
+ _plugins = LoadPlugins();
+
+ _selectedPlugin = string.Empty;
+ }
+
+ // Загрузка плагинов
+ private Dictionary LoadPlugins()
+ {
+ var plugins = new Dictionary();
+
+ // Ищем в директории плагины, указан путь к каталогу
+ string pluginsDir = Directory.GetParent(Directory.GetCurrentDirectory())!.Parent!.Parent!.FullName + "\\plugins";
+
+ // Получает файлы dll
+ string[] dllFiles = Directory.GetFiles(pluginsDir, "*.dll", SearchOption.AllDirectories);
+
+ foreach (string dllFile in dllFiles)
+ {
+ try
+ {
+ /// Загрузка каждого dll
+ Assembly assembly = Assembly.LoadFrom(dllFile);
+ Type[] types = assembly.GetTypes();
+
+ foreach (var type in types)
+ {
+ // Поиск классов, которые реализуют интерфейс плагина
+ if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface)
+ {
+ var plugin = (IPluginsConvention)Activator.CreateInstance(type)!;
+ plugins.Add(plugin.PluginName, plugin);
+ CreateToolStripMenuItem(plugin.PluginName);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Ошибка при загрузке сборки {dllFile}: {ex.Message}");
+ }
+ }
+
+ return plugins;
+ }
+
+ /// Создать ToolStripMenuItem для плагина (создание элементов меню)
+ private void CreateToolStripMenuItem(string pluginName)
+ {
+ var menuItem = new ToolStripMenuItem(pluginName);
+ menuItem.Click += (object? sender, EventArgs e) =>
+ {
+ _selectedPlugin = pluginName;
+
+ // Начало обработки выбранногоо плагина
+ IPluginsConvention plugin = _plugins![pluginName];
+
+ // Get Control возвращает пользовательский элемент
+ UserControl userControl = plugin.GetControl;
+
+ if (userControl != null)
+ {
+ // panelControl добавляет контейнер на котором происходит отображение интерфейса
+ panelControl.Controls.Clear();
+ plugin.ReloadData();
+ userControl.Dock = DockStyle.Fill;
+ panelControl.Controls.Add(userControl);
+ }
+ };
+
+ ControlsStripMenuItem.DropDownItems.Add(menuItem);
+ }
+
+ private void FormMain_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (!e.Control)
+ {
+ return;
+ }
+
+ switch (e.KeyCode)
+ {
+ case Keys.I:
+ ShowThesaurus();
+ break;
+ case Keys.A:
+ AddNewElement();
+ break;
+ case Keys.U:
+ UpdateElement();
+ break;
+ case Keys.D:
+ DeleteElement();
+ break;
+ case Keys.S:
+ CreateSimpleDoc();
+ break;
+ case Keys.T:
+ CreateTableDoc();
+ break;
+ case Keys.C:
+ CreateChartDoc();
+ break;
+ }
+ }
+
+ /// Отобразить форму для работы со справочником
+ private void ShowThesaurus()
+ {
+ _plugins[_selectedPlugin].GetThesaurus()?.Show();
+ }
+
+ private void AddNewElement()
+ {
+ var form = _plugins[_selectedPlugin].GetForm(null);
+
+ if (form != null && form.ShowDialog() == DialogResult.OK)
+ {
+ _plugins[_selectedPlugin].ReloadData();
+ }
+ }
+
+ private void UpdateElement()
+ {
+ var element = _plugins[_selectedPlugin].GetElement;
+
+ if (element == null)
+ {
+ MessageBox.Show("Нет выбранного элемента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
+ var form = _plugins[_selectedPlugin].GetForm(element);
+ if (form != null && form.ShowDialog() == DialogResult.OK)
+ {
+ _plugins[_selectedPlugin].ReloadData();
+ }
+ }
+
+ private void DeleteElement()
+ {
+ if (MessageBox.Show("Удалить выбранный элемент", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
+ {
+ return;
+ }
+
+ var element = _plugins[_selectedPlugin].GetElement;
+
+ if (element == null)
+ {
+ MessageBox.Show("Нет выбранного элемента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (_plugins[_selectedPlugin].DeleteElement(element))
+ {
+ _plugins[_selectedPlugin].ReloadData();
+ }
+ }
+
+ /// Создать простой документ
+ private void CreateSimpleDoc()
+ {
+ if (_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument()))
+ {
+ MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ /// Создать документ с настраиваемой таблицей
+ private void CreateTableDoc()
+ {
+ if (_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument()))
+ {
+ MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ /// Создать документ с диаграммой
+ private void CreateChartDoc()
+ {
+ if (_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument()))
+ {
+ MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ /// Отобразить форму для работы со справочником
+ private void ThesaurusToolStripMenuItem_Click(object sender, EventArgs e) => ShowThesaurus();
+
+ /// Создать элемент
+ private void AddElementToolStripMenuItem_Click(object sender, EventArgs e) => AddNewElement();
+
+ /// Редактировать элемент
+ private void UpdElementToolStripMenuItem_Click(object sender, EventArgs e) => UpdateElement();
+
+ /// Удалить элемент
+ private void DelElementToolStripMenuItem_Click(object sender, EventArgs e) => DeleteElement();
+
+ /// Создать простой документ
+ private void SimpleDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateSimpleDoc();
+
+ /// Создать документ с настраиваемой таблицей
+ private void TableDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateTableDoc();
+
+ /// Создать документ с диаграммой
+ private void ChartDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateChartDoc();
+ }
+}
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.resx b/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.resx
new file mode 100644
index 0000000..93c550b
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithPlugins/FormMain.resx
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 161, 17
+
+
+ 295, 17
+
+
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/Program.cs b/Lab 4/Belianin_4/DesktopWithPlugins/Program.cs
new file mode 100644
index 0000000..47722d9
--- /dev/null
+++ b/Lab 4/Belianin_4/DesktopWithPlugins/Program.cs
@@ -0,0 +1,24 @@
+using EnterpriseBusinessLogic.BusinessLogics;
+using EnterpriseContracts.BusinessLogicContracts;
+using EnterpriseContracts.StorageContracts;
+using EnterpriseDataBaseImplement.Implements;
+using Unity;
+using Unity.Lifetime;
+
+namespace DesktopWithPlugins
+{
+ internal static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ Application.Run(new FormMain());
+ }
+ }
+}
\ No newline at end of file
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Azure.Core.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Azure.Core.dll
new file mode 100644
index 0000000..7a2ceec
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Azure.Core.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Azure.Identity.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Azure.Identity.dll
new file mode 100644
index 0000000..3508843
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Azure.Identity.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/BarsukovComponents.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/BarsukovComponents.dll
new file mode 100644
index 0000000..1c0de50
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/BarsukovComponents.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/BelianinComponents.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/BelianinComponents.dll
new file mode 100644
index 0000000..82ec36b
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/BelianinComponents.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DesktopWithMyVisualComponents.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DesktopWithMyVisualComponents.dll
new file mode 100644
index 0000000..f1afb2e
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DesktopWithMyVisualComponents.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DocumentFormat.OpenXml.Framework.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DocumentFormat.OpenXml.Framework.dll
new file mode 100644
index 0000000..8acaae0
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DocumentFormat.OpenXml.Framework.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DocumentFormat.OpenXml.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DocumentFormat.OpenXml.dll
new file mode 100644
index 0000000..681d5e9
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/DocumentFormat.OpenXml.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseBusinessLogic.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseBusinessLogic.dll
new file mode 100644
index 0000000..7abb569
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseBusinessLogic.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseContracts.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseContracts.dll
new file mode 100644
index 0000000..bfcac4b
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseContracts.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseDataBaseImplement.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseDataBaseImplement.dll
new file mode 100644
index 0000000..f767c3d
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/EnterpriseDataBaseImplement.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Humanizer.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Humanizer.dll
new file mode 100644
index 0000000..c9a7ef8
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Humanizer.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/KryukovLib.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/KryukovLib.dll
new file mode 100644
index 0000000..e4cd7ca
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/KryukovLib.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Bcl.AsyncInterfaces.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Bcl.AsyncInterfaces.dll
new file mode 100644
index 0000000..a5b7ff9
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Bcl.AsyncInterfaces.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Data.SqlClient.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Data.SqlClient.dll
new file mode 100644
index 0000000..cc62e64
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Data.SqlClient.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Abstractions.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Abstractions.dll
new file mode 100644
index 0000000..93f27f8
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Abstractions.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Design.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Design.dll
new file mode 100644
index 0000000..0f13dd2
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Design.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Relational.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Relational.dll
new file mode 100644
index 0000000..c96960d
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.Relational.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.SqlServer.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.SqlServer.dll
new file mode 100644
index 0000000..24314dc
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.SqlServer.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.dll
new file mode 100644
index 0000000..cbb4006
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.EntityFrameworkCore.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Caching.Abstractions.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Caching.Abstractions.dll
new file mode 100644
index 0000000..be73869
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Caching.Abstractions.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Caching.Memory.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Caching.Memory.dll
new file mode 100644
index 0000000..561804a
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Caching.Memory.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Configuration.Abstractions.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Configuration.Abstractions.dll
new file mode 100644
index 0000000..3a12ec4
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Configuration.Abstractions.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll
new file mode 100644
index 0000000..11e5f2e
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyInjection.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyInjection.dll
new file mode 100644
index 0000000..2c64257
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyInjection.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyModel.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyModel.dll
new file mode 100644
index 0000000..072af1f
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.DependencyModel.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Logging.Abstractions.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Logging.Abstractions.dll
new file mode 100644
index 0000000..03edd8f
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Logging.Abstractions.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Logging.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Logging.dll
new file mode 100644
index 0000000..c53f5d2
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Logging.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Options.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Options.dll
new file mode 100644
index 0000000..3987d66
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Options.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Primitives.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Primitives.dll
new file mode 100644
index 0000000..081abea
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Extensions.Primitives.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Identity.Client.Extensions.Msal.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Identity.Client.Extensions.Msal.dll
new file mode 100644
index 0000000..04be9fc
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Identity.Client.Extensions.Msal.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Identity.Client.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Identity.Client.dll
new file mode 100644
index 0000000..5e06934
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Identity.Client.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Abstractions.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Abstractions.dll
new file mode 100644
index 0000000..422bfb9
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Abstractions.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.JsonWebTokens.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.JsonWebTokens.dll
new file mode 100644
index 0000000..fa2330d
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.JsonWebTokens.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Logging.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Logging.dll
new file mode 100644
index 0000000..454079e
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Logging.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll
new file mode 100644
index 0000000..da3da51
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Protocols.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Protocols.dll
new file mode 100644
index 0000000..68bc57c
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Protocols.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Tokens.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Tokens.dll
new file mode 100644
index 0000000..7f087c7
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.IdentityModel.Tokens.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.SqlServer.Server.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.SqlServer.Server.dll
new file mode 100644
index 0000000..ddeaa86
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.SqlServer.Server.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Win32.SystemEvents.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Win32.SystemEvents.dll
new file mode 100644
index 0000000..b66319e
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Microsoft.Win32.SystemEvents.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.DocumentObjectModel.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.DocumentObjectModel.dll
new file mode 100644
index 0000000..4334467
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.DocumentObjectModel.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.Rendering-gdi.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.Rendering-gdi.dll
new file mode 100644
index 0000000..f76d616
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.Rendering-gdi.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.RtfRendering-gdi.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.RtfRendering-gdi.dll
new file mode 100644
index 0000000..10c59a4
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/MigraDoc.RtfRendering-gdi.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Mono.TextTemplating.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Mono.TextTemplating.dll
new file mode 100644
index 0000000..d5a4b3c
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Mono.TextTemplating.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp-gdi.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp-gdi.dll
new file mode 100644
index 0000000..b7ff608
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp-gdi.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Charting-gdi.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Charting-gdi.dll
new file mode 100644
index 0000000..8bb8f10
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Charting-gdi.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Quality-gdi.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Quality-gdi.dll
new file mode 100644
index 0000000..dda5371
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Quality-gdi.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Snippets-gdi.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Snippets-gdi.dll
new file mode 100644
index 0000000..5ddd13e
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.Snippets-gdi.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.System.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.System.dll
new file mode 100644
index 0000000..e8dded5
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.System.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.WPFonts.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.WPFonts.dll
new file mode 100644
index 0000000..9a7c2ca
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PdfSharp.WPFonts.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PluginsConventionLibrary.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PluginsConventionLibrary.dll
new file mode 100644
index 0000000..fb44ab1
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/PluginsConventionLibrary.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Configuration.ConfigurationManager.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Configuration.ConfigurationManager.dll
new file mode 100644
index 0000000..14f8ef6
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Configuration.ConfigurationManager.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Drawing.Common.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Drawing.Common.dll
new file mode 100644
index 0000000..32bb015
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Drawing.Common.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.IO.Packaging.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.IO.Packaging.dll
new file mode 100644
index 0000000..6ef5541
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.IO.Packaging.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.IdentityModel.Tokens.Jwt.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.IdentityModel.Tokens.Jwt.dll
new file mode 100644
index 0000000..af8fc34
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.IdentityModel.Tokens.Jwt.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Memory.Data.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Memory.Data.dll
new file mode 100644
index 0000000..6f2a3e0
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Memory.Data.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Runtime.Caching.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Runtime.Caching.dll
new file mode 100644
index 0000000..14826eb
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Runtime.Caching.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Text.Encodings.Web.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Text.Encodings.Web.dll
new file mode 100644
index 0000000..13a219a
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Text.Encodings.Web.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Text.Json.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Text.Json.dll
new file mode 100644
index 0000000..2078226
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/System.Text.Json.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Unity.Abstractions.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Unity.Abstractions.dll
new file mode 100644
index 0000000..7584a48
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Unity.Abstractions.dll differ
diff --git a/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Unity.Container.dll b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Unity.Container.dll
new file mode 100644
index 0000000..9602753
Binary files /dev/null and b/Lab 4/Belianin_4/DesktopWithPlugins/plugins/Unity.Container.dll differ
diff --git a/Lab 4/Belianin_4/EnterpriseBusinessLogic/BusinessLogics/EmployeeLogic.cs b/Lab 4/Belianin_4/EnterpriseBusinessLogic/BusinessLogics/EmployeeLogic.cs
new file mode 100644
index 0000000..760282f
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseBusinessLogic/BusinessLogics/EmployeeLogic.cs
@@ -0,0 +1,89 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.BusinessLogicContracts;
+using EnterpriseContracts.StorageContracts;
+using EnterpriseContracts.ViewModels;
+using EnterpriseDataBaseImplement.Implements;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseBusinessLogic.BusinessLogics
+{
+ public class EmployeeLogic : IEmployeeLogic
+ {
+ private readonly IEmployeeStorage _employeeStorage;
+
+ public EmployeeLogic()
+ {
+ _employeeStorage = new EmployeeStorage();
+ }
+
+ public EmployeeLogic(IEmployeeStorage employeeStorage)
+ {
+ _employeeStorage = employeeStorage;
+ }
+
+ // Создание и обновление записи о работнике
+ public void CreateOrUpdate(EmployeeBindingModel model)
+ {
+ var element = _employeeStorage.GetElement(new EmployeeBindingModel
+ {
+ FIO = model.FIO
+ });
+
+ if (element != null && element.Id != model.Id)
+ {
+ throw new Exception("Сотрудник с таким именем уже существует");
+ }
+
+ // Если уже создан, то обновляем, иначе создаём
+ if (model.Id.HasValue)
+ {
+ _employeeStorage.Update(model);
+ }
+ else
+ {
+ _employeeStorage.Insert(model);
+ }
+ }
+
+ // Удаление записи о работнике
+ public void Delete(EmployeeBindingModel model)
+ {
+ var element = _employeeStorage.GetElement(new EmployeeBindingModel
+ {
+ Id = model.Id
+ });
+
+ if (element == null)
+ {
+ throw new Exception("Сотрудник не найден");
+ }
+
+ _employeeStorage.Delete(model);
+ }
+
+ // Чтение записей о работнике
+ public List Read(EmployeeBindingModel model)
+ {
+ // Если неконкретная запись, то выводим все
+ if (model == null)
+ {
+ return _employeeStorage.GetFullList();
+ }
+
+ // Если конкретная запись о навыке
+ if (model.Id.HasValue)
+ {
+ return new List
+ {
+ _employeeStorage.GetElement(model)
+ };
+ }
+
+ return _employeeStorage.GetFullList();
+ }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseBusinessLogic/BusinessLogics/SkillLogic.cs b/Lab 4/Belianin_4/EnterpriseBusinessLogic/BusinessLogics/SkillLogic.cs
new file mode 100644
index 0000000..d171a76
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseBusinessLogic/BusinessLogics/SkillLogic.cs
@@ -0,0 +1,95 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.BusinessLogicContracts;
+using EnterpriseContracts.StorageContracts;
+using EnterpriseContracts.ViewModels;
+using EnterpriseDataBaseImplement.Implements;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseBusinessLogic.BusinessLogics
+{
+ public class SkillLogic : ISkillLogic
+ {
+ private readonly ISkillStorage _skillStorage;
+
+ public SkillLogic()
+ {
+ _skillStorage = new SkillStorage();
+ }
+
+ public SkillLogic(ISkillStorage skillStorage)
+ {
+ _skillStorage = skillStorage;
+ }
+
+ // Создание и обновление записи о навыке
+ public void CreateOrUpdate(SkillBindingModel model)
+ {
+ var element = _skillStorage.GetElement(
+ new SkillBindingModel
+ {
+ Name = model.Name
+ });
+
+ if (element != null && element.Id != model.Id)
+ {
+ throw new Exception("Такой навык уже существует");
+ }
+
+ // Если уже создан, то обновляем, иначе создаём
+ if (model.Id.HasValue)
+ {
+ _skillStorage.Update(model);
+ }
+ else
+ {
+ _skillStorage.Insert(model);
+ }
+ }
+
+ // Удаление записи о навыке
+ public bool Delete(SkillBindingModel model)
+ {
+ var element = _skillStorage.GetElement(new SkillBindingModel
+ {
+ Id = model.Id
+ });
+
+ if (element == null)
+ {
+ throw new Exception("Навык не найден");
+ }
+
+ if (_skillStorage.Delete(model) == null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ // Чтение записей о навыках
+ public List Read(SkillBindingModel model)
+ {
+ // Если неконкретная запись, то выводим все
+ if (model == null)
+ {
+ return _skillStorage.GetFullList();
+ }
+
+ // Если конкретная запись о навыке
+ if (model.Id.HasValue)
+ {
+ return new List
+ {
+ _skillStorage.GetElement(model)
+ };
+ }
+
+ return _skillStorage.GetFilteredList(model);
+ }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseBusinessLogic/EnterpriseBusinessLogic.csproj b/Lab 4/Belianin_4/EnterpriseBusinessLogic/EnterpriseBusinessLogic.csproj
new file mode 100644
index 0000000..7d27783
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseBusinessLogic/EnterpriseBusinessLogic.csproj
@@ -0,0 +1,15 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/BindingModels/EmployeeBindingModel.cs b/Lab 4/Belianin_4/EnterpriseContracts/BindingModels/EmployeeBindingModel.cs
new file mode 100644
index 0000000..bb6c7d5
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/BindingModels/EmployeeBindingModel.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseContracts.BindingModels
+{
+ public class EmployeeBindingModel
+ {
+ public int? Id { get; set; }
+
+ public string Skill { get; set; }
+
+ public string Photo { get; set; }
+
+ public string FIO { get; set; }
+
+ public string PhoneNumber { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/BindingModels/SkillBindingModel.cs b/Lab 4/Belianin_4/EnterpriseContracts/BindingModels/SkillBindingModel.cs
new file mode 100644
index 0000000..9dc4854
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/BindingModels/SkillBindingModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseContracts.BindingModels
+{
+ public class SkillBindingModel
+ {
+ public int? Id { get; set; }
+
+ public string Name { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/BusinessLogicContracts/IEmployeeLogic.cs b/Lab 4/Belianin_4/EnterpriseContracts/BusinessLogicContracts/IEmployeeLogic.cs
new file mode 100644
index 0000000..18bc785
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/BusinessLogicContracts/IEmployeeLogic.cs
@@ -0,0 +1,19 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseContracts.BusinessLogicContracts
+{
+ public interface IEmployeeLogic
+ {
+ List Read(EmployeeBindingModel model);
+
+ void CreateOrUpdate(EmployeeBindingModel model);
+
+ void Delete(EmployeeBindingModel model);
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/BusinessLogicContracts/ISkillLogic.cs b/Lab 4/Belianin_4/EnterpriseContracts/BusinessLogicContracts/ISkillLogic.cs
new file mode 100644
index 0000000..52f1e68
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/BusinessLogicContracts/ISkillLogic.cs
@@ -0,0 +1,19 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseContracts.BusinessLogicContracts
+{
+ public interface ISkillLogic
+ {
+ List Read(SkillBindingModel model);
+
+ void CreateOrUpdate(SkillBindingModel model);
+
+ bool Delete(SkillBindingModel model);
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/EnterpriseContracts.csproj b/Lab 4/Belianin_4/EnterpriseContracts/EnterpriseContracts.csproj
new file mode 100644
index 0000000..060aa1c
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/EnterpriseContracts.csproj
@@ -0,0 +1,10 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/StorageContracts/IEmployeeStorage.cs b/Lab 4/Belianin_4/EnterpriseContracts/StorageContracts/IEmployeeStorage.cs
new file mode 100644
index 0000000..70ae523
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/StorageContracts/IEmployeeStorage.cs
@@ -0,0 +1,25 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseContracts.StorageContracts
+{
+ public interface IEmployeeStorage
+ {
+ List GetFullList();
+
+ List GetFilteredList(EmployeeBindingModel model);
+
+ EmployeeViewModel GetElement(EmployeeBindingModel model);
+
+ void Insert(EmployeeBindingModel model);
+
+ void Update(EmployeeBindingModel model);
+
+ void Delete(EmployeeBindingModel model);
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/StorageContracts/ISkillStorage.cs b/Lab 4/Belianin_4/EnterpriseContracts/StorageContracts/ISkillStorage.cs
new file mode 100644
index 0000000..7b116a6
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/StorageContracts/ISkillStorage.cs
@@ -0,0 +1,25 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseContracts.StorageContracts
+{
+ public interface ISkillStorage
+ {
+ List GetFullList();
+
+ List GetFilteredList(SkillBindingModel model);
+
+ SkillViewModel GetElement(SkillBindingModel model);
+
+ void Insert(SkillBindingModel model);
+
+ void Update(SkillBindingModel model);
+
+ bool Delete(SkillBindingModel model);
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/ViewModels/EmployeeViewModel.cs b/Lab 4/Belianin_4/EnterpriseContracts/ViewModels/EmployeeViewModel.cs
new file mode 100644
index 0000000..0f30555
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/ViewModels/EmployeeViewModel.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseContracts.ViewModels
+{
+ public class EmployeeViewModel
+ {
+ public int? Id { get; set; }
+
+ [DisplayName("Навык")]
+ public string Skill { get; set; }
+
+ // [DisplayName("Фото")]
+ public string Photo { get; set; }
+
+ [DisplayName("ФИО")]
+ public string FIO { get; set; }
+
+ [DisplayName("Номер телефона")]
+ public string PhoneNumber { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseContracts/ViewModels/SkillViewModel.cs b/Lab 4/Belianin_4/EnterpriseContracts/ViewModels/SkillViewModel.cs
new file mode 100644
index 0000000..ba7f53e
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseContracts/ViewModels/SkillViewModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseContracts.ViewModels
+{
+ public class SkillViewModel
+ {
+ public int? Id { get; set; }
+
+ public string Name { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseDataBaseImplement/EnterpriseDataBase.cs b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/EnterpriseDataBase.cs
new file mode 100644
index 0000000..3a8a66b
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/EnterpriseDataBase.cs
@@ -0,0 +1,27 @@
+using EnterpriseDataBaseImplement.Models;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseDataBaseImplement
+{
+ public class EnterpriseDataBase : DbContext
+ {
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (optionsBuilder.IsConfigured == false)
+ {
+ optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=EnterpriseDataBase;Integrated Security=True;MultipleActiveResultSets=True; TrustServerCertificate=True");
+ }
+
+ base.OnConfiguring(optionsBuilder);
+ }
+
+ public virtual DbSet Employees { set; get; }
+
+ public virtual DbSet Skills { set; get; }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseDataBaseImplement/EnterpriseDataBaseImplement.csproj b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/EnterpriseDataBaseImplement.csproj
new file mode 100644
index 0000000..12c1e07
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/EnterpriseDataBaseImplement.csproj
@@ -0,0 +1,28 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
diff --git a/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Implements/EmployeeStorage.cs b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Implements/EmployeeStorage.cs
new file mode 100644
index 0000000..eefa798
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Implements/EmployeeStorage.cs
@@ -0,0 +1,136 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.StorageContracts;
+using EnterpriseContracts.ViewModels;
+using EnterpriseDataBaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseDataBaseImplement.Implements
+{
+ public class EmployeeStorage : IEmployeeStorage
+ {
+ // Создание работника
+ private static Employee CreateModel(EmployeeBindingModel model, Employee employee)
+ {
+ employee.FIO = model.FIO;
+ employee.Skill = model.Skill;
+ employee.PhoneNumber = model.PhoneNumber;
+ employee.Photo = model.Photo;
+
+ return employee;
+ }
+
+ private static EmployeeViewModel CreateModel(Employee employee)
+ {
+ return new EmployeeViewModel
+ {
+ Id = employee.Id,
+ FIO = employee.FIO,
+ Photo = employee.Photo,
+ PhoneNumber = employee.PhoneNumber,
+ Skill = employee.Skill
+ };
+ }
+
+ // Добавление работника
+ public void Insert(EmployeeBindingModel model)
+ {
+ var context = new EnterpriseDataBase();
+ var transaction = context.Database.BeginTransaction();
+
+ try
+ {
+ context.Employees.Add(CreateModel(model, new Employee()));
+ context.SaveChanges();
+ transaction.Commit();
+ }
+ catch
+ {
+ transaction.Rollback();
+ throw;
+ }
+ }
+
+ // Обновление данных о работнике
+ public void Update(EmployeeBindingModel model)
+ {
+ var context = new EnterpriseDataBase();
+ var transaction = context.Database.BeginTransaction();
+
+ try
+ {
+ var employee = context.Employees.FirstOrDefault(rec => rec.Id == model.Id);
+
+ if (employee == null)
+ {
+ throw new Exception("Сотрудник не найден");
+ }
+
+ CreateModel(model, employee);
+ context.SaveChanges();
+ transaction.Commit();
+ }
+ catch
+ {
+ transaction.Rollback();
+ throw;
+ }
+ }
+
+ public void Delete(EmployeeBindingModel model)
+ {
+ var context = new EnterpriseDataBase();
+ var employee = context.Employees.FirstOrDefault(rec => rec.Id == model.Id);
+
+ if (employee != null)
+ {
+ context.Employees.Remove(employee);
+ context.SaveChanges();
+ }
+ else
+ {
+ throw new Exception("Сотрудник не найден");
+ }
+ }
+
+ // Получение записи о работнике
+ public EmployeeViewModel GetElement(EmployeeBindingModel model)
+ {
+ // Если пусто
+ if (model == null)
+ {
+ return null;
+ }
+
+ using var context = new EnterpriseDataBase();
+
+ var employee = context.Employees.ToList()
+ .FirstOrDefault(rec => rec.FIO == model.FIO || rec.Id == model.Id);
+
+ return employee != null ? CreateModel(employee) : null;
+ }
+
+ // Получение отфильтрованного списка
+ public List GetFilteredList(EmployeeBindingModel model)
+ {
+ var context = new EnterpriseDataBase();
+
+ return context.Employees
+ .Where(employee => employee.FIO.Contains(model.FIO) && employee.Skill.Contains(model.Skill))
+ .ToList().Select(CreateModel).ToList();
+ }
+
+ // Получение всех записей
+ public List GetFullList()
+ {
+ using (var context = new EnterpriseDataBase())
+ {
+ return context.Employees.ToList()
+ .Select(CreateModel).ToList();
+ }
+ }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Implements/SkillStorage.cs b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Implements/SkillStorage.cs
new file mode 100644
index 0000000..a8d9d7e
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Implements/SkillStorage.cs
@@ -0,0 +1,133 @@
+using EnterpriseContracts.BindingModels;
+using EnterpriseContracts.StorageContracts;
+using EnterpriseContracts.ViewModels;
+using EnterpriseDataBaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseDataBaseImplement.Implements
+{
+ public class SkillStorage : ISkillStorage
+ {
+ // Создание навыка
+ private static Skill CreateModel(SkillBindingModel model, Skill skill)
+ {
+ skill.Name = model.Name;
+ return skill;
+ }
+
+ private static SkillViewModel CreateModel(Skill skill)
+ {
+ return new SkillViewModel
+ {
+ Id = skill.Id,
+ Name = skill.Name
+ };
+ }
+
+ // Добавление навыка
+ public void Insert(SkillBindingModel model)
+ {
+ var context = new EnterpriseDataBase();
+ var transaction = context.Database.BeginTransaction();
+
+ try
+ {
+ context.Skills.Add(CreateModel(model, new Skill()));
+ context.SaveChanges();
+ transaction.Commit();
+ }
+ catch
+ {
+ transaction.Rollback();
+ throw;
+ }
+ }
+
+ // Обновление навыка
+ public void Update(SkillBindingModel model)
+ {
+ var context = new EnterpriseDataBase();
+ var transaction = context.Database.BeginTransaction();
+
+ try
+ {
+ var skill = context.Skills.FirstOrDefault(rec => rec.Id == model.Id);
+
+ // Навык не найден -> исключение
+ if (skill == null)
+ {
+ throw new Exception("Навык не найден :(");
+ }
+
+ CreateModel(model, skill);
+ context.SaveChanges();
+ transaction.Commit();
+ }
+ catch
+ {
+ transaction.Rollback();
+ throw;
+ }
+ }
+
+ // Удаление навыка
+ public bool Delete(SkillBindingModel model)
+ {
+ var context = new EnterpriseDataBase();
+ var skill = context.Skills.FirstOrDefault(rec => rec.Id == model.Id);
+
+ if (skill != null)
+ {
+ context.Skills.Remove(skill);
+ context.SaveChanges();
+ return true;
+ }
+ else
+ {
+ throw new Exception("Навык не найден");
+ }
+ }
+
+ // Получение записи о навыке
+ public SkillViewModel GetElement(SkillBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+
+ using var context = new EnterpriseDataBase();
+
+ var skill = context.Skills.ToList().FirstOrDefault(rec => rec.Id == model.Id || rec.Name == model.Name);
+
+ return skill != null ? CreateModel(skill) : null;
+ }
+
+ // Получение фильтрованного списка
+ public List GetFilteredList(SkillBindingModel model)
+ {
+ // Если пусто
+ if (model == null)
+ {
+ return null;
+ }
+
+ var context = new EnterpriseDataBase();
+
+ return context.Skills.Where(rec => rec.Name.Contains(model.Name))
+ .Select(CreateModel).ToList();
+ }
+
+ // Получение всего списка навыков
+ public List GetFullList()
+ {
+ using var context = new EnterpriseDataBase();
+
+ return context.Skills.Select(CreateModel).ToList();
+ }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Models/Employee.cs b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Models/Employee.cs
new file mode 100644
index 0000000..c186d05
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Models/Employee.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseDataBaseImplement.Models
+{
+ public class Employee
+ {
+ public int Id { get; set; }
+
+ [Required]
+ public string Skill { get; set; }
+
+ [Required]
+ public string Photo { get; set; }
+
+ [Required]
+ public string FIO { get; set; }
+
+ [Required]
+ public string PhoneNumber { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Models/Skill.cs b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Models/Skill.cs
new file mode 100644
index 0000000..1d1b623
--- /dev/null
+++ b/Lab 4/Belianin_4/EnterpriseDataBaseImplement/Models/Skill.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EnterpriseDataBaseImplement.Models
+{
+ public class Skill
+ {
+ public int Id { get; set; }
+
+ [Required]
+ public string Name { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/PluginsConventionLibrary/MainPluginConventionElement.cs b/Lab 4/Belianin_4/PluginsConventionLibrary/MainPluginConventionElement.cs
new file mode 100644
index 0000000..303ae43
--- /dev/null
+++ b/Lab 4/Belianin_4/PluginsConventionLibrary/MainPluginConventionElement.cs
@@ -0,0 +1,20 @@
+using PluginsConventionLibrary.Plugins;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PluginsConventionLibrary
+{
+ public class MainPluginConventionElement : PluginsConventionElement
+ {
+ public string Skill { get; set; }
+
+ public string Photo { get; set; }
+
+ public string FIO { get; set; }
+
+ public string PhoneNumber { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/IPluginsConvention.cs b/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/IPluginsConvention.cs
new file mode 100644
index 0000000..c7b05b5
--- /dev/null
+++ b/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/IPluginsConvention.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PluginsConventionLibrary.Plugins
+{
+ public interface IPluginsConvention
+ {
+ /// Название плагина
+ string PluginName { get; }
+
+ /// Получение контрола для вывода набора данных
+ UserControl GetControl { get; }
+
+ /// Получение элемента, выбранного в контроле
+ PluginsConventionElement GetElement { get; }
+
+ /// Получение формы для создания/редактирования объекта
+ Form GetForm(PluginsConventionElement element);
+
+ /// Получение формы для работы со справочником
+ Form GetThesaurus();
+
+ /// Удаление элемента
+ bool DeleteElement(PluginsConventionElement element);
+
+ /// Обновление набора данных в контроле
+ void ReloadData();
+
+ /// Создание простого документа
+ bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument);
+
+ /// Создание простого документа (таблицы)
+ bool CreateTableDocument(PluginsConventionSaveDocument saveDocument);
+
+ /// Создание простого документа (диаграммы)
+ bool CreateChartDocument(PluginsConventionSaveDocument saveDocument);
+ }
+}
diff --git a/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs b/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs
new file mode 100644
index 0000000..74dce2a
--- /dev/null
+++ b/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PluginsConventionLibrary.Plugins
+{
+ // Класс для передачи объекта на форму и удаления
+ public class PluginsConventionElement
+ {
+ // Глобальный уникальный идентификатор
+ public int Id { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/PluginsConventionSaveDocument.cs b/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/PluginsConventionSaveDocument.cs
new file mode 100644
index 0000000..adfd46d
--- /dev/null
+++ b/Lab 4/Belianin_4/PluginsConventionLibrary/Plugins/PluginsConventionSaveDocument.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PluginsConventionLibrary.Plugins
+{
+ public class PluginsConventionSaveDocument
+ {
+ public string FileName { get; set; }
+ }
+}
diff --git a/Lab 4/Belianin_4/PluginsConventionLibrary/PluginsConventionLibrary.csproj b/Lab 4/Belianin_4/PluginsConventionLibrary/PluginsConventionLibrary.csproj
new file mode 100644
index 0000000..8f221d3
--- /dev/null
+++ b/Lab 4/Belianin_4/PluginsConventionLibrary/PluginsConventionLibrary.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net6.0-windows7.0
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
+