From 68831c48fdbe8e30a7e6f6c219a3880879b58f98 Mon Sep 17 00:00:00 2001 From: aleksandr chegodaev Date: Sun, 16 Jun 2024 21:00:26 +0400 Subject: [PATCH] lab4 ispr --- LawFirm/LawFirm/FormMain.Designer.cs | 94 ++++++++++++++----- LawFirm/LawFirm/FormMain.cs | 45 +++++++++ LawFirm/LawFirm/FormMain.resx | 2 +- LawFirm/LawFirm/LawFirmView.csproj | 10 +- LawFirm/LawFirm/Program.cs | 18 +++- .../LawFirmBusinessLogic.csproj | 9 +- .../Implements/OrderStorage.cs | 7 +- ... 20240616165923_InitialCreate.Designer.cs} | 6 +- ...ate.cs => 20240616165923_InitialCreate.cs} | 0 .../LawFirmFileImplement/DataFileSingleton.cs | 1 - 10 files changed, 141 insertions(+), 51 deletions(-) rename LawFirm/LawFirmDatabaseImplement/Migrations/{20240616163258_InitialCreate.Designer.cs => 20240616165923_InitialCreate.Designer.cs} (95%) rename LawFirm/LawFirmDatabaseImplement/Migrations/{20240616163258_InitialCreate.cs => 20240616165923_InitialCreate.cs} (100%) diff --git a/LawFirm/LawFirm/FormMain.Designer.cs b/LawFirm/LawFirm/FormMain.Designer.cs index d17ea9a..afce909 100644 --- a/LawFirm/LawFirm/FormMain.Designer.cs +++ b/LawFirm/LawFirm/FormMain.Designer.cs @@ -28,30 +28,34 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain)); - toolStrip1 = new ToolStrip(); - toolStripDropDownButton1 = new ToolStripDropDownButton(); - компонентыToolStripMenuItem = new ToolStripMenuItem(); - ПутёвкиToolStripMenuItem = new ToolStripMenuItem(); - buttonCreateOrder = new Button(); - buttonTakeOrderInWork = new Button(); - buttonOrderReady = new Button(); - buttonIssuedOrder = new Button(); - buttonRef = new Button(); - dataGridView = new DataGridView(); - toolStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); - SuspendLayout(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.toolStripMenuItemCatalogs = new System.Windows.Forms.ToolStripMenuItem(); + this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.пакетыДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.списокПакетовДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.компонентыПоПакетамДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.buttonCreateOrder = new System.Windows.Forms.Button(); + this.buttonTakeOrderInWork = new System.Windows.Forms.Button(); + this.buttonOrderReady = new System.Windows.Forms.Button(); + this.buttonIssuedOrder = new System.Windows.Forms.Button(); + this.buttonRef = new System.Windows.Forms.Button(); + this.menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); // // menuStrip1 // - toolStrip1.ImageScalingSize = new Size(20, 20); - toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripDropDownButton1 }); - toolStrip1.Location = new Point(0, 0); - toolStrip1.Name = "toolStrip1"; - toolStrip1.Size = new Size(969, 25); - toolStrip1.TabIndex = 0; - toolStrip1.Text = "toolStrip1"; + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItemCatalogs, + this.отчётыToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(910, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "Справочники"; // // toolStripMenuItemCatalogs // @@ -76,6 +80,46 @@ this.пакетыДокументовToolStripMenuItem.Text = "Пакеты документов"; this.пакетыДокументовToolStripMenuItem.Click += new System.EventHandler(this.пакетыДокументовToolStripMenuItem_Click); // + // отчётыToolStripMenuItem + // + this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.списокПакетовДокументовToolStripMenuItem, + this.компонентыПоПакетамДокументовToolStripMenuItem, + this.списокЗаказовToolStripMenuItem}); + this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; + this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20); + this.отчётыToolStripMenuItem.Text = "Отчёты"; + // + // списокПакетовДокументовToolStripMenuItem + // + this.списокПакетовДокументовToolStripMenuItem.Name = "списокПакетовДокументовToolStripMenuItem"; + this.списокПакетовДокументовToolStripMenuItem.Size = new System.Drawing.Size(278, 22); + this.списокПакетовДокументовToolStripMenuItem.Text = "Список пакетов документов"; + this.списокПакетовДокументовToolStripMenuItem.Click += new System.EventHandler(this.списокПакетовДокументовToolStripMenuItem_Click); + // + // компонентыПоПакетамДокументовToolStripMenuItem + // + this.компонентыПоПакетамДокументовToolStripMenuItem.Name = "компонентыПоПакетамДокументовToolStripMenuItem"; + this.компонентыПоПакетамДокументовToolStripMenuItem.Size = new System.Drawing.Size(278, 22); + this.компонентыПоПакетамДокументовToolStripMenuItem.Text = "Компоненты по пакетам документов"; + this.компонентыПоПакетамДокументовToolStripMenuItem.Click += new System.EventHandler(this.компонентыПоПакетамДокументовToolStripMenuItem_Click); + // + // списокЗаказовToolStripMenuItem + // + this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; + this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(278, 22); + this.списокЗаказовToolStripMenuItem.Text = "Список заказов"; + this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокЗаказовToolStripMenuItem_Click); + // + // dataGridView + // + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Location = new System.Drawing.Point(0, 27); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowTemplate.Height = 25; + this.dataGridView.Size = new System.Drawing.Size(736, 411); + this.dataGridView.TabIndex = 1; + // // buttonCreateOrder // this.buttonCreateOrder.Location = new System.Drawing.Point(742, 39); @@ -162,9 +206,9 @@ private Button buttonOrderReady; private Button buttonIssuedOrder; private Button buttonRef; - private DataGridView dataGridView; - private ToolStripDropDownButton toolStripDropDownButton1; - private ToolStripMenuItem компонентыToolStripMenuItem; - private ToolStripMenuItem ПутёвкиToolStripMenuItem; + private ToolStripMenuItem отчётыToolStripMenuItem; + private ToolStripMenuItem списокПакетовДокументовToolStripMenuItem; + private ToolStripMenuItem компонентыПоПакетамДокументовToolStripMenuItem; + private ToolStripMenuItem списокЗаказовToolStripMenuItem; } } \ No newline at end of file diff --git a/LawFirm/LawFirm/FormMain.cs b/LawFirm/LawFirm/FormMain.cs index c1f84a3..a560c07 100644 --- a/LawFirm/LawFirm/FormMain.cs +++ b/LawFirm/LawFirm/FormMain.cs @@ -167,5 +167,50 @@ namespace LawFirmView { LoadData(); } + private OrderBindingModel CreateBindingModel(int id, bool isDone = false) + { + return new OrderBindingModel + { + Id = id, + DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value), + Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), + Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), + Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), + DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), + }; + } + + private void списокПакетовДокументовToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveDocumentsToWordFile(new ReportBindingModel + { + FileName = dialog.FileName + }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } + + private void компонентыПоПакетамДокументовToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportDocumentComponents)); + if (service is FormReportDocumentComponents form) + { + form.ShowDialog(); + } + + } + + private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + } + } } } diff --git a/LawFirm/LawFirm/FormMain.resx b/LawFirm/LawFirm/FormMain.resx index c81a0e7..2e307a2 100644 --- a/LawFirm/LawFirm/FormMain.resx +++ b/LawFirm/LawFirm/FormMain.resx @@ -61,6 +61,6 @@ 17, 17 - 56 + 96 \ No newline at end of file diff --git a/LawFirm/LawFirm/LawFirmView.csproj b/LawFirm/LawFirm/LawFirmView.csproj index 280d7dc..80d7bc0 100644 --- a/LawFirm/LawFirm/LawFirmView.csproj +++ b/LawFirm/LawFirm/LawFirmView.csproj @@ -24,11 +24,11 @@ - + - - Always - - + + Always + + \ No newline at end of file diff --git a/LawFirm/LawFirm/Program.cs b/LawFirm/LawFirm/Program.cs index 073c437..a87c31b 100644 --- a/LawFirm/LawFirm/Program.cs +++ b/LawFirm/LawFirm/Program.cs @@ -1,4 +1,7 @@ using LawFirmBusinessLogic.BusinessLogic; +using LawFirmBusinessLogic.OfficePackage.Implements; +using LawFirmBusinessLogic.OfficePackage; +using LawFirmContracts.BusinessLogicsContracts; using LawFirmContracts.StoragesContracts; using LawFirmDatabaseImplement.Implements; using Microsoft.Extensions.DependencyInjection; @@ -38,15 +41,20 @@ namespace LawFirmView services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); - + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } diff --git a/LawFirm/LawFirmBusinessLogic/LawFirmBusinessLogic.csproj b/LawFirm/LawFirmBusinessLogic/LawFirmBusinessLogic.csproj index ee096ba..b30d1d3 100644 --- a/LawFirm/LawFirmBusinessLogic/LawFirmBusinessLogic.csproj +++ b/LawFirm/LawFirmBusinessLogic/LawFirmBusinessLogic.csproj @@ -7,12 +7,9 @@ - - - - - - + + + diff --git a/LawFirm/LawFirmDatabaseImplement/Implements/OrderStorage.cs b/LawFirm/LawFirmDatabaseImplement/Implements/OrderStorage.cs index a1c1f2f..6421020 100644 --- a/LawFirm/LawFirmDatabaseImplement/Implements/OrderStorage.cs +++ b/LawFirm/LawFirmDatabaseImplement/Implements/OrderStorage.cs @@ -32,9 +32,10 @@ namespace LawFirmDatabaseImplement.Implements } using var context = new LawFirmDatabase(); return context.Orders - .Where(x => x.Id == model.Id) - .Select(x => AccessLawStorage(x.GetViewModel)) - .ToList(); + .Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo) + .Include(x => x.Document) + .Select(x => x.GetViewModel) + .ToList(); } public List GetFullList() diff --git a/LawFirm/LawFirmDatabaseImplement/Migrations/20240616163258_InitialCreate.Designer.cs b/LawFirm/LawFirmDatabaseImplement/Migrations/20240616165923_InitialCreate.Designer.cs similarity index 95% rename from LawFirm/LawFirmDatabaseImplement/Migrations/20240616163258_InitialCreate.Designer.cs rename to LawFirm/LawFirmDatabaseImplement/Migrations/20240616165923_InitialCreate.Designer.cs index 932b461..a9f562a 100644 --- a/LawFirm/LawFirmDatabaseImplement/Migrations/20240616163258_InitialCreate.Designer.cs +++ b/LawFirm/LawFirmDatabaseImplement/Migrations/20240616165923_InitialCreate.Designer.cs @@ -12,11 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace LawFirmDatabaseImplement.Migrations { [DbContext(typeof(LawFirmDatabase))] -<<<<<<<< HEAD:LawFirm/LawFirmDatabaseImplement/Migrations/20240616163258_InitialCreate.Designer.cs - [Migration("20240616163258_InitialCreate")] -======== - [Migration("20240616155435_InitialCreate")] ->>>>>>>> lab3:LawFirm/LawFirmDatabaseImplement/Migrations/20240616155435_InitialCreate.Designer.cs + [Migration("20240616165923_InitialCreate")] partial class InitialCreate { /// diff --git a/LawFirm/LawFirmDatabaseImplement/Migrations/20240616163258_InitialCreate.cs b/LawFirm/LawFirmDatabaseImplement/Migrations/20240616165923_InitialCreate.cs similarity index 100% rename from LawFirm/LawFirmDatabaseImplement/Migrations/20240616163258_InitialCreate.cs rename to LawFirm/LawFirmDatabaseImplement/Migrations/20240616165923_InitialCreate.cs diff --git a/LawFirm/LawFirmFileImplement/DataFileSingleton.cs b/LawFirm/LawFirmFileImplement/DataFileSingleton.cs index 2641f2c..218b937 100644 --- a/LawFirm/LawFirmFileImplement/DataFileSingleton.cs +++ b/LawFirm/LawFirmFileImplement/DataFileSingleton.cs @@ -33,7 +33,6 @@ namespace LawFirmFileImplement Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; Documents = LoadData(DocumentFileName, "Document", x => Document.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; - //Orders = new List(); } private static List? LoadData(string filename, string xmlNodeName, Func selectFunction)