мать накрывай поляну почта работает
This commit is contained in:
parent
cf486ae9cf
commit
7ae4464b36
3
.gitignore
vendored
3
.gitignore
vendored
@ -398,3 +398,6 @@ FodyWeavers.xsd
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
/LawFim/LawFirmRestApi/file.pdf
|
||||
/LawFim/LawFirmRestApi/pdf.file
|
||||
/LawFim/LawFirmRestApi/string
|
||||
|
@ -259,8 +259,8 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
public List<ReportClientCaseHearingViewModel> GetCaseHearing(ReportClientCaseHearingBindingModel model)
|
||||
{
|
||||
var list = new List<ReportClientCaseHearingViewModel>();
|
||||
var clients = _clientStorage.GetFilteredList(new ClientSearchModel { ExecutorId = model.ExecutorId });
|
||||
var cases = _caseStorage.GetFilteredList(new CaseSearchModel { ExecutorId = model.ExecutorId, DateFrom = model.DateFrom });
|
||||
var clients = _clientStorage.GetFilteredList(new ClientSearchModel { Id = model.ClientId });
|
||||
var cases = _caseStorage.GetFilteredList(new CaseSearchModel { ExecutorId = model.ExecutorId });
|
||||
var hearings = _hearingStorage.GetFilteredList(new HearingSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo });
|
||||
var visits = _visitStorage.GetFilteredList(new VisitSearchModel { ExecutorId = model.ExecutorId });
|
||||
foreach (ClientViewModel client in clients)
|
||||
@ -365,7 +365,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
_saveToPdfClientCaseHearing.CreateDoc(new PDFClientCaseHearingInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Отчёт по клиентам по делам и консультациям",
|
||||
Title = "Отчёт по делам и слушаниям по выбранным клиентам",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo,
|
||||
ClientCaseHearing = GetCaseHearing(model)
|
||||
|
@ -25,7 +25,8 @@ namespace LawFirmBusinessLogic.MailWorker
|
||||
objMailMessage.Body = info.Text;
|
||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||
Attachment attachment = new Attachment("D:\\Уник\\2 курс 4 семестр\\РПП\\курсач\\LawFirm\\LawFim\\LawFirmRestApi\\file4.pdf", new ContentType(MediaTypeNames.Application.Pdf));
|
||||
//Attachment attachment = new Attachment("D:\\Уник\\2 курс 4 семестр\\РПП\\курсач\\LawFirm\\LawFim\\LawFirmRestApi\\file4.pdf", new ContentType(MediaTypeNames.Application.Pdf));
|
||||
Attachment attachment = new Attachment("E:\\reports\\pdf\\file.pdf", new ContentType(MediaTypeNames.Application.Pdf));
|
||||
objMailMessage.Attachments.Add(attachment);
|
||||
|
||||
objSmtpClient.UseDefaultCredentials = false;
|
||||
|
@ -6,6 +6,7 @@
|
||||
public DateTime DateFrom { get; set; } = DateTime.Now;
|
||||
public DateTime DateTo { get; set; } = DateTime.Now;
|
||||
public int? ExecutorId { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -67,39 +67,30 @@ namespace LawFirmRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
//[HttpPost]
|
||||
//public void MailSend(MailSendInfoBindingModel report)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// _mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
// {
|
||||
// MailAddress = report.MailAddress,
|
||||
// Subject = report.Subject,
|
||||
// Text = report.Text
|
||||
// });
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// _logger.LogError(ex, "Ошибка отправки письма");
|
||||
// throw;
|
||||
// }
|
||||
//}
|
||||
[HttpPost]
|
||||
public void SendClientReportToEmail(ReportClientCaseHearingBindingModel model)
|
||||
public void MailSend(ReportClientCaseHearingBindingModel report)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportLogic.SaveClientCaseHearingToPdfFile(model);
|
||||
_reportLogic.SaveClientCaseHearingToPdfFile(new ReportClientCaseHearingBindingModel
|
||||
{
|
||||
DateFrom = report.DateFrom,
|
||||
DateTo = report.DateTo,
|
||||
FileName = report.FileName,
|
||||
ExecutorId = report.ExecutorId,
|
||||
ClientId = report.ClientId,
|
||||
Email = report.Email,
|
||||
});
|
||||
_mailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = model.Email!,
|
||||
Subject = "Отчет по визитам",
|
||||
Text = "Лови"
|
||||
MailAddress = report.Email!,
|
||||
Subject = "Отчет по выбранным клиентам с расшифровкой по слушаниям и делам",
|
||||
Text = "Ваш отчет!"
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отправки письма");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user