Сон в метре от меня
This commit is contained in:
parent
305719faef
commit
92f4c08128
@ -85,7 +85,20 @@ namespace VeterinaryClinicBusinessLogics.MailWorker
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(info.MailAddress))
|
||||
{
|
||||
_logger.LogWarning("MailAddress is null or empty");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.Subject))
|
||||
{
|
||||
_logger.LogWarning("Subject is null or empty");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.Path))
|
||||
{
|
||||
_logger.LogWarning("Path is null or empty");
|
||||
}
|
||||
if (string.IsNullOrEmpty(info.MailAddress) || string.IsNullOrEmpty(info.Subject) || string.IsNullOrEmpty(info.Path))
|
||||
{
|
||||
return;
|
||||
|
@ -276,7 +276,7 @@ public class HomeController : Controller
|
||||
|
||||
_reportLogic.SaveVisitsInfoToPdfFile(new ReportBindingModel
|
||||
{
|
||||
FileName = $@"D:\ {DateTime.Now.ToString("dd-MM-yyyy HH-mm-ss")}.pdf",
|
||||
FileName = $@"D:\report.pdf",
|
||||
UserId = APIClient.User.Id,
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
@ -289,23 +289,19 @@ public class HomeController : Controller
|
||||
/// Îòïðàâèòü ïî ïî÷òå îò÷¸ò
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public void SendReport(DateTime dateFrom, DateTime dateTo)
|
||||
public void SendReport()
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
throw new Exception("Íåîáõîäèìî àâòîðèçîâàòüñÿ!");
|
||||
}
|
||||
|
||||
if (dateFrom == DateTime.MinValue || dateTo == DateTime.MinValue)
|
||||
{
|
||||
throw new Exception("Ââåäåíû íå âñå äàííûå!");
|
||||
}
|
||||
|
||||
_mailLogic.MailSendAsync(new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = APIClient.User.Email,
|
||||
Subject = $"Îò÷åò {APIClient.User.FullName}",
|
||||
Text = $"Îò÷åò ñ {dateFrom.ToShortDateString()} ïî {dateTo.ToShortDateString()}"
|
||||
Text = "Âàø îò÷åò",
|
||||
Path = "D:\\report.pdf"
|
||||
});
|
||||
|
||||
Response.Redirect("/Home/Reports");
|
||||
|
@ -60,8 +60,6 @@ mailSender?.MailConfig(new MailConfigBindingModel
|
||||
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
|
||||
});
|
||||
|
||||
APIClient.Connect(builder.Configuration);
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
|
@ -41,16 +41,9 @@
|
||||
</div>
|
||||
|
||||
<!-- Отправить отчет на почту -->
|
||||
@* <div class="d-flex">
|
||||
<label for="fileUpload" class="d-block"></label>
|
||||
<input type="file" id="fileUpload" name="fileUpload" class="form-control-file d-inline-block w-auto">
|
||||
<div class="d-flex">
|
||||
<button type="submit" class="btn btn-primary" formaction="@Url.Action("SendReport", "Home")">Отправить отчет на почту</button>
|
||||
</div> *@
|
||||
<form asp-controller="Home" asp-action="SendReport" method="post">
|
||||
<input type="hidden" name="dateFrom" readonly value="@(ViewBag.DateFrom)" />
|
||||
<input type="hidden" name="dateTo" readonly value="@(ViewBag.DateTo)" />
|
||||
<button type="submit" class="btn btn-primary">Отправить отчет на почту</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Вывести отчет на форму -->
|
||||
<div class="text-center">
|
||||
|
Loading…
Reference in New Issue
Block a user