From 855b5368bb1f51c23d938bce4fd8a2d78e40f694 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Mon, 1 May 2023 00:21:27 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=20=D0=BD=D1=83=20=D0=BA=D0=B0?= =?UTF-8?q?=D0=BA-=D0=B1=D1=83=D0=B4=D1=82=D0=BE=20=D0=B1=D1=8B=20=D0=B3?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B2=D0=B0=D1=8F=20LabWork08=5FHard)(((((?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BlacksmithWorkshop/FormMails.cs | 26 +- .../BlacksmithWorkshop/FormMain.Designer.cs | 583 +++++++++--------- .../BlacksmithWorkshop/FormMain.cs | 379 ++++++------ .../BlacksmithWorkshop/FormShops.cs | 43 +- .../BlacksmithWorkshop/Program.cs | 12 +- .../Attributes/ColumnAttribute.cs | 9 +- .../ViewModels/ManufactureViewModel.cs | 2 +- .../ViewModels/MessageInfoViewModel.cs | 13 +- .../ViewModels/OrderViewModel.cs | 6 +- .../ViewModels/ShopViewModel.cs | 28 +- .../ViewModels/WorkPieceViewModel.cs | 2 +- .../DataBaseImplementationExtension.cs | 4 +- .../Models/MessageInfo.cs | 13 +- .../FileImplementationExtension.cs | 4 +- .../Models/MessageInfo.cs | 3 +- .../ListImplementationExtension.cs | 6 +- Бэкап.zip | Bin 0 -> 2926 bytes 17 files changed, 566 insertions(+), 567 deletions(-) create mode 100644 Бэкап.zip diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMails.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMails.cs index 7ce6cbd..65ac456 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMails.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMails.cs @@ -1,5 +1,6 @@ using BlacksmithWorkshopBusinessLogic.BusinessLogic; using BlacksmithWorkshopContracts.BusinessLogicsContracts; +using BlacksmithWorkshopContracts.DI; using BlacksmithWorkshopContracts.ViewModels; using Microsoft.Extensions.Logging; using System; @@ -45,19 +46,11 @@ namespace BlacksmithWorkshop try { - var list = _messageLogic.ReadList(new() + dataGridView.FillandConfigGrid(_messageLogic.ReadList(new() { Page = currentPage, PageSize = pageSize, - }); - - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["ClientId"].Visible = false; - dataGridView.Columns["MessageId"].Visible = false; - dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - } + })); _logger.LogInformation("Загрузка списка писем"); @@ -117,16 +110,13 @@ namespace BlacksmithWorkshop { if (dataGridView.SelectedRows.Count == 1) { - var service = Program.ServiceProvider?.GetService(typeof(FormAnswerMail)); + var form = DependencyManager.Instance.Resolve(); - if (service is FormAnswerMail form) + form.MessageId = dataGridView.SelectedRows[0].Cells["MessageId"].Value.ToString(); + + if (form.ShowDialog() == DialogResult.OK) { - form.MessageId = dataGridView.SelectedRows[0].Cells["MessageId"].Value.ToString(); - - if (form.ShowDialog() == DialogResult.OK) - { - LoadData(); - } + LoadData(); } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs index ff8d08c..be44158 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs @@ -1,295 +1,304 @@ namespace BlacksmithWorkshop { - partial class FormMain - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; + partial class FormMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } - #region Windows Form Designer generated code + #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(); - buttonCreateOrder = new Button(); - buttonIssuedOrder = new Button(); - buttonRef = new Button(); - menuStrip = new MenuStrip(); - toolStripMenuItem = new ToolStripMenuItem(); - workPieceToolStripMenuItem = new ToolStripMenuItem(); - manufactureToolStripMenuItem = new ToolStripMenuItem(); - shopToolStripMenuItem = new ToolStripMenuItem(); - addManufactureToolStripMenuItem = new ToolStripMenuItem(); - reportToolStripMenuItem = new ToolStripMenuItem(); - groupedOrdersReportToolStripMenuItem = new ToolStripMenuItem(); - ordersReportToolStripMenuItem = new ToolStripMenuItem(); - workloadStoresReportToolStripMenuItem = new ToolStripMenuItem(); - shopsReportToolStripMenuItem = new ToolStripMenuItem(); - reportManufactureToolStripMenuItem = new ToolStripMenuItem(); - workPieceManufacturesToolStripMenuItem = new ToolStripMenuItem(); - workWithImplementerToolStripMenuItem = new ToolStripMenuItem(); - implementerToolStripMenuItem = new ToolStripMenuItem(); - работаСКлиентамиToolStripMenuItem = new ToolStripMenuItem(); - clientsToolStripMenuItem = new ToolStripMenuItem(); - startWorkToolStripMenuItem = new ToolStripMenuItem(); - buttonSellManufacture = new Button(); - messageToolStripMenuItem = new ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - menuStrip.SuspendLayout(); - SuspendLayout(); - // - // dataGridView - // - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridView.Location = new Point(11, 36); - dataGridView.Name = "dataGridView"; - dataGridView.RowHeadersWidth = 51; - dataGridView.RowTemplate.Height = 29; - dataGridView.Size = new Size(937, 448); - dataGridView.TabIndex = 0; - // - // buttonCreateOrder - // - buttonCreateOrder.Location = new Point(1014, 67); - buttonCreateOrder.Name = "buttonCreateOrder"; - buttonCreateOrder.Size = new Size(235, 29); - buttonCreateOrder.TabIndex = 1; - buttonCreateOrder.Text = "Создать заказ"; - buttonCreateOrder.UseVisualStyleBackColor = true; - buttonCreateOrder.Click += ButtonCreateOrder_Click; - // - // buttonIssuedOrder - // - buttonIssuedOrder.Location = new Point(1014, 141); - buttonIssuedOrder.Name = "buttonIssuedOrder"; - buttonIssuedOrder.Size = new Size(235, 29); - buttonIssuedOrder.TabIndex = 4; - buttonIssuedOrder.Text = "Заказ выдан"; - buttonIssuedOrder.UseVisualStyleBackColor = true; - buttonIssuedOrder.Click += ButtonIssuedOrder_Click; - // - // buttonRef - // - buttonRef.Location = new Point(1014, 214); - buttonRef.Name = "buttonRef"; - buttonRef.Size = new Size(235, 29); - buttonRef.TabIndex = 5; - buttonRef.Text = "Обновить"; - buttonRef.UseVisualStyleBackColor = true; - buttonRef.Click += ButtonRef_Click; - // - // menuStrip - // - menuStrip.ImageScalingSize = new Size(20, 20); - menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportToolStripMenuItem, workWithImplementerToolStripMenuItem, работаСКлиентамиToolStripMenuItem, startWorkToolStripMenuItem }); - menuStrip.Location = new Point(0, 0); - menuStrip.Name = "menuStrip"; - menuStrip.Padding = new Padding(6, 3, 0, 3); - menuStrip.Size = new Size(1297, 30); - menuStrip.TabIndex = 6; - menuStrip.Text = "menuStrip1"; - // - // toolStripMenuItem - // - toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { workPieceToolStripMenuItem, manufactureToolStripMenuItem, shopToolStripMenuItem, addManufactureToolStripMenuItem }); - toolStripMenuItem.Name = "toolStripMenuItem"; - toolStripMenuItem.Size = new Size(117, 24); - toolStripMenuItem.Text = "Справочники"; - // - // workPieceToolStripMenuItem - // - workPieceToolStripMenuItem.Name = "workPieceToolStripMenuItem"; - workPieceToolStripMenuItem.Size = new Size(251, 26); - workPieceToolStripMenuItem.Text = "Заготовки"; - workPieceToolStripMenuItem.Click += WorkPieceToolStripMenuItem_Click; - // - // manufactureToolStripMenuItem - // - manufactureToolStripMenuItem.Name = "manufactureToolStripMenuItem"; - manufactureToolStripMenuItem.Size = new Size(251, 26); - manufactureToolStripMenuItem.Text = "Изделия"; - manufactureToolStripMenuItem.Click += ManufactureToolStripMenuItem_Click; - // - // shopToolStripMenuItem - // - shopToolStripMenuItem.Name = "shopToolStripMenuItem"; - shopToolStripMenuItem.Size = new Size(251, 26); - shopToolStripMenuItem.Text = "Магазины"; - shopToolStripMenuItem.Click += ShopToolStripMenuItem_Click; - // - // addManufactureToolStripMenuItem - // - addManufactureToolStripMenuItem.Name = "addManufactureToolStripMenuItem"; - addManufactureToolStripMenuItem.Size = new Size(251, 26); - addManufactureToolStripMenuItem.Text = "Пополнение магазина"; - addManufactureToolStripMenuItem.Click += AddManufactureToolStripMenuItem_Click; - // - // reportToolStripMenuItem - // - reportToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { groupedOrdersReportToolStripMenuItem, ordersReportToolStripMenuItem, workloadStoresReportToolStripMenuItem, shopsReportToolStripMenuItem, reportManufactureToolStripMenuItem, workPieceManufacturesToolStripMenuItem }); - reportToolStripMenuItem.Name = "reportToolStripMenuItem"; - reportToolStripMenuItem.Size = new Size(73, 24); - reportToolStripMenuItem.Text = "Отчёты"; - // - // groupedOrdersReportToolStripMenuItem - // - groupedOrdersReportToolStripMenuItem.Name = "groupedOrdersReportToolStripMenuItem"; - groupedOrdersReportToolStripMenuItem.Size = new Size(310, 26); - groupedOrdersReportToolStripMenuItem.Text = "Список заказов за весь период"; - groupedOrdersReportToolStripMenuItem.Click += GroupedOrdersReportToolStripMenuItem_Click; - // - // ordersReportToolStripMenuItem - // - ordersReportToolStripMenuItem.Name = "ordersReportToolStripMenuItem"; - ordersReportToolStripMenuItem.Size = new Size(310, 26); - ordersReportToolStripMenuItem.Text = "Список заказов"; - ordersReportToolStripMenuItem.Click += OrdersReportToolStripMenuItem_Click; - // - // workloadStoresReportToolStripMenuItem - // - workloadStoresReportToolStripMenuItem.Name = "workloadStoresReportToolStripMenuItem"; - workloadStoresReportToolStripMenuItem.Size = new Size(310, 26); - workloadStoresReportToolStripMenuItem.Text = "Загруженность магазинов"; - workloadStoresReportToolStripMenuItem.Click += WorkloadStoresReportToolStripMenuItem_Click; - // - // shopsReportToolStripMenuItem - // - shopsReportToolStripMenuItem.Name = "shopsReportToolStripMenuItem"; - shopsReportToolStripMenuItem.Size = new Size(310, 26); - shopsReportToolStripMenuItem.Text = "Таблица магазинов"; - shopsReportToolStripMenuItem.Click += ShopsReportToolStripMenuItem_Click; - // - // reportManufactureToolStripMenuItem - // - reportManufactureToolStripMenuItem.Name = "reportManufactureToolStripMenuItem"; - reportManufactureToolStripMenuItem.Size = new Size(310, 26); - reportManufactureToolStripMenuItem.Text = "Список изделий"; - reportManufactureToolStripMenuItem.Click += ReportManufactureToolStripMenuItem_Click; - // - // workPieceManufacturesToolStripMenuItem - // - workPieceManufacturesToolStripMenuItem.Name = "workPieceManufacturesToolStripMenuItem"; - workPieceManufacturesToolStripMenuItem.Size = new Size(310, 26); - workPieceManufacturesToolStripMenuItem.Text = "Заготовки по изделиям"; - workPieceManufacturesToolStripMenuItem.Click += WorkPieceManufacturesToolStripMenuItem_Click; - // - // workWithImplementerToolStripMenuItem - // - workWithImplementerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { implementerToolStripMenuItem }); - workWithImplementerToolStripMenuItem.Name = "workWithImplementerToolStripMenuItem"; - workWithImplementerToolStripMenuItem.Size = new Size(196, 24); - workWithImplementerToolStripMenuItem.Text = "Работа с исполнителями"; - // - // implementerToolStripMenuItem - // - implementerToolStripMenuItem.Name = "implementerToolStripMenuItem"; - implementerToolStripMenuItem.Size = new Size(185, 26); - implementerToolStripMenuItem.Text = "Исполнители"; - implementerToolStripMenuItem.Click += ImplementerToolStripMenuItem_Click_1; - // - // работаСКлиентамиToolStripMenuItem - // - работаСКлиентамиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsToolStripMenuItem, messageToolStripMenuItem }); - работаСКлиентамиToolStripMenuItem.Name = "работаСКлиентамиToolStripMenuItem"; - работаСКлиентамиToolStripMenuItem.Size = new Size(161, 24); - работаСКлиентамиToolStripMenuItem.Text = "Работа с клиентами"; - // - // clientsToolStripMenuItem - // - clientsToolStripMenuItem.Name = "clientsToolStripMenuItem"; - clientsToolStripMenuItem.Size = new Size(224, 26); - clientsToolStripMenuItem.Text = "Клиенты"; - clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click_1; - // - // startWorkToolStripMenuItem - // - startWorkToolStripMenuItem.Name = "startWorkToolStripMenuItem"; - startWorkToolStripMenuItem.Size = new Size(114, 24); - startWorkToolStripMenuItem.Text = "Запуск работ"; - startWorkToolStripMenuItem.Click += StartWorkToolStripMenuItem_Click; - // - // buttonSellManufacture - // - buttonSellManufacture.Location = new Point(1014, 285); - buttonSellManufacture.Name = "buttonSellManufacture"; - buttonSellManufacture.Size = new Size(233, 29); - buttonSellManufacture.TabIndex = 7; - buttonSellManufacture.Text = "Продажа изделий"; - buttonSellManufacture.UseVisualStyleBackColor = true; - buttonSellManufacture.Click += ButtonSellManufacture_Click; - // - // messageToolStripMenuItem - // - messageToolStripMenuItem.Name = "messageToolStripMenuItem"; - messageToolStripMenuItem.Size = new Size(224, 26); - messageToolStripMenuItem.Text = "Письма"; - messageToolStripMenuItem.Click += MessageToolStripMenuItem_Click; - // - // FormMain - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1297, 496); - Controls.Add(buttonSellManufacture); - Controls.Add(buttonRef); - Controls.Add(buttonIssuedOrder); - Controls.Add(buttonCreateOrder); - Controls.Add(dataGridView); - Controls.Add(menuStrip); - MainMenuStrip = menuStrip; - Name = "FormMain"; - Text = "Кузнечная мастерская"; - Load += FormMain_Load; - ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); - menuStrip.ResumeLayout(false); - menuStrip.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(); + buttonCreateOrder = new Button(); + buttonIssuedOrder = new Button(); + buttonRef = new Button(); + menuStrip = new MenuStrip(); + toolStripMenuItem = new ToolStripMenuItem(); + workPieceToolStripMenuItem = new ToolStripMenuItem(); + manufactureToolStripMenuItem = new ToolStripMenuItem(); + shopToolStripMenuItem = new ToolStripMenuItem(); + addManufactureToolStripMenuItem = new ToolStripMenuItem(); + reportToolStripMenuItem = new ToolStripMenuItem(); + groupedOrdersReportToolStripMenuItem = new ToolStripMenuItem(); + ordersReportToolStripMenuItem = new ToolStripMenuItem(); + workloadStoresReportToolStripMenuItem = new ToolStripMenuItem(); + shopsReportToolStripMenuItem = new ToolStripMenuItem(); + reportManufactureToolStripMenuItem = new ToolStripMenuItem(); + workPieceManufacturesToolStripMenuItem = new ToolStripMenuItem(); + workWithImplementerToolStripMenuItem = new ToolStripMenuItem(); + implementerToolStripMenuItem = new ToolStripMenuItem(); + работаСКлиентамиToolStripMenuItem = new ToolStripMenuItem(); + clientsToolStripMenuItem = new ToolStripMenuItem(); + messageToolStripMenuItem = new ToolStripMenuItem(); + startWorkToolStripMenuItem = new ToolStripMenuItem(); + buttonSellManufacture = new Button(); + createBackUpToolStripMenuItem = new ToolStripMenuItem(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Location = new Point(11, 36); + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(937, 448); + dataGridView.TabIndex = 0; + // + // buttonCreateOrder + // + buttonCreateOrder.Location = new Point(1014, 67); + buttonCreateOrder.Name = "buttonCreateOrder"; + buttonCreateOrder.Size = new Size(235, 29); + buttonCreateOrder.TabIndex = 1; + buttonCreateOrder.Text = "Создать заказ"; + buttonCreateOrder.UseVisualStyleBackColor = true; + buttonCreateOrder.Click += ButtonCreateOrder_Click; + // + // buttonIssuedOrder + // + buttonIssuedOrder.Location = new Point(1014, 141); + buttonIssuedOrder.Name = "buttonIssuedOrder"; + buttonIssuedOrder.Size = new Size(235, 29); + buttonIssuedOrder.TabIndex = 4; + buttonIssuedOrder.Text = "Заказ выдан"; + buttonIssuedOrder.UseVisualStyleBackColor = true; + buttonIssuedOrder.Click += ButtonIssuedOrder_Click; + // + // buttonRef + // + buttonRef.Location = new Point(1014, 214); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(235, 29); + buttonRef.TabIndex = 5; + buttonRef.Text = "Обновить"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += ButtonRef_Click; + // + // menuStrip + // + menuStrip.ImageScalingSize = new Size(20, 20); + menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportToolStripMenuItem, workWithImplementerToolStripMenuItem, работаСКлиентамиToolStripMenuItem, startWorkToolStripMenuItem, createBackUpToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Padding = new Padding(6, 3, 0, 3); + menuStrip.Size = new Size(1297, 30); + menuStrip.TabIndex = 6; + menuStrip.Text = "menuStrip1"; + // + // toolStripMenuItem + // + toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { workPieceToolStripMenuItem, manufactureToolStripMenuItem, shopToolStripMenuItem, addManufactureToolStripMenuItem }); + toolStripMenuItem.Name = "toolStripMenuItem"; + toolStripMenuItem.Size = new Size(117, 24); + toolStripMenuItem.Text = "Справочники"; + // + // workPieceToolStripMenuItem + // + workPieceToolStripMenuItem.Name = "workPieceToolStripMenuItem"; + workPieceToolStripMenuItem.Size = new Size(251, 26); + workPieceToolStripMenuItem.Text = "Заготовки"; + workPieceToolStripMenuItem.Click += WorkPieceToolStripMenuItem_Click; + // + // manufactureToolStripMenuItem + // + manufactureToolStripMenuItem.Name = "manufactureToolStripMenuItem"; + manufactureToolStripMenuItem.Size = new Size(251, 26); + manufactureToolStripMenuItem.Text = "Изделия"; + manufactureToolStripMenuItem.Click += ManufactureToolStripMenuItem_Click; + // + // shopToolStripMenuItem + // + shopToolStripMenuItem.Name = "shopToolStripMenuItem"; + shopToolStripMenuItem.Size = new Size(251, 26); + shopToolStripMenuItem.Text = "Магазины"; + shopToolStripMenuItem.Click += ShopToolStripMenuItem_Click; + // + // addManufactureToolStripMenuItem + // + addManufactureToolStripMenuItem.Name = "addManufactureToolStripMenuItem"; + addManufactureToolStripMenuItem.Size = new Size(251, 26); + addManufactureToolStripMenuItem.Text = "Пополнение магазина"; + addManufactureToolStripMenuItem.Click += AddManufactureToolStripMenuItem_Click; + // + // reportToolStripMenuItem + // + reportToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { groupedOrdersReportToolStripMenuItem, ordersReportToolStripMenuItem, workloadStoresReportToolStripMenuItem, shopsReportToolStripMenuItem, reportManufactureToolStripMenuItem, workPieceManufacturesToolStripMenuItem }); + reportToolStripMenuItem.Name = "reportToolStripMenuItem"; + reportToolStripMenuItem.Size = new Size(73, 24); + reportToolStripMenuItem.Text = "Отчёты"; + // + // groupedOrdersReportToolStripMenuItem + // + groupedOrdersReportToolStripMenuItem.Name = "groupedOrdersReportToolStripMenuItem"; + groupedOrdersReportToolStripMenuItem.Size = new Size(310, 26); + groupedOrdersReportToolStripMenuItem.Text = "Список заказов за весь период"; + groupedOrdersReportToolStripMenuItem.Click += GroupedOrdersReportToolStripMenuItem_Click; + // + // ordersReportToolStripMenuItem + // + ordersReportToolStripMenuItem.Name = "ordersReportToolStripMenuItem"; + ordersReportToolStripMenuItem.Size = new Size(310, 26); + ordersReportToolStripMenuItem.Text = "Список заказов"; + ordersReportToolStripMenuItem.Click += OrdersReportToolStripMenuItem_Click; + // + // workloadStoresReportToolStripMenuItem + // + workloadStoresReportToolStripMenuItem.Name = "workloadStoresReportToolStripMenuItem"; + workloadStoresReportToolStripMenuItem.Size = new Size(310, 26); + workloadStoresReportToolStripMenuItem.Text = "Загруженность магазинов"; + workloadStoresReportToolStripMenuItem.Click += WorkloadStoresReportToolStripMenuItem_Click; + // + // shopsReportToolStripMenuItem + // + shopsReportToolStripMenuItem.Name = "shopsReportToolStripMenuItem"; + shopsReportToolStripMenuItem.Size = new Size(310, 26); + shopsReportToolStripMenuItem.Text = "Таблица магазинов"; + shopsReportToolStripMenuItem.Click += ShopsReportToolStripMenuItem_Click; + // + // reportManufactureToolStripMenuItem + // + reportManufactureToolStripMenuItem.Name = "reportManufactureToolStripMenuItem"; + reportManufactureToolStripMenuItem.Size = new Size(310, 26); + reportManufactureToolStripMenuItem.Text = "Список изделий"; + reportManufactureToolStripMenuItem.Click += ReportManufactureToolStripMenuItem_Click; + // + // workPieceManufacturesToolStripMenuItem + // + workPieceManufacturesToolStripMenuItem.Name = "workPieceManufacturesToolStripMenuItem"; + workPieceManufacturesToolStripMenuItem.Size = new Size(310, 26); + workPieceManufacturesToolStripMenuItem.Text = "Заготовки по изделиям"; + workPieceManufacturesToolStripMenuItem.Click += WorkPieceManufacturesToolStripMenuItem_Click; + // + // workWithImplementerToolStripMenuItem + // + workWithImplementerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { implementerToolStripMenuItem }); + workWithImplementerToolStripMenuItem.Name = "workWithImplementerToolStripMenuItem"; + workWithImplementerToolStripMenuItem.Size = new Size(196, 24); + workWithImplementerToolStripMenuItem.Text = "Работа с исполнителями"; + // + // implementerToolStripMenuItem + // + implementerToolStripMenuItem.Name = "implementerToolStripMenuItem"; + implementerToolStripMenuItem.Size = new Size(185, 26); + implementerToolStripMenuItem.Text = "Исполнители"; + implementerToolStripMenuItem.Click += ImplementerToolStripMenuItem_Click_1; + // + // работаСКлиентамиToolStripMenuItem + // + работаСКлиентамиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientsToolStripMenuItem, messageToolStripMenuItem }); + работаСКлиентамиToolStripMenuItem.Name = "работаСКлиентамиToolStripMenuItem"; + работаСКлиентамиToolStripMenuItem.Size = new Size(161, 24); + работаСКлиентамиToolStripMenuItem.Text = "Работа с клиентами"; + // + // clientsToolStripMenuItem + // + clientsToolStripMenuItem.Name = "clientsToolStripMenuItem"; + clientsToolStripMenuItem.Size = new Size(152, 26); + clientsToolStripMenuItem.Text = "Клиенты"; + clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click_1; + // + // messageToolStripMenuItem + // + messageToolStripMenuItem.Name = "messageToolStripMenuItem"; + messageToolStripMenuItem.Size = new Size(152, 26); + messageToolStripMenuItem.Text = "Письма"; + messageToolStripMenuItem.Click += MessageToolStripMenuItem_Click; + // + // startWorkToolStripMenuItem + // + startWorkToolStripMenuItem.Name = "startWorkToolStripMenuItem"; + startWorkToolStripMenuItem.Size = new Size(114, 24); + startWorkToolStripMenuItem.Text = "Запуск работ"; + startWorkToolStripMenuItem.Click += StartWorkToolStripMenuItem_Click; + // + // buttonSellManufacture + // + buttonSellManufacture.Location = new Point(1014, 285); + buttonSellManufacture.Name = "buttonSellManufacture"; + buttonSellManufacture.Size = new Size(233, 29); + buttonSellManufacture.TabIndex = 7; + buttonSellManufacture.Text = "Продажа изделий"; + buttonSellManufacture.UseVisualStyleBackColor = true; + buttonSellManufacture.Click += ButtonSellManufacture_Click; + // + // createBackUpToolStripMenuItem + // + createBackUpToolStripMenuItem.Name = "createBackUpToolStripMenuItem"; + createBackUpToolStripMenuItem.Size = new Size(122, 24); + createBackUpToolStripMenuItem.Text = "Создать бэкап"; + createBackUpToolStripMenuItem.Click += CreateBackUpToolStripMenuItem_Click_1; + // + // FormMain + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1297, 496); + Controls.Add(buttonSellManufacture); + Controls.Add(buttonRef); + Controls.Add(buttonIssuedOrder); + Controls.Add(buttonCreateOrder); + Controls.Add(dataGridView); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Name = "FormMain"; + Text = "Кузнечная мастерская"; + Load += FormMain_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } - #endregion + #endregion - private DataGridView dataGridView; - private Button buttonCreateOrder; - private Button buttonIssuedOrder; - private Button buttonRef; - private MenuStrip menuStrip; - private ToolStripMenuItem toolStripMenuItem; - private ToolStripMenuItem workPieceToolStripMenuItem; - private ToolStripMenuItem manufactureToolStripMenuItem; - private ToolStripMenuItem shopToolStripMenuItem; - private ToolStripMenuItem addManufactureToolStripMenuItem; - private Button buttonSellManufacture; - private ToolStripMenuItem reportToolStripMenuItem; - private ToolStripMenuItem groupedOrdersReportToolStripMenuItem; - private ToolStripMenuItem ordersReportToolStripMenuItem; - private ToolStripMenuItem workloadStoresReportToolStripMenuItem; - private ToolStripMenuItem shopsReportToolStripMenuItem; - private ToolStripMenuItem reportManufactureToolStripMenuItem; - private ToolStripMenuItem workPieceManufacturesToolStripMenuItem; - private ToolStripMenuItem workWithImplementerToolStripMenuItem; - private ToolStripMenuItem implementerToolStripMenuItem; - private ToolStripMenuItem работаСКлиентамиToolStripMenuItem; - private ToolStripMenuItem clientsToolStripMenuItem; - private ToolStripMenuItem startWorkToolStripMenuItem; - private ToolStripMenuItem messageToolStripMenuItem; - } + private DataGridView dataGridView; + private Button buttonCreateOrder; + private Button buttonIssuedOrder; + private Button buttonRef; + private MenuStrip menuStrip; + private ToolStripMenuItem toolStripMenuItem; + private ToolStripMenuItem workPieceToolStripMenuItem; + private ToolStripMenuItem manufactureToolStripMenuItem; + private ToolStripMenuItem shopToolStripMenuItem; + private ToolStripMenuItem addManufactureToolStripMenuItem; + private Button buttonSellManufacture; + private ToolStripMenuItem reportToolStripMenuItem; + private ToolStripMenuItem groupedOrdersReportToolStripMenuItem; + private ToolStripMenuItem ordersReportToolStripMenuItem; + private ToolStripMenuItem workloadStoresReportToolStripMenuItem; + private ToolStripMenuItem shopsReportToolStripMenuItem; + private ToolStripMenuItem reportManufactureToolStripMenuItem; + private ToolStripMenuItem workPieceManufacturesToolStripMenuItem; + private ToolStripMenuItem workWithImplementerToolStripMenuItem; + private ToolStripMenuItem implementerToolStripMenuItem; + private ToolStripMenuItem работаСКлиентамиToolStripMenuItem; + private ToolStripMenuItem clientsToolStripMenuItem; + private ToolStripMenuItem startWorkToolStripMenuItem; + private ToolStripMenuItem messageToolStripMenuItem; + private ToolStripMenuItem createBackUpToolStripMenuItem; + } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs index 89a5119..36d8270 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs @@ -16,252 +16,239 @@ using System.Windows.Forms; namespace BlacksmithWorkshop { - public partial class FormMain : Form - { - private readonly ILogger _logger; + public partial class FormMain : Form + { + private readonly ILogger _logger; - private readonly IOrderLogic _orderLogic; + private readonly IOrderLogic _orderLogic; - private readonly IReportLogic _reportLogic; + private readonly IReportLogic _reportLogic; - private readonly IWorkProcess _workProcess; + private readonly IWorkProcess _workProcess; - private readonly IBackUpLogic _backUpLogic; + private readonly IBackUpLogic _backUpLogic; - public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IBackUpLogic backUpLogic) - { - InitializeComponent(); + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IBackUpLogic backUpLogic) + { + InitializeComponent(); - _logger = logger; - _orderLogic = orderLogic; - _reportLogic = reportLogic; - _workProcess = workProcess; - _backUpLogic = backUpLogic; - } + _logger = logger; + _orderLogic = orderLogic; + _reportLogic = reportLogic; + _workProcess = workProcess; + _backUpLogic = backUpLogic; + } - private void FormMain_Load(object sender, EventArgs e) - { - LoadData(); - } + private void FormMain_Load(object sender, EventArgs e) + { + LoadData(); + } - private void LoadData() - { - _logger.LogInformation("Загрузка заказов"); + private void LoadData() + { + _logger.LogInformation("Загрузка заказов"); - try - { - dataGridView.FillandConfigGrid(_orderLogic.ReadList(null)); + try + { + dataGridView.FillandConfigGrid(_orderLogic.ReadList(null)); - _logger.LogInformation("Загрузка заказов"); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка загрузки заказов"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } + _logger.LogInformation("Загрузка заказов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки заказов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } - private void WorkPieceToolStripMenuItem_Click(object sender, EventArgs e) - { - var form = DependencyManager.Instance.Resolve(); + private void WorkPieceToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - form.ShowDialog(); - } + form.ShowDialog(); + } - private void ManufactureToolStripMenuItem_Click(object sender, EventArgs e) - { - var form = DependencyManager.Instance.Resolve(); + private void ManufactureToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - form.ShowDialog(); - } + form.ShowDialog(); + } - private void ButtonCreateOrder_Click(object sender, EventArgs e) - { - var form = DependencyManager.Instance.Resolve(); + private void ButtonCreateOrder_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - form.ShowDialog(); - LoadData(); - } + form.ShowDialog(); + LoadData(); + } - 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); + 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 - }); + try + { + var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel + { + Id = id + }); - if (!operationResult) - { - throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); - } + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } - _logger.LogInformation("Заказ №{id} выдан", id); + _logger.LogInformation("Заказ №{id} выдан", id); - LoadData(); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } + 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 ButtonRef_Click(object sender, EventArgs e) + { + LoadData(); + } - private void ButtonSellManufacture_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormSellManufacture)); - if (service is FormSellManufacture form) - { - form.ShowDialog(); - LoadData(); - } - } + private void ButtonSellManufacture_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - private void ShopToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormShops)); + form.ShowDialog(); + LoadData(); - if (service is FormShops form) - { - form.ShowDialog(); - } - } + } - private void AddManufactureToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormAddManufacture)); + private void ShopToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - if (service is FormAddManufacture form) - { - form.ShowDialog(); - LoadData(); - } - } + form.ShowDialog(); + } - private void GroupedOrdersReportToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders)); + private void AddManufactureToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - if (service is FormReportGroupedOrders form) - { - form.ShowDialog(); - } - } + form.ShowDialog(); + LoadData(); + } - private void WorkloadStoresReportToolStripMenuItem_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormReportShopManufactures)); + private void GroupedOrdersReportToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - if (service is FormReportShopManufactures form) - { - form.ShowDialog(); - } - } + form.ShowDialog(); + } - private void ShopsReportToolStripMenuItem_Click(object sender, EventArgs e) - { - using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + private void WorkloadStoresReportToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - if (dialog.ShowDialog() == DialogResult.OK) - { - _reportLogic.SaveShopsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); - MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } + form.ShowDialog(); + } - private void WorkPieceManufacturesToolStripMenuItem_Click(object sender, EventArgs e) - { - var form = DependencyManager.Instance.Resolve(); + private void ShopsReportToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; - form.ShowDialog(); + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveShopsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } - } + private void WorkPieceManufacturesToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - private void ImplementerToolStripMenuItem_Click_1(object sender, EventArgs e) - { - var form = DependencyManager.Instance.Resolve(); + form.ShowDialog(); - form.ShowDialog(); - } + } - private void ClientsToolStripMenuItem_Click_1(object sender, EventArgs e) - { - var form = DependencyManager.Instance.Resolve(); + private void ImplementerToolStripMenuItem_Click_1(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - form.ShowDialog(); - } + form.ShowDialog(); + } - private void StartWorkToolStripMenuItem_Click(object sender, EventArgs e) - { - _workProcess.DoWork(DependencyManager.Instance.Resolve()!, _orderLogic); + private void ClientsToolStripMenuItem_Click_1(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); - } + form.ShowDialog(); + } - private void ReportManufactureToolStripMenuItem_Click(object sender, EventArgs e) - { - using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + private void StartWorkToolStripMenuItem_Click(object sender, EventArgs e) + { + _workProcess.DoWork(DependencyManager.Instance.Resolve()!, _orderLogic); - if (dialog.ShowDialog() == DialogResult.OK) - { - _reportLogic.SaveManufacturesToWordFile(new ReportBindingModel - { - FileName = dialog.FileName - }); + MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); + } - MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } + private void ReportManufactureToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; - private void OrdersReportToolStripMenuItem_Click(object sender, EventArgs e) - { - var form = DependencyManager.Instance.Resolve(); + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveManufacturesToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); - form.ShowDialog(); - } + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } - private void MailsToolStripMenuItem_Click(object sender, EventArgs e) - { - var form = DependencyManager.Instance.Resolve(); + private void OrdersReportToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - form.ShowDialog(); - } + form.ShowDialog(); + } - private void CreateBackUpToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - if (_backUpLogic != null) - { - var fbd = new FolderBrowserDialog(); + private void MessageToolStripMenuItem_Click(object sender, EventArgs e) + { + var form = DependencyManager.Instance.Resolve(); - if (fbd.ShowDialog() == DialogResult.OK) - { - _backUpLogic.CreateBackUp(new BackUpSaveBinidngModel - { - FolderName = fbd.SelectedPath - }); + form.ShowDialog(); + } - MessageBox.Show("Бекап создан", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } + private void CreateBackUpToolStripMenuItem_Click_1(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); + } + } + } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormShops.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormShops.cs index 9c33261..74aef2b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormShops.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormShops.cs @@ -1,5 +1,7 @@ -using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopBusinessLogic.BusinessLogic; +using BlacksmithWorkshopContracts.BindingModels; using BlacksmithWorkshopContracts.BusinessLogicsContracts; +using BlacksmithWorkshopContracts.DI; using BlacksmithWorkshopContracts.SearchModels; using BlacksmithWorkshopDataModels.Models; using Microsoft.Extensions.Logging; @@ -18,6 +20,7 @@ namespace BlacksmithWorkshop public partial class FormShops : Form { private readonly ILogger _logger; + private readonly IShopLogic _logic; public FormShops(ILogger logger, IShopLogic logic) @@ -33,20 +36,12 @@ namespace BlacksmithWorkshop } private void LoadData() - { - try + { + try { - var list = _logic.ReadList(null); + dataGridView.FillandConfigGrid(_logic.ReadList(null)); - if (list != null) - { - dataGridView.DataSource = list; - dataGridView.Columns["Id"].Visible = false; - dataGridView.Columns["ShopManufactures"].Visible = false; - dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - } - - _logger.LogInformation("Загрузка магазинов"); + _logger.LogInformation("Загрузка магазинов"); } catch (Exception ex) { @@ -57,13 +52,11 @@ namespace BlacksmithWorkshop private void ButtonAdd_Click(object sender, EventArgs e) { - var service = Program.ServiceProvider?.GetService(typeof(FormShop)); - if (service is FormShop form) + var form = DependencyManager.Instance.Resolve(); + + if (form.ShowDialog() == DialogResult.OK) { - if (form.ShowDialog() == DialogResult.OK) - { - LoadData(); - } + LoadData(); } } @@ -71,14 +64,12 @@ namespace BlacksmithWorkshop { if (dataGridView.SelectedRows.Count == 1) { - var service = Program.ServiceProvider?.GetService(typeof(FormShop)); - if (service is FormShop form) + var form = DependencyManager.Instance.Resolve(); + + form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + if (form.ShowDialog() == DialogResult.OK) { - form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); - if (form.ShowDialog() == DialogResult.OK) - { - LoadData(); - } + LoadData(); } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs index 57c8290..8b23862 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs @@ -69,7 +69,8 @@ namespace BlacksmithWorkshop DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); - DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); @@ -93,7 +94,14 @@ namespace BlacksmithWorkshop 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) => DependencyManager.Instance.Resolve()?.MailCheck(); } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/Attributes/ColumnAttribute.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/Attributes/ColumnAttribute.cs index aec5b3a..5fd65f0 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/Attributes/ColumnAttribute.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/Attributes/ColumnAttribute.cs @@ -11,14 +11,15 @@ namespace BlacksmithWorkshopContracts.Attributes public class ColumnAttribute : Attribute { public ColumnAttribute(string title = "", bool visible = true, int width = 0, - GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false) + GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false, string format = "") { Title = title; Visible = visible; Width = width; GridViewAutoSize = gridViewAutoSize; IsUseAutoSize = isUseAutoSize; - } + Format = format; + } public string Title { get; private set; } @@ -29,5 +30,7 @@ namespace BlacksmithWorkshopContracts.Attributes public GridViewAutoSize GridViewAutoSize { get; private set; } public bool IsUseAutoSize { get; private set; } - } + + public string Format { get; private set; } + } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ManufactureViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ManufactureViewModel.cs index d027131..705c066 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ManufactureViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ManufactureViewModel.cs @@ -18,7 +18,7 @@ namespace BlacksmithWorkshopContracts.ViewModels [Column(title: "Навание изделия", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string ManufactureName { get; set; } = string.Empty; - [Column(title: "Цена", width: 150)] + [Column(title: "Цена", width: 150, format: "0.00")] public double Price { get; set; } [Column(visible: false)] diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/MessageInfoViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/MessageInfoViewModel.cs index cbf7aef..ab5f80b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/MessageInfoViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/MessageInfoViewModel.cs @@ -23,7 +23,7 @@ namespace BlacksmithWorkshopContracts.ViewModels [Column(title: "Отправитель", width: 150)] public string SenderName { get; set; } = string.Empty; - [Column(title: "Дата отправки", width: 150)] + [Column(title: "Дата отправки", width: 150, format: "D")] public DateTime DateDelivery { get; set; } = DateTime.Now; [Column(title: "Заголовок", width: 150)] @@ -31,14 +31,11 @@ namespace BlacksmithWorkshopContracts.ViewModels [Column(title: "Текст", width: 150)] public string Body { get; set; } = string.Empty; - } - [DisplayName("Текст")] - public string Body { get; set; } = string.Empty; - [DisplayName("Прочитано")] - public bool IsRead { get; set; } = false; + [Column(title: "Прочитано", width: 150)] + public bool IsRead { get; set; } = false; - [DisplayName("Ответ")] - public string? Answer { get; set; } + [Column(title: "Ответ", width: 150)] + public string Answer { get; set; } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs index 094f1f0..1183a9d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs @@ -37,16 +37,16 @@ namespace BlacksmithWorkshopContracts.ViewModels [Column(title: "Количество", width: 150)] public int Count { get; set; } - [Column(title: "Сумма", width: 150)] + [Column(title: "Сумма", width: 150, format: "0.00")] public double Sum { get; set; } [Column(title: "Статус", width: 150)] public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; - [Column(title: "Дата создания", width: 150)] + [Column(title: "Дата создания", width: 150, format: "D")] public DateTime DateCreate { get; set; } = DateTime.Now; - [Column(title: "Дата выполнения", width: 150)] + [Column(title: "Дата выполнения", width: 150, format: "f")] public DateTime? DateImplement { get; set; } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ShopViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ShopViewModel.cs index 7118e49..9aa9f18 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ShopViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ShopViewModel.cs @@ -1,4 +1,5 @@ -using BlacksmithWorkshopDataModels.Models; +using BlacksmithWorkshopContracts.Attributes; +using BlacksmithWorkshopDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,22 +11,25 @@ namespace BlacksmithWorkshopContracts.ViewModels { public class ShopViewModel { - public int Id { get; set; } + [Column(visible: false)] + public int Id { get; set; } - [DisplayName("Название магазина")] - public string ShopName { get; set; } = string.Empty; + [Column(title: "Название магазина", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] + public string ShopName { get; set; } = string.Empty; - [DisplayName("Адрес магазина")] - public string Address { get; set; } = string.Empty; + [Column(title: "Адрес магазина", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string Address { get; set; } = string.Empty; - [DisplayName("Дата открытия")] - public DateTime DateOpen { get; set; } = DateTime.Now; + [Column(title: "Время открытия", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true, format: "f")] + public DateTime DateOpen { get; set; } = DateTime.Now; - public Dictionary ShopManufactures { get; set; } = new(); + [Column(visible: false)] + public Dictionary ShopManufactures { get; set; } = new(); - [DisplayName("Вместимость магазина")] - public int MaxCountManufactures { get; set; } + [Column(title:"Вместимость магазина", gridViewAutoSize: GridViewAutoSize.DisplayedCells, isUseAutoSize: true)] + public int MaxCountManufactures { get; set; } - public List> ShopManufactureList { get; set; } = new(); + [Column(visible: false)] + public List> ShopManufactureList { get; set; } = new(); } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/WorkPieceViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/WorkPieceViewModel.cs index 690f8ea..6b08138 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/WorkPieceViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/WorkPieceViewModel.cs @@ -15,7 +15,7 @@ namespace BlacksmithWorkshopContracts.ViewModels [Column(visible: false)] public int Id { get; set; } - [Column(title: "Название заготовки", width: 150)] + [Column(title: "Название заготовки", width: 150, format: "0.00")] public string WorkPieceName { get; set; } = string.Empty; [Column(title: "Цена", width: 150)] diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/DataBaseImplementationExtension.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/DataBaseImplementationExtension.cs index 8967c2f..bd68eab 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/DataBaseImplementationExtension.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/DataBaseImplementationExtension.cs @@ -27,7 +27,9 @@ namespace BlacksmithWorkshopDatabaseImplement DependencyManager.Instance.RegisterType(); - DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/MessageInfo.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/MessageInfo.cs index a5c72de..9d729ba 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/MessageInfo.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/MessageInfo.cs @@ -20,20 +20,25 @@ namespace BlacksmithWorkshopDatabaseImplement.Models [DataMember] public string MessageId { get; set; } = string.Empty; + [DataMember] public int? ClientId { get; set; } public bool IsRead { get; private set; } = false; [Required] + [DataMember] public string SenderName { get; set; } = string.Empty; - public DateTime DateDelivery { get; set; } = DateTime.Now; + [DataMember] + public DateTime DateDelivery { get; set; } = DateTime.Now; - public string Subject { get; set; } = string.Empty; + [DataMember] + public string Subject { get; set; } = string.Empty; - public string Body { get; set; } = string.Empty; + [DataMember] + public string Body { get; set; } = string.Empty; - public string? Answer { get; private set; } = string.Empty; + public string? Answer { get; private set; } = string.Empty; public virtual Client? Client { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/FileImplementationExtension.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/FileImplementationExtension.cs index 28d2b45..6d7ec31 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/FileImplementationExtension.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/FileImplementationExtension.cs @@ -28,7 +28,9 @@ namespace BlacksmithWorkshopFileImplement DependencyManager.Instance.RegisterType(); - DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/MessageInfo.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/MessageInfo.cs index 1d93c71..a3fd1a5 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/MessageInfo.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/MessageInfo.cs @@ -26,9 +26,8 @@ namespace BlacksmithWorkshopFileImplement.Models [DataMember] public string SenderName { get; private set; } = string.Empty; - public bool IsRead { get; private set; } = false; - public string SenderName { get; private set; } = string.Empty; + public bool IsRead { get; private set; } = false; [DataMember] public DateTime DateDelivery { get; private set; } = DateTime.Now; diff --git a/BlacksmithWorkshop/BlacksmithWorkshopListImplement/ListImplementationExtension.cs b/BlacksmithWorkshop/BlacksmithWorkshopListImplement/ListImplementationExtension.cs index 2f024fd..993fb9b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopListImplement/ListImplementationExtension.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopListImplement/ListImplementationExtension.cs @@ -26,8 +26,10 @@ namespace BlacksmithWorkshopListImplement DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); - - DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); } } diff --git a/Бэкап.zip b/Бэкап.zip new file mode 100644 index 0000000000000000000000000000000000000000..83ae114a00d827fe47c6c6142f9b867be741f317 GIT binary patch literal 2926 zcmZ`*c{r47AD*!_*+Oat$C3!gGBQO<%gHjvm>O!3P&4*r7-K(aP{xrhl=Bq%Vs+JQXKZQHLK{CU~2#=gODg*`8E#K72%FCL#S zA3NR;{o)z`+HVZbJrAF4<_l+nD}5b@?8yC?zCN%Y8Z!tVLicy;oxUiov)=0zm2-5HdiZh@=2d zBEZj+{13w=Te}*gA-knM{Vr5Lre7DOPyUPT!v*%!WGR3mKMdbVZ5D@qyuc^nxzs9X zxUNf1DBdLfk*N05Nw)OEJj{s(R}@l5jZs%;)&lXllX*L%BA2lptM~B0el3JP!jz$b zIDWdj2aD7(YtbHKmZ~we5eMO>xbB`i#=8YLdmybg9spbe!GCea-~+?F@a~~uWY2Fn z^X!%|eYzO5t$~id%?i2?g9AzokRD0KK*L@6B_zgMc7lWwe724sj=w6GG`g@}Ivd-^ zd(R_i-kWk#rp1=_d6ama2|=54os|=(t(-8$kOO2B&a$#NR4Hx*WD31x0JP;YUf0eT zrsxdIgR$-#c6d?I;vzDhMYLRoLf?U%_oa&{cvVj8T5RB}2>e|k!$YwJ5{-#Q}V)X8}@Sr-*<+*T4HaInR&~ytgMR&@1TA2i1dbZLG=CrhM~Zphqm_#}+BNi>&p?9n>3w(G0Lx;GT7 z{v-h7JeI2HKaxM}ve^>iHJ}o+6gJ&Fo$}8lr-X-r81;Qd@gnnMzp_5xug7J zY^VS7P9hinG!L$IzAvU3lRs_aeAnHN{z69wp##%g)^II3df3)6=e>QF!ULby*FWQ_ zAy!qj10O%W%Z(&_{d^lqTMQ_LcJJ8tU-T zj;7tPKxxKJOS6fxSNBoEWnWh`d?Ip~ex8WMrP?7SSWGVC9z~Q{AKheMzx;c9q}jo> zR_lt=UYf4?qs6R9LiDj}Pn!#0cD$C!pdNBTb(;QUT+m_~sepOVfk2qMGlI_d%xG)5 zmM|S07OZhdD!DZ>{hC9*dGhsl6&ZD3-f}!r_AT;5^;s7Y!Dgxu@3K!7Ng>6TWp@mg zjv#}n&kxt~e3xKPi%zJ`bMp9KGi8^=5MQoeD+~c6tiJfMiatE zyML^IM&e$1y?qvcO`7bdQk1>y7$o)e*i@k_70Rn-m-DOH+KB}j9c0?2AV++@E73d| z=km*QWxs;VwcOE-DyXo2kmfI^QhD@FB&?FTUiUiM2+}#NKdOs(Hdd9Svdwc}sAUoJ zzIV><-hdgM1WjtRbekXRVqU#(R9O^-?GTc(FcDuhvEM`OhZhajy`Rdbb?~-zsSDDT z#j99y#aIpwY8aDG4ACE*lQitwC3MS}#3m854i4LC2DE?^%qStY+SA{kJNJCGz{65Y z%iP-|?5wQ=QcYqy(C>&1>z9T;P2K&7d1l%qg-FR5BlH%SZyrXfh*U}@pNM^K$utS;#(%xw~ zLY8P~nD{b-YjWSWd2`vz&5h}l+*0c#5f{AQJ(83-=R)m(6m%b+)p38_5qWh4W&oj^ zWEA*wUg@Ep%&VTL(X)>;>eIqUH{(_ZCT7ce_d=YIpKhnw_F0B*epY=q()qKcnA{>u zaZlk*^>+VTGf(s>QdM|Sy?fL?rF54V3$qG5y++*hJGH%g3 zae2R|DpHyYHX~%Y1URdrPJRC`dTiHi13#;MCsx-(F+846&(^Psuoy?3v35c4>T#S}!bfn8thMZnOk9;1%`GWTgnKsz z{H>I%KKuC7S>Q@e6$639f$RA++2d~!q463|wHeBby@^;9QMVs_75<_o^x`LL1$Bs= z{dp{EA1|WQ7k9S%kcQ_qxyeJnhpr#Fej$(%6YfQ+H-|>*Vjo|y_9V^wB zs*1+~Czkg*)#J`Tc{RECp>mAAhsPq7Q-1oay1-KDY`vOjm0GGWPH+89^4D2QG)XyO z+YgzG%HBIqD~w-w5iD+ZS=JziRc5hyA+k+^Y<>$d3zATv;oQ>D}ZEd+l!7;2aekr-LgCQ7d~Frp1fD;{0188|3;@ z-Y0-}CQ21Ps8C23rMJvYEAII~gTYGAIz5(nNQRAlsWm5bWVe*vIJy#SLm2pSU_aqb z8`tF9+Sg3xrBnko{{Yl~J8+)y2_pTYg=AZlj*Y&710a6NsI zv1Sm^@bCv@EAKs9OjB7iyFK&l<`teW$L<;*Vz+}tYNcXpy;6>0Y2Hbh zS=6-5AcC8(Gl7iK;Y9zTmFd>h5Q?wc_R5soadBz(Br6J-E|y+?fe`pTXFx&%9#983 zgEnfR4fAl2!u2cjzMI9 ztgom0e^s7505<@by5@INfe4R+ZrU;1C>2rMKI`v2YyVDYc#Urr8-{uU_ctF};uz^9