правки 1

This commit is contained in:
GokaPek 2024-04-09 22:12:15 +04:00
parent 78d888b600
commit 87a199d096
30 changed files with 120 additions and 125 deletions

View File

@ -9,7 +9,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" /> <PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="1.50.5147" /> <PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,5 +1,5 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; using AbstractLawFirmBusinessLogic.OfficePackage;
using AbstractLawFirmBusinessLogic.OfficePackage; using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
using AbstractLawFirmContracts.BindingModels; using AbstractLawFirmContracts.BindingModels;
using AbstractLawFirmContracts.BusinessLogicsContracts; using AbstractLawFirmContracts.BusinessLogicsContracts;
using AbstractLawFirmContracts.SearchModels; using AbstractLawFirmContracts.SearchModels;
@ -11,7 +11,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace AbstractLawFirmBusinessLogic namespace AbstractLawFirmBusinessLogic.BusinessLogic
{ {
public class ReportLogic : IReportLogic public class ReportLogic : IReportLogic
{ {
@ -39,24 +39,20 @@ namespace AbstractLawFirmBusinessLogic
/// <returns></returns> /// <returns></returns>
public List<ReportDocumentComponentViewModel> GetDocumentComponent() public List<ReportDocumentComponentViewModel> GetDocumentComponent()
{ {
var components = _componentStorage.GetFullList();
var documents = _documentStorage.GetFullList(); var documents = _documentStorage.GetFullList();
var list = new List<ReportDocumentComponentViewModel>(); var list = new List<ReportDocumentComponentViewModel>();
foreach (var component in components) foreach (var document in documents)
{ {
var record = new ReportDocumentComponentViewModel var record = new ReportDocumentComponentViewModel
{ {
ComponentName = component.ComponentName, DocumentName = document.DocumentName,
Document = new List<Tuple<string, int>>(), Components = new List<(string Component, int Count)>(),
TotalCount = 0 TotalCount = 0
}; };
foreach (var document in documents) foreach (var component in document.DocumentComponents.Values)
{ {
if (document.DocumentComponents.ContainsKey(component.Id)) record.Components.Add((component.Item1.ComponentName, component.Item2));
{ record.TotalCount += component.Item2;
record.Document.Add(new Tuple<string, int>(document.DocumentName, document.DocumentComponents[component.Id].Item2));
record.TotalCount += document.DocumentComponents[component.Id].Item2;
}
} }
list.Add(record); list.Add(record);
} }
@ -71,7 +67,8 @@ namespace AbstractLawFirmBusinessLogic
{ {
return _orderStorage.GetFilteredList(new OrderSearchModel return _orderStorage.GetFilteredList(new OrderSearchModel
{ {
DateFrom = model.DateFrom, DateFrom
= model.DateFrom,
DateTo = model.DateTo DateTo = model.DateTo
}) })
.Select(x => new ReportOrdersViewModel .Select(x => new ReportOrdersViewModel
@ -79,7 +76,8 @@ namespace AbstractLawFirmBusinessLogic
Id = x.Id, Id = x.Id,
DateCreate = x.DateCreate, DateCreate = x.DateCreate,
DocumentName = x.DocumentName, DocumentName = x.DocumentName,
Sum = x.Sum Sum = x.Sum,
Status = x.Status.ToString(),
}) })
.ToList(); .ToList();
} }
@ -87,13 +85,13 @@ namespace AbstractLawFirmBusinessLogic
/// Сохранение компонент в файл-Word /// Сохранение компонент в файл-Word
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
public void SaveComponentsToWordFile(ReportBindingModel model) public void SaveDocumentsToWordFile(ReportBindingModel model)
{ {
_saveToWord.CreateDoc(new WordInfo _saveToWord.CreateDoc(new WordInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список компонент", Title = "Список пакетов документов",
Components = _componentStorage.GetFullList() Documents = _documentStorage.GetFullList()
}); });
} }
/// <summary> /// <summary>
@ -124,6 +122,6 @@ namespace AbstractLawFirmBusinessLogic
Orders = GetOrders(model) Orders = GetOrders(model)
}); });
} }
}
} }
}

View File

