From 62f847e5f61b06bf0f1188e6197856cd73168196 Mon Sep 17 00:00:00 2001 From: antoc0der <1@DESKTOP-K1L8ND3> Date: Thu, 2 May 2024 10:46:04 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=80=D1=83=D1=87=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=20=D0=BE=D1=82=D1=87=D0=B5=D1=82=D1=8B=20?= =?UTF-8?q?=D1=87=D0=B5=20=D1=82=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OfficePackage/AbstractSaveToExcel.cs | 24 +++++++++++++++++++ .../HelperEnums/ExcelStyleInfoType.cs | 15 ++++++++++++ .../HelperModels/ExcelCellParameters.cs | 18 ++++++++++++++ .../OfficePackage/HelperModels/ExcelInfo.cs | 15 ++++++++++++ .../HelperModels/ExcelMergeParameters.cs | 15 ++++++++++++ .../VeterinaryBusinessLogic.csproj | 3 +-- .../ViewModels/BigReportViewModel.cs | 12 ++++++++++ .../ReportPurchaseMedicationModel.cs | 15 ++++++++++++ 8 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 VeterinaryView/VeterinaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs create mode 100644 VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs create mode 100644 VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs create mode 100644 VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs create mode 100644 VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs create mode 100644 VeterinaryView/VeterinaryContracts/ViewModels/BigReportViewModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/ViewModels/ReportPurchaseMedicationModel.cs diff --git a/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs new file mode 100644 index 0000000..fd77389 --- /dev/null +++ b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VeterinaryBusinessLogic.OfficePackage.HelperModels; + +namespace VeterinaryBusinessLogic.OfficePackage +{ + public abstract class AbstractSaveToExcel + { + /// Создание excel-файла + protected abstract void CreateExcel(ExcelInfo info); + + /// Добавляем новую ячейку в лист + protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams); + + /// Объединение ячеек + protected abstract void MergeCells(ExcelMergeParameters excelParams); + + /// Сохранение файла + protected abstract void SaveExcel(ExcelInfo info); + } +} diff --git a/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs new file mode 100644 index 0000000..e9e76fe --- /dev/null +++ b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VeterinaryBusinessLogic.OfficePackage.HelperEnums +{ + public enum ExcelStyleInfoType + { + Title, + Text, + TextWithBroder + } +} diff --git a/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs new file mode 100644 index 0000000..f418e88 --- /dev/null +++ b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VeterinaryBusinessLogic.OfficePackage.HelperEnums; + +namespace VeterinaryBusinessLogic.OfficePackage.HelperModels +{ + public class ExcelCellParameters + { + public string ColumnName { get; set; } = string.Empty; + public uint RowIndex { get; set; } + public string Text { get; set; } = string.Empty; + public string CellReference => $"{ColumnName}{RowIndex}"; + public ExcelStyleInfoType StyleInfo { get; set; } + } +} diff --git a/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs new file mode 100644 index 0000000..d4bd360 --- /dev/null +++ b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VeterinaryBusinessLogic.OfficePackage.HelperModels +{ + public class ExcelInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public List PurchaseMedications { get; set; } = new(); + } +} diff --git a/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs new file mode 100644 index 0000000..c15779e --- /dev/null +++ b/VeterinaryView/VeterinaryBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VeterinaryBusinessLogic.OfficePackage.HelperModels +{ + public class ExcelMergeParameters + { + public string CellFromName { get; set; } = string.Empty; + public string CellToName { get; set; } = string.Empty; + public string Merge => $"{CellFromName}:{CellToName}"; + } +} diff --git a/VeterinaryView/VeterinaryBusinessLogic/VeterinaryBusinessLogic.csproj b/VeterinaryView/VeterinaryBusinessLogic/VeterinaryBusinessLogic.csproj index 52a5007..cb0a8ba 100644 --- a/VeterinaryView/VeterinaryBusinessLogic/VeterinaryBusinessLogic.csproj +++ b/VeterinaryView/VeterinaryBusinessLogic/VeterinaryBusinessLogic.csproj @@ -15,8 +15,7 @@ - - + diff --git a/VeterinaryView/VeterinaryContracts/ViewModels/BigReportViewModel.cs b/VeterinaryView/VeterinaryContracts/ViewModels/BigReportViewModel.cs new file mode 100644 index 0000000..67ad75a --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/ViewModels/BigReportViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VeterinaryContracts.ViewModels +{ + internal class BigReportViewModel + { + } +} diff --git a/VeterinaryView/VeterinaryContracts/ViewModels/ReportPurchaseMedicationModel.cs b/VeterinaryView/VeterinaryContracts/ViewModels/ReportPurchaseMedicationModel.cs new file mode 100644 index 0000000..aee087a --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/ViewModels/ReportPurchaseMedicationModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VeterinaryContracts.ViewModels +{ + public class ReportPurchaseMedicationModel + { + public string FlowerName { get; set; } = string.Empty; + public int TotalCount { get; set; } + public List> Components { get; set; } = new(); + } +}