From 29e33b79fe3b42706d9c407543928e793b334ae7 Mon Sep 17 00:00:00 2001 From: Yourdax Date: Tue, 27 Aug 2024 19:01:28 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A3=D1=80=D0=B0=D0=B0=D0=B0=D0=B0,=20=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BB=D0=B8=D1=81=D1=8C=20=D0=BD=D0=B5=D0=B1?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D1=88=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DiningRoomBusinessLogic/MailWorker/AbstractMailWorker.cs | 4 +--- .../DiningRoomBusinessLogic/MailWorker/MailKitWorker.cs | 2 +- .../OfficePackage/AbstractSaveToPdf.cs | 1 + DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/DiningRoom/DiningRoomBusinessLogic/MailWorker/AbstractMailWorker.cs b/DiningRoom/DiningRoomBusinessLogic/MailWorker/AbstractMailWorker.cs index 56f41fb..a6f2712 100644 --- a/DiningRoom/DiningRoomBusinessLogic/MailWorker/AbstractMailWorker.cs +++ b/DiningRoom/DiningRoomBusinessLogic/MailWorker/AbstractMailWorker.cs @@ -17,7 +17,7 @@ namespace DiningRoomBusinessLogic.MailWorker protected int _smtpClientPort; protected string _popHost = string.Empty; protected int _popPort; - private readonly ILogger _logger; + public AbstractMailWorker() { @@ -52,8 +52,6 @@ namespace DiningRoomBusinessLogic.MailWorker return; } - _logger.LogDebug("Send Mail: {To}, {Subject}", info.MailAddress, info.Subject); - await SendMailAsync(info); } diff --git a/DiningRoom/DiningRoomBusinessLogic/MailWorker/MailKitWorker.cs b/DiningRoom/DiningRoomBusinessLogic/MailWorker/MailKitWorker.cs index 8ff3a28..2cc3020 100644 --- a/DiningRoom/DiningRoomBusinessLogic/MailWorker/MailKitWorker.cs +++ b/DiningRoom/DiningRoomBusinessLogic/MailWorker/MailKitWorker.cs @@ -29,7 +29,7 @@ namespace DiningRoomBusinessLogic.MailWorker objMailMessage.Body = info.Text; objMailMessage.SubjectEncoding = Encoding.UTF8; objMailMessage.BodyEncoding = Encoding.UTF8; - Attachment attachment = new Attachment("C:\\Users\\sshan\\OneDrive\\Desktop\\reports\\reportpdf.pdf", new ContentType(MediaTypeNames.Application.Pdf)); + Attachment attachment = new Attachment("C:\\reportpdf.pdf", new ContentType(MediaTypeNames.Application.Pdf)); objMailMessage.Attachments.Add(attachment); objSmtpClient.UseDefaultCredentials = false; diff --git a/DiningRoom/DiningRoomBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/DiningRoom/DiningRoomBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 7aed049..a9b38bb 100644 --- a/DiningRoom/DiningRoomBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/DiningRoom/DiningRoomBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -7,6 +7,7 @@ namespace DiningRoomBusinessLogic.OfficePackage { public void CreateDoc(PdfInfo info) { + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); CreatePdf(info); CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); diff --git a/DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs b/DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs index 8c16dc8..e92fdd6 100644 --- a/DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs +++ b/DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs @@ -563,7 +563,7 @@ namespace DiningRoomUserApp.Controllers } APIClient.PostRequest("api/main/SendComponentsByDateReportToEmail", new ReportBindingModel { - FileName = "C:\\Dax\\reportpdf.pdf", + FileName = "C:\\reportpdf.pdf", DateFrom = dateFrom, DateTo = dateTo, Email = APIClient.User.Email,