From 37b2d0ef0be459b1a4572d7624c2bc8b76b38576 Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Sun, 26 May 2024 13:48:55 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=D0=B8=20=D0=BE?= =?UTF-8?q?=D1=82=D1=87=D0=B5=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankBusinessLogic.csproj | 1 + .../OfficePackage/AbstractSaveToExcel.cs | 12 +++++++++++ .../OfficePackage/AbstractSaveToPdf.cs | 12 +++++++++++ .../OfficePackage/AbstractSaveToWord.cs | 12 +++++++++++ .../HelperEnums/ExcelStyleInfoType.cs | 15 +++++++++++++ .../HelperEnums/PdfParagraphAlignmentType.cs | 15 +++++++++++++ .../HelperEnums/WordJustificationType.cs | 14 +++++++++++++ .../HelperModels/ExcelCellParameters.cs | 18 ++++++++++++++++ .../OfficePackage/HelperModels/ExcelInfo.cs | 21 +++++++++++++++++++ .../HelperModels/ExcelMergeParameters.cs | 15 +++++++++++++ .../OfficePackage/HelperModels/PdfInfo.cs | 18 ++++++++++++++++ .../HelperModels/PdfParagraph.cs | 16 ++++++++++++++ .../HelperModels/PdfRowParameters.cs | 16 ++++++++++++++ .../OfficePackage/HelperModels/WordInfo.cs | 16 ++++++++++++++ .../HelperModels/WordParagraph.cs | 14 +++++++++++++ .../HelperModels/WordTextProperties.cs | 16 ++++++++++++++ .../OfficePackage/Implements/SaveToExcel.cs | 12 +++++++++++ .../OfficePackage/Implements/SaveToPdf.cs | 12 +++++++++++ .../OfficePackage/Implements/SaveToWord.cs | 12 +++++++++++ .../Controllers/HomeController.cs | 6 +++--- .../BankClientApp/Views/Shared/_Layout.cshtml | 6 +++--- .../Implements/RequestStorage.cs | 3 ++- 22 files changed, 275 insertions(+), 7 deletions(-) create mode 100644 Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/WordInfo.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/Implements/SaveToExcel.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/Implements/SaveToPdf.cs create mode 100644 Bank/BankBusinessLogic/OfficePackage/Implements/SaveToWord.cs diff --git a/Bank/BankBusinessLogic/BankBusinessLogic.csproj b/Bank/BankBusinessLogic/BankBusinessLogic.csproj index 0112389..a83de5d 100644 --- a/Bank/BankBusinessLogic/BankBusinessLogic.csproj +++ b/Bank/BankBusinessLogic/BankBusinessLogic.csproj @@ -8,6 +8,7 @@ + diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs new file mode 100644 index 0000000..6e14d22 --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage +{ + internal class AbstractSaveToExcel + { + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs new file mode 100644 index 0000000..50e3829 --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage +{ + internal class AbstractSaveToPdf + { + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs new file mode 100644 index 0000000..2adc31a --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage +{ + internal class AbstractSaveToWord + { + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs b/Bank/BankBusinessLogic/OfficePackage/HelperEnums/ExcelStyleInfoType.cs new file mode 100644 index 0000000..220043b --- /dev/null +++ b/Bank/BankBusinessLogic/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 BankBusinessLogic.OfficePackage.HelperEnums +{ + public enum ExcelStyleInfoType + { + Title, + Text, + TextWithBroder + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs b/Bank/BankBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs new file mode 100644 index 0000000..449f9fd --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage.HelperEnums +{ + public enum PdfParagraphAlignmentType + { + Center, + Left, + Right + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs b/Bank/BankBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs new file mode 100644 index 0000000..bd73291 --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperEnums/WordJustificationType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage.HelperEnums +{ + public enum WordJustificationType + { + Center, + Both + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs new file mode 100644 index 0000000..d83d2a7 --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs @@ -0,0 +1,18 @@ +using BankBusinessLogic.OfficePackage.HelperEnums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.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/Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs new file mode 100644 index 0000000..607515e --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs @@ -0,0 +1,21 @@ +using BankContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage.HelperModels +{ + public class ExcelInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public List OperationRequests + { + get; + set; + } = new(); + + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/ExcelMergeParameters.cs new file mode 100644 index 0000000..2d6ab4b --- /dev/null +++ b/Bank/BankBusinessLogic/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 BankBusinessLogic.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/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs new file mode 100644 index 0000000..4f35ad9 --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs @@ -0,0 +1,18 @@ +using BankContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage.HelperModels +{ + public class PdfInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public DateTime DateFrom { get; set; } + public DateTime DateTo { get; set; } + public List Requests { get; set; } = new(); + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs new file mode 100644 index 0000000..f07c57d --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs @@ -0,0 +1,16 @@ +using ComputersShopBusinessLogic.OfficePackage.HelperEnums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComputersShopBusinessLogic.OfficePackage.HelperModels +{ + public class PdfParagraph + { + public string Text { get; set; } = string.Empty; + public string Style { get; set; } = string.Empty; + public PdfParagraphAlignmentType ParagraphAlignment { get; set; } + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs new file mode 100644 index 0000000..b503fb1 --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs @@ -0,0 +1,16 @@ +using ComputersShopBusinessLogic.OfficePackage.HelperEnums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ComputersShopBusinessLogic.OfficePackage.HelperModels +{ + public class PdfRowParameters + { + public List Texts { get; set; } = new(); + public string Style { get; set; } = string.Empty; + public PdfParagraphAlignmentType ParagraphAlignment { get; set; } + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordInfo.cs new file mode 100644 index 0000000..3a7138d --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -0,0 +1,16 @@ +using BankContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage.HelperModels +{ + public class WordInfo + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public List Requests { get; set; } = new(); + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs new file mode 100644 index 0000000..4d7590f --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordParagraph.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage.HelperModels +{ + public class WordParagraph + { + public List<(string, WordTextProperties)> Texts { get; set; } = new(); + public WordTextProperties? TextProperties { get; set; } + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs new file mode 100644 index 0000000..4a806ad --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordTextProperties.cs @@ -0,0 +1,16 @@ +using BankBusinessLogic.OfficePackage.HelperEnums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.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/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToExcel.cs b/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToExcel.cs new file mode 100644 index 0000000..699cb43 --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToExcel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage.Implements +{ + internal class SaveToExcel + { + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToPdf.cs b/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToPdf.cs new file mode 100644 index 0000000..86f0e26 --- /dev/null +++ b/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToPdf.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankBusinessLogic.OfficePackage.Implements +{ + internal class SaveToPdf + { + } +} diff --git a/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToWord.cs new file mode 100644 index 0000000..d2f5cf4 --- /dev/null +++ b/Bank/BankBusinessLogic/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 BankBusinessLogic.OfficePackage.Implements +{ + internal class SaveToWord + { + } +} diff --git a/Bank/BankClientApp/Controllers/HomeController.cs b/Bank/BankClientApp/Controllers/HomeController.cs index 95b5951..06bdd68 100644 --- a/Bank/BankClientApp/Controllers/HomeController.cs +++ b/Bank/BankClientApp/Controllers/HomeController.cs @@ -403,7 +403,7 @@ namespace BankClientApp.Controllers Dictionary a = new Dictionary(); foreach(int card in cards) { - a.Add(card, new CardSearchModel() { Id = card } as ICardModel); + a.Add(card, null); } APIClient.PostRequest("/api/request/createrequest", new RequestBindingModel { @@ -434,14 +434,14 @@ namespace BankClientApp.Controllers Dictionary a = new Dictionary(); foreach (int card in cards) { - a.Add(card, new CardSearchModel() { Id = card } as ICardModel); + a.Add(card, null); } APIClient.PostRequest("/api/request/updaterequest", new RequestBindingModel { Id = request, Sum = sum, CardRequests = a, - Status = RequestStatus.Неизвестен + Status = RequestStatus.Принята }); Response.Redirect("Request"); } diff --git a/Bank/BankClientApp/Views/Shared/_Layout.cshtml b/Bank/BankClientApp/Views/Shared/_Layout.cshtml index de279a6..8b33bec 100644 --- a/Bank/BankClientApp/Views/Shared/_Layout.cshtml +++ b/Bank/BankClientApp/Views/Shared/_Layout.cshtml @@ -13,12 +13,12 @@