From 685ec452a3ff98539c18513eddc1890112abcb3e Mon Sep 17 00:00:00 2001 From: Artyom_Yashin Date: Mon, 27 May 2024 01:36:49 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D1=87=D0=B5=D1=82=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=BE=D1=87=D1=82=D1=83=20=D0=B2=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=86=D0=B5=D1=81=D1=81=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 20 ++++++++++++- Bank/BankClientApp/Views/Home/Report.cshtml | 28 ++++++++----------- .../BindingModels/ReportBindingModel.cs | 1 + .../BusinessLogicsContracts/IReportLogic.cs | 4 +-- .../Controllers/ReportController.cs | 14 ++++++++++ Bank/BankRestApi/appsettings.json | 9 +++++- 6 files changed, 55 insertions(+), 21 deletions(-) diff --git a/Bank/BankClientApp/Controllers/HomeController.cs b/Bank/BankClientApp/Controllers/HomeController.cs index 8c5b290..a3733d9 100644 --- a/Bank/BankClientApp/Controllers/HomeController.cs +++ b/Bank/BankClientApp/Controllers/HomeController.cs @@ -491,7 +491,7 @@ namespace BankClientApp.Controllers #endregion #region//работа с отчетами - [HttpGet] + [HttpGet] public IActionResult Report() { if (APIClient.Client == null) @@ -501,6 +501,24 @@ namespace BankClientApp.Controllers return View(); } + [HttpPost] + public void Report(DateTime dateFrom, DateTime dateTo) + { + if (APIClient.Client == null) + { + throw new Exception("Вы как суда попали? Суда вход только авторизованным"); + } + APIClient.PostRequest("api/report/sandoperationsrequeststoemail", new ReportBindingModel + { + FileName = "C:\\ReportsCourseWork\\pdffile.pdf", + DateFrom = dateFrom, + DateTo = dateTo, + Email = APIClient.Client.Email + }); + Response.Redirect("Report"); + + } + [HttpGet] public IActionResult TransferListReport() { diff --git a/Bank/BankClientApp/Views/Home/Report.cshtml b/Bank/BankClientApp/Views/Home/Report.cshtml index 5e82fe7..06bde4d 100644 --- a/Bank/BankClientApp/Views/Home/Report.cshtml +++ b/Bank/BankClientApp/Views/Home/Report.cshtml @@ -2,27 +2,30 @@ ViewData["Title"] = "Report"; }
-

Список карт с расшифровкой по операциям и заявкам

+

Список карт с расшифровкой по операциям и заявкам за период

@{ - // if (Model == null) - // { - //

Авторизуйтесь!

- // return; - // }
Начальная дата:
- +
Конечная дата:
- +
+
+
+
+
+
+
+
+
@@ -44,16 +47,7 @@ - будет заполняться вьюшками отчета
-
-
-
-
-
-
-
-
}
\ No newline at end of file diff --git a/Bank/BankContracts/BindingModels/ReportBindingModel.cs b/Bank/BankContracts/BindingModels/ReportBindingModel.cs index 532aafa..a9fb8cd 100644 --- a/Bank/BankContracts/BindingModels/ReportBindingModel.cs +++ b/Bank/BankContracts/BindingModels/ReportBindingModel.cs @@ -13,5 +13,6 @@ namespace BankContracts.BindingModels public DateTime? DateTo { get; set; } public List? SelectedAccountIds { get; set; } public List? SelectedCardIds { get; set; } + public string Email { get; set; } = string.Empty; } } diff --git a/Bank/BankContracts/BusinessLogicsContracts/IReportLogic.cs b/Bank/BankContracts/BusinessLogicsContracts/IReportLogic.cs index 8247263..3f65fa6 100644 --- a/Bank/BankContracts/BusinessLogicsContracts/IReportLogic.cs +++ b/Bank/BankContracts/BusinessLogicsContracts/IReportLogic.cs @@ -4,6 +4,7 @@ using BankContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; @@ -21,7 +22,6 @@ namespace BankContracts.BusinessLogicsContracts void SaveTransfersToExcelFile(ReportBindingModel model); void SaveOperationsRequestsToPdfFile(ReportBindingModel model); void SaveTransfersWithdrawalsToPdfFile(ReportBindingModel model); - - + void SandOperationsRequestsToEmail(ReportBindingModel model); } } diff --git a/Bank/BankRestApi/Controllers/ReportController.cs b/Bank/BankRestApi/Controllers/ReportController.cs index 5c4401c..e0f5077 100644 --- a/Bank/BankRestApi/Controllers/ReportController.cs +++ b/Bank/BankRestApi/Controllers/ReportController.cs @@ -70,5 +70,19 @@ namespace BankRestApi.Controllers throw; } } + + [HttpPost] + public void SendOperationsRequestsToEmail(ReportBindingModel model) + { + try + { + _logic.SandOperationsRequestsToEmail(model); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка сохранения переводов в ворд"); + throw; + } + } } } diff --git a/Bank/BankRestApi/appsettings.json b/Bank/BankRestApi/appsettings.json index 10f68b8..4183f61 100644 --- a/Bank/BankRestApi/appsettings.json +++ b/Bank/BankRestApi/appsettings.json @@ -5,5 +5,12 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "SmtpClientHost": "smtp.gmail.com", + "SmtpClientPort": "587", + "PopHost": "pop.gmail.com", + "PopPort": "995", + + "MailLogin": "forlabspibd23@gmail.com", + "MailPassword": "euby honk jvrl rrjj" }