@ -1,10 +1,10 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels; using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
using DocumentFormat.OpenXml; using System;
using DocumentFormat.OpenXml.Office2010.Excel; using System.Collections.Generic;
using DocumentFormat.OpenXml.Office2013.Excel; using System.Linq;
using DocumentFormat.OpenXml.Packaging; using System.Text;
using DocumentFormat.OpenXml.Spreadsheet; using System.Threading.Tasks;
namespace AbstractLawFirmBusinessLogic.OfficePackage namespace AbstractLawFirmBusinessLogic.OfficePackage
{ {
@ -30,33 +30,31 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
CellToName = "C1" CellToName = "C1"
}); });
uint rowIndex = 2; uint rowIndex = 2;
foreach (var dc in info.DocumentComponents) foreach (var pc in info.DocumentComponents)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = dc.ComponentName, Text = pc.DocumentName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var document in dc.Document) foreach (var (Component, Count) in pc.Components)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "B", ColumnName = "B",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = document.Item1, Text = Component,
StyleInfo = StyleInfo = ExcelStyleInfoType.TextWithBorder
ExcelStyleInfoType.TextWithBroder
}); });
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = document.Item2.ToString(), Text = Count.ToString(),
StyleInfo = StyleInfo = ExcelStyleInfoType.TextWithBorder
ExcelStyleInfoType.TextWithBroder
}); });
rowIndex++; rowIndex++;
} }
@ -71,7 +69,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = dc.TotalCount.ToString(), Text = pc.TotalCount.ToString(),
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
@ -100,5 +98,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
/// <param name="info"></param> /// <param name="info"></param>
protected abstract void SaveExcel(ExcelInfo info); protected abstract void SaveExcel(ExcelInfo info);
} }
} }

View File

@ -1,10 +1,10 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using System;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
namespace AbstractLawFirmBusinessLogic.OfficePackage namespace AbstractLawFirmBusinessLogic.OfficePackage
{ {
@ -16,18 +16,19 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
CreateParagraph(new PdfParagraph CreateParagraph(new PdfParagraph
{ {
Text = info.Title, Text = info.Title,
Style = Style = "NormalTitle",
"NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
CreateParagraph(new PdfParagraph 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<string> { "2cm", "3cm", "6cm", "3cm" }); CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "4cm" });
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма" }, Texts = new List<string> { "Номер", "Дата заказа", "Пакет документов", "Сумма", "Статус" },
Style = "NormalTitle", Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
@ -36,7 +37,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { order.Id.ToString(), Texts = new List<string> { order.Id.ToString(),
order.DateCreate.ToShortDateString(), order.DocumentName, order.Sum.ToString() }, order.DateCreate.ToShortDateString(), order.DocumentName, order.Sum.ToString(), order.Status },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });
@ -78,4 +79,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
/// <param name="info"></param> /// <param name="info"></param>
protected abstract void SavePdf(PdfInfo info); protected abstract void SavePdf(PdfInfo info);
} }
} }

View File

@ -1,10 +1,10 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using System;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums;
namespace AbstractLawFirmBusinessLogic.OfficePackage namespace AbstractLawFirmBusinessLogic.OfficePackage
{ {
@ -22,11 +22,14 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
JustificationType = WordJustificationType.Center JustificationType = WordJustificationType.Center
} }
}); });
foreach (var component in info.Components) foreach (var document in info.Documents)
{ {
CreateParagraph(new WordParagraph 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 TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",
@ -53,4 +56,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
/// <param name="info"></param> /// <param name="info"></param>
protected abstract void SaveWord(WordInfo info); protected abstract void SaveWord(WordInfo info);
} }
} }

View File

@ -10,7 +10,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums
{ {
Title, Title,
Text, Text,
TextWithBroder TextWithBorder
} }
} }

View File

@ -10,7 +10,6 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums
{ {
Center, Center,
Left, Left,
Rigth Rigth
} }

View File

@ -12,4 +12,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
public string CellToName { get; set; } = string.Empty; public string CellToName { get; set; } = string.Empty;
public string Merge => $"{CellFromName}:{CellToName}"; public string Merge => $"{CellFromName}:{CellToName}";
} }
} }

View File

@ -1,9 +1,9 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums;
namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
{ {
@ -15,4 +15,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
public string CellReference => $"{ColumnName}{RowIndex}"; public string CellReference => $"{ColumnName}{RowIndex}";
public ExcelStyleInfoType StyleInfo { get; set; } public ExcelStyleInfoType StyleInfo { get; set; }
} }
} }

