Почта работает
This commit is contained in:
parent
b42564d7f7
commit
616ab0c5c4
@ -1,5 +1,6 @@
|
||||
using HostrelHeadwaiterApp.Models;
|
||||
using HotelContracts.BindingModels;
|
||||
using HotelContracts.BusinessLogicsContracts;
|
||||
using HotelContracts.SearchModels;
|
||||
using HotelContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -10,10 +11,12 @@ namespace HostrelHeadwaiterApp.Controllers
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IReportHeadwaiterLogic _report;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
public HomeController(ILogger<HomeController> logger, IReportHeadwaiterLogic report)
|
||||
{
|
||||
_logger = logger;
|
||||
_report = report;
|
||||
}
|
||||
|
||||
public IActionResult CreateDinner()
|
||||
@ -627,6 +630,11 @@ namespace HostrelHeadwaiterApp.Controllers
|
||||
return new PhysicalFileResult("E:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
}
|
||||
|
||||
public IActionResult GetPdfFile()
|
||||
{
|
||||
return new PhysicalFileResult("E:\\ReportsCourseWork\\pdffile.pdf", "application/pdf");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ListDinnersToPdfFile()
|
||||
{
|
||||
@ -634,26 +642,82 @@ namespace HostrelHeadwaiterApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View();
|
||||
return View("ListDinnersToPdfFile");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void ListDinnersToPdfFile(DateTime dateFrom, DateTime dateTo)
|
||||
public void ListDinnersToPdfFile(DateTime dateFrom, DateTime dateTo, string headwaiterEmail)
|
||||
{
|
||||
if (APIClient.Headwaiter == null)
|
||||
{
|
||||
throw new Exception("Не авторизованы");
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateHeadwaiterReportToPdfFile", new ReportHeadwaiterBindingModel()
|
||||
if (string.IsNullOrEmpty(headwaiterEmail))
|
||||
{
|
||||
throw new Exception("Email пуст");
|
||||
}
|
||||
APIClient.PostRequest("api/report/CreateHeadwaiterReportToPdfFile", new ReportHeadwaiterBindingModel
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo,
|
||||
HeadwaiterId = APIClient.Headwaiter.Id
|
||||
});
|
||||
|
||||
APIClient.PostRequest("api/report/SendPdfToMail", new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = headwaiterEmail,
|
||||
Subject = "Отчет по участникам (pdf)",
|
||||
Text = "Отчет по участникам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
|
||||
});
|
||||
Response.Redirect("ListDinnersToPdfFile");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string GetDinnersReport(DateTime dateFrom, DateTime dateTo)
|
||||
{
|
||||
if (APIClient.Headwaiter == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
List<ReportDinnersViewModel> result;
|
||||
try
|
||||
{
|
||||
result = _report.GetDinners(new ReportHeadwaiterBindingModel
|
||||
{
|
||||
HeadwaiterId = APIClient.Headwaiter.Id,
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
string table = "";
|
||||
foreach (var report in result)
|
||||
{
|
||||
table += $"<h2>{report.DinnerName}</h2>";
|
||||
table += $"<table>";
|
||||
table += "<thead>";
|
||||
table += "<tr>";
|
||||
table += $"<th>Имя комнаты</th>";
|
||||
table += $"<th>Цена комнаты</th>";
|
||||
table += $"<th>Название зала</th>";
|
||||
table += $"<th>Дата броинирования</th>";
|
||||
table += "</tr>";
|
||||
table += "</thead>";
|
||||
table += "<tbody>";
|
||||
table += "<tr>";
|
||||
table += $"<td>{report.RoomName}</td>";
|
||||
table += $"<td>{report.RoomPrice}</td>";
|
||||
table += $"<td>{report.NameHall}</td>";
|
||||
table += $"<td>{report.BookingDate}</td>";
|
||||
table += "</tr>";
|
||||
table += "</tbody>";
|
||||
table += "</table>";
|
||||
}
|
||||
//table += $"<h3 style=\"align-self: self-start;\">Итого: {result.Item2}</h3>";
|
||||
return table;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,13 +7,16 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNet.WebPages" Version="3.2.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HotelContracts\HotelContracts.csproj" />
|
||||
<ProjectReference Include="..\HotelDataModels\HotelDataModels.csproj" />
|
||||
<ProjectReference Include="..\HotelBusinessLogic\HotelBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\HotelContracts\HotelContracts.csproj" />
|
||||
<ProjectReference Include="..\HotelDataBaseImplement\HotelDataBaseImplement.csproj" />
|
||||
<ProjectReference Include="..\HotelDataModels\HotelDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,6 +1,19 @@
|
||||
using HostrelHeadwaiterApp;
|
||||
using HotelBusinessLogic.BusinessLogics;
|
||||
using HotelBusinessLogic.OfficePackage;
|
||||
using HotelBusinessLogic.OfficePackage.Implements;
|
||||
using HotelContracts.BusinessLogicsContracts;
|
||||
using HotelContracts.StoragesContracts;
|
||||
using HotelDataBaseImplement.Implemets;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddTransient<IReportHeadwaiterLogic, ReportLogicHeadwaiter>();
|
||||
builder.Services.AddTransient<IDinnerStorage, DinnerStorage>();
|
||||
builder.Services.AddTransient<IConferenceBookingStorage, ConferenceBookingStorage>();
|
||||
builder.Services.AddTransient<IRoomStorage, RoomStorage>();
|
||||
builder.Services.AddTransient<AbstractSaveToExcelHeadwaiter, SaveToExcelHeadwaiter>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdfHeadwaiter, SaveToPdfHeadwaiter>();
|
||||
builder.Services.AddTransient<AbstractSaveToWordHeadwaitre, SaveToWordHeadwaiter>();
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
@ -9,12 +22,12 @@ var app = builder.Build();
|
||||
APIClient.Connect(builder.Configuration);
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
//if (!app.Environment.IsDevelopment())
|
||||
//{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
//}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
@ -1,35 +1,73 @@
|
||||
@{
|
||||
ViewData["Title"] = "ListDinnersToPdf";
|
||||
@using HotelContracts.ViewModels
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "ListDinnersToPdfFile";
|
||||
}
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
<h2
|
||||
class="u-text u-text-custom-color-1 u-text-default u-text-1"
|
||||
>
|
||||
Создание отчета по участникам за период
|
||||
</h2>
|
||||
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Отчет по участникам за период </h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="u-form-group u-form-name u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Дата начала периода:</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
placeholder="Выберите дату начала периода"
|
||||
id="dateFrom" name="dateFrom"
|
||||
class="u-input u-input-rectangle"/>
|
||||
</div>
|
||||
<div class="u-form-email u-form-group u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-2">Дата конца периода:</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
placeholder="Выберите дату конца периода"
|
||||
id="dateTo" name="dateTo"
|
||||
class="u-input u-input-rectangle"/>
|
||||
</div>
|
||||
<div class="u-align-right u-form-group u-form-submit u-label-top">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сформировать отчёт" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="text-center">
|
||||
@{
|
||||
<form method="post">
|
||||
<div class="u-form-email u-form-group u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-2" for="dateFrom">Начало периода</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
placeholder="Выберите дату начала периода"
|
||||
id="dateFrom" name="dateFrom"
|
||||
class="u-input u-input-rectangle"/>
|
||||
</div>
|
||||
<div class="u-form-email u-form-group u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-2" for="dateTo">Окончание периода</label>
|
||||
<input
|
||||
type="datetime-local"
|
||||
placeholder="Выберите дату окончания периода"
|
||||
id="dateTo" name="dateTo"
|
||||
class="u-input u-input-rectangle"/>
|
||||
</div>
|
||||
<div class="u-form-group u-form-name u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Введите почту</label>
|
||||
<input
|
||||
type="email"
|
||||
placeholder="Введите вашу почту"
|
||||
name="headwaiterEmail"
|
||||
class="u-input u-input-rectangle"/>
|
||||
</div>
|
||||
<div class="u-align-right u-form-group u-form-submit u-label-top">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Отправить на почту" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
||||
</div>
|
||||
<div class="mt-3" id="report">
|
||||
</div>
|
||||
</form>
|
||||
<div class="u-align-right u-form-group u-form-submit u-label-top">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><button type="button" id="demonstrate" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1">Продемонстрировать</button></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
function check() {
|
||||
var dateFrom = $('#dateFrom').val();
|
||||
var dateTo = $('#dateTo').val();
|
||||
if (dateFrom && dateTo) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetDinnersReport",
|
||||
data: { dateFrom: dateFrom, dateTo: dateTo },
|
||||
success: function (result) {
|
||||
if (result != null) {
|
||||
$('#report').html(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#demonstrate').on('click', (e) => check());
|
||||
</script>
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using HotelContracts.BindingModels;
|
||||
using HotelBusinessLogic.MailWorker;
|
||||
using HotelContracts.BindingModels;
|
||||
using HotelContracts.BusinessLogicsContracts;
|
||||
using HotelContracts.SearchModels;
|
||||
using HotelContracts.StoragesContracts;
|
||||
@ -17,11 +18,15 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IConferenceBookingStorage _conferenceBookingStorage;
|
||||
private readonly AbstractMailWorker _mailWorker;
|
||||
private readonly IHeadwaiterLogic _headwaiterLogic;
|
||||
|
||||
public ConferenceBookingLogic(ILogger<ConferenceBookingLogic> logger, IConferenceBookingStorage conferenceBookingStorage)
|
||||
public ConferenceBookingLogic(ILogger<ConferenceBookingLogic> logger, IConferenceBookingStorage conferenceBookingStorage, IHeadwaiterLogic headwaiterLogic, AbstractMailWorker mailWorker)
|
||||
{
|
||||
_logger = logger;
|
||||
_conferenceBookingStorage = conferenceBookingStorage;
|
||||
_mailWorker = mailWorker;
|
||||
_headwaiterLogic = headwaiterLogic;
|
||||
}
|
||||
|
||||
public bool AddDinnerToConferenceBooking(ConferenceBookingSearchModel model, IDinnerModel dinner)
|
||||
@ -62,12 +67,16 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
CheckModel(model);
|
||||
model.ConferenceBookingDinners = new();
|
||||
|
||||
if (_conferenceBookingStorage.Insert(model) == null)
|
||||
var result = _conferenceBookingStorage.Insert(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
SendConferenceBookingMessage(result.HeadwaiterId, $"Гостиница \"Развитие\", План питания №{result.Id}", $"План питания №{result.Id} под названием {result.NameHall} и стоимостью {result.BookingDate} добавлен");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -77,12 +86,16 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
|
||||
if (_conferenceBookingStorage.Delete(model) == null)
|
||||
var result = _conferenceBookingStorage.Delete(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
SendConferenceBookingMessage(result.HeadwaiterId, $"Гостиница \"Развитие\", План питания №{result.Id}", $"План питания №{result.Id} под названием {result.NameHall} и стоимостью {result.BookingDate} удален");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -158,5 +171,24 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
_logger.LogInformation("ConferenceBooking. Id: { Id}", model.Id);
|
||||
|
||||
}
|
||||
|
||||
private bool SendConferenceBookingMessage(int headwaiterId, string subject, string text)
|
||||
{
|
||||
var headwaiter = _headwaiterLogic.ReadElement(new() { Id = headwaiterId });
|
||||
|
||||
if (headwaiter == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_mailWorker.MailSendAsync(new()
|
||||
{
|
||||
MailAddress = headwaiter.HeadwaiterEmail,
|
||||
Subject = subject,
|
||||
Text = text
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using HotelContracts.BusinessLogicsContracts;
|
||||
using HotelContracts.SearchModels;
|
||||
using HotelContracts.StoragesContracts;
|
||||
using HotelContracts.ViewModels;
|
||||
using HotelBusinessLogic.MailWorker;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -16,23 +17,31 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDinnerStorage _dinnerStorage;
|
||||
private readonly AbstractMailWorker _mailWorker;
|
||||
private readonly IHeadwaiterLogic _headwaiterLogic;
|
||||
|
||||
public DinnerLogic(ILogger<DinnerLogic> logger, IDinnerStorage dinnerStorage)
|
||||
public DinnerLogic(ILogger<DinnerLogic> logger, IDinnerStorage dinnerStorage, AbstractMailWorker mailWorker, IHeadwaiterLogic headwaiterLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_dinnerStorage = dinnerStorage;
|
||||
_mailWorker = mailWorker;
|
||||
_headwaiterLogic = headwaiterLogic;
|
||||
}
|
||||
|
||||
public bool Create(DinnerBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_dinnerStorage.Insert(model) == null)
|
||||
var result = _dinnerStorage.Insert(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
SendDinnerMessage(result.HeadwaiterId, $"Гостиница \"Развитие\", Участник №{result.Id}", $"Участник №{result.Id} по имени {result.DinnerName} и с гражданством {result.DinnerPrice} добавлен");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -42,12 +51,16 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
|
||||
if (_dinnerStorage.Delete(model) == null)
|
||||
var result = _dinnerStorage.Delete(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
SendDinnerMessage(result.HeadwaiterId, $"Гостиница \"Развитие\", Участник №{result.Id}", $"Участник №{result.Id} по имени {result.DinnerName} и с гражданством {result.DinnerPrice} удален");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -126,5 +139,24 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
|
||||
_logger.LogInformation("Dinner. DinnerName:{DinnerName}.DinnerPrice:{ DinnerPrice}. Id: { Id}", model.DinnerName, model.DinnerPrice, model.Id);
|
||||
}
|
||||
|
||||
private bool SendDinnerMessage(int headwaiterId, string subject, string text)
|
||||
{
|
||||
var headwaiter = _headwaiterLogic.ReadElement(new() { Id = headwaiterId });
|
||||
|
||||
if (headwaiter == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_mailWorker.MailSendAsync(new()
|
||||
{
|
||||
MailAddress = headwaiter.HeadwaiterEmail,
|
||||
Subject = subject,
|
||||
Text = text
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +138,16 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
|
||||
public void SaveDinnersToPdfFile(ReportHeadwaiterBindingModel model)
|
||||
{
|
||||
if (model.DateFrom == null)
|
||||
{
|
||||
throw new ArgumentException("Дата начала не задана");
|
||||
}
|
||||
|
||||
if (model.DateTo == null)
|
||||
{
|
||||
throw new ArgumentException("Дата окончания не задана");
|
||||
}
|
||||
|
||||
_saveToPdf.CreateDoc(new PdfInfoHeadwaiter
|
||||
{
|
||||
FileName = model.FileName,
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HotelContracts.BindingModels;
|
||||
using HotelBusinessLogic.MailWorker;
|
||||
using HotelContracts.BindingModels;
|
||||
using HotelContracts.BusinessLogicsContracts;
|
||||
using HotelContracts.SearchModels;
|
||||
using HotelContracts.StoragesContracts;
|
||||
@ -17,23 +18,31 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRoomStorage _roomStorage;
|
||||
private readonly AbstractMailWorker _mailWorker;
|
||||
private readonly IHeadwaiterLogic _headwaiterLogic;
|
||||
|
||||
public RoomLogic(ILogger<RoomLogic> logger, IRoomStorage roomStorage)
|
||||
public RoomLogic(ILogger<RoomLogic> logger, IRoomStorage roomStorage, IHeadwaiterLogic headwaiterLogic, AbstractMailWorker mailWorker)
|
||||
{
|
||||
_logger = logger;
|
||||
_roomStorage = roomStorage;
|
||||
_mailWorker = mailWorker;
|
||||
_headwaiterLogic = headwaiterLogic;
|
||||
}
|
||||
public bool Create(RoomBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
model.RoomDinners = new();
|
||||
|
||||
if (_roomStorage.Insert(model) == null)
|
||||
var result = _roomStorage.Insert(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
SendRoomMessage(result.HeadwaiterId, $"Гостиница \"Развитие\", Конференция №{result.Id}", $"Конференция №{result.Id} под названием {result.RoomName} и датой начала {result.RoomPrice} добавлена {result.RoomFrame}");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -43,12 +52,17 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
|
||||
if (_roomStorage.Delete(model) == null)
|
||||
var result = _roomStorage.Delete(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
SendRoomMessage(result.HeadwaiterId, $"Гостиница \"Развитие\", Конференция №{result.Id}", $"Конференция №{result.Id} под названием {result.RoomName} и датой начала {result.RoomPrice} удалена {result.RoomFrame}");
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -168,5 +182,24 @@ namespace HotelBusinessLogic.BusinessLogics
|
||||
|
||||
_logger.LogInformation("Room. RoomName:{RoomName}.RoomFrame:{ RoomFrame}.RoomPrice:{ RoomPrice}. Id: { Id}", model.RoomName, model.RoomFrame, model.RoomPrice, model.Id);
|
||||
}
|
||||
|
||||
private bool SendRoomMessage(int headwaiterId, string subject, string text)
|
||||
{
|
||||
var headwaiter = _headwaiterLogic.ReadElement(new() { Id = headwaiterId });
|
||||
|
||||
if (headwaiter == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_mailWorker.MailSendAsync(new()
|
||||
{
|
||||
MailAddress = headwaiter.HeadwaiterEmail,
|
||||
Subject = subject,
|
||||
Text = text
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace HotelBusinessLogic.MailWorker
|
||||
objMailMessage.Body = info.Text;
|
||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||
Attachment attachment = new Attachment("F:\\ReportsCourseWork\\pdffile.pdf", new ContentType(MediaTypeNames.Application.Pdf));
|
||||
Attachment attachment = new Attachment("E:\\ReportsCourseWork\\pdffile.pdf", new ContentType(MediaTypeNames.Application.Pdf));
|
||||
objMailMessage.Attachments.Add(attachment);
|
||||
|
||||
objSmtpClient.UseDefaultCredentials = false;
|
||||
|
@ -9,7 +9,7 @@ namespace HotelBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfInfoHeadwaiter
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string FileName { get; set; } = "E:\\ReportsCourseWork\\pdffile.pdf";
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public DateTime DateFrom { get; set; }
|
||||
public DateTime DateTo { get; set; }
|
||||
|
@ -34,7 +34,7 @@ namespace HotelRestApi.Controllers
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo,
|
||||
OrganiserId = model.OrganiserId,
|
||||
FileName = "F:\\ReportsCourseWork\\pdffile.pdf",
|
||||
FileName = "E:\\ReportsCourseWork\\pdffile.pdf",
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -121,7 +121,7 @@ namespace HotelRestApi.Controllers
|
||||
{
|
||||
_reportHeadwaiterLogic.SaveDinnersToPdfFile(new ReportHeadwaiterBindingModel
|
||||
{
|
||||
FileName = "Отчет PDF.pdf",
|
||||
FileName = "E:\\ReportsCourseWork\\pdffile.pdf",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo,
|
||||
HeadwaiterId = model.HeadwaiterId,
|
||||
|
Loading…
x
Reference in New Issue
Block a user