Не ну как-будто бы готовая LabWork08_Hard)(((((
This commit is contained in:
parent
755f5c7353
commit
855b5368bb
@ -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<FormAnswerMail>();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,295 +1,304 @@
|
||||
namespace BlacksmithWorkshop
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
partial class FormMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
@ -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<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IBackUpLogic backUpLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
public FormMain(ILogger<FormMain> 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<FormWorkPieces>();
|
||||
private void WorkPieceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormWorkPieces>();
|
||||
|
||||
form.ShowDialog();
|
||||
}
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void ManufactureToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormManufactures>();
|
||||
private void ManufactureToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormManufactures>();
|
||||
|
||||
form.ShowDialog();
|
||||
}
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
|
||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
|
||||
|
||||
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<FormSellManufacture>();
|
||||
|
||||
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<FormShops>();
|
||||
|
||||
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<FormAddManufacture>();
|
||||
|
||||
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<FormReportGroupedOrders>();
|
||||
|
||||
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<FormReportShopManufactures>();
|
||||
|
||||
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<FormReportManufactureWorkPieces>();
|
||||
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<FormReportManufactureWorkPieces>();
|
||||
|
||||
private void ImplementerToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormReportOrders>();
|
||||
form.ShowDialog();
|
||||
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ClientsToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormClients>();
|
||||
private void ImplementerToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormReportOrders>();
|
||||
|
||||
form.ShowDialog();
|
||||
}
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void StartWorkToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_workProcess.DoWork(DependencyManager.Instance.Resolve<IImplementerLogic>()!, _orderLogic);
|
||||
private void ClientsToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormClients>();
|
||||
|
||||
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<IImplementerLogic>()!, _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<FormImplementers>();
|
||||
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<FormMails>();
|
||||
private void OrdersReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = DependencyManager.Instance.Resolve<FormImplementers>();
|
||||
|
||||
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<FormMails>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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<FormShops> 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<FormShop>();
|
||||
|
||||
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<FormShop>();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,8 @@ namespace BlacksmithWorkshop
|
||||
DependencyManager.Instance.RegisterType<IManufactureLogic, ManufactureLogic>();
|
||||
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
||||
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
||||
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
||||
DependencyManager.Instance.RegisterType<IShopLogic, ShopLogic>();
|
||||
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
||||
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
||||
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
||||
|
||||
@ -93,7 +94,14 @@ namespace BlacksmithWorkshop
|
||||
DependencyManager.Instance.RegisterType<FormImplementer>();
|
||||
DependencyManager.Instance.RegisterType<FormImplementers>();
|
||||
DependencyManager.Instance.RegisterType<FormMails>();
|
||||
}
|
||||
DependencyManager.Instance.RegisterType<FormAnswerMail>();
|
||||
DependencyManager.Instance.RegisterType<FormMails>();
|
||||
DependencyManager.Instance.RegisterType<FormSellManufacture>();
|
||||
DependencyManager.Instance.RegisterType<FormReportGroupedOrders>();
|
||||
DependencyManager.Instance.RegisterType<FormReportShopManufactures>();
|
||||
DependencyManager.Instance.RegisterType<FormShops>();
|
||||
DependencyManager.Instance.RegisterType<FormShop>();
|
||||
}
|
||||
|
||||
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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)]
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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<int, (IManufactureModel, int)> ShopManufactures { get; set; } = new();
|
||||
[Column(visible: false)]
|
||||
public Dictionary<int, (IManufactureModel, int)> ShopManufactures { get; set; } = new();
|
||||
|
||||
[DisplayName("Вместимость магазина")]
|
||||
public int MaxCountManufactures { get; set; }
|
||||
[Column(title:"Вместимость магазина", gridViewAutoSize: GridViewAutoSize.DisplayedCells, isUseAutoSize: true)]
|
||||
public int MaxCountManufactures { get; set; }
|
||||
|
||||
public List<Tuple<ManufactureViewModel, int>> ShopManufactureList { get; set; } = new();
|
||||
[Column(visible: false)]
|
||||
public List<Tuple<ManufactureViewModel, int>> ShopManufactureList { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -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)]
|
||||
|
@ -27,7 +27,9 @@ namespace BlacksmithWorkshopDatabaseImplement
|
||||
|
||||
DependencyManager.Instance.RegisterType<IManufactureStorage, ManufactureStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -28,7 +28,9 @@ namespace BlacksmithWorkshopFileImplement
|
||||
|
||||
DependencyManager.Instance.RegisterType<IManufactureStorage, ManufactureStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -26,8 +26,10 @@ namespace BlacksmithWorkshopListImplement
|
||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IManufactureStorage, ManufactureStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user