diff --git a/WinFormUchetLab/PluginsApp/FormMain.Designer.cs b/WinFormUchetLab/PluginsApp/FormMain.Designer.cs new file mode 100644 index 0000000..b8e4b8b --- /dev/null +++ b/WinFormUchetLab/PluginsApp/FormMain.Designer.cs @@ -0,0 +1,245 @@ +namespace PluginsApp +{ + 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/WinFormUchetLab/PluginsApp/FormMain.cs b/WinFormUchetLab/PluginsApp/FormMain.cs new file mode 100644 index 0000000..5b8af73 --- /dev/null +++ b/WinFormUchetLab/PluginsApp/FormMain.cs @@ -0,0 +1,249 @@ +using PluginsConventionLibrary; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace PluginsApp +{ + 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 = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory())!.Parent!.Parent!.FullName, "Plugins"); + if (!Directory.Exists(pluginsDir)) + { + MessageBox.Show($"Каталог {pluginsDir} не найден.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return plugins; + } + foreach (string dllFile in Directory.EnumerateFiles(pluginsDir, "*.dll", SearchOption.AllDirectories)) + { + try + { + Assembly assembly = Assembly.LoadFrom(dllFile); + Type[] types = assembly.GetTypes(); + foreach (var type in types) + { + if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract) + { + var plugin = (IPluginsConvention)Activator.CreateInstance(type)!; + plugins.Add(plugin.PluginName, plugin); + CreateToolStripMenuItem(plugin.PluginName); + } + } + } + catch (Exception ex) + { + MessageBox.Show($"Ошибка при загрузке сборки {dllFile}: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + return plugins; + } + private void CreateToolStripMenuItem(string pluginName) + { + var menuItem = new ToolStripMenuItem(pluginName); + menuItem.Click += (object? sender, EventArgs e) => + { + _selectedPlugin = pluginName; + IPluginsConvention plugin = _plugins![pluginName]; + UserControl userControl = plugin?.GetControl ?? throw new Exception("Проблема с загрузкой элемента для вывода данных"); + 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 (string.IsNullOrEmpty(_selectedPlugin) || !_plugins.ContainsKey(_selectedPlugin)) + { + return; + } + 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() + { + using var dialog = new SaveFileDialog + { + Filter = "docx|*.docx" + }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + if (_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName })) + { + MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + catch (Exception ex) + { + MessageBox.Show("Произошла ошибка: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void CreateTableDoc() + { + using var dialog = new SaveFileDialog + { + Filter = "PDF Files|*.pdf" + }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + if (_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName })) + { + MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + catch (Exception ex) + { + MessageBox.Show("Произошла ошибка: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void CreateChartDoc() + { + using var dialog = new SaveFileDialog + { + Filter = "Excel Files|*.xlsx" + }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + if (_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName })) + { + MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + catch (Exception ex) + { + MessageBox.Show("Произошла ошибка: " + ex.Message, "Ошибка", 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/WinFormUchetLab/PluginsApp/FormMain.resx b/WinFormUchetLab/PluginsApp/FormMain.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/WinFormUchetLab/PluginsApp/FormMain.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/WinFormUchetLab/PluginsApp/PluginsApp.csproj b/WinFormUchetLab/PluginsApp/PluginsApp.csproj new file mode 100644 index 0000000..902ed04 --- /dev/null +++ b/WinFormUchetLab/PluginsApp/PluginsApp.csproj @@ -0,0 +1,25 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WinFormUchetLab/PluginsApp/Program.cs b/WinFormUchetLab/PluginsApp/Program.cs new file mode 100644 index 0000000..1d6f10e --- /dev/null +++ b/WinFormUchetLab/PluginsApp/Program.cs @@ -0,0 +1,17 @@ +namespace PluginsApp +{ + 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/WinFormUchetLab/PluginsApp/plugins/Azure.Core.dll b/WinFormUchetLab/PluginsApp/plugins/Azure.Core.dll new file mode 100644 index 0000000..791391b Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Azure.Core.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Azure.Identity.dll b/WinFormUchetLab/PluginsApp/plugins/Azure.Identity.dll new file mode 100644 index 0000000..4a32fd0 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Azure.Identity.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/ComponentsLibraryNet60.dll b/WinFormUchetLab/PluginsApp/plugins/ComponentsLibraryNet60.dll new file mode 100644 index 0000000..9807306 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/ComponentsLibraryNet60.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/ControlsLibraryNet60.dll b/WinFormUchetLab/PluginsApp/plugins/ControlsLibraryNet60.dll new file mode 100644 index 0000000..3d14013 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/ControlsLibraryNet60.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/CustomComponents.dll b/WinFormUchetLab/PluginsApp/plugins/CustomComponents.dll new file mode 100644 index 0000000..79e8191 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/CustomComponents.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/DocumentFormat.OpenXml.dll b/WinFormUchetLab/PluginsApp/plugins/DocumentFormat.OpenXml.dll new file mode 100644 index 0000000..383430c Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/DocumentFormat.OpenXml.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Humanizer.dll b/WinFormUchetLab/PluginsApp/plugins/Humanizer.dll new file mode 100644 index 0000000..c9a7ef8 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Humanizer.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Bcl.AsyncInterfaces.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Bcl.AsyncInterfaces.dll new file mode 100644 index 0000000..a5b7ff9 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Bcl.AsyncInterfaces.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Data.SqlClient.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Data.SqlClient.dll new file mode 100644 index 0000000..087fa83 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Data.SqlClient.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Abstractions.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Abstractions.dll new file mode 100644 index 0000000..60595f4 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Abstractions.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Design.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Design.dll new file mode 100644 index 0000000..931f5b7 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Design.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Relational.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Relational.dll new file mode 100644 index 0000000..fef022a Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.Relational.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.SqlServer.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.SqlServer.dll new file mode 100644 index 0000000..64c8780 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.SqlServer.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.dll new file mode 100644 index 0000000..ecc1aac Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.EntityFrameworkCore.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Caching.Abstractions.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Caching.Abstractions.dll new file mode 100644 index 0000000..be73869 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Caching.Abstractions.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Caching.Memory.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Caching.Memory.dll new file mode 100644 index 0000000..561804a Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Caching.Memory.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Configuration.Abstractions.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Configuration.Abstractions.dll new file mode 100644 index 0000000..3a12ec4 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Configuration.Abstractions.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll new file mode 100644 index 0000000..11e5f2e Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyInjection.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyInjection.dll new file mode 100644 index 0000000..2c64257 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyInjection.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyModel.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyModel.dll new file mode 100644 index 0000000..072af1f Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.DependencyModel.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Logging.Abstractions.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Logging.Abstractions.dll new file mode 100644 index 0000000..03edd8f Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Logging.Abstractions.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Logging.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Logging.dll new file mode 100644 index 0000000..c53f5d2 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Logging.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Options.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Options.dll new file mode 100644 index 0000000..3987d66 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Options.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Primitives.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Primitives.dll new file mode 100644 index 0000000..081abea Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Extensions.Primitives.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.Extensions.Msal.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.Extensions.Msal.dll new file mode 100644 index 0000000..1a2779c Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.Extensions.Msal.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.NativeInterop.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.NativeInterop.dll new file mode 100644 index 0000000..44eb67c Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.NativeInterop.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.dll new file mode 100644 index 0000000..99f06f0 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Identity.Client.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Abstractions.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Abstractions.dll new file mode 100644 index 0000000..422bfb9 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Abstractions.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.JsonWebTokens.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.JsonWebTokens.dll new file mode 100644 index 0000000..fa2330d Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.JsonWebTokens.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Logging.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Logging.dll new file mode 100644 index 0000000..454079e Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Logging.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll new file mode 100644 index 0000000..da3da51 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Protocols.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Protocols.dll new file mode 100644 index 0000000..68bc57c Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Protocols.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Tokens.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Tokens.dll new file mode 100644 index 0000000..7f087c7 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.IdentityModel.Tokens.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.SqlServer.Server.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.SqlServer.Server.dll new file mode 100644 index 0000000..ddeaa86 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.SqlServer.Server.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.Core.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.Core.dll new file mode 100644 index 0000000..3042b42 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.Core.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.WinForms.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.WinForms.dll new file mode 100644 index 0000000..5073df4 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.WinForms.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.Wpf.dll b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.Wpf.dll new file mode 100644 index 0000000..fc6585a Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Microsoft.Web.WebView2.Wpf.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/MigraDoc.DocumentObjectModel.dll b/WinFormUchetLab/PluginsApp/plugins/MigraDoc.DocumentObjectModel.dll new file mode 100644 index 0000000..4334467 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/MigraDoc.DocumentObjectModel.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/MigraDoc.Rendering.dll b/WinFormUchetLab/PluginsApp/plugins/MigraDoc.Rendering.dll new file mode 100644 index 0000000..def985f Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/MigraDoc.Rendering.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/MigraDoc.RtfRendering.dll b/WinFormUchetLab/PluginsApp/plugins/MigraDoc.RtfRendering.dll new file mode 100644 index 0000000..21748d4 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/MigraDoc.RtfRendering.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Mono.TextTemplating.dll b/WinFormUchetLab/PluginsApp/plugins/Mono.TextTemplating.dll new file mode 100644 index 0000000..d5a4b3c Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Mono.TextTemplating.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Non_visual_components_Kouvshinoff.dll b/WinFormUchetLab/PluginsApp/plugins/Non_visual_components_Kouvshinoff.dll new file mode 100644 index 0000000..09b602d Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Non_visual_components_Kouvshinoff.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Charting.dll b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Charting.dll new file mode 100644 index 0000000..5c61b17 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Charting.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Quality.dll b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Quality.dll new file mode 100644 index 0000000..72e514c Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Quality.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Snippets.dll b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Snippets.dll new file mode 100644 index 0000000..266cdad Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.Snippets.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/PdfSharp.System.dll b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.System.dll new file mode 100644 index 0000000..e8dded5 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.System.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/PdfSharp.WPFonts.dll b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.WPFonts.dll new file mode 100644 index 0000000..9a7c2ca Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.WPFonts.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/PdfSharp.dll b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.dll new file mode 100644 index 0000000..61b8fde Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/PdfSharp.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/System.Configuration.ConfigurationManager.dll b/WinFormUchetLab/PluginsApp/plugins/System.Configuration.ConfigurationManager.dll new file mode 100644 index 0000000..14f8ef6 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/System.Configuration.ConfigurationManager.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/System.Diagnostics.DiagnosticSource.dll b/WinFormUchetLab/PluginsApp/plugins/System.Diagnostics.DiagnosticSource.dll new file mode 100644 index 0000000..1e58f62 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/System.Diagnostics.DiagnosticSource.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/System.IdentityModel.Tokens.Jwt.dll b/WinFormUchetLab/PluginsApp/plugins/System.IdentityModel.Tokens.Jwt.dll new file mode 100644 index 0000000..af8fc34 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/System.IdentityModel.Tokens.Jwt.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/System.Memory.Data.dll b/WinFormUchetLab/PluginsApp/plugins/System.Memory.Data.dll new file mode 100644 index 0000000..6f2a3e0 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/System.Memory.Data.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/System.Runtime.Caching.dll b/WinFormUchetLab/PluginsApp/plugins/System.Runtime.Caching.dll new file mode 100644 index 0000000..14826eb Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/System.Runtime.Caching.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/UchetLabBusinessLogic.dll b/WinFormUchetLab/PluginsApp/plugins/UchetLabBusinessLogic.dll new file mode 100644 index 0000000..541d18d Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/UchetLabBusinessLogic.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/UchetLabContracts.dll b/WinFormUchetLab/PluginsApp/plugins/UchetLabContracts.dll new file mode 100644 index 0000000..f01a4b7 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/UchetLabContracts.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/UchetLabDataModels.dll b/WinFormUchetLab/PluginsApp/plugins/UchetLabDataModels.dll new file mode 100644 index 0000000..67a3e2c Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/UchetLabDataModels.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/UchetLabDatabaseImplement.dll b/WinFormUchetLab/PluginsApp/plugins/UchetLabDatabaseImplement.dll new file mode 100644 index 0000000..583e73a Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/UchetLabDatabaseImplement.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/Visual_components_Kouvshinoff.dll b/WinFormUchetLab/PluginsApp/plugins/Visual_components_Kouvshinoff.dll new file mode 100644 index 0000000..0c1d112 Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/Visual_components_Kouvshinoff.dll differ diff --git a/WinFormUchetLab/PluginsApp/plugins/WinFormUchetLab.dll b/WinFormUchetLab/PluginsApp/plugins/WinFormUchetLab.dll new file mode 100644 index 0000000..6f7e99a Binary files /dev/null and b/WinFormUchetLab/PluginsApp/plugins/WinFormUchetLab.dll differ diff --git a/WinFormUchetLab/PluginsConventionLibrary/IPluginsConvention.cs b/WinFormUchetLab/PluginsConventionLibrary/IPluginsConvention.cs new file mode 100644 index 0000000..95a31d7 --- /dev/null +++ b/WinFormUchetLab/PluginsConventionLibrary/IPluginsConvention.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PluginsConventionLibrary +{ + 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/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionElement.cs b/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionElement.cs new file mode 100644 index 0000000..775c74a --- /dev/null +++ b/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionElement.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PluginsConventionLibrary +{ + public class PluginsConventionElement + { + public Guid Id { get; set; } + } +} diff --git a/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionLibrary.csproj b/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionLibrary.csproj new file mode 100644 index 0000000..060aa1c --- /dev/null +++ b/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionLibrary.csproj @@ -0,0 +1,10 @@ + + + + net6.0-windows + enable + true + enable + + + diff --git a/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionSaveDocument.cs b/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionSaveDocument.cs new file mode 100644 index 0000000..f902bc6 --- /dev/null +++ b/WinFormUchetLab/PluginsConventionLibrary/PluginsConventionSaveDocument.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PluginsConventionLibrary +{ + public class PluginsConventionSaveDocument + { + public string FileName { get; set; } + } +} diff --git a/WinFormUchetLab/WinFormUchetLab.sln b/WinFormUchetLab/WinFormUchetLab.sln index 9af638b..2015b98 100644 --- a/WinFormUchetLab/WinFormUchetLab.sln +++ b/WinFormUchetLab/WinFormUchetLab.sln @@ -3,15 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.11.35208.52 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormUchetLab", "WinFormUchetLab\WinFormUchetLab.csproj", "{C8C620EA-CCC9-4031-8753-57647F65440E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormUchetLab", "WinFormUchetLab\WinFormUchetLab.csproj", "{C8C620EA-CCC9-4031-8753-57647F65440E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UchetLabDataModels", "UchetLabDataModels\UchetLabDataModels.csproj", "{AC162555-3770-4CB5-A5DF-7F85135D49B4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UchetLabDataModels", "UchetLabDataModels\UchetLabDataModels.csproj", "{AC162555-3770-4CB5-A5DF-7F85135D49B4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UchetLabContracts", "UchetLabContracts\UchetLabContracts.csproj", "{4DF262DD-81DF-4B26-8978-5334DE8E9F67}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UchetLabContracts", "UchetLabContracts\UchetLabContracts.csproj", "{4DF262DD-81DF-4B26-8978-5334DE8E9F67}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UchetLabBusinessLogic", "UchetLabBusinessLogic\UchetLabBusinessLogic.csproj", "{D7D2300F-78BE-49A4-9733-1A2B52192864}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UchetLabBusinessLogic", "UchetLabBusinessLogic\UchetLabBusinessLogic.csproj", "{D7D2300F-78BE-49A4-9733-1A2B52192864}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UchetLabDatabaseImplement", "UchetLabDatabaseImplement\UchetLabDatabaseImplement.csproj", "{F6CB8BDD-E2B3-4449-B150-7D67FA013611}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UchetLabDatabaseImplement", "UchetLabDatabaseImplement\UchetLabDatabaseImplement.csproj", "{F6CB8BDD-E2B3-4449-B150-7D67FA013611}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsConventionLibrary", "PluginsConventionLibrary\PluginsConventionLibrary.csproj", "{69555F08-B398-4718-B690-361576E8D8BF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsApp", "PluginsApp\PluginsApp.csproj", "{3F9BBC16-BEAD-4D5D-8971-EC69CB313041}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -39,6 +43,14 @@ Global {F6CB8BDD-E2B3-4449-B150-7D67FA013611}.Debug|Any CPU.Build.0 = Debug|Any CPU {F6CB8BDD-E2B3-4449-B150-7D67FA013611}.Release|Any CPU.ActiveCfg = Release|Any CPU {F6CB8BDD-E2B3-4449-B150-7D67FA013611}.Release|Any CPU.Build.0 = Release|Any CPU + {69555F08-B398-4718-B690-361576E8D8BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69555F08-B398-4718-B690-361576E8D8BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69555F08-B398-4718-B690-361576E8D8BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69555F08-B398-4718-B690-361576E8D8BF}.Release|Any CPU.Build.0 = Release|Any CPU + {3F9BBC16-BEAD-4D5D-8971-EC69CB313041}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3F9BBC16-BEAD-4D5D-8971-EC69CB313041}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F9BBC16-BEAD-4D5D-8971-EC69CB313041}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3F9BBC16-BEAD-4D5D-8971-EC69CB313041}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WinFormUchetLab/WinFormUchetLab/PluginsConvention.cs b/WinFormUchetLab/WinFormUchetLab/PluginsConvention.cs new file mode 100644 index 0000000..3cfecb2 --- /dev/null +++ b/WinFormUchetLab/WinFormUchetLab/PluginsConvention.cs @@ -0,0 +1,261 @@ +using ComponentsLibraryNet60.DocumentWithChart; +using ComponentsLibraryNet60.Models; +using ControlsLibraryNet60.Data; +using ControlsLibraryNet60.Models; +using CustomComponents.Helpers; +using CustomComponents.NonVisualComponents; +using DocumentFormat.OpenXml.Spreadsheet; +using Non_visual_components_Kouvshinoff; +using Non_visual_components_Kouvshinoff.InfoModels; +using PluginsConventionLibrary; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UchetLabBusinessLogic.BusinessLogic; +using UchetLabContracts.BindingModels; +using UchetLabContracts.BusinessLogicsContracts; +using UchetLabContracts.ViewModels; +using UchetLabDatabaseImplement.Implements; + +namespace WinFormUchetLab +{ + public class PluginsConvention : IPluginsConvention + { + private readonly ILabLogic _labLogic; + private readonly ICheckerLogic _checkerLogic; + private readonly ControlDataTableRow controlDataTableRow1 = new(); + private readonly CustomComponents.NonVisualComponents.PdfImage _pdfImage = new(); + private readonly Non_visual_components_Kouvshinoff.CustomComponentExcelTableWithHeader _customComponentExcelTableWithHeader = new(); + private readonly ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartPieWord _componentDocumentWithChartPieWord = new(); + public PluginsConvention() + { + _labLogic = new LabLogic(new LabStorage()); + _checkerLogic = new CheckerLogic(new CheckerStorage()); + List columnConfigs = new List + { + new DataTableColumnConfig + { + ColumnHeader = "Идентификатор", + PropertyName = "Id", + Width = 150, + Visible = false + }, + new DataTableColumnConfig + { + ColumnHeader = "Задание", + PropertyName = "LabTask", + Width = 250, + Visible = true + }, + new DataTableColumnConfig + { + ColumnHeader = "Проверяющий", + PropertyName = "Checker", + Width = 200, + Visible = true + }, + new DataTableColumnConfig + { + ColumnHeader = "Дата сдачи", + PropertyName = "CheckDate", + Width = 200, + Visible = true + } + }; + controlDataTableRow1 = new ControlDataTableRow(); + controlDataTableRow1.LoadColumns(columnConfigs); + } + public string PluginName => "LabWork3 Plugin"; + public UserControl GetControl + { + get + { + ReloadData(); + return controlDataTableRow1; + } + } + public PluginsConventionElement GetElement + { + get + { + var order = controlDataTableRow1.GetSelectedObject(); + int id = -1; + if (order != null) + { + id = order.Id; + } + + byte[] bytes = new byte[16]; + BitConverter.GetBytes(id).CopyTo(bytes, 0); + return new PluginsConventionElement { Id = new Guid(bytes) }; + } + } + public Form GetForm(PluginsConventionElement element) + { + if (element == null) + { + return new FormLab(_labLogic, _checkerLogic); + } + + if (element.Id.GetHashCode() >= 0) + { + byte[] bytes = element.Id.ToByteArray(); + int Id = BitConverter.ToInt32(bytes, 0); + + var form = new FormLab(_labLogic, _checkerLogic); + form.Id = Id; + return form; + } + + return null; + } + public Form GetThesaurus() + { + return new FormChecker(_checkerLogic); + } + public bool DeleteElement(PluginsConventionElement element) + { + if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + { + return false; + } + + byte[] bytes = element.Id.ToByteArray(); + int Id = BitConverter.ToInt32(bytes, 0); + + try + { + _labLogic.Delete(new LabBindingModel() { Id = Id }); + ReloadData(); + return true; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + } + public void ReloadData() + { + controlDataTableRow1.Clear(); + try + { + var labs = _labLogic.ReadList(null); + if (labs == null) + { + return; + } + + foreach (var lab in labs) + { + + controlDataTableRow1.AddRow(lab); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + public bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument) + { + + List images = new List(); + var list = _labLogic.ReadList(null); + + try + { + if (list != null) + { + foreach (var item in list) + { + images.Add(item.TaskImage); + } + string[] imagesArray = images.ToArray(); + _pdfImage.CreatePdfDoc(new DataForImage(saveDocument.FileName, "Сканы чеков", imagesArray)); + return true; + } + return false; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка"); + return false; + } + } + public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument) + { + + string title = "Документ с таблицей"; + + var list = _labLogic.ReadList(null); + List header = new List(); + ColumnInfo col1 = new ColumnInfo("Id", 5, "Id"); + ColumnInfo col2 = new ColumnInfo("задание", 20, "LabTask"); + ColumnInfo col3 = new ColumnInfo("проверяющий", 6, "Checker"); + ColumnInfo col4 = new ColumnInfo("дата приёма", 6.5, "CheckDate"); + ColumnInfo colExam = new ColumnInfo("приём", new List { col3, col4 }); + header.Add(col1); + header.Add(col2); + header.Add(colExam); + try + { + _customComponentExcelTableWithHeader.createExcel(saveDocument.FileName, title, + header, list); + return true; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка"); + return false; + } + } + public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument) + { + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); + + var data = new Dictionary>(); + + var labs = _labLogic.ReadList(null); + + var groupedLabs = labs.GroupBy(lab => lab.Checker) + .Select(group => new + { + CheckerName = group.Key, + LabCount = group.Count() + }) + .ToList(); + + data["Проверяющие"] = new List<(int Date, double Value)>(); + + int counter = 1; + foreach (var group in groupedLabs) + { + data["Проверяющие"].Add((counter, group.LabCount)); + counter++; + } + + + + try + { + _componentDocumentWithChartPieWord.CreateDoc(new ComponentDocumentWithChartConfig + { + Header = "Проверки", + FilePath = saveDocument.FileName, + ChartTitle = "Количество лабораторных у проверяющих", + LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom, + Data = data + }); + return true; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка"); + return false; + } + } + } +} diff --git a/WinFormUchetLab/WinFormUchetLab/PluginsConventionLab.cs b/WinFormUchetLab/WinFormUchetLab/PluginsConventionLab.cs new file mode 100644 index 0000000..6de0d6e --- /dev/null +++ b/WinFormUchetLab/WinFormUchetLab/PluginsConventionLab.cs @@ -0,0 +1,17 @@ +using PluginsConventionLibrary; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WinFormUchetLab +{ + public class PluginsConventionLab : PluginsConventionElement + { + public string LabTask { get; set; } = string.Empty; + public string TaskImage { get; set; } = string.Empty; + public string Checker { get; set; } = string.Empty; + public DateTime CheckDate { get; set; } = DateTime.Now; + } +} diff --git a/WinFormUchetLab/WinFormUchetLab/WinFormUchetLab.csproj b/WinFormUchetLab/WinFormUchetLab/WinFormUchetLab.csproj index 4e59619..a803947 100644 --- a/WinFormUchetLab/WinFormUchetLab/WinFormUchetLab.csproj +++ b/WinFormUchetLab/WinFormUchetLab/WinFormUchetLab.csproj @@ -21,6 +21,7 @@ +