View File

@ -1,9 +1,9 @@
using AbstractLawFirmContracts.ViewModels; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AbstractLawFirmContracts.ViewModels;
namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
{ {
@ -16,6 +16,6 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
get; get;
set; set;
} = new(); } = new();
}
} }
}

View File

@ -15,4 +15,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
public DateTime DateTo { get; set; } public DateTime DateTo { get; set; }
public List<ReportOrdersViewModel> Orders { get; set; } = new(); public List<ReportOrdersViewModel> Orders { get; set; } = new();
} }
} }

View File

@ -1,9 +1,9 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums;
namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
{ {
@ -13,4 +13,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
public string Style { get; set; } = string.Empty; public string Style { get; set; } = string.Empty;
public PdfParagraphAlignmentType ParagraphAlignment { get; set; } public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
} }
} }

View File

@ -1,9 +1,9 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums;
namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
{ {
@ -13,5 +13,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
public string Style { get; set; } = string.Empty; public string Style { get; set; } = string.Empty;
public PdfParagraphAlignmentType ParagraphAlignment { get; set; } public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
} }
}
}

View File

@ -11,6 +11,6 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
{ {
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<ComponentViewModel> Components { get; set; } = new(); public List<DocumentViewModel> Documents { get; set; } = new();
} }
} }

View File

@ -11,4 +11,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
public List<(string, WordTextProperties)> Texts { get; set; } = new(); public List<(string, WordTextProperties)> Texts { get; set; } = new();
public WordTextProperties? TextProperties { get; set; } public WordTextProperties? TextProperties { get; set; }
} }
} }

View File

@ -13,4 +13,4 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.HelperModels
public bool Bold { get; set; } public bool Bold { get; set; }
public WordJustificationType JustificationType { get; set; } public WordJustificationType JustificationType { get; set; }
} }
} }

View File

@ -1,16 +1,16 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using System;
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.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; 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 namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
{ {
@ -105,8 +105,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
var cellFormatFont = new CellFormat() var cellFormatFont = new CellFormat()
{ {
NumberFormatId = 0U, NumberFormatId = 0U,
FontId = FontId = 0U,
0U,
FillId = 0U, FillId = 0U,
BorderId = 0U, BorderId = 0U,
FormatId = 0U, FormatId = 0U,
@ -206,7 +205,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
return styleInfo switch return styleInfo switch
{ {
ExcelStyleInfoType.Title => 2U, ExcelStyleInfoType.Title => 2U,
ExcelStyleInfoType.TextWithBroder => 1U, ExcelStyleInfoType.TextWithBorder => 1U,
ExcelStyleInfoType.Text => 0U, ExcelStyleInfoType.Text => 0U,
_ => 0U, _ => 0U,
}; };
@ -283,8 +282,8 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
else else
{ {
// Все ячейки должны быть последовательно друг за другом расположены // Все ячейки должны быть последовательно друг за другом расположены
// нужно определить, после какой вставлять // нужно определить, после какой вставлять
Cell? refCell = null; Cell? refCell = null;
foreach (Cell rowCell in row.Elements<Cell>()) foreach (Cell rowCell in row.Elements<Cell>())
{ {
if (string.Compare(rowCell.CellReference!.Value, if (string.Compare(rowCell.CellReference!.Value,
@ -350,8 +349,8 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
return; return;
} }
_spreadsheetDocument.WorkbookPart!.Workbook.Save(); _spreadsheetDocument.WorkbookPart!.Workbook.Save();
//_spreadsheetDocument.Close(); _spreadsheetDocument.Dispose();
} }
}
} }
}

View File

@ -1,13 +1,13 @@
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums; using System;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; 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 namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
{ {
@ -102,5 +102,6 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
renderer.RenderDocument(); renderer.RenderDocument();
renderer.PdfDocument.Save(info.FileName); renderer.PdfDocument.Save(info.FileName);
} }
} }
} }

View File

@ -1,15 +1,14 @@
using System; using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperEnums;
using AbstractLawFirmBusinessLogic.OfficePackage.HelperModels;
using DocumentFormat.OpenXml; using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing; using DocumentFormat.OpenXml.Wordprocessing;
namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
{ {
public class SaveToWord : AbstractSaveToWord public class SaveToWord : AbstractSaveToWord
@ -125,7 +124,8 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
} }
_docBody.AppendChild(CreateSectionProperties()); _docBody.AppendChild(CreateSectionProperties());
_wordDocument.MainDocumentPart!.Document.Save(); _wordDocument.MainDocumentPart!.Document.Save();
//_wordDocument.Close(); _wordDocument.Dispose();
} }
} }
} }

