From 87a199d09618661596edda35400b9ae27d246cf0 Mon Sep 17 00:00:00 2001 From: GokaPek Date: Tue, 9 Apr 2024 22:12:15 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractLawFirmBusinessLogic.csproj | 2 +- .../{ => BusinessLogic}/ReportLogic.cs | 38 +++++++++---------- .../OfficePackage/AbstractSaveToExcel.cs | 31 +++++++-------- .../OfficePackage/AbstractSaveToPdf.cs | 21 +++++----- .../OfficePackage/AbstractSaveToWord.cs | 15 +++++--- .../HelperEnums/ExelStyleInfoType.cs | 2 +- .../HelperEnums/PdfParagraphAlignmentType.cs | 1 - .../HelperModels/ExcelMergeParameters.cs | 2 +- .../HelperModels/ExelCellParameters.cs | 6 +-- .../OfficePackage/HelperModels/ExelInfo.cs | 8 ++-- .../OfficePackage/HelperModels/PdfInfo.cs | 2 +- .../HelperModels/PdfParagraph.cs | 6 +-- .../HelperModels/PdfRowParameters.cs | 7 ++-- .../OfficePackage/HelperModels/WordInfo.cs | 4 +- .../HelperModels/WordParagraph.cs | 2 +- .../HelperModels/WordTextProperties.cs | 2 +- .../OfficePackage/Implements/SaveToExel.cs | 35 +++++++++-------- .../OfficePackage/Implements/SaveToPdf.cs | 15 ++++---- .../OfficePackage/Implements/SaveToWord.cs | 12 +++--- .../BindingModels/ReportBindingModel.cs | 2 +- .../BusinessLogicsContracts/IReportLogic.cs | 4 +- .../ReportDocumentComponentViewModel.cs | 6 +-- .../ViewModels/ReportOrdersViewModel.cs | 4 +- .../Implements/OrderStorage.cs | 4 +- .../Implements/OrderStorage.cs | 4 +- .../Implements/OrderStorage.cs | 2 +- LawFirm/LawFirmView/FormMain.cs | 2 +- .../FormReportDocumentComponents.cs | 4 +- LawFirm/LawFirmView/LawFirmView.csproj | 1 - LawFirm/LawFirmView/Program.cs | 1 - 30 files changed, 120 insertions(+), 125 deletions(-) rename LawFirm/AbstractLawFirmBusinessLogic/{ => BusinessLogic}/ReportLogic.cs (79%) diff --git a/LawFirm/AbstractLawFirmBusinessLogic/AbstractLawFirmBusinessLogic.csproj b/LawFirm/AbstractLawFirmBusinessLogic/AbstractLawFirmBusinessLogic.csproj index e013934..c1db291 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/AbstractLawFirmBusinessLogic.csproj +++ b/LawFirm/AbstractLawFirmBusinessLogic/AbstractLawFirmBusinessLogic.csproj @@ -9,7 +9,7 @@ - + diff --git a/LawFirm/AbstractLawFirmBusinessLogic/ReportLogic.cs b/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ReportLogic.cs similarity index 79% rename from LawFirm/AbstractLawFirmBusinessLogic/ReportLogic.cs rename to LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ReportLogic.cs index 8cd2aaf..49dde1e 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/ReportLogic.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ReportLogic.cs @@ -1,5 +1,5 @@ -using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; -using AbstractLawFirmBusinessLogic.OfficePackage; +using AbstractLawFirmBusinessLogic.OfficePackage; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; using AbstractLawFirmContracts.BindingModels; using AbstractLawFirmContracts.BusinessLogicsContracts; using AbstractLawFirmContracts.SearchModels; @@ -11,7 +11,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace AbstractLawFirmBusinessLogic +namespace AbstractLawFirmBusinessLogic.BusinessLogic { public class ReportLogic : IReportLogic { @@ -39,24 +39,20 @@ namespace AbstractLawFirmBusinessLogic /// public List GetDocumentComponent() { - var components = _componentStorage.GetFullList(); var documents = _documentStorage.GetFullList(); var list = new List(); - foreach (var component in components) + foreach (var document in documents) { var record = new ReportDocumentComponentViewModel { - ComponentName = component.ComponentName, - Document = new List>(), + DocumentName = document.DocumentName, + Components = new List<(string Component, int Count)>(), TotalCount = 0 }; - foreach (var document in documents) + foreach (var component in document.DocumentComponents.Values) { - if (document.DocumentComponents.ContainsKey(component.Id)) - { - record.Document.Add(new Tuple(document.DocumentName, document.DocumentComponents[component.Id].Item2)); - record.TotalCount += document.DocumentComponents[component.Id].Item2; - } + record.Components.Add((component.Item1.ComponentName, component.Item2)); + record.TotalCount += component.Item2; } list.Add(record); } @@ -71,7 +67,8 @@ namespace AbstractLawFirmBusinessLogic { return _orderStorage.GetFilteredList(new OrderSearchModel { - DateFrom = model.DateFrom, + DateFrom + = model.DateFrom, DateTo = model.DateTo }) .Select(x => new ReportOrdersViewModel @@ -79,7 +76,8 @@ namespace AbstractLawFirmBusinessLogic Id = x.Id, DateCreate = x.DateCreate, DocumentName = x.DocumentName, - Sum = x.Sum + Sum = x.Sum, + Status = x.Status.ToString(), }) .ToList(); } @@ -87,13 +85,13 @@ namespace AbstractLawFirmBusinessLogic /// Сохранение компонент в файл-Word /// /// - public void SaveComponentsToWordFile(ReportBindingModel model) + public void SaveDocumentsToWordFile(ReportBindingModel model) { _saveToWord.CreateDoc(new WordInfo { FileName = model.FileName, - Title = "Список компонент", - Components = _componentStorage.GetFullList() + Title = "Список пакетов документов", + Documents = _documentStorage.GetFullList() }); } /// @@ -124,6 +122,6 @@ namespace AbstractLawFirmBusinessLogic Orders = GetOrders(model) }); } - } -} + } +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index a93401a..2676966 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -1,10 +1,10 @@ using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; -using DocumentFormat.OpenXml; -using DocumentFormat.OpenXml.Office2010.Excel; -using DocumentFormat.OpenXml.Office2013.Excel; -using DocumentFormat.OpenXml.Packaging; -using DocumentFormat.OpenXml.Spreadsheet; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; namespace AbstractLawFirmBusinessLogic.OfficePackage { @@ -30,33 +30,31 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage CellToName = "C1" }); uint rowIndex = 2; - foreach (var dc in info.DocumentComponents) + foreach (var pc in info.DocumentComponents) { InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "A", RowIndex = rowIndex, - Text = dc.ComponentName, + Text = pc.DocumentName, StyleInfo = ExcelStyleInfoType.Text }); rowIndex++; - foreach (var document in dc.Document) + foreach (var (Component, Count) in pc.Components) { InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "B", RowIndex = rowIndex, - Text = document.Item1, - StyleInfo = - ExcelStyleInfoType.TextWithBroder + Text = Component, + StyleInfo = ExcelStyleInfoType.TextWithBorder }); InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "C", RowIndex = rowIndex, - Text = document.Item2.ToString(), - StyleInfo = - ExcelStyleInfoType.TextWithBroder + Text = Count.ToString(), + StyleInfo = ExcelStyleInfoType.TextWithBorder }); rowIndex++; } @@ -71,7 +69,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage { ColumnName = "C", RowIndex = rowIndex, - Text = dc.TotalCount.ToString(), + Text = pc.TotalCount.ToString(), StyleInfo = ExcelStyleInfoType.Text }); rowIndex++; @@ -100,5 +98,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage /// protected abstract void SaveExcel(ExcelInfo info); } -} - +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index b117438..55c96b8 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -1,10 +1,10 @@ -using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; -using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; namespace AbstractLawFirmBusinessLogic.OfficePackage { @@ -16,18 +16,19 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage CreateParagraph(new PdfParagraph { Text = info.Title, - Style = - "NormalTitle", + Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { - Text = $"с{ info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style= "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center + Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Center }); - CreateTable(new List { "2cm", "3cm", "6cm", "3cm" }); + CreateTable(new List { "2cm", "3cm", "6cm", "3cm", "4cm" }); CreateRow(new PdfRowParameters { - Texts = new List { "Номер", "Дата заказа", "Изделие", "Сумма" }, + Texts = new List { "Номер", "Дата заказа", "Пакет документов", "Сумма", "Статус" }, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); @@ -36,7 +37,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage CreateRow(new PdfRowParameters { Texts = new List { order.Id.ToString(), - order.DateCreate.ToShortDateString(), order.DocumentName, order.Sum.ToString() }, + order.DateCreate.ToShortDateString(), order.DocumentName, order.Sum.ToString(), order.Status }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); @@ -78,4 +79,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage /// protected abstract void SavePdf(PdfInfo info); } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs index b852d71..dd6d65f 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -1,10 +1,10 @@ -using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; -using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; namespace AbstractLawFirmBusinessLogic.OfficePackage { @@ -22,11 +22,14 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage JustificationType = WordJustificationType.Center } }); - foreach (var component in info.Components) + foreach (var document in info.Documents) { CreateParagraph(new WordParagraph { - Texts = new List<(string, WordTextProperties)> { (component.ComponentName, new WordTextProperties { Size = "24", }) }, + Texts = new List<(string, WordTextProperties)> { + (document.DocumentName + " - ", new WordTextProperties { Size = "24", Bold = true}), + (document.Price.ToString(), new WordTextProperties { Size = "24", }) + }, TextProperties = new WordTextProperties { Size = "24", @@ -53,4 +56,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage /// protected abstract void SaveWord(WordInfo info); } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperEnums/ExelStyleInfoType.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperEnums/ExelStyleInfoType.cs index b497a9c..23ac320 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperEnums/ExelStyleInfoType.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperEnums/ExelStyleInfoType.cs @@ -10,7 +10,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums { Title, Text, - TextWithBroder + TextWithBorder } } diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs index d527761..85e3354 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs @@ -10,7 +10,6 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums { Center, Left, - Rigth } diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs index 7a5d2cc..8c39e2b 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs @@ -12,4 +12,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels public string CellToName { get; set; } = string.Empty; public string Merge => $"{CellFromName}:{CellToName}"; } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExelCellParameters.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExelCellParameters.cs index 17b32b2..3cfb5a0 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExelCellParameters.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExelCellParameters.cs @@ -1,9 +1,9 @@ -using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels { @@ -15,4 +15,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels public string CellReference => $"{ColumnName}{RowIndex}"; public ExcelStyleInfoType StyleInfo { get; set; } } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExelInfo.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExelInfo.cs index 9e835f9..1a0187b 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExelInfo.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/ExelInfo.cs @@ -1,9 +1,9 @@ -using AbstractLawFirmContracts.ViewModels; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using AbstractLawFirmContracts.ViewModels; namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels { @@ -16,6 +16,6 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels get; set; } = new(); - } -} + } +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs index 0d16f6f..67ec0f6 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs @@ -15,4 +15,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels public DateTime DateTo { get; set; } public List Orders { get; set; } = new(); } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs index 85c57dd..853f1cb 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs @@ -1,9 +1,9 @@ -using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels { @@ -13,4 +13,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels public string Style { get; set; } = string.Empty; public PdfParagraphAlignmentType ParagraphAlignment { get; set; } } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs index 0f76c70..7e2f0ea 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs @@ -1,9 +1,9 @@ -using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels { @@ -13,5 +13,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels public string Style { get; set; } = string.Empty; public PdfParagraphAlignmentType ParagraphAlignment { get; set; } } - -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordInfo.cs index 321727f..a92a9a9 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordInfo.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -11,6 +11,6 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels { public string FileName { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; - public List Components { get; set; } = new(); + public List Documents { get; set; } = new(); } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs index 2c13a95..f558f0c 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs @@ -11,4 +11,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels public List<(string, WordTextProperties)> Texts { get; set; } = new(); public WordTextProperties? TextProperties { get; set; } } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs index 08c3674..214951c 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs @@ -13,4 +13,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels public bool Bold { get; set; } public WordJustificationType JustificationType { get; set; } } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToExel.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToExel.cs index 5c6c8f8..c5353d1 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToExel.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToExel.cs @@ -1,16 +1,16 @@ -using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; -using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; -using DocumentFormat.OpenXml.Office2010.Excel; -using DocumentFormat.OpenXml.Office2013.Excel; -using DocumentFormat.OpenXml.Office2016.Excel; -using DocumentFormat.OpenXml.Packaging; -using DocumentFormat.OpenXml.Spreadsheet; -using DocumentFormat.OpenXml; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; +using DocumentFormat.OpenXml.Office2010.Excel; +using DocumentFormat.OpenXml.Office2013.Excel; +using DocumentFormat.OpenXml; +using DocumentFormat.OpenXml.Packaging; +using DocumentFormat.OpenXml.Spreadsheet; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; + + namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements { @@ -105,8 +105,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements var cellFormatFont = new CellFormat() { NumberFormatId = 0U, - FontId = - 0U, + FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U, @@ -206,7 +205,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements return styleInfo switch { ExcelStyleInfoType.Title => 2U, - ExcelStyleInfoType.TextWithBroder => 1U, + ExcelStyleInfoType.TextWithBorder => 1U, ExcelStyleInfoType.Text => 0U, _ => 0U, }; @@ -283,8 +282,8 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements else { // Все ячейки должны быть последовательно друг за другом расположены - // нужно определить, после какой вставлять - Cell? refCell = null; + // нужно определить, после какой вставлять + Cell? refCell = null; foreach (Cell rowCell in row.Elements()) { if (string.Compare(rowCell.CellReference!.Value, @@ -350,8 +349,8 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements return; } _spreadsheetDocument.WorkbookPart!.Workbook.Save(); - //_spreadsheetDocument.Close(); + _spreadsheetDocument.Dispose(); } - } -} + } +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToPdf.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToPdf.cs index efe7ab4..1609c50 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToPdf.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToPdf.cs @@ -1,13 +1,13 @@ -using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; -using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; -using MigraDoc.DocumentObjectModel; -using MigraDoc.DocumentObjectModel.Tables; -using MigraDoc.Rendering; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using MigraDoc.DocumentObjectModel; +using MigraDoc.Rendering; +using MigraDoc.DocumentObjectModel.Tables; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements { @@ -102,5 +102,6 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements renderer.RenderDocument(); renderer.PdfDocument.Save(info.FileName); } + } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToWord.cs index c8216a2..0938398 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToWord.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToWord.cs @@ -1,15 +1,14 @@ -using System; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; +using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; -using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Wordprocessing; - namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements { public class SaveToWord : AbstractSaveToWord @@ -125,7 +124,8 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements } _docBody.AppendChild(CreateSectionProperties()); _wordDocument.MainDocumentPart!.Document.Save(); - //_wordDocument.Close(); + _wordDocument.Dispose(); } + } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BindingModels/ReportBindingModel.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BindingModels/ReportBindingModel.cs index ab0ab39..3bbc3f9 100644 --- a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BindingModels/ReportBindingModel.cs +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BindingModels/ReportBindingModel.cs @@ -12,4 +12,4 @@ namespace AbstractLawFirmContracts.BindingModels public DateTime? DateFrom { get; set; } public DateTime? DateTo { get; set; } } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BusinessLogicsContracts/IReportLogic.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BusinessLogicsContracts/IReportLogic.cs index 3f503c0..0081cc7 100644 --- a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BusinessLogicsContracts/IReportLogic.cs +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/BusinessLogicsContracts/IReportLogic.cs @@ -25,7 +25,7 @@ namespace AbstractLawFirmContracts.BusinessLogicsContracts /// Сохранение компонент в файл-Word /// /// - void SaveComponentsToWordFile(ReportBindingModel model); + void SaveDocumentsToWordFile(ReportBindingModel model); /// /// Сохранение компонент с указаеним продуктов в файл-Excel /// @@ -37,4 +37,4 @@ namespace AbstractLawFirmContracts.BusinessLogicsContracts /// void SaveOrdersToPdfFile(ReportBindingModel model); } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportDocumentComponentViewModel.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportDocumentComponentViewModel.cs index 18168c7..d28503b 100644 --- a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportDocumentComponentViewModel.cs +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportDocumentComponentViewModel.cs @@ -8,8 +8,8 @@ namespace AbstractLawFirmContracts.ViewModels { public class ReportDocumentComponentViewModel { - public string ComponentName { get; set; } = string.Empty; + public string DocumentName { get; set; } = string.Empty; public int TotalCount { get; set; } - public List> Document { get; set; } = new(); + public List<(string Component, int Count)> Components { get; set; } = new(); } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportOrdersViewModel.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportOrdersViewModel.cs index 493ee80..4d6c474 100644 --- a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportOrdersViewModel.cs +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportOrdersViewModel.cs @@ -12,6 +12,6 @@ namespace AbstractLawFirmContracts.ViewModels public DateTime DateCreate { get; set; } public string DocumentName { get; set; } = string.Empty; public double Sum { get; set; } - + public String Status { get; set; } = string.Empty; } -} +} \ No newline at end of file diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Implements/OrderStorage.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Implements/OrderStorage.cs index 52f2afa..fb419ea 100644 --- a/LawFirm/AbstractLawFirmDatabaseImplement/Implements/OrderStorage.cs +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Implements/OrderStorage.cs @@ -42,13 +42,13 @@ namespace AbstractLawFirmDatabaseImplement.Implements public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) + if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) { return new(); } using var context = new AbstractLawFirmDataBase(); return context.Orders - .Where(x => x.Id == model.Id) + .Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo) .Select(x => x.GetViewModel) .ToList(); } diff --git a/LawFirm/AbstractLawFirmFileImpliment/Implements/OrderStorage.cs b/LawFirm/AbstractLawFirmFileImpliment/Implements/OrderStorage.cs index 2674094..2a873f3 100644 --- a/LawFirm/AbstractLawFirmFileImpliment/Implements/OrderStorage.cs +++ b/LawFirm/AbstractLawFirmFileImpliment/Implements/OrderStorage.cs @@ -32,11 +32,11 @@ namespace AbstractLawFirmFileImplement.Implements public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) + if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) { return new(); } - return source.Orders.Where(x => x.Id == model.Id).Select(x => GetViewModel(x)).ToList(); + return source.Orders.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList(); } public List GetFullList() diff --git a/LawFirm/AbstractLawFirmListImplement/Implements/OrderStorage.cs b/LawFirm/AbstractLawFirmListImplement/Implements/OrderStorage.cs index 82a0ece..6d5d65c 100644 --- a/LawFirm/AbstractLawFirmListImplement/Implements/OrderStorage.cs +++ b/LawFirm/AbstractLawFirmListImplement/Implements/OrderStorage.cs @@ -37,7 +37,7 @@ namespace AbstractLawFirmListImplement.Implements } foreach (var order in _source.Orders) { - if (order.Id == model.Id) + if (order.Id == model.Id || model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo) { result.Add(AccessDocumentStorage(order.GetViewModel)); } diff --git a/LawFirm/LawFirmView/FormMain.cs b/LawFirm/LawFirmView/FormMain.cs index a43fdeb..d3d4f04 100644 --- a/LawFirm/LawFirmView/FormMain.cs +++ b/LawFirm/LawFirmView/FormMain.cs @@ -184,7 +184,7 @@ namespace LawFirmView using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; if (dialog.ShowDialog() == DialogResult.OK) { - _reportLogic.SaveComponentsToWordFile(new ReportBindingModel + _reportLogic.SaveDocumentsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); diff --git a/LawFirm/LawFirmView/FormReportDocumentComponents.cs b/LawFirm/LawFirmView/FormReportDocumentComponents.cs index 28f0680..6a8bf0a 100644 --- a/LawFirm/LawFirmView/FormReportDocumentComponents.cs +++ b/LawFirm/LawFirmView/FormReportDocumentComponents.cs @@ -35,8 +35,8 @@ namespace LawFirmView foreach (var elem in dict) { // проверить ComponentName Document (поменять местами) - dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" }); - foreach (var listElem in elem.Document) + dataGridView.Rows.Add(new object[] { elem.DocumentName, "", "" }); + foreach (var listElem in elem.Components) { dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); } diff --git a/LawFirm/LawFirmView/LawFirmView.csproj b/LawFirm/LawFirmView/LawFirmView.csproj index 6f8e541..c2052cd 100644 --- a/LawFirm/LawFirmView/LawFirmView.csproj +++ b/LawFirm/LawFirmView/LawFirmView.csproj @@ -9,7 +9,6 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/LawFirm/LawFirmView/Program.cs b/LawFirm/LawFirmView/Program.cs index 4d10dbc..d655516 100644 --- a/LawFirm/LawFirmView/Program.cs +++ b/LawFirm/LawFirmView/Program.cs @@ -1,4 +1,3 @@ -using AbstractLawFirmBusinessLogic; using AbstractLawFirmBusinessLogic.BusinessLogic; using AbstractLawFirmBusinessLogic.OfficePackage.Implements; using AbstractLawFirmBusinessLogic.OfficePackage;