From 501b3bb6cf70b32a1e6cbce83e1450db8bd42eee Mon Sep 17 00:00:00 2001 From: bekodeg Date: Mon, 17 Jun 2024 10:16:39 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=BD=D0=BE=20=D0=B4=D0=BE=D0=BB=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D0=BD=D0=BE=20=D0=BD=D0=B5=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/DataGridViewExtension.cs | 46 ++ .../SushiBar/Forms/FormClients.Designer.cs | 24 +- SushiBar/SushiBar/Forms/FormClients.cs | 43 +- SushiBar/SushiBar/Forms/FormComponents.cs | 29 +- SushiBar/SushiBar/Forms/FormCreateOrder.cs | 37 +- SushiBar/SushiBar/Forms/FormImplementer.cs | 3 +- SushiBar/SushiBar/Forms/FormImplementers.cs | 18 +- SushiBar/SushiBar/Forms/FormMailView.cs | 31 +- SushiBar/SushiBar/Forms/FormMain.Designer.cs | 477 +++++++++--------- SushiBar/SushiBar/Forms/FormMain.cs | 413 ++++++++------- SushiBar/SushiBar/Forms/FormSushis.cs | 30 +- .../SushiBar/ImplementationExtensions.dll | Bin 0 -> 6144 bytes .../SushiBar/ImplementationExtensionst.dll | Bin 0 -> 76800 bytes SushiBar/SushiBar/Program.cs | 101 ++-- SushiBar/SushiBar/SushiBar.csproj | 3 - .../BusinessLogics/BackUpLogic.cs | 90 ++++ .../BusinessLogics/ImplementerLogic.cs | 4 +- .../SushiBarBusinessLogic.csproj | 1 + .../Attributes/ColumnAttribute.cs | 22 + .../Attributes/GridViewAutoSize.cs | 14 + .../BindingModels/BackUpSaveBinidngModel.cs | 8 + .../BindingModels/MessageInfoBindingModel.cs | 4 +- .../BusinessLogicsContracts/IBackUpLogic.cs | 9 + .../SushiBarContracts/DI/DependencyManager.cs | 45 ++ .../DI/IDependencyContainer.cs | 12 + .../DI/IImplementationExtension.cs | 9 + .../DI/ServiceDependencyContainer.cs | 57 +++ .../DI/ServiceProviderLoader.cs | 53 ++ .../StoragesContracts/IBackUpInfo.cs | 8 + .../StoragesContracts/IImplementerStorage.cs | 2 +- .../SushiBarContracts.csproj | 5 + .../ViewModels/ClientViewModel.cs | 19 +- .../ViewModels/ComponentViewModel.cs | 15 +- .../ViewModels/ImplementerViewModel.cs | 13 +- .../ViewModels/MessageInfoViewModel.cs | 33 +- .../ViewModels/OrderViewModel.cs | 49 +- .../ViewModels/ReportOrdersViewModel.cs | 8 +- .../ReportProductComponentViewModel.cs | 8 +- .../ViewModels/SushiViewModel.cs | 18 +- .../Models/IMessageInfoModel.cs | 3 +- .../DatabaseImplementationExtension.cs | 21 + .../Implements/BackUpInfo.cs | 27 + .../Implements/ImplementerStorage.cs | 4 +- .../Models/MessageInfo.cs | 4 +- .../Properties/Resources.Designer.cs | 63 +++ .../Properties/Resources.resx | 101 ++++ .../SushiBarDatabaseImplement.csproj | 19 + .../FileImplementationExtension.cs | 21 + .../Implements/BackUpInfo.cs | 38 ++ .../Implements/ClientStorage.cs | 3 +- .../Implements/ImplementerStorage.cs | 4 +- .../Models/MessageInfo.cs | 4 +- .../Implements/BackUpInfo.cs | 17 + .../Implements/ImplementerStorage.cs | 4 +- .../ListImplementationExtension.cs | 22 + .../Models/MessageInfo.cs | 3 +- 56 files changed, 1416 insertions(+), 703 deletions(-) create mode 100644 SushiBar/SushiBar/Extensions/DataGridViewExtension.cs create mode 100644 SushiBar/SushiBar/ImplementationExtensions.dll create mode 100644 SushiBar/SushiBar/ImplementationExtensionst.dll create mode 100644 SushiBar/SushiBarBusinessLogic/BusinessLogics/BackUpLogic.cs create mode 100644 SushiBar/SushiBarContracts/Attributes/ColumnAttribute.cs create mode 100644 SushiBar/SushiBarContracts/Attributes/GridViewAutoSize.cs create mode 100644 SushiBar/SushiBarContracts/BindingModels/BackUpSaveBinidngModel.cs create mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/IBackUpLogic.cs create mode 100644 SushiBar/SushiBarContracts/DI/DependencyManager.cs create mode 100644 SushiBar/SushiBarContracts/DI/IDependencyContainer.cs create mode 100644 SushiBar/SushiBarContracts/DI/IImplementationExtension.cs create mode 100644 SushiBar/SushiBarContracts/DI/ServiceDependencyContainer.cs create mode 100644 SushiBar/SushiBarContracts/DI/ServiceProviderLoader.cs create mode 100644 SushiBar/SushiBarContracts/StoragesContracts/IBackUpInfo.cs create mode 100644 SushiBar/SushiBarDatabaseImplement/DatabaseImplementationExtension.cs create mode 100644 SushiBar/SushiBarDatabaseImplement/Implements/BackUpInfo.cs create mode 100644 SushiBar/SushiBarDatabaseImplement/Properties/Resources.Designer.cs create mode 100644 SushiBar/SushiBarDatabaseImplement/Properties/Resources.resx create mode 100644 SushiBar/SushiBarFileImplement/FileImplementationExtension.cs create mode 100644 SushiBar/SushiBarFileImplement/Implements/BackUpInfo.cs create mode 100644 SushiBar/SushiBarListImplement/Implements/BackUpInfo.cs create mode 100644 SushiBar/SushiBarListImplement/ListImplementationExtension.cs diff --git a/SushiBar/SushiBar/Extensions/DataGridViewExtension.cs b/SushiBar/SushiBar/Extensions/DataGridViewExtension.cs new file mode 100644 index 0000000..8cfc6b0 --- /dev/null +++ b/SushiBar/SushiBar/Extensions/DataGridViewExtension.cs @@ -0,0 +1,46 @@ +using SushiBarContracts.Attributes; + +namespace SushiBar.Extensions +{ + public static class DataGridViewExtension + { + public static void FillandConfigGrid(this DataGridView grid, List? data) + { + if (data == null) + { + return; + } + grid.DataSource = data; + var type = typeof(T); + var properties = type.GetProperties(); + foreach (DataGridViewColumn column in grid.Columns) + { + var property = properties.FirstOrDefault(x => x.Name == column.Name); + if (property == null) + { + throw new InvalidOperationException($"В типе {type.Name} не найдено свойство с именем { column.Name }"); + } + var attribute = property.GetCustomAttributes(typeof(ColumnAttribute), true)?.SingleOrDefault(); + if (attribute == null) + { + throw new InvalidOperationException($"Не найден атрибут типа ColumnAttribute для свойства { property.Name }"); + } + if (attribute is ColumnAttribute columnAttr) + { + column.HeaderText = columnAttr.Title; + column.Visible = columnAttr.Visible; + if (columnAttr.IsUseAutoSize) + { + column.AutoSizeMode = (DataGridViewAutoSizeColumnMode)Enum + .Parse(typeof(DataGridViewAutoSizeColumnMode), + columnAttr.GridViewAutoSize.ToString()); + } + else + { + column.Width = columnAttr.Width; + } + } + } + } + } +} diff --git a/SushiBar/SushiBar/Forms/FormClients.Designer.cs b/SushiBar/SushiBar/Forms/FormClients.Designer.cs index 2cd8cae..1fadac7 100644 --- a/SushiBar/SushiBar/Forms/FormClients.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormClients.Designer.cs @@ -28,19 +28,19 @@ /// private void InitializeComponent() { - DataGridView = new DataGridView(); + dataGridView = new DataGridView(); DeleteButton = new Button(); - ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); // - // DataGridView + // dataGridView // - DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Location = new Point(12, 34); - DataGridView.Name = "DataGridView"; - DataGridView.RowTemplate.Height = 25; - DataGridView.Size = new Size(776, 404); - DataGridView.TabIndex = 0; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(12, 34); + dataGridView.Name = "DataGridView"; + dataGridView.RowTemplate.Height = 25; + dataGridView.Size = new Size(776, 404); + dataGridView.TabIndex = 0; // // DeleteButton // @@ -58,17 +58,17 @@ AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(800, 450); Controls.Add(DeleteButton); - Controls.Add(DataGridView); + Controls.Add(dataGridView); Name = "ClientsForm"; Text = "Клиенты"; Load += ClientsForm_Load; - ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ResumeLayout(false); } #endregion - private DataGridView DataGridView; + private DataGridView dataGridView; private Button DeleteButton; } } \ No newline at end of file diff --git a/SushiBar/SushiBar/Forms/FormClients.cs b/SushiBar/SushiBar/Forms/FormClients.cs index dc6d81a..51fc24d 100644 --- a/SushiBar/SushiBar/Forms/FormClients.cs +++ b/SushiBar/SushiBar/Forms/FormClients.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using SushiBar.Extensions; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; @@ -17,28 +18,22 @@ namespace SushiBar.Forms private void LoadData() { - try - { - var list = _logic.ReadList(null); - if (list != null) - { - DataGridView.DataSource = list; - DataGridView.Columns["Id"].Visible = false; - DataGridView.Columns["ClientFIO"].AutoSizeMode = - DataGridViewAutoSizeColumnMode.Fill; - DataGridView.Columns["Email"].AutoSizeMode = - DataGridViewAutoSizeColumnMode.Fill; - DataGridView.Columns["Password"].AutoSizeMode = - DataGridViewAutoSizeColumnMode.Fill; - } - _logger.LogInformation("Загрузка клиентов"); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки клиентов"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } + try + { + var list = _logic.ReadList(null); + if (list != null) + { + dataGridView.FillandConfigGrid(list); + _logger.LogInformation("Загрузка клиентов"); + } + _logger.LogInformation("Загрузка клиентов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки клиентов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } private void ClientsForm_Load(object sender, EventArgs e) { @@ -47,12 +42,12 @@ namespace SushiBar.Forms private void DeleteButton_Click(object sender, EventArgs e) { - if (DataGridView.SelectedRows.Count == 1) + if (dataGridView.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value); + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); _logger.LogInformation("Удаление клиента"); try { diff --git a/SushiBar/SushiBar/Forms/FormComponents.cs b/SushiBar/SushiBar/Forms/FormComponents.cs index 7943174..749aba9 100644 --- a/SushiBar/SushiBar/Forms/FormComponents.cs +++ b/SushiBar/SushiBar/Forms/FormComponents.cs @@ -1,6 +1,7 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using Microsoft.Extensions.Logging; +using SushiBar.Extensions; namespace SushiBar.Forms { @@ -20,23 +21,17 @@ namespace SushiBar.Forms } private void LoadData() { - try - { - var list = _logic.ReadList(null); - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["Id"].Visible = false; - dataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - } - _logger.LogInformation("Загрузка компонентов"); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки компонентов"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } + try + { + dataGridView.FillandConfigGrid(_logic.ReadList(null)); + _logger.LogInformation("Загрузка компонентов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки компонентов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } private void ButtonAdd_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormComponent)); diff --git a/SushiBar/SushiBar/Forms/FormCreateOrder.cs b/SushiBar/SushiBar/Forms/FormCreateOrder.cs index b447051..8624895 100644 --- a/SushiBar/SushiBar/Forms/FormCreateOrder.cs +++ b/SushiBar/SushiBar/Forms/FormCreateOrder.cs @@ -20,24 +20,25 @@ namespace SushiBar.Forms } private void FormCreateOrder_Load(object sender, EventArgs e) { - try - { - _logger.LogInformation("Загрузка суши для заказа"); - List? _list = _logicS.ReadList(null); - if (_list != null) - { - ComboBoxSushi.DisplayMember = "SushiName"; - ComboBoxSushi.ValueMember = "Id"; - ComboBoxSushi.DataSource = _list; - ComboBoxSushi.SelectedItem = null; - } - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки суши"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } + _logger.LogInformation("Загрузка суши для заказа"); + try + { + var list = _logicS.ReadList(null); + if (list != null) + { + ComboBoxSushi.DisplayMember = "SushiCreamName"; + ComboBoxSushi.ValueMember = "Id"; + ComboBoxSushi.DataSource = list; + ComboBoxSushi.SelectedItem = null; + } + _logger.LogInformation("Суши загружено"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки суши"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } private void CalcSum() { if (ComboBoxSushi.SelectedValue != null && !string.IsNullOrEmpty(TextBoxCount.Text)) diff --git a/SushiBar/SushiBar/Forms/FormImplementer.cs b/SushiBar/SushiBar/Forms/FormImplementer.cs index f359f4a..959744a 100644 --- a/SushiBar/SushiBar/Forms/FormImplementer.cs +++ b/SushiBar/SushiBar/Forms/FormImplementer.cs @@ -40,8 +40,7 @@ namespace SushiBar.Forms catch (Exception ex) { _logger.LogError(ex, "Ошибка получения исполнителя"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, - MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } diff --git a/SushiBar/SushiBar/Forms/FormImplementers.cs b/SushiBar/SushiBar/Forms/FormImplementers.cs index db4c42e..8b75f8b 100644 --- a/SushiBar/SushiBar/Forms/FormImplementers.cs +++ b/SushiBar/SushiBar/Forms/FormImplementers.cs @@ -1,6 +1,8 @@ using Microsoft.Extensions.Logging; +using SushiBar.Extensions; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; +using System.Windows.Forms; namespace SushiBar.Forms { @@ -24,23 +26,13 @@ namespace SushiBar.Forms { try { - var list = _logic.ReadList(null); - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["Id"].Visible = false; - dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView.Columns["Password"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView.Columns["Qualification"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView.Columns["WorkExperience"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - } - _logger.LogInformation("Загрузка компонентов"); + dataGridView.FillandConfigGrid(_logic.ReadList(null)); + _logger.LogInformation("Загрузка исполнителей"); } catch (Exception ex) { _logger.LogError(ex, "Ошибка загрузки исполнителей"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, - MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void CreateButton_Click(object sender, EventArgs e) diff --git a/SushiBar/SushiBar/Forms/FormMailView.cs b/SushiBar/SushiBar/Forms/FormMailView.cs index 112d5b6..d2f27d1 100644 --- a/SushiBar/SushiBar/Forms/FormMailView.cs +++ b/SushiBar/SushiBar/Forms/FormMailView.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using SushiBar.Extensions; using SushiBarContracts.BusinessLogicsContracts; namespace SushiBar.Forms @@ -16,24 +17,16 @@ namespace SushiBar.Forms private void FormMailView_Load(object sender, EventArgs e) { - try - { - var list = _logic.ReadList(null); - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["ClientId"].Visible = false; - dataGridView.Columns["MessageId"].Visible = false; - dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - } - _logger.LogInformation("Загрузка списка писем"); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки писем"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, - MessageBoxIcon.Error); - } - } + try + { + dataGridView.FillandConfigGrid(_logic.ReadList(null)); + _logger.LogInformation("Загрузка списка писем"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки писем"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } } } diff --git a/SushiBar/SushiBar/Forms/FormMain.Designer.cs b/SushiBar/SushiBar/Forms/FormMain.Designer.cs index 83a9518..b5574a5 100644 --- a/SushiBar/SushiBar/Forms/FormMain.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormMain.Designer.cs @@ -20,242 +20,250 @@ base.Dispose(disposing); } - #region Windows Form Designer generated code + #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - dataGridView = new DataGridView(); - menuStrip1 = new MenuStrip(); - toolStripMenuItem = new ToolStripMenuItem(); - sushiToolStripMenuItem = new ToolStripMenuItem(); - componentsToolStripMenuItem = new ToolStripMenuItem(); - clientsToolStripMenuItem = new ToolStripMenuItem(); - implementersToolStripMenuItem = new ToolStripMenuItem(); - отчётыToolStripMenuItem1 = new ToolStripMenuItem(); - sushisReportToolStripMenuItem = new ToolStripMenuItem(); - componentsReportПоСушиToolStripMenuItem = new ToolStripMenuItem(); - orderReportToolStripMenuItem = new ToolStripMenuItem(); - startWorksToolStripMenuItem = new ToolStripMenuItem(); - отчётыToolStripMenuItem = new ToolStripMenuItem(); - sushisToolStripMenuItem = new ToolStripMenuItem(); - componentSushisToolStripMenuItem = new ToolStripMenuItem(); - ordersToolStripMenuItem = new ToolStripMenuItem(); - buttonCreateOrder = new Button(); - buttonTakeOrderInWork = new Button(); - buttonOrderReady = new Button(); - buttonIssuedOrder = new Button(); - buttonRef = new Button(); - MailToolStripMenuItem = new ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - menuStrip1.SuspendLayout(); - SuspendLayout(); - // - // dataGridView - // - dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(0, 28); - dataGridView.Name = "dataGridView"; - dataGridView.RowHeadersWidth = 51; - dataGridView.RowTemplate.Height = 29; - dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dataGridView.Size = new Size(986, 514); - dataGridView.TabIndex = 0; - // - // menuStrip1 - // - menuStrip1.ImageScalingSize = new Size(20, 20); - menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчётыToolStripMenuItem1, startWorksToolStripMenuItem, MailToolStripMenuItem }); - menuStrip1.Location = new Point(0, 0); - menuStrip1.Name = "menuStrip1"; - menuStrip1.Size = new Size(1184, 28); - menuStrip1.TabIndex = 1; - menuStrip1.Text = "menuStrip1"; - // - // toolStripMenuItem - // - toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sushiToolStripMenuItem, componentsToolStripMenuItem, clientsToolStripMenuItem, implementersToolStripMenuItem }); - toolStripMenuItem.Name = "toolStripMenuItem"; - toolStripMenuItem.Size = new Size(117, 24); - toolStripMenuItem.Text = "Справочники"; - // - // sushiToolStripMenuItem - // - sushiToolStripMenuItem.Name = "sushiToolStripMenuItem"; - sushiToolStripMenuItem.Size = new Size(185, 26); - sushiToolStripMenuItem.Text = "Суши"; - sushiToolStripMenuItem.Click += SushiToolStripMenuItem_Click; - // - // componentsToolStripMenuItem - // - componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; - componentsToolStripMenuItem.Size = new Size(185, 26); - componentsToolStripMenuItem.Text = "Компоненты"; - componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; - // - // clientsToolStripMenuItem - // - clientsToolStripMenuItem.Name = "clientsToolStripMenuItem"; - clientsToolStripMenuItem.Size = new Size(185, 26); - clientsToolStripMenuItem.Text = "Клиенты"; - clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click; - // - // implementersToolStripMenuItem - // - implementersToolStripMenuItem.Name = "implementersToolStripMenuItem"; - implementersToolStripMenuItem.Size = new Size(185, 26); - implementersToolStripMenuItem.Text = "Исполнители"; - implementersToolStripMenuItem.Click += implementersToolStripMenuItem_Click; - // - // отчётыToolStripMenuItem1 - // - отчётыToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { sushisReportToolStripMenuItem, componentsReportПоСушиToolStripMenuItem, orderReportToolStripMenuItem }); - отчётыToolStripMenuItem1.Name = "отчётыToolStripMenuItem1"; - отчётыToolStripMenuItem1.Size = new Size(73, 24); - отчётыToolStripMenuItem1.Text = "Отчёты"; - // - // sushisReportToolStripMenuItem - // - sushisReportToolStripMenuItem.Name = "sushisReportToolStripMenuItem"; - sushisReportToolStripMenuItem.Size = new Size(243, 26); - sushisReportToolStripMenuItem.Text = "Список суши"; - sushisReportToolStripMenuItem.Click += sushisReportToolStripMenuItem_Click; - // - // componentsReportПоСушиToolStripMenuItem - // - componentsReportПоСушиToolStripMenuItem.Name = "componentsReportПоСушиToolStripMenuItem"; - componentsReportПоСушиToolStripMenuItem.Size = new Size(243, 26); - componentsReportПоСушиToolStripMenuItem.Text = "Компоненты по суши"; - componentsReportПоСушиToolStripMenuItem.Click += componentsReportПоСушиToolStripMenuItem_Click; - // - // orderReportToolStripMenuItem - // - orderReportToolStripMenuItem.Name = "orderReportToolStripMenuItem"; - orderReportToolStripMenuItem.Size = new Size(243, 26); - orderReportToolStripMenuItem.Text = "Список заказов"; - orderReportToolStripMenuItem.Click += orderReportToolStripMenuItem_Click; - // - // startWorksToolStripMenuItem - // - startWorksToolStripMenuItem.Name = "startWorksToolStripMenuItem"; - startWorksToolStripMenuItem.Size = new Size(114, 24); - startWorksToolStripMenuItem.Text = "Запуск работ"; - startWorksToolStripMenuItem.Click += startWorksToolStripMenuItem_Click; - // - // отчётыToolStripMenuItem - // - отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; - отчётыToolStripMenuItem.Size = new Size(32, 19); - // - // sushisToolStripMenuItem - // - sushisToolStripMenuItem.Name = "sushisToolStripMenuItem"; - sushisToolStripMenuItem.Size = new Size(32, 19); - // - // componentSushisToolStripMenuItem - // - componentSushisToolStripMenuItem.Name = "componentSushisToolStripMenuItem"; - componentSushisToolStripMenuItem.Size = new Size(32, 19); - // - // ordersToolStripMenuItem - // - ordersToolStripMenuItem.Name = "ordersToolStripMenuItem"; - ordersToolStripMenuItem.Size = new Size(32, 19); - // - // buttonCreateOrder - // - buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonCreateOrder.Location = new Point(992, 28); - buttonCreateOrder.Name = "buttonCreateOrder"; - buttonCreateOrder.Size = new Size(180, 30); - buttonCreateOrder.TabIndex = 8; - buttonCreateOrder.Text = "Создать заказ"; - buttonCreateOrder.UseVisualStyleBackColor = true; - buttonCreateOrder.Click += ButtonCreateOrder_Click; - // - // buttonTakeOrderInWork - // - buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonTakeOrderInWork.Location = new Point(992, 64); - buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; - buttonTakeOrderInWork.Size = new Size(180, 30); - buttonTakeOrderInWork.TabIndex = 9; - buttonTakeOrderInWork.Text = "Отдать на выполнение"; - buttonTakeOrderInWork.UseVisualStyleBackColor = true; - buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click; - // - // buttonOrderReady - // - buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonOrderReady.Location = new Point(992, 100); - buttonOrderReady.Name = "buttonOrderReady"; - buttonOrderReady.Size = new Size(180, 30); - buttonOrderReady.TabIndex = 10; - buttonOrderReady.Text = "Заказ готов"; - buttonOrderReady.UseVisualStyleBackColor = true; - buttonOrderReady.Click += ButtonOrderReady_Click; - // - // buttonIssuedOrder - // - buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonIssuedOrder.Location = new Point(992, 136); - buttonIssuedOrder.Name = "buttonIssuedOrder"; - buttonIssuedOrder.Size = new Size(180, 30); - buttonIssuedOrder.TabIndex = 11; - buttonIssuedOrder.Text = "Заказ Выдан"; - buttonIssuedOrder.UseVisualStyleBackColor = true; - buttonIssuedOrder.Click += ButtonIssuedOrder_Click; - // - // buttonRef - // - buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonRef.Location = new Point(992, 172); - buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(180, 30); - buttonRef.TabIndex = 12; - buttonRef.Text = "Обновить список"; - buttonRef.UseVisualStyleBackColor = true; - buttonRef.Click += ButtonRef_Click; - // - // MailToolStripMenuItem - // - MailToolStripMenuItem.Name = "MailToolStripMenuItem"; - MailToolStripMenuItem.Size = new Size(65, 24); - MailToolStripMenuItem.Text = "Почта"; - MailToolStripMenuItem.Click += MailToolStripMenuItem_Click; - // - // FormMain - // - AllowDrop = true; - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1184, 554); - Controls.Add(buttonRef); - Controls.Add(buttonIssuedOrder); - Controls.Add(buttonOrderReady); - Controls.Add(buttonTakeOrderInWork); - Controls.Add(buttonCreateOrder); - Controls.Add(dataGridView); - Controls.Add(menuStrip1); - MainMenuStrip = menuStrip1; - Name = "FormMain"; - Text = "Сушибар"; - WindowState = FormWindowState.Maximized; - Load += FormMain_Load; - ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); - menuStrip1.ResumeLayout(false); - menuStrip1.PerformLayout(); - ResumeLayout(false); - PerformLayout(); - } + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + menuStrip1 = new MenuStrip(); + toolStripMenuItem = new ToolStripMenuItem(); + sushiToolStripMenuItem = new ToolStripMenuItem(); + componentsToolStripMenuItem = new ToolStripMenuItem(); + clientsToolStripMenuItem = new ToolStripMenuItem(); + implementersToolStripMenuItem = new ToolStripMenuItem(); + отчётыToolStripMenuItem1 = new ToolStripMenuItem(); + sushisReportToolStripMenuItem = new ToolStripMenuItem(); + componentsReportПоСушиToolStripMenuItem = new ToolStripMenuItem(); + orderReportToolStripMenuItem = new ToolStripMenuItem(); + startWorksToolStripMenuItem = new ToolStripMenuItem(); + MailToolStripMenuItem = new ToolStripMenuItem(); + отчётыToolStripMenuItem = new ToolStripMenuItem(); + sushisToolStripMenuItem = new ToolStripMenuItem(); + componentSushisToolStripMenuItem = new ToolStripMenuItem(); + ordersToolStripMenuItem = new ToolStripMenuItem(); + buttonCreateOrder = new Button(); + buttonTakeOrderInWork = new Button(); + buttonOrderReady = new Button(); + buttonIssuedOrder = new Button(); + buttonRef = new Button(); + backupToolStripMenuItem = new ToolStripMenuItem(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + menuStrip1.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(0, 28); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(986, 514); + dataGridView.TabIndex = 0; + // + // menuStrip1 + // + menuStrip1.ImageScalingSize = new Size(20, 20); + menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчётыToolStripMenuItem1, startWorksToolStripMenuItem, MailToolStripMenuItem, backupToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(1184, 28); + menuStrip1.TabIndex = 1; + menuStrip1.Text = "menuStrip1"; + // + // toolStripMenuItem + // + toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sushiToolStripMenuItem, componentsToolStripMenuItem, clientsToolStripMenuItem, implementersToolStripMenuItem }); + toolStripMenuItem.Name = "toolStripMenuItem"; + toolStripMenuItem.Size = new Size(117, 24); + toolStripMenuItem.Text = "Справочники"; + // + // sushiToolStripMenuItem + // + sushiToolStripMenuItem.Name = "sushiToolStripMenuItem"; + sushiToolStripMenuItem.Size = new Size(185, 26); + sushiToolStripMenuItem.Text = "Суши"; + sushiToolStripMenuItem.Click += SushiToolStripMenuItem_Click; + // + // componentsToolStripMenuItem + // + componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; + componentsToolStripMenuItem.Size = new Size(185, 26); + componentsToolStripMenuItem.Text = "Компоненты"; + componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; + // + // clientsToolStripMenuItem + // + clientsToolStripMenuItem.Name = "clientsToolStripMenuItem"; + clientsToolStripMenuItem.Size = new Size(185, 26); + clientsToolStripMenuItem.Text = "Клиенты"; + clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click; + // + // implementersToolStripMenuItem + // + implementersToolStripMenuItem.Name = "implementersToolStripMenuItem"; + implementersToolStripMenuItem.Size = new Size(185, 26); + implementersToolStripMenuItem.Text = "Исполнители"; + implementersToolStripMenuItem.Click += implementersToolStripMenuItem_Click; + // + // отчётыToolStripMenuItem1 + // + отчётыToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { sushisReportToolStripMenuItem, componentsReportПоСушиToolStripMenuItem, orderReportToolStripMenuItem }); + отчётыToolStripMenuItem1.Name = "отчётыToolStripMenuItem1"; + отчётыToolStripMenuItem1.Size = new Size(73, 24); + отчётыToolStripMenuItem1.Text = "Отчёты"; + // + // sushisReportToolStripMenuItem + // + sushisReportToolStripMenuItem.Name = "sushisReportToolStripMenuItem"; + sushisReportToolStripMenuItem.Size = new Size(243, 26); + sushisReportToolStripMenuItem.Text = "Список суши"; + sushisReportToolStripMenuItem.Click += sushisReportToolStripMenuItem_Click; + // + // componentsReportПоСушиToolStripMenuItem + // + componentsReportПоСушиToolStripMenuItem.Name = "componentsReportПоСушиToolStripMenuItem"; + componentsReportПоСушиToolStripMenuItem.Size = new Size(243, 26); + componentsReportПоСушиToolStripMenuItem.Text = "Компоненты по суши"; + componentsReportПоСушиToolStripMenuItem.Click += componentsReportПоСушиToolStripMenuItem_Click; + // + // orderReportToolStripMenuItem + // + orderReportToolStripMenuItem.Name = "orderReportToolStripMenuItem"; + orderReportToolStripMenuItem.Size = new Size(243, 26); + orderReportToolStripMenuItem.Text = "Список заказов"; + orderReportToolStripMenuItem.Click += orderReportToolStripMenuItem_Click; + // + // startWorksToolStripMenuItem + // + startWorksToolStripMenuItem.Name = "startWorksToolStripMenuItem"; + startWorksToolStripMenuItem.Size = new Size(114, 24); + startWorksToolStripMenuItem.Text = "Запуск работ"; + startWorksToolStripMenuItem.Click += startWorksToolStripMenuItem_Click; + // + // MailToolStripMenuItem + // + MailToolStripMenuItem.Name = "MailToolStripMenuItem"; + MailToolStripMenuItem.Size = new Size(65, 24); + MailToolStripMenuItem.Text = "Почта"; + MailToolStripMenuItem.Click += MailToolStripMenuItem_Click; + // + // отчётыToolStripMenuItem + // + отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; + отчётыToolStripMenuItem.Size = new Size(32, 19); + // + // sushisToolStripMenuItem + // + sushisToolStripMenuItem.Name = "sushisToolStripMenuItem"; + sushisToolStripMenuItem.Size = new Size(32, 19); + // + // componentSushisToolStripMenuItem + // + componentSushisToolStripMenuItem.Name = "componentSushisToolStripMenuItem"; + componentSushisToolStripMenuItem.Size = new Size(32, 19); + // + // ordersToolStripMenuItem + // + ordersToolStripMenuItem.Name = "ordersToolStripMenuItem"; + ordersToolStripMenuItem.Size = new Size(32, 19); + // + // buttonCreateOrder + // + buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonCreateOrder.Location = new Point(992, 28); + buttonCreateOrder.Name = "buttonCreateOrder"; + buttonCreateOrder.Size = new Size(180, 30); + buttonCreateOrder.TabIndex = 8; + buttonCreateOrder.Text = "Создать заказ"; + buttonCreateOrder.UseVisualStyleBackColor = true; + buttonCreateOrder.Click += ButtonCreateOrder_Click; + // + // buttonTakeOrderInWork + // + buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonTakeOrderInWork.Location = new Point(992, 64); + buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; + buttonTakeOrderInWork.Size = new Size(180, 30); + buttonTakeOrderInWork.TabIndex = 9; + buttonTakeOrderInWork.Text = "Отдать на выполнение"; + buttonTakeOrderInWork.UseVisualStyleBackColor = true; + buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click; + // + // buttonOrderReady + // + buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonOrderReady.Location = new Point(992, 100); + buttonOrderReady.Name = "buttonOrderReady"; + buttonOrderReady.Size = new Size(180, 30); + buttonOrderReady.TabIndex = 10; + buttonOrderReady.Text = "Заказ готов"; + buttonOrderReady.UseVisualStyleBackColor = true; + buttonOrderReady.Click += ButtonOrderReady_Click; + // + // buttonIssuedOrder + // + buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonIssuedOrder.Location = new Point(992, 136); + buttonIssuedOrder.Name = "buttonIssuedOrder"; + buttonIssuedOrder.Size = new Size(180, 30); + buttonIssuedOrder.TabIndex = 11; + buttonIssuedOrder.Text = "Заказ Выдан"; + buttonIssuedOrder.UseVisualStyleBackColor = true; + buttonIssuedOrder.Click += ButtonIssuedOrder_Click; + // + // buttonRef + // + buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right; + buttonRef.Location = new Point(992, 172); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(180, 30); + buttonRef.TabIndex = 12; + buttonRef.Text = "Обновить список"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += ButtonRef_Click; + // + // backupToolStripMenuItem + // + backupToolStripMenuItem.Name = "backupToolStripMenuItem"; + backupToolStripMenuItem.Size = new Size(123, 24); + backupToolStripMenuItem.Text = "Создать бекап"; + backupToolStripMenuItem.Click += backupToolStripMenuItem_Click; + // + // FormMain + // + AllowDrop = true; + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1184, 554); + Controls.Add(buttonRef); + Controls.Add(buttonIssuedOrder); + Controls.Add(buttonOrderReady); + Controls.Add(buttonTakeOrderInWork); + Controls.Add(buttonCreateOrder); + Controls.Add(dataGridView); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; + Name = "FormMain"; + Text = "Сушибар"; + WindowState = FormWindowState.Maximized; + Load += FormMain_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } - #endregion + #endregion - private DataGridView dataGridView; + private DataGridView dataGridView; private MenuStrip menuStrip1; private Button buttonCreateOrder; private Button buttonTakeOrderInWork; @@ -277,5 +285,6 @@ private ToolStripMenuItem implementersToolStripMenuItem; private ToolStripMenuItem startWorksToolStripMenuItem; private ToolStripMenuItem MailToolStripMenuItem; - } + private ToolStripMenuItem backupToolStripMenuItem; + } } \ No newline at end of file diff --git a/SushiBar/SushiBar/Forms/FormMain.cs b/SushiBar/SushiBar/Forms/FormMain.cs index 5b1b4e7..4686ddc 100644 --- a/SushiBar/SushiBar/Forms/FormMain.cs +++ b/SushiBar/SushiBar/Forms/FormMain.cs @@ -1,208 +1,235 @@ using Microsoft.Extensions.Logging; +using SushiBar.Extensions; +using SushiBarBusinessLogic.BusinessLogic; using SushiBarBusinessLogic.BusinessLogics; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; namespace SushiBar.Forms { - public partial class FormMain : Form - { - private readonly ILogger _logger; - private readonly IOrderLogic _orderLogic; - private readonly IReportLogic _reportLogic; - private readonly IWorkProcess _workProcess; - public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess) - { - InitializeComponent(); - _logger = logger; - _orderLogic = orderLogic; - _reportLogic = reportLogic; - _workProcess = workProcess; - } - private void FormMain_Load(object sender, EventArgs e) - { - LoadData(); - } - private void LoadData() - { - try - { - var list = _orderLogic.ReadList(null); - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["SushiId"].Visible = false; - dataGridView.Columns["ClientId"].Visible = false; - dataGridView.Columns["ImplementerId"].Visible = false; - dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - } - _logger.LogInformation("Загрузка заказов"); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки суши"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); - if (service is FormComponents form) - { - form.ShowDialog(); - } - } - private void SushiToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormSushis)); - if (service is FormSushis form) - { - form.ShowDialog(); - } - } - private void ButtonCreateOrder_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); - if (service is FormCreateOrder form) - { - form.ShowDialog(); - LoadData(); - } - } - private void ButtonTakeOrderInWork_Click(object sender, EventArgs e) - { - if (dataGridView.SelectedRows.Count == 1) - { - int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); - try - { - var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id }); - if (!operationResult) - { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); - } - LoadData(); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка передачи заказа в работу"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - private void ButtonOrderReady_Click(object sender, EventArgs e) - { - if (dataGridView.SelectedRows.Count == 1) - { - int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id); - try - { - var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id }); - if (!operationResult) - { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); - } - LoadData(); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка отметки о готовности заказа"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - private void ButtonIssuedOrder_Click(object sender, EventArgs e) - { - if (dataGridView.SelectedRows.Count == 1) - { - int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id); - try - { - var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id }); - if (!operationResult) - { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); - } - _logger.LogInformation("Заказ №{id} выдан", id); - LoadData(); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - private void ButtonRef_Click(object sender, EventArgs e) - { - LoadData(); - } + public partial class FormMain : Form + { + private readonly ILogger _logger; + private readonly IOrderLogic _orderLogic; + private readonly IReportLogic _reportLogic; + private readonly IWorkProcess _workProcess; + private readonly IBackUpLogic _backUpLogic; - private void sushisReportToolStripMenuItem_Click(object sender, EventArgs e) - { - using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; - if (dialog.ShowDialog() == DialogResult.OK) - { - _reportLogic.SaveSushisToWordFile(new ReportBindingModel - { - FileName = dialog.FileName - }); - MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - private void componentsReportПоСушиToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiComponents)); - if (service is FormReportSushiComponents form) - { - form.ShowDialog(); - } - } + public FormMain(ILogger logger, + IOrderLogic orderLogic, + IReportLogic reportLogic, + IWorkProcess workProcess, + IBackUpLogic backUpLogic + ) + { + InitializeComponent(); + _logger = logger; + _orderLogic = orderLogic; + _reportLogic = reportLogic; + _workProcess = workProcess; + _backUpLogic = backUpLogic; + } + private void FormMain_Load(object sender, EventArgs e) + { + LoadData(); + } + private void LoadData() + { + _logger.LogInformation("Загрузка заказов"); + try + { + dataGridView.FillandConfigGrid(_orderLogic.ReadList(null)); + _logger.LogInformation("Загрузка заказов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки заказов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); + if (service is FormComponents form) + { + form.ShowDialog(); + } + } + private void SushiToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormSushis)); + if (service is FormSushis form) + { + form.ShowDialog(); + } + } + private void ButtonCreateOrder_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); + if (service is FormCreateOrder form) + { + form.ShowDialog(); + LoadData(); + } + } + private void ButtonTakeOrderInWork_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); + try + { + var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка передачи заказа в работу"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void ButtonOrderReady_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id); + try + { + var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка отметки о готовности заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void ButtonIssuedOrder_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id); + try + { + var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + _logger.LogInformation("Заказ №{id} выдан", id); + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + private void ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } - private void orderReportToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); - if (service is FormReportOrders form) - { - form.ShowDialog(); - } - } + private void sushisReportToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveSushisToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } - private void clientsToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormClients)); - if (service is FormClients form) - { - form.ShowDialog(); - } - } + private void componentsReportПоСушиToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiComponents)); + if (service is FormReportSushiComponents form) + { + form.ShowDialog(); + } + } - private void implementersToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormImplementers)); - if (service is FormImplementers form) - { - form.ShowDialog(); - } - } + private void orderReportToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + } + } - private void startWorksToolStripMenuItem_Click(object sender, EventArgs e) - { - _workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic); - MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); - } + private void clientsToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormClients)); + if (service is FormClients form) + { + form.ShowDialog(); + } + } - private void MailToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormMailView)); - if (service is FormMailView form) - { - form.ShowDialog(); - } - } - } + private void implementersToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormImplementers)); + if (service is FormImplementers form) + { + form.ShowDialog(); + } + } + + private void startWorksToolStripMenuItem_Click(object sender, EventArgs e) + { + _workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic); + MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void MailToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormMailView)); + if (service is FormMailView form) + { + form.ShowDialog(); + } + } + + private void backupToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (_backUpLogic != null) + { + var fbd = new FolderBrowserDialog(); + if (fbd.ShowDialog() == DialogResult.OK) + { + _backUpLogic.CreateBackUp(new BackUpSaveBinidngModel + { + FolderName = fbd.SelectedPath + }); + MessageBox.Show("Бекап создан", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } } diff --git a/SushiBar/SushiBar/Forms/FormSushis.cs b/SushiBar/SushiBar/Forms/FormSushis.cs index caefccd..8b92ef8 100644 --- a/SushiBar/SushiBar/Forms/FormSushis.cs +++ b/SushiBar/SushiBar/Forms/FormSushis.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using SushiBar.Extensions; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; @@ -20,24 +21,17 @@ namespace SushiBar.Forms } private void LoadData() { - try - { - var list = _logic.ReadList(null); - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["Id"].Visible = false; - dataGridView.Columns["SushiComponents"].Visible = false; - dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - } - _logger.LogInformation("Загрузка суши"); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки суши"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } + try + { + dataGridView.FillandConfigGrid(_logic.ReadList(null)); + _logger.LogInformation("Загрузка суши"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки суши"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } private void ButtonAdd_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormSushi)); diff --git a/SushiBar/SushiBar/ImplementationExtensions.dll b/SushiBar/SushiBar/ImplementationExtensions.dll new file mode 100644 index 0000000000000000000000000000000000000000..a5c8c73e004546c4996cd7ee607ea251a7f547db GIT binary patch literal 6144 zcmeHLdyHIV6+ibe+vzU5blWa1ebAw$vbJ=XWgm2rmVL}FjC3FEY_}BFw0CCiPH(w$ z@8sS)ZP#EeEn*DHQ;i6Mm_Q5~($LlxNm0>YHKMbK1|NSwgaqOP6Qc%WsK4{wJ2Q8> z6_Ni;{C4l}p4WH2bI$je`DWzidr2W870=nTM5plP)+g}2;Skg~T0SUOg)b9%hFx$&~V_4p9c7D=JMs>hzF zjP@$6jx|XMq6LsN_|liI#5;zk4-ac%K-rI*1suO#l_aiWQHb??Q;h@v5V6#NY#KJMuUJn*kv2!Kw+7Q_usv>4Iu zxZ^rma3Z!o5S-{jJfYTy=;MxV+A!o;X*VABbrGIW>mwQnv4VV>>x#y)$rPc_$B5o+ zCX!hA0orQ09laZAT_zypC7)}9yR{c74}Stq)peUI3S|zDnALR%GX2p3DTsjc+1C|M z#5)t69lab-giPSISQl#!5`7)-LAfd4Z7ZRakx+_8h^77+{Ndqy==f^p?_HGO)bL#?bzTlbyu1RozWCyUkP;h4hu1#>S1>8!K5YA`R z4eC}{#t`Fgluf|r<$h{t7^fsn9{QVlJ+LXlxK!Y)Lh^gyc#LzpbLj)33OlRZR^;MT zxk+$`s~qe6_CoW1nhJ3P*e*5QHAbTF=jrU|7_occKj;Y~TGDUb_??{W109A>C_r zasGh9UiPX-s+JA382e>0&BxP-r%BKcV6U_i&*jCyM*1*t0d)xM71%E@C2*_2odPvr z1I+;2$PjcCtMf9PyNlr^N=qpYTtS_{7;S`R8TQv&9G^Er(?n;0i)a?Ooc;`4L+=3B zW0%CyXAJlex*0e~dEkvgo(2xmEwCFz4sjY1-m*fH6_PAv=^;rM@*_fiM97ao{=D?K zkbj?6(_7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Ny9Cg+6*7DQSK3g#S)1Y&Ru@Ecu5oy zMBw|+cTab2?C8vD8xskwTkq<~^iFs5 z^kg^U>LAe_xAKiIiO?&@H$@C0-enBulW$nSI1deJp+p_pSn_+g4cawx~1^l@y zY5?j-88J6OanCLX_jItrZV}#>W)^H)>_C^2)Ct^>DPC@Sz7(h znJth1>BeupwIh9k#~Qq5YP*XQeQLj9{@s^w=8pAo>wA?j!TIS)vNva!aABG zXFLAw;HEyJ13a}sJD_xdnxr)C0uIqOP$~S8q0{Qy@A|V`SrPvGy1)-_ zdtMvimINcgt40p|82CLvhfj;9$rfgp@f8%m);O@RaFaFh_F!j&^V?DN6*!d;lLspU z^89%`9TzqUs{D0P1~h-`UWC4b@K>Os7-I$*Y2b9>K20Tzx(9v-Aa!t`jl|=R7@t44!E9VJY3o)9Z zOy1A9ab#rTk6Sxt3WouF<%K7%P!abt&M1$1@b6tQJd=WE zFXQmbbuOWnUML&FY`?#GIgDF_MD>2ot!Ay3>rvAl#N0)_;;rF^F^wmKTL(Ygg73ur zvjaDfEG##Q6~%Tsda+e6dUT+75A-;B(Kd>??8p4MuqwdDL?vUWUHz=q;^4Xc04?VK T#`SV#!+ii3|L^j@TY-N8Q@&4@ literal 0 HcmV?d00001 diff --git a/SushiBar/SushiBar/ImplementationExtensionst.dll b/SushiBar/SushiBar/ImplementationExtensionst.dll new file mode 100644 index 0000000000000000000000000000000000000000..d9be8058ff350cd7b32251f49d4336d6da16b03c GIT binary patch literal 76800 zcmeFa34B!L)jxjjo#bXR*;hgWBq5m?2}VE^qlkon5Cs9j1x3k_j2I2MFcXj%z);kR zV%_(pEG~6vE7iJG+k)cu)+JVJYi$*ZuWz->Yg_xa`m^-+J?DAu+&h^`2x|YI-|zox zbk057bDr~@=RC`O?ww)Inb(kyh*I$R=Rb*_z?J`|3LG5tLY!UxgKT;<{guimjM=YL zEtzd|6@R2MK)wp{8rlPy*BjFAkitH=FXNkd>1ifjVVuCK7s&v>llTzu9 zJBW5~C2~r(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)PbO5A5o>cX33o1EKcaBv@Q3$%VKlKuLOw>m z&50H-K!23<1;i#?0ZtLejPSrX0>U{$#5Ve2iO~)3Mb{B8dK{AxOyMuO-xFV _serviceProvider; @@ -28,12 +27,11 @@ namespace SushiBar // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); var services = new ServiceCollection(); - ConfigureServices(services); - _serviceProvider = services.BuildServiceProvider(); + InitDependency(); - try + try { - var mailSender = _serviceProvider.GetService(); + var mailSender = DependencyManager.Instance.Resolve(); mailSender?.MailConfig(new MailConfigBindingModel { MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty, @@ -48,54 +46,53 @@ namespace SushiBar } catch (Exception ex) { - var logger = _serviceProvider.GetService(); - logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé"); + var logger = DependencyManager.Instance.Resolve(); + logger?.LogError(ex, "Ошибка при ходе в почту"); } - Application.Run(_serviceProvider.GetRequiredService()); - } - private static void ConfigureServices(ServiceCollection services) - { - services.AddLogging(option => - { - option.SetMinimumLevel(LogLevel.Information); - option.AddNLog("nlog.config"); - }); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + Application.Run(DependencyManager.Instance.Resolve()); + } - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddSingleton(); - services.AddTransient(); + private static void InitDependency() + { + DependencyManager.InitDependency(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + DependencyManager.Instance.AddLogging(option => + { + option.SetMinimumLevel(LogLevel.Information); + option.AddNLog("nlog.config"); + }); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddSingleton(); - } + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } private static void MailCheck(object obj) => ServiceProvider?.GetService()?.MailCheck(); } diff --git a/SushiBar/SushiBar/SushiBar.csproj b/SushiBar/SushiBar/SushiBar.csproj index dfe9d68..62d3b8d 100644 --- a/SushiBar/SushiBar/SushiBar.csproj +++ b/SushiBar/SushiBar/SushiBar.csproj @@ -23,9 +23,6 @@ - - - diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/BackUpLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/BackUpLogic.cs new file mode 100644 index 0000000..3dd51bc --- /dev/null +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/BackUpLogic.cs @@ -0,0 +1,90 @@ +using Microsoft.Extensions.Logging; +using SushiBarContracts.BindingModels; +using SushiBarContracts.BusinessLogicsContracts; +using SushiBarContracts.StoragesContracts; +using SushiBarDataModels; +using System.IO.Compression; +using System.Reflection; +using System.Runtime.Serialization.Json; + +namespace SushiBarBusinessLogic.BusinessLogic +{ + public class BackUpLogic : IBackUpLogic + { + private readonly ILogger _logger; + private readonly IBackUpInfo _backUpInfo; + public BackUpLogic(ILogger logger, IBackUpInfo backUpInfo) + { + _logger = logger; + _backUpInfo = backUpInfo; + } + public void CreateBackUp(BackUpSaveBinidngModel model) + { + if (_backUpInfo == null) + { + return; + } + try + { + _logger.LogDebug("Clear folder"); + var dirInfo = new DirectoryInfo(model.FolderName); + if (dirInfo.Exists) + { + foreach (var file in dirInfo.GetFiles()) + { + file.Delete(); + } + } + _logger.LogDebug("Delete archive"); + string fileName = $"{model.FolderName}.zip"; + if (File.Exists(fileName)) + { + File.Delete(fileName); + } + _logger.LogDebug("Get assembly"); + var typeIId = typeof(IId); + var assembly = typeIId.Assembly; + if (assembly == null) + { + throw new ArgumentNullException("Сборка не найдена", nameof(assembly)); + } + var types = assembly.GetTypes(); + var method = GetType().GetMethod("SaveToFile", BindingFlags.NonPublic | BindingFlags.Instance); + _logger.LogDebug("Find {count} types", types.Length); + foreach (var type in types) + { + if (type.IsInterface && type.GetInterface(typeIId.Name) != null) + { + var modelType = _backUpInfo.GetTypeByModelInterface(type.Name); + if (modelType == null) + { + throw new InvalidOperationException($"Не найден класс - модель для { type.Name }"); + } + _logger.LogDebug("Call SaveToFile method for {name} type", type.Name); + method?.MakeGenericMethod(modelType).Invoke(this, new object[] { model.FolderName }); + } + } + _logger.LogDebug("Create zip and remove folder"); + ZipFile.CreateFromDirectory(model.FolderName, fileName); + dirInfo.Delete(true); + } + catch (Exception) + { + throw; + } + } + private void SaveToFile(string folderName) where T : class, new() + { + var records = _backUpInfo.GetList(); + if (records == null) + { + _logger.LogWarning("{type} type get null list", typeof(T).Name); + return; + } + var jsonFormatter = new DataContractJsonSerializer(typeof(List)); + using var fs = new FileStream(string.Format("{0}/{1}.json", folderName, typeof(T).Name), FileMode.OpenOrCreate); + jsonFormatter.WriteObject(fs, records); + } + + } +} diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/ImplementerLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/ImplementerLogic.cs index 0fae2b2..3d09b6a 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/ImplementerLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/ImplementerLogic.cs @@ -1,8 +1,8 @@ -using IceCreamShopContracts.StoragesContracts; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; using SushiBarContracts.ViewModels; namespace SushiBarBusinessLogic.BusinessLogics diff --git a/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj b/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj index 5639c84..7017c98 100644 --- a/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj +++ b/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj @@ -16,6 +16,7 @@ + diff --git a/SushiBar/SushiBarContracts/Attributes/ColumnAttribute.cs b/SushiBar/SushiBarContracts/Attributes/ColumnAttribute.cs new file mode 100644 index 0000000..d6a1576 --- /dev/null +++ b/SushiBar/SushiBarContracts/Attributes/ColumnAttribute.cs @@ -0,0 +1,22 @@ +namespace SushiBarContracts.Attributes +{ + [AttributeUsage(AttributeTargets.Property)] + public class ColumnAttribute : Attribute + { + public ColumnAttribute(string title = "", bool visible = true, int width = 0, + GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false) + { + Title = title; + Visible = visible; + Width = width; + GridViewAutoSize = gridViewAutoSize; + IsUseAutoSize = isUseAutoSize; + } + public string Title { get; private set; } + public bool Visible { get; private set; } + public int Width { get; private set; } + public GridViewAutoSize GridViewAutoSize { get; private set; } + public bool IsUseAutoSize { get; private set; } + + } +} diff --git a/SushiBar/SushiBarContracts/Attributes/GridViewAutoSize.cs b/SushiBar/SushiBarContracts/Attributes/GridViewAutoSize.cs new file mode 100644 index 0000000..9fa1721 --- /dev/null +++ b/SushiBar/SushiBarContracts/Attributes/GridViewAutoSize.cs @@ -0,0 +1,14 @@ +namespace SushiBarContracts.Attributes +{ + public enum GridViewAutoSize + { + NotSet = 0, + None = 1, + ColumnHeader = 2, + AllCellsExceptHeader = 4, + AllCells = 6, + DisplayedCellsExceptHeader = 8, + DisplayedCells = 10, + Fill = 16 + } +} diff --git a/SushiBar/SushiBarContracts/BindingModels/BackUpSaveBinidngModel.cs b/SushiBar/SushiBarContracts/BindingModels/BackUpSaveBinidngModel.cs new file mode 100644 index 0000000..f0ca175 --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/BackUpSaveBinidngModel.cs @@ -0,0 +1,8 @@ +namespace SushiBarContracts.BindingModels +{ + public class BackUpSaveBinidngModel + { + public string FolderName { get; set; } = string.Empty; + } + +} diff --git a/SushiBar/SushiBarContracts/BindingModels/MessageInfoBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/MessageInfoBindingModel.cs index 6db61aa..b1ed58f 100644 --- a/SushiBar/SushiBarContracts/BindingModels/MessageInfoBindingModel.cs +++ b/SushiBar/SushiBarContracts/BindingModels/MessageInfoBindingModel.cs @@ -15,5 +15,7 @@ namespace SushiBarContracts.BindingModels public string Body { get; set; } = string.Empty; public DateTime DateDelivery { get; set; } - } + + public int Id => throw new NotImplementedException(); + } } diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/IBackUpLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IBackUpLogic.cs new file mode 100644 index 0000000..bd17b76 --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IBackUpLogic.cs @@ -0,0 +1,9 @@ +using SushiBarContracts.BindingModels; + +namespace SushiBarContracts.BusinessLogicsContracts +{ + public interface IBackUpLogic + { + void CreateBackUp(BackUpSaveBinidngModel model); + } +} diff --git a/SushiBar/SushiBarContracts/DI/DependencyManager.cs b/SushiBar/SushiBarContracts/DI/DependencyManager.cs new file mode 100644 index 0000000..e15165a --- /dev/null +++ b/SushiBar/SushiBarContracts/DI/DependencyManager.cs @@ -0,0 +1,45 @@ +using Microsoft.Extensions.Logging; + +namespace SushiBarContracts.DI +{ + public class DependencyManager + { + private readonly IDependencyContainer _dependencyManager; + private static DependencyManager? _manager; + private static readonly object _locjObject = new(); + private DependencyManager() + { + _dependencyManager = new ServiceDependencyContainer(); + } + public static DependencyManager Instance + { + get + { + if (_manager == null) { + lock (_locjObject) + { + _manager = new DependencyManager(); + } + } + return _manager; + } + } + public static void InitDependency() + { + var ext = ServiceProviderLoader.GetImplementationExtensions(); + if (ext == null) + { + throw new ArgumentNullException("Отсутствуют компонент для загрузки зависимостей по модулям"); + } + ext.RegisterServices(); + } + public void AddLogging(Action configure) => + _dependencyManager.AddLogging(configure); + public void RegisterType(bool isSingle = false) where U : + class, T where T : class => + _dependencyManager.RegisterType(isSingle); + public void RegisterType(bool isSingle = false) where T : class => + _dependencyManager.RegisterType(isSingle); + public T Resolve() => _dependencyManager.Resolve(); + } +} diff --git a/SushiBar/SushiBarContracts/DI/IDependencyContainer.cs b/SushiBar/SushiBarContracts/DI/IDependencyContainer.cs new file mode 100644 index 0000000..f00efbe --- /dev/null +++ b/SushiBar/SushiBarContracts/DI/IDependencyContainer.cs @@ -0,0 +1,12 @@ +using Microsoft.Extensions.Logging; + +namespace SushiBarContracts.DI +{ + public interface IDependencyContainer + { + void AddLogging(Action configure); + void RegisterType(bool isSingle) where U : class, T where T : class; + void RegisterType(bool isSingle) where T : class; + T Resolve(); + } +} diff --git a/SushiBar/SushiBarContracts/DI/IImplementationExtension.cs b/SushiBar/SushiBarContracts/DI/IImplementationExtension.cs new file mode 100644 index 0000000..4f2d798 --- /dev/null +++ b/SushiBar/SushiBarContracts/DI/IImplementationExtension.cs @@ -0,0 +1,9 @@ +namespace SushiBarContracts.DI +{ + public interface IImplementationExtension + { + public int Priority { get; } + public void RegisterServices(); + + } +} diff --git a/SushiBar/SushiBarContracts/DI/ServiceDependencyContainer.cs b/SushiBar/SushiBarContracts/DI/ServiceDependencyContainer.cs new file mode 100644 index 0000000..f2af4f7 --- /dev/null +++ b/SushiBar/SushiBarContracts/DI/ServiceDependencyContainer.cs @@ -0,0 +1,57 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace SushiBarContracts.DI +{ + public class ServiceDependencyContainer : IDependencyContainer + { + private ServiceProvider? _serviceProvider; + + private readonly ServiceCollection _serviceCollection; + + public ServiceDependencyContainer() + { + _serviceCollection = new ServiceCollection(); + } + + public void AddLogging(Action configure) + { + _serviceCollection.AddLogging(configure); + } + + public void RegisterType(bool isSingle) where T : class + { + if (isSingle) + { + _serviceCollection.AddSingleton(); + } + else + { + _serviceCollection.AddTransient(); + } + _serviceProvider = null; + } + + public void RegisterType(bool isSingle) where U : class, T where T : class + { + if (isSingle) + { + _serviceCollection.AddSingleton(); + } + else + { + _serviceCollection.AddTransient(); + } + _serviceProvider = null; + } + public T Resolve() + { + if (_serviceProvider == null) + { + _serviceProvider = _serviceCollection.BuildServiceProvider(); + } + return _serviceProvider.GetService()!; + } + + } +} diff --git a/SushiBar/SushiBarContracts/DI/ServiceProviderLoader.cs b/SushiBar/SushiBarContracts/DI/ServiceProviderLoader.cs new file mode 100644 index 0000000..a4e2763 --- /dev/null +++ b/SushiBar/SushiBarContracts/DI/ServiceProviderLoader.cs @@ -0,0 +1,53 @@ +using System.Reflection; + +namespace SushiBarContracts.DI +{ + public static partial class ServiceProviderLoader + { + public static IImplementationExtension? GetImplementationExtensions() + { + IImplementationExtension? source = null; + var files = Directory + .GetFiles( + TryGetImplementationExtensionsFolder(), + "*.dll", + SearchOption.AllDirectories + ); + foreach (var file in files.Distinct()) + { + Assembly asm = Assembly.LoadFrom(file); + foreach (var t in asm.GetExportedTypes()) + { + if (t.IsClass && + typeof(IImplementationExtension).IsAssignableFrom(t)) + { + if (source == null) + { + source = (IImplementationExtension)Activator.CreateInstance(t)!; + } + else + { + var newSource = (IImplementationExtension)Activator.CreateInstance(t)!; + if (newSource.Priority > source.Priority) + { + source = newSource; + } + } + } + } + } + return source; + } + private static string TryGetImplementationExtensionsFolder() + { + var directory = new DirectoryInfo(Directory.GetCurrentDirectory()); + while (directory != null && !directory.GetDirectories("ImplementationExtensions", + SearchOption.AllDirectories).Any(x => x.Name == "ImplementationExtensions")) + { + directory = directory.Parent; + } + return $"{directory?.FullName}\\ImplementationExtensions"; + } + } + +} diff --git a/SushiBar/SushiBarContracts/StoragesContracts/IBackUpInfo.cs b/SushiBar/SushiBarContracts/StoragesContracts/IBackUpInfo.cs new file mode 100644 index 0000000..7cbedd5 --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/IBackUpInfo.cs @@ -0,0 +1,8 @@ +namespace SushiBarContracts.StoragesContracts +{ + public interface IBackUpInfo + { + List? GetList() where T : class, new(); + Type? GetTypeByModelInterface(string modelInterfaceName); + } +} diff --git a/SushiBar/SushiBarContracts/StoragesContracts/IImplementerStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IImplementerStorage.cs index 3b112b3..fb23fc6 100644 --- a/SushiBar/SushiBarContracts/StoragesContracts/IImplementerStorage.cs +++ b/SushiBar/SushiBarContracts/StoragesContracts/IImplementerStorage.cs @@ -2,7 +2,7 @@ using SushiBarContracts.SearchModels; using SushiBarContracts.ViewModels; -namespace IceCreamShopContracts.StoragesContracts +namespace SushiBarContracts.StoragesContracts { public interface IImplementerStorage { diff --git a/SushiBar/SushiBarContracts/SushiBarContracts.csproj b/SushiBar/SushiBarContracts/SushiBarContracts.csproj index ef52534..fba228a 100644 --- a/SushiBar/SushiBarContracts/SushiBarContracts.csproj +++ b/SushiBar/SushiBarContracts/SushiBarContracts.csproj @@ -4,8 +4,13 @@ net6.0 enable enable + \bin + + + + diff --git a/SushiBar/SushiBarContracts/ViewModels/ClientViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ClientViewModel.cs index d4ab405..da48bb6 100644 --- a/SushiBar/SushiBarContracts/ViewModels/ClientViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/ClientViewModel.cs @@ -1,16 +1,17 @@ -using System.ComponentModel; +using SushiBarContracts.Attributes; +using SushiBarDataModels.Models; namespace SushiBarContracts.ViewModels { - public class ClientViewModel + public class ClientViewModel : IClientModel { - public int Id { get; set; } - [DisplayName("ФИО клиента")] - public string ClientFIO { get; set; } = string.Empty; - [DisplayName("Логин (эл. почта)")] - public string Email { get; set; } = string.Empty; - [DisplayName("Пароль")] - public string Password { get; set; } = string.Empty; + [Column(visible: false)] + public int Id { get; set; } + public string ClientFIO { get; set; } = string.Empty; + [Column(title: "Email клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string Email { get; set; } = string.Empty; + [Column(title: "Пароль", width: 150)] + public string Password { get; set; } = string.Empty; } } diff --git a/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs index f879afc..69fb28a 100644 --- a/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs @@ -1,14 +1,15 @@ -using SushiBarDataModels.Models; -using System.ComponentModel; +using SushiBarContracts.Attributes; +using SushiBarDataModels.Models; namespace SushiBarContracts.ViewModels { public class ComponentViewModel : IComponentModel { - public int Id { get; set; } - [DisplayName("Название компонента")] - public string ComponentName { get; set; } = string.Empty; - [DisplayName("Цена")] - public double Cost { get; set; } + [Column(visible: false)] + public int Id { get; set; } + [Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string ComponentName { get; set; } = string.Empty; + [Column(title: "Цена", width: 80)] + public double Cost { get; set; } } } diff --git a/SushiBar/SushiBarContracts/ViewModels/ImplementerViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ImplementerViewModel.cs index 8dc68c4..b1c6c13 100644 --- a/SushiBar/SushiBarContracts/ViewModels/ImplementerViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/ImplementerViewModel.cs @@ -1,18 +1,19 @@ -using SushiBarDataModels.Models; -using System.ComponentModel; +using SushiBarContracts.Attributes; +using SushiBarDataModels.Models; namespace SushiBarContracts.ViewModels { public class ImplementerViewModel : IImplementerModel { + [Column(visible: false)] public int Id { get; set; } - [DisplayName("ФИО исполнителя")] + [Column(title: "ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string ImplementerFIO { get; set; } = string.Empty; - [DisplayName("Стаж работы")] + [Column(title: "Стаж работы", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] public int WorkExperience { get; set; } = 0; - [DisplayName("Квалификация")] + [Column(title: "Квалификация", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] public int Qualification { get; set; } = 0; - [DisplayName("Пароль")] + [Column(title: "Пароль", width: 150)] public string Password { get; set; } = string.Empty; } } diff --git a/SushiBar/SushiBarContracts/ViewModels/MessageInfoViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/MessageInfoViewModel.cs index d1cb3cb..7c2b854 100644 --- a/SushiBar/SushiBarContracts/ViewModels/MessageInfoViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/MessageInfoViewModel.cs @@ -1,24 +1,27 @@ -using SushiBarDataModels.Models; -using System.ComponentModel; +using SushiBarContracts.Attributes; +using SushiBarDataModels.Models; namespace SushiBarContracts.ViewModels { - public class MessageInfoViewModel : IMessageInfoModel + public class MessageInfoViewModel : IMessageInfoModel { - public string MessageId { get; set; } = string.Empty; + [Column(visible: false)] + public string MessageId { get; set; } = string.Empty; + [Column(visible: false)] + public int? ClientId { get; set; } - public int? ClientId { get; set; } + [Column(title: "Отправитель", gridViewAutoSize: GridViewAutoSize.DisplayedCells, isUseAutoSize: true)] + public string SenderName { get; set; } = string.Empty; - [DisplayName("Отправитель")] - public string SenderName { get; set; } = string.Empty; + [Column(title: "Дата письма", width: 100)] + public DateTime DateDelivery { get; set; } - [DisplayName("Дата письма")] - public DateTime DateDelivery { get; set; } + [Column(title: "Заголовок", width: 150)] + public string Subject { get; set; } = string.Empty; - [DisplayName("Заголовок")] - public string Subject { get; set; } = string.Empty; - - [DisplayName("Текст")] - public string Body { get; set; } = string.Empty; - } + [Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string Body { get; set; } = string.Empty; + [Column(visible: false)] + public int Id => throw new NotImplementedException(); + } } diff --git a/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs index 6c3fc54..f6bafa4 100644 --- a/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs @@ -1,31 +1,34 @@ -using SushiBarDataModels.Enums; +using SushiBarContracts.Attributes; +using SushiBarDataModels.Enums; using SushiBarDataModels.Models; -using System.ComponentModel; namespace SushiBarContracts.ViewModels { public class OrderViewModel : IOrderModel { - [DisplayName("Номер")] - public int Id { get; set; } - public int SushiId { get; set; } - public int ClientId { get; set; } - public int? ImplementerId { get; set; } - [DisplayName("Клиент")] - public string ClientFIO { get; set; } = string.Empty; - [DisplayName("Суши")] - public string SushiName { get; set; } = string.Empty; - [DisplayName("Исполнитель")] - public string ImplementerName { get; set;} = string.Empty; - [DisplayName("Количество")] - public int Count { get; set; } - [DisplayName("Сумма")] - public double Sum { get; set; } - [DisplayName("Статус")] - public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; - [DisplayName("Дата создания")] - public DateTime DateCreate { get; set; } = DateTime.Now; - [DisplayName("Дата выполнения")] - public DateTime? DateImplement { get; set; } + [Column(title: "Номер", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] + public int Id { get; set; } + [Column(visible: false)] + public int SushiId { get; set; } + [Column(visible: false)] + public int ClientId { get; set; } + [Column(visible: false)] + public int? ImplementerId { get; set; } + [Column(title: "ФИО клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string ClientFIO { get; set; } = string.Empty; + [Column(title: "Суши", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] + public string SushiName { get; set; } = string.Empty; + [Column(title: "ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string ImplementerName { get; set;} = string.Empty; + [Column(title: "Количество", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] + public int Count { get; set; } + [Column(title: "Сумма", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] + public double Sum { get; set; } + [Column(title: "Статус", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + [Column(title: "Дата создания", width: 100)] + public DateTime DateCreate { get; set; } = DateTime.Now; + [Column(title: "Дата выполнения", width: 100)] + public DateTime? DateImplement { get; set; } } } diff --git a/SushiBar/SushiBarContracts/ViewModels/ReportOrdersViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ReportOrdersViewModel.cs index dfb4ded..3d43be1 100644 --- a/SushiBar/SushiBarContracts/ViewModels/ReportOrdersViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/ReportOrdersViewModel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SushiBarContracts.ViewModels +namespace SushiBarContracts.ViewModels { public class ReportOrdersViewModel { diff --git a/SushiBar/SushiBarContracts/ViewModels/ReportProductComponentViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ReportProductComponentViewModel.cs index 63ce68a..730ee42 100644 --- a/SushiBar/SushiBarContracts/ViewModels/ReportProductComponentViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/ReportProductComponentViewModel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SushiBarContracts.ViewModels +namespace SushiBarContracts.ViewModels { public class ReportSushiComponentViewModel { diff --git a/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs index 73b3ae8..037996b 100644 --- a/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs @@ -1,16 +1,18 @@ -using SushiBarDataModels.Models; -using System.ComponentModel; +using SushiBarContracts.Attributes; +using SushiBarDataModels.Models; namespace SushiBarContracts.ViewModels { public class SushiViewModel : ISushiModel { - public int Id { get; set; } - [DisplayName("Название суши")] - public string SushiName { get; set; } = string.Empty; - [DisplayName("Цена")] - public double Price { get; set; } - public Dictionary SushiComponents + [Column(visible: false)] + public int Id { get; set; } + [Column(title: "Название Суши", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string SushiName { get; set; } = string.Empty; + [Column(title: "Цена", width: 100)] + public double Price { get; set; } + [Column(visible: false)] + public Dictionary SushiComponents { get; set; diff --git a/SushiBar/SushiBarDataModels/Models/IMessageInfoModel.cs b/SushiBar/SushiBarDataModels/Models/IMessageInfoModel.cs index 626ae17..8468874 100644 --- a/SushiBar/SushiBarDataModels/Models/IMessageInfoModel.cs +++ b/SushiBar/SushiBarDataModels/Models/IMessageInfoModel.cs @@ -1,6 +1,6 @@ namespace SushiBarDataModels.Models { - public interface IMessageInfoModel + public interface IMessageInfoModel : IId { string MessageId { get; } int? ClientId { get; } @@ -8,6 +8,5 @@ DateTime DateDelivery { get; } string Subject { get; } string Body { get; } - } } diff --git a/SushiBar/SushiBarDatabaseImplement/DatabaseImplementationExtension.cs b/SushiBar/SushiBarDatabaseImplement/DatabaseImplementationExtension.cs new file mode 100644 index 0000000..b3a9a1f --- /dev/null +++ b/SushiBar/SushiBarDatabaseImplement/DatabaseImplementationExtension.cs @@ -0,0 +1,21 @@ +using SushiBarContracts.DI; +using SushiBarContracts.StoragesContracts; +using SushiBarDatabaseImplement.Implements; + +namespace SushiBarDatabaseImplement +{ + public class DatabaseImplementationExtension : IImplementationExtension + { + public int Priority => 2; + public void RegisterServices() + { + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } + } +} diff --git a/SushiBar/SushiBarDatabaseImplement/Implements/BackUpInfo.cs b/SushiBar/SushiBarDatabaseImplement/Implements/BackUpInfo.cs new file mode 100644 index 0000000..712ae1e --- /dev/null +++ b/SushiBar/SushiBarDatabaseImplement/Implements/BackUpInfo.cs @@ -0,0 +1,27 @@ +using SushiBarContracts.StoragesContracts; + +namespace SushiBarDatabaseImplement.Implements +{ + public class BackUpInfo : IBackUpInfo + { + public List? GetList() where T : class, new() + { + using var context = new SushiBarDatabase(); + return context.Set().ToList(); + } + public Type? GetTypeByModelInterface(string modelInterfaceName) + { + var assembly = typeof(BackUpInfo).Assembly; + var types = assembly.GetTypes(); + foreach (var type in types) + { + if (type.IsClass && + type.GetInterface(modelInterfaceName) != null) + { + return type; + } + } + return null; + } + } +} diff --git a/SushiBar/SushiBarDatabaseImplement/Implements/ImplementerStorage.cs b/SushiBar/SushiBarDatabaseImplement/Implements/ImplementerStorage.cs index 4918d1a..aca63f2 100644 --- a/SushiBar/SushiBarDatabaseImplement/Implements/ImplementerStorage.cs +++ b/SushiBar/SushiBarDatabaseImplement/Implements/ImplementerStorage.cs @@ -1,6 +1,6 @@ -using IceCreamShopContracts.StoragesContracts; -using SushiBarContracts.BindingModels; +using SushiBarContracts.BindingModels; using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; using SushiBarContracts.ViewModels; using SushiBarDatabaseImplement.Models; diff --git a/SushiBar/SushiBarDatabaseImplement/Models/MessageInfo.cs b/SushiBar/SushiBarDatabaseImplement/Models/MessageInfo.cs index 5109a4a..db851df 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/MessageInfo.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/MessageInfo.cs @@ -46,5 +46,7 @@ namespace SushiBarDatabaseImplement.Models SenderName = SenderName, DateDelivery = DateDelivery, }; - } + + public int Id => throw new NotImplementedException(); + } } diff --git a/SushiBar/SushiBarDatabaseImplement/Properties/Resources.Designer.cs b/SushiBar/SushiBarDatabaseImplement/Properties/Resources.Designer.cs new file mode 100644 index 0000000..daab7e1 --- /dev/null +++ b/SushiBar/SushiBarDatabaseImplement/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace SushiBarDatabaseImplement.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SushiBarDatabaseImplement.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/SushiBar/SushiBarDatabaseImplement/Properties/Resources.resx b/SushiBar/SushiBarDatabaseImplement/Properties/Resources.resx new file mode 100644 index 0000000..4fdb1b6 --- /dev/null +++ b/SushiBar/SushiBarDatabaseImplement/Properties/Resources.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj index 2af36de..85958cc 100644 --- a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj +++ b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj @@ -26,4 +26,23 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + diff --git a/SushiBar/SushiBarFileImplement/FileImplementationExtension.cs b/SushiBar/SushiBarFileImplement/FileImplementationExtension.cs new file mode 100644 index 0000000..2c4f761 --- /dev/null +++ b/SushiBar/SushiBarFileImplement/FileImplementationExtension.cs @@ -0,0 +1,21 @@ +using SushiBarContracts.DI; +using SushiBarContracts.StoragesContracts; +using SushiBarFileImplement.Implements; + +namespace SushiBarFileImplement +{ + public class FileImplementationExtension : IImplementationExtension + { + public int Priority => 0; + public void RegisterServices() + { + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } + } +} diff --git a/SushiBar/SushiBarFileImplement/Implements/BackUpInfo.cs b/SushiBar/SushiBarFileImplement/Implements/BackUpInfo.cs new file mode 100644 index 0000000..708688f --- /dev/null +++ b/SushiBar/SushiBarFileImplement/Implements/BackUpInfo.cs @@ -0,0 +1,38 @@ +using SushiBarContracts.StoragesContracts; +using System.Reflection; + +namespace SushiBarFileImplement.Implements +{ + public class BackUpInfo : IBackUpInfo + { + private readonly DataFileSingleton source; + private readonly PropertyInfo[] sourceProperties; + + public BackUpInfo() + { + source = DataFileSingleton.GetInstance(); + sourceProperties = source.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public); + } + public Type? GetTypeByModelInterface(string modelInterfaceName) + { + var assembly = typeof(BackUpInfo).Assembly; + var types = assembly.GetTypes(); + foreach (var type in types) + { + if (type.IsClass && + type.GetInterface(modelInterfaceName) != null) + { + return type; + } + } + return null; + } + public List? GetList() where T : class, new() + { + var requredType = typeof(T); + return (List?)sourceProperties.FirstOrDefault(x => x.PropertyType.IsGenericType && x.PropertyType.GetGenericArguments()[0] == requredType) + ?.GetValue(source); + } + + } +} diff --git a/SushiBar/SushiBarFileImplement/Implements/ClientStorage.cs b/SushiBar/SushiBarFileImplement/Implements/ClientStorage.cs index 9950acb..ad0690f 100644 --- a/SushiBar/SushiBarFileImplement/Implements/ClientStorage.cs +++ b/SushiBar/SushiBarFileImplement/Implements/ClientStorage.cs @@ -1,11 +1,12 @@ using SushiBarContracts.BindingModels; using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; using SushiBarContracts.ViewModels; using SushiBarFileImplement.Models; namespace SushiBarFileImplement.Implements { - public class ClientStorage + public class ClientStorage : IClientStorage { private readonly DataFileSingleton source; public ClientStorage() diff --git a/SushiBar/SushiBarFileImplement/Implements/ImplementerStorage.cs b/SushiBar/SushiBarFileImplement/Implements/ImplementerStorage.cs index 6369c82..ebab256 100644 --- a/SushiBar/SushiBarFileImplement/Implements/ImplementerStorage.cs +++ b/SushiBar/SushiBarFileImplement/Implements/ImplementerStorage.cs @@ -1,6 +1,6 @@ -using IceCreamShopContracts.StoragesContracts; -using SushiBarContracts.BindingModels; +using SushiBarContracts.BindingModels; using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; using SushiBarContracts.ViewModels; using SushiBarFileImplement.Models; diff --git a/SushiBar/SushiBarFileImplement/Models/MessageInfo.cs b/SushiBar/SushiBarFileImplement/Models/MessageInfo.cs index 0d6e81a..71e5184 100644 --- a/SushiBar/SushiBarFileImplement/Models/MessageInfo.cs +++ b/SushiBar/SushiBarFileImplement/Models/MessageInfo.cs @@ -71,5 +71,7 @@ namespace SushiBarFileImplement.Models new XAttribute("SenderName", SenderName), new XAttribute("DateDelivery", DateDelivery) ); - } + + public int Id => throw new NotImplementedException(); + } } diff --git a/SushiBar/SushiBarListImplement/Implements/BackUpInfo.cs b/SushiBar/SushiBarListImplement/Implements/BackUpInfo.cs new file mode 100644 index 0000000..f6f3014 --- /dev/null +++ b/SushiBar/SushiBarListImplement/Implements/BackUpInfo.cs @@ -0,0 +1,17 @@ +using SushiBarContracts.StoragesContracts; + +namespace SushiBarListImplement.Implements +{ + public class BackUpInfo : IBackUpInfo + { + public List? GetList() where T : class, new() + { + throw new NotImplementedException(); + } + + public Type? GetTypeByModelInterface(string modelInterfaceName) + { + throw new NotImplementedException(); + } + } +} diff --git a/SushiBar/SushiBarListImplement/Implements/ImplementerStorage.cs b/SushiBar/SushiBarListImplement/Implements/ImplementerStorage.cs index 8836a46..35fa59e 100644 --- a/SushiBar/SushiBarListImplement/Implements/ImplementerStorage.cs +++ b/SushiBar/SushiBarListImplement/Implements/ImplementerStorage.cs @@ -1,6 +1,6 @@ -using IceCreamShopContracts.StoragesContracts; -using SushiBarContracts.BindingModels; +using SushiBarContracts.BindingModels; using SushiBarContracts.SearchModels; +using SushiBarContracts.StoragesContracts; using SushiBarContracts.ViewModels; using SushiBarListImplement.Models; diff --git a/SushiBar/SushiBarListImplement/ListImplementationExtension.cs b/SushiBar/SushiBarListImplement/ListImplementationExtension.cs new file mode 100644 index 0000000..aaebeb8 --- /dev/null +++ b/SushiBar/SushiBarListImplement/ListImplementationExtension.cs @@ -0,0 +1,22 @@ +using SushiBarContracts.DI; +using SushiBarContracts.StoragesContracts; +using SushiBarListImplement.Implements; + +namespace SushiBarListImplement +{ + public class ListImplementationExtension : IImplementationExtension + { + public int Priority => 0; + public void RegisterServices() + { + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } + + } +} diff --git a/SushiBar/SushiBarListImplement/Models/MessageInfo.cs b/SushiBar/SushiBarListImplement/Models/MessageInfo.cs index 8a99091..7cba57c 100644 --- a/SushiBar/SushiBarListImplement/Models/MessageInfo.cs +++ b/SushiBar/SushiBarListImplement/Models/MessageInfo.cs @@ -45,5 +45,6 @@ namespace SushiBarListImplement.Models DateDelivery = DateDelivery, }; - } + public int Id => throw new NotImplementedException(); + } }