This commit is contained in:
Анна Забродина 2024-05-25 22:51:21 +04:00
commit aaa156086f
3 changed files with 24 additions and 2 deletions

View File

@ -10,7 +10,7 @@ namespace HotelDataBaseImplement
{ {
if (optionsBuilder.IsConfigured == false) if (optionsBuilder.IsConfigured == false)
{ {
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-7DB3VEN\SQLEXPRESS;Initial Catalog=HotelDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-M2G96S06\SQLEXPRESS;Initial Catalog=HotelDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
} }
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
} }

View File

@ -630,18 +630,28 @@ namespace HotelHeadwaiterApp.Controllers
} }
[HttpPost] [HttpPost]
public void ListLunchesToPdfFile(DateTime dateFrom, DateTime dateTo) public void ListLunchesToPdfFile(DateTime dateFrom, DateTime dateTo, string headwaiterEmail)
{ {
if (APIClient.Headwaiter == null) if (APIClient.Headwaiter == null)
{ {
throw new Exception("Вы как суда попали? Суда вход только авторизованным"); throw new Exception("Вы как суда попали? Суда вход только авторизованным");
} }
if (string.IsNullOrEmpty(headwaiterEmail))
{
throw new Exception("Email пуст");
}
APIClient.PostRequest("api/report/CreateHeadwaiterReportToPdfFile", new ReportHeadwaiterBindingModel APIClient.PostRequest("api/report/CreateHeadwaiterReportToPdfFile", new ReportHeadwaiterBindingModel
{ {
DateFrom = dateFrom, DateFrom = dateFrom,
DateTo = dateTo, DateTo = dateTo,
HeadwaiterId = APIClient.Headwaiter.Id HeadwaiterId = APIClient.Headwaiter.Id
}); });
APIClient.PostRequest("api/report/SendPdfToMail", new MailSendInfoBindingModel
{
MailAddress = headwaiterEmail,
Subject = "Отчет по обедам (pdf)",
Text = "Отчет по обедам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
});
Response.Redirect("ListLunchesToPdfFile"); Response.Redirect("ListLunchesToPdfFile");
} }

View File

@ -25,6 +25,18 @@
</div> </div>
</div> </div>
<div class="form-group mb-4">
<label for="headwaiterEmail" class="form-label text-custom-color-1">Почта:</label>
<input type="email" id="headwaiterEmail" name="headwaiterEmail" class="form-control" placeholder="Введите вашу почту">
</div>
<div class="row mb-4">
<div class="col-md-8"></div>
<div class="col-md-4">
<button type="submit" class="btn btn-outline-dark w-100 text-center d-flex justify-content-md-center">Отправить на почту</button>
</div>
</div>
<div class="row mb-4"> <div class="row mb-4">
<div class="col-md-8"></div> <div class="col-md-8"></div>
<div class="col-md-4"> <div class="col-md-4">