diff --git a/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs new file mode 100644 index 0000000..cb724fe --- /dev/null +++ b/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -0,0 +1,58 @@ +using JewelryStoreBusinessLogic.OfficePackage.HelperModels; +using JewelryStoreBusinessLogic.OfficePackage.HelperEnums; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreBusinessLogic.OfficePackage +{ + public abstract class AbstractSaveToWord + { + public void CreateDoc(WordInfo info) + { + CreateWord(info); + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> { (info.Title, newWordTextProperties { Bold = true, Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Center + } + }); + foreach (var component in info.Components) + { + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> {(component.ComponentName, new WordTextProperties { Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Both + } + }); + } + SaveWord(info); + } + /// + /// Создание doc-файла + /// + /// + protected abstract void CreateWord(WordInfo info); + /// + /// Создание абзаца с текстом + /// + /// + /// + protected abstract void CreateParagraph(WordParagraph paragraph); + /// + /// Сохранение файла + /// + /// + protected abstract void SaveWord(WordInfo info); + + } +} diff --git a/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordInfo.cs new file mode 100644 index 0000000..28a45b5 --- /dev/null +++ b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -0,0 +1,17 @@ +using JewelryStoreContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels +{ + public class WordInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public List Components { get; set; } = new(); + + } +} diff --git a/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordJustificationType.cs b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordJustificationType.cs new file mode 100644 index 0000000..4060b56 --- /dev/null +++ b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordJustificationType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels +{ + public enum WordJustificationType + { + Center, + Both + } +} diff --git a/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs new file mode 100644 index 0000000..2e9d0b2 --- /dev/null +++ b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels +{ + public class WordParagraph + { + public List<(string, WordTextProperties)> Texts { get; set; } = new(); + public WordTextProperties? TextProperties { get; set; } + + } +} diff --git a/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs new file mode 100644 index 0000000..db02e60 --- /dev/null +++ b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels +{ + public class WordTextProperties + { + public string Size { get; set; } = string.Empty; + public bool Bold { get; set; } + public WordJustificationType JustificationType { get; set; } + } +} diff --git a/JewelryStoreBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/JewelryStoreBusinessLogic/OfficePackage/Implements/SaveToWord.cs new file mode 100644 index 0000000..c1083a6 --- /dev/null +++ b/JewelryStoreBusinessLogic/OfficePackage/Implements/SaveToWord.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreBusinessLogic.OfficePackage.Implements +{ + internal class SaveToWord + { + } +} diff --git a/JewelryStoreContracts/BindingModels/ReportBindingModel.cs b/JewelryStoreContracts/BindingModels/ReportBindingModel.cs new file mode 100644 index 0000000..cb1fac7 --- /dev/null +++ b/JewelryStoreContracts/BindingModels/ReportBindingModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreContracts.BindingModels +{ + public class ReportBindingModel + { + public string FileName { get; set; } = string.Empty; + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } + } +} diff --git a/JewelryStoreContracts/BusinessLogicsContracts/IReportLogic.cs b/JewelryStoreContracts/BusinessLogicsContracts/IReportLogic.cs new file mode 100644 index 0000000..995fa24 --- /dev/null +++ b/JewelryStoreContracts/BusinessLogicsContracts/IReportLogic.cs @@ -0,0 +1,41 @@ +using JewelryStoreContracts.BindingModels; +using JewelryStoreContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreContracts.BusinessLogicsContracts +{ + public interface IReportLogic + { + /// + /// Получение списка компонент с указанием, в каких изделиях используются + /// + /// + List GetJewelComponent(); + /// + /// Получение списка заказов за определенный период + /// + /// + /// + List GetOrders(ReportBindingModel model); + /// + /// Сохранение компонент в файл-Word + /// + /// + void SaveComponentsToWordFile(ReportBindingModel model); + /// + /// Сохранение компонент с указаеним продуктов в файл-Excel + /// + /// + void SaveJewelComponentToExcelFile(ReportBindingModel model); + /// + /// Сохранение заказов в файл-Pdf + /// + /// + void SaveOrdersToPdfFile(ReportBindingModel model); + + } +} diff --git a/JewelryStoreContracts/ViewModels/ReportJewelComponentViewModel.cs b/JewelryStoreContracts/ViewModels/ReportJewelComponentViewModel.cs new file mode 100644 index 0000000..1f05466 --- /dev/null +++ b/JewelryStoreContracts/ViewModels/ReportJewelComponentViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreContracts.ViewModels +{ + public class ReportJewelComponentViewModel + { + public string JewelName { get; set; } = string.Empty; + public int TotalCount { get; set; } + public List> Products { get; set; } = new(); + } +} diff --git a/JewelryStoreContracts/ViewModels/ReportOrdersViewModel.cs b/JewelryStoreContracts/ViewModels/ReportOrdersViewModel.cs new file mode 100644 index 0000000..8f927c0 --- /dev/null +++ b/JewelryStoreContracts/ViewModels/ReportOrdersViewModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JewelryStoreContracts.ViewModels +{ + public class ReportOrdersViewModel + { + public int Id { get; set; } + public DateTime DateCreate { get; set; } + public string JewelName { get; set; } = string.Empty; + public double Sum { get; set; } + + } +}