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 0000000..83ae114 Binary files /dev/null and b/Бэкап.zip differ