View File

@ -12,4 +12,4 @@ namespace AbstractLawFirmContracts.BindingModels
public DateTime? DateFrom { get; set; } public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; } public DateTime? DateTo { get; set; }
} }
} }

View File

@ -25,7 +25,7 @@ namespace AbstractLawFirmContracts.BusinessLogicsContracts
/// Сохранение компонент в файл-Word /// Сохранение компонент в файл-Word
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
void SaveComponentsToWordFile(ReportBindingModel model); void SaveDocumentsToWordFile(ReportBindingModel model);
/// <summary> /// <summary>
/// Сохранение компонент с указаеним продуктов в файл-Excel /// Сохранение компонент с указаеним продуктов в файл-Excel
/// </summary> /// </summary>
@ -37,4 +37,4 @@ namespace AbstractLawFirmContracts.BusinessLogicsContracts
/// <param name="model"></param> /// <param name="model"></param>
void SaveOrdersToPdfFile(ReportBindingModel model); void SaveOrdersToPdfFile(ReportBindingModel model);
} }
} }

View File

@ -8,8 +8,8 @@ namespace AbstractLawFirmContracts.ViewModels
{ {
public class ReportDocumentComponentViewModel public class ReportDocumentComponentViewModel
{ {
public string ComponentName { get; set; } = string.Empty; public string DocumentName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<Tuple<string, int>> Document { get; set; } = new(); public List<(string Component, int Count)> Components { get; set; } = new();
} }
} }

View File

@ -12,6 +12,6 @@ namespace AbstractLawFirmContracts.ViewModels
public DateTime DateCreate { get; set; } public DateTime DateCreate { get; set; }
public string DocumentName { get; set; } = string.Empty; public string DocumentName { get; set; } = string.Empty;
public double Sum { get; set; } public double Sum { get; set; }
public String Status { get; set; } = string.Empty;
} }
} }

View File

@ -42,13 +42,13 @@ namespace AbstractLawFirmDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
{ {
return new(); return new();
} }
using var context = new AbstractLawFirmDataBase(); using var context = new AbstractLawFirmDataBase();
return context.Orders 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) .Select(x => x.GetViewModel)
.ToList(); .ToList();
} }

View File

@ -32,11 +32,11 @@ namespace AbstractLawFirmFileImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
{ {
return new(); 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<OrderViewModel> GetFullList() public List<OrderViewModel> GetFullList()

View File

@ -37,7 +37,7 @@ namespace AbstractLawFirmListImplement.Implements
} }
foreach (var order in _source.Orders) 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)); result.Add(AccessDocumentStorage(order.GetViewModel));
} }

View File

@ -184,7 +184,7 @@ namespace LawFirmView
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK) if (dialog.ShowDialog() == DialogResult.OK)
{ {
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel _reportLogic.SaveDocumentsToWordFile(new ReportBindingModel
{ {
FileName = dialog.FileName FileName = dialog.FileName
}); });

View File

@ -35,8 +35,8 @@ namespace LawFirmView
foreach (var elem in dict) foreach (var elem in dict)
{ {
// проверить ComponentName Document (поменять местами) // проверить ComponentName Document (поменять местами)
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" }); dataGridView.Rows.Add(new object[] { elem.DocumentName, "", "" });
foreach (var listElem in elem.Document) foreach (var listElem in elem.Components)
{ {
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
} }

View File

@ -9,7 +9,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Data.Tools.Msbuild" Version="16.0.62004.28040" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.28"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.28">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -1,4 +1,3 @@
using AbstractLawFirmBusinessLogic;
using AbstractLawFirmBusinessLogic.BusinessLogic; using AbstractLawFirmBusinessLogic.BusinessLogic;
using AbstractLawFirmBusinessLogic.OfficePackage.Implements; using AbstractLawFirmBusinessLogic.OfficePackage.Implements;
using AbstractLawFirmBusinessLogic.OfficePackage; using AbstractLawFirmBusinessLogic.OfficePackage;