yes
This commit is contained in:
commit
21722147d5
@ -50,9 +50,9 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
}
|
||||
public List<ReportClientsHearingViewModel> GetClientsHearing(ReportBindingModel model)
|
||||
{
|
||||
var clients = _clientStorage.GetFilteredList(new ClientSearchModel {Id = model.ClientId});
|
||||
var clients = _clientStorage.GetFilteredList(new ClientSearchModel {Id = model.ClientId, CompanyId = model.CompanyId});
|
||||
var hearings = _hearingStorage.GetFullList();
|
||||
var cases = _caseStorage.GetFullList();
|
||||
var cases = _caseStorage.GetFilteredList(new CaseSearchModel { CompanyId = model.CompanyId});
|
||||
|
||||
var list = new List<ReportClientsHearingViewModel>();
|
||||
foreach (var client in clients)
|
||||
@ -73,6 +73,8 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
{
|
||||
record.Hearings.Add(new(hear.Court, hear.HearingDate));
|
||||
record.CaseName = cas.Name;
|
||||
record.Court = hear.Court;
|
||||
record.HearingDate = hear.HearingDate;
|
||||
}
|
||||
|
||||
}
|
||||
@ -127,7 +129,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
list.Add(new ReportClientsViewModel
|
||||
{
|
||||
Id = casId,
|
||||
FIO = clients.FirstOrDefault(x => x.Id == 4).FIO ,
|
||||
FIO = clients.FirstOrDefault(x => x.Id == casId).FIO ,
|
||||
CaseName = cas.Name,
|
||||
VisitDate = visit.VisitDate
|
||||
|
||||
@ -153,6 +155,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
{
|
||||
Id = model.LawyerId
|
||||
});
|
||||
//getfilteredlist
|
||||
var consultations = _consultationStorage.GetFullList();
|
||||
var visits = _visitStorage.GetFullList();
|
||||
foreach(var lawyer in lawyers)
|
||||
@ -173,6 +176,8 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
if (visit.ConsultationId.Equals(consultation.Id))
|
||||
{
|
||||
record.Visits.Add(visit.VisitDate);
|
||||
//record.VisitDate= visit.VisitDate;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmBusinessLogic.BusinessLogics
|
||||
@ -108,7 +109,11 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
throw new ArgumentNullException("Нет e-mail пользователя",
|
||||
nameof(model.Email));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Password))
|
||||
if (!Regex.IsMatch(model.Email, @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"))
|
||||
{
|
||||
throw new ArgumentException("Некорректно введен email ", nameof(model.Email));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
throw new ArgumentNullException("У пользователя не указан пароль",
|
||||
nameof(model.Password));
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LawFirmContracts.BindingModels.Mails;
|
||||
using LawFirmContracts.BusinessLogicContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -10,16 +11,18 @@ namespace LawFirmBusinessLogic.MailWorker
|
||||
{
|
||||
public abstract class AbstractMailWorker
|
||||
{
|
||||
protected string _mailLogin = string.Empty;
|
||||
protected string _mailPassword = string.Empty;
|
||||
protected string _smtpClientHost = string.Empty;
|
||||
protected int _smtpClientPort;
|
||||
protected string _popHost = string.Empty;
|
||||
protected int _popPort;
|
||||
protected string _mailLogin = "lab7rpp@gmail.com";
|
||||
protected string _mailPassword = "bzoh xhcm oecc glud";
|
||||
protected string _smtpClientHost = "smtp.gmail.com";
|
||||
protected int _smtpClientPort = 587;
|
||||
protected string _popHost = "pop.gmail.com";
|
||||
protected int _popPort = 995;
|
||||
private readonly ILogger _logger;
|
||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger)
|
||||
private readonly IUserLogic _userLogic;
|
||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IUserLogic userLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_userLogic = userLogic;
|
||||
|
||||
}
|
||||
public void MailConfig(MailConfigBindingModel config)
|
||||
@ -56,6 +59,6 @@ namespace LawFirmBusinessLogic.MailWorker
|
||||
|
||||
protected abstract Task SendMailAsync(MailSendInfoBindingModel info);
|
||||
|
||||
//ReceiveMailAsync();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,14 @@ using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using LawFirmContracts.BindingModels.Mails;
|
||||
using System.Net.Mime;
|
||||
using LawFirmContracts.BusinessLogicContracts;
|
||||
|
||||
namespace LawFirmBusinessLogic.MailWorker
|
||||
{
|
||||
public class MailKitWorker: AbstractMailWorker
|
||||
{
|
||||
public MailKitWorker(ILogger<MailKitWorker> logger) : base(logger) { }
|
||||
public MailKitWorker(ILogger<MailKitWorker> logger, IUserLogic userLogic) : base(logger, userLogic) { }
|
||||
|
||||
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
||||
{
|
||||
@ -26,7 +28,9 @@ namespace LawFirmBusinessLogic.MailWorker
|
||||
objMailMessage.Body = info.Text;
|
||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||
|
||||
Attachment attachment = new Attachment("C:\\Users\\User\\Desktop\\универ\\2курс\\рпп\\второйсеместр\\Курсовая\\pdfclientsreport.pdf", new ContentType(MediaTypeNames.Application.Pdf));
|
||||
objMailMessage.Attachments.Add(attachment);
|
||||
|
||||
objSmtpClient.UseDefaultCredentials = false;
|
||||
objSmtpClient.EnableSsl = true;
|
||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||
|
@ -46,7 +46,7 @@ namespace LawFirmBusinessLogic.OfficePackages
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = hearing.Item1,
|
||||
Text = hearing.Court,
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
@ -54,7 +54,7 @@ namespace LawFirmBusinessLogic.OfficePackages
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = hearing.Item2.ToString(),
|
||||
Text = hearing.HearingDate.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.BindingModels.Mails;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@ -40,6 +41,34 @@ namespace LawFirmClientApp.Controllers
|
||||
CompanyId = APIClient.User.CompanyId
|
||||
});
|
||||
}
|
||||
[HttpPost]
|
||||
|
||||
public void LoadReportClientsHearingWord(int clientId)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
APIClient.PostRequest($"api/report/saveclientswordfile", new ReportBindingModel
|
||||
{
|
||||
|
||||
CompanyId = APIClient.User.CompanyId,
|
||||
ClientId = clientId
|
||||
});
|
||||
}
|
||||
[HttpGet]
|
||||
|
||||
public IActionResult GetReportClientsHearing(int clientId)
|
||||
{
|
||||
ViewBag.Clients = APIClient.GetRequest<List<ClientViewModel>>($"api/client/getclientlist?companyId={APIClient.User.CompanyId}");
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View(APIClient.GetRequest<List<ReportClientsHearingViewModel>>($"api/report/getclientsreporthearing?clientid={clientId}&companyId={APIClient.User.CompanyId}"));
|
||||
}
|
||||
[HttpGet]
|
||||
|
||||
public IActionResult LoadReportClients(DateTime dateFrom, DateTime dateTo, string a)
|
||||
@ -63,6 +92,39 @@ namespace LawFirmClientApp.Controllers
|
||||
|
||||
return View(APIClient.GetRequest<List<ReportClientsViewModel>>($"api/report/getclientsreport?datefrom={dateFrom}&dateTo={dateTo}&companyId={APIClient.User.CompanyId}"));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void LoadReportClientsHearingExcel(int clientId)
|
||||
{
|
||||
if (APIClient.User == null)
|
||||
{
|
||||
Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
APIClient.PostRequest($"api/report/saveclientsexcelfile", new ReportBindingModel
|
||||
{
|
||||
|
||||
CompanyId = APIClient.User.CompanyId,
|
||||
ClientId = clientId
|
||||
});
|
||||
}
|
||||
[HttpPost]
|
||||
public void SendClientsPdf(DateTime dateFrom, DateTime dateTo, string organiserEmail)
|
||||
{
|
||||
APIClient.PostRequest($"api/report/saveclientspdffile", new ReportBindingModel
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo,
|
||||
CompanyId = APIClient.User.CompanyId
|
||||
});
|
||||
APIClient.PostRequest("api/report/mailsend", new MailSendInfoBindingModel
|
||||
{
|
||||
MailAddress = "dimazhelovanov@gmail.com",
|
||||
Subject = "Отчет по клиентам",
|
||||
Text = "Отчет по клиентам с " + dateFrom.ToShortDateString() + " до " + dateTo.ToShortDateString()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,8 @@
|
||||
<form action="/Report/CreateReportClients" method="get">
|
||||
|
||||
<button type="submit" class="btn btn-danger">Получить отчет</button>
|
||||
<button id="loadButton">Load Report Clients</button>
|
||||
<button id="loadButton" class="btn btn-danger">Скачать</button>
|
||||
<button id="loadButtonEmail" class="btn btn-danger">Отправить</button>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">От</div>
|
||||
@ -82,6 +83,7 @@
|
||||
}
|
||||
</div>
|
||||
<script>
|
||||
//не надо
|
||||
$(document).ready(function () {
|
||||
$('#formDownload').submit(function (e) {
|
||||
e.preventDefault(); // Предотвращаем отправку формы по умолчанию
|
||||
@ -133,4 +135,29 @@
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#loadButtonEmail').click(function () {
|
||||
var dateTo = $('#dateTo').val();
|
||||
var dateFrom = $('#dateFrom').val();
|
||||
// Выполняем AJAX-запрос
|
||||
$.ajax({
|
||||
url: '/Report/SendClientsPdf', // Замените на URL вашего метода контроллера
|
||||
type: 'POST', // Или 'POST', в зависимости от типа запроса
|
||||
data: {
|
||||
dateTo: dateTo,
|
||||
dateFrom: dateFrom
|
||||
},
|
||||
success: function (response) {
|
||||
// Обработка успешного ответа
|
||||
console.log(response);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Обработка ошибки
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
@ -0,0 +1,101 @@
|
||||
@using LawFirmContracts.ViewModels;
|
||||
|
||||
@model List<ReportClientsHearingViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Отчёт по клиентам";
|
||||
Layout = "~/Views/Shared/_LayoutIspol.cshtml";
|
||||
}
|
||||
<head>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</head>
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Отчёт по клиентам</h1>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
@{
|
||||
<form action="/Report/LoadReportClientsHearing" method="post">
|
||||
|
||||
<button type="submit" class="btn btn-danger">Получить отчет</button>
|
||||
<button id="loadButtonWord" class="btn btn-danger">в Word</button>
|
||||
|
||||
<div class="col-8">
|
||||
<select id="clientId" name="clientId" class="form-control" asp-items="@(new SelectList(@ViewBag.Clients,"Id", "FIO"))"></select>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Имя клиента
|
||||
</th>
|
||||
<th>
|
||||
Дело
|
||||
</th>
|
||||
<th>
|
||||
Суд
|
||||
</th>
|
||||
<th>
|
||||
Дата слушания
|
||||
</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td id="id">
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.ClientFIO)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.CaseName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.Court)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem =>
|
||||
item.HearingDate)
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#loadButtonWord').click(function () {
|
||||
var clientId = $('#clientId').val();
|
||||
|
||||
// Выполняем AJAX-запрос
|
||||
$.ajax({
|
||||
url: '/Report/LoadReportClientsHearingWord', // Замените на URL вашего метода контроллера
|
||||
type: 'POST', // Или 'POST', в зависимости от типа запроса
|
||||
data: {
|
||||
clientId: clientId
|
||||
|
||||
},
|
||||
success: function (response) {
|
||||
// Обработка успешного ответа
|
||||
console.log(response);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Обработка ошибки
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
@ -32,7 +32,10 @@
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="PrivacyLawyer">Личные данные</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Report" asp-action="CreateReportClients">Отчёт по сотрудникам</a>
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Report" asp-action="CreateReportClients">Отчёт по клиентам</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Report" asp-action="GetReportClientsHearing">Отчёт по слушаниям</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="RegisterLawyer">Регистрация</a>
|
||||
|
@ -11,6 +11,8 @@ namespace LawFirmContracts.ViewModels
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
//Это нужно?
|
||||
public string CaseName { get; set; } = string.Empty;
|
||||
public string? Court { get; set; } = string.Empty;
|
||||
public DateTime? HearingDate { get; set; }
|
||||
|
||||
public List<(string Court, DateTime HearingDate)> Hearings { get; set; } = new();
|
||||
public List<string> Cases { get; set; } = new();
|
||||
|
@ -39,6 +39,14 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.CompanyId.HasValue && model.Id.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Clients
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.CompanyId.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
|
@ -31,11 +31,14 @@ namespace LawFirmDatabaseImplement.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_visitClients == null)
|
||||
|
||||
if (_visitClients == null)
|
||||
{
|
||||
_visitClients = Clients
|
||||
.ToDictionary(recPC => recPC.ClientId, recPC => recPC.Client as IClientModel);
|
||||
}
|
||||
using var context = new LawFirmDatabase();
|
||||
_visitClients = Clients
|
||||
.ToDictionary(x => x.ClientId, x => (context.Clients
|
||||
.FirstOrDefault(y => y.Id == x.ClientId) as IClientModel));
|
||||
}
|
||||
return _visitClients;
|
||||
}
|
||||
}
|
||||
@ -48,6 +51,11 @@ namespace LawFirmDatabaseImplement.Models
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var visits = context.Visits.Where(x => x.ConsultationId == model.ConsultationId).ToList();
|
||||
if(visits.Count > 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Visit()
|
||||
{
|
||||
Id = model.Id,
|
||||
@ -65,17 +73,18 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public void Update(VisitBindingModel? model)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
|
||||
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
VisitDate = model.VisitDate;
|
||||
|
||||
VisitDate = model.VisitDate;
|
||||
ConsultationId = model.ConsultationId;
|
||||
Clients = model.VisitClients.Select(x => new
|
||||
VisitClient
|
||||
{
|
||||
Client = context.Clients.First(y => y.Id == x.Key)
|
||||
}).ToList();
|
||||
|
||||
|
||||
if (!model.CompanyId.HasValue) CompanyId = model.CompanyId;
|
||||
}
|
||||
public VisitViewModel GetViewModel => new()
|
||||
|
@ -1,6 +1,7 @@
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using LawFirmBusinessLogic.MailWorker;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.BindingModels.Mails;
|
||||
using LawFirmContracts.BusinessLogicContracts;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -14,12 +15,12 @@ namespace LawFirmRestApi.Controllers
|
||||
private readonly ILogger _logger;
|
||||
private readonly IReportLogic _reportLogic;
|
||||
|
||||
//private readonly AbstractMailWorker _mailWorker;
|
||||
public ReportController(ILogger<ReportController> logger, IReportLogic reportLogic)
|
||||
private readonly AbstractMailWorker _mailWorker;
|
||||
public ReportController(ILogger<ReportController> logger, IReportLogic reportLogic, AbstractMailWorker abstractMailWorker)
|
||||
{
|
||||
_logger = logger;
|
||||
_reportLogic = reportLogic;
|
||||
//_mailWorker = mailWorker;
|
||||
_mailWorker = abstractMailWorker;
|
||||
}
|
||||
[HttpPost]
|
||||
public void SaveClientsPdfFile(ReportBindingModel report)
|
||||
@ -42,18 +43,11 @@ namespace LawFirmRestApi.Controllers
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void SaveConsultationHearingToPdfFile(ReportBindingModel report)
|
||||
public void SaveClientsWordFile(ReportBindingModel report)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportLogic.SaveConsultationHearingToPdfFile(new ReportBindingModel
|
||||
{
|
||||
DateFrom = report.DateFrom,
|
||||
DateTo = report.DateTo,
|
||||
FileName = "C:\\Users\\xarla\\OneDrive\\Документы\\Отчёты_по_юрфирме\\pdfreport.pdf",
|
||||
LawyerId = report.LawyerId,
|
||||
CompanyId = report.CompanyId,
|
||||
});
|
||||
_reportLogic.SaveClientsHearingToWordFile(new ReportBindingModel { CompanyId = report.CompanyId, FileName = "C:\\Users\\User\\Desktop\\универ\\2курс\\рпп\\второйсеместр\\Курсовая\\wordclientsreport.docx", ClientId = report.ClientId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -61,7 +55,37 @@ namespace LawFirmRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void SaveClientsExcelFile(ReportBindingModel report)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportLogic.SaveClientsHearingToExcelFile(new ReportBindingModel { CompanyId = report.CompanyId, FileName = "C:\\Users\\User\\Desktop\\универ\\2курс\\рпп\\второйсеместр\\Курсовая\\excelclientsreport.xlsx", ClientId = report.ClientId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
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;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<ReportClientsViewModel> GetClientsReport(DateTime dateFrom, DateTime dateTo, int companyId)
|
||||
{
|
||||
@ -75,19 +99,6 @@ namespace LawFirmRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<ReportConsultationHearingViewModel> GetConsultationHearing(DateTime dateFrom, DateTime dateTo, int companyId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _reportLogic.GetConsultationHearing(new ReportBindingModel { DateFrom = dateFrom, DateTo = dateTo, CompanyId = companyId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
using LawFirmBusinessLogic.BusinessLogics;
|
||||
using LawFirmBusinessLogic.MailWorker;
|
||||
using LawFirmBusinessLogic.OfficePackages;
|
||||
using LawFirmBusinessLogic.OfficePackages.Implements;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.BindingModels.Mails;
|
||||
using LawFirmContracts.BusinessLogicContracts;
|
||||
using LawFirmContracts.StoragesContracts;
|
||||
using LawFirmContracts.ViewModels;
|
||||
@ -44,6 +46,7 @@ builder.Services.AddTransient<AbstractSaveToWordClientsHearing, SaveToWordClient
|
||||
builder.Services.AddTransient<AbstractSaveToWordVisitsLawyer, SaveToWordVisitsLawyer>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdfConsultationHearing, SaveToPdfConsultationHearing>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdfClients, SaveToPdfClients>();
|
||||
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
|
||||
|
||||
|
||||
builder.Services.AddControllers();
|
||||
@ -57,6 +60,17 @@ builder.Services.AddSwaggerGen(c => c.SwaggerDoc("v1", new OpenApiInfo
|
||||
}));
|
||||
|
||||
var app = builder.Build();
|
||||
var mailSender = app.Services.GetService<AbstractMailWorker>();
|
||||
|
||||
mailSender?.MailConfig(new MailConfigBindingModel
|
||||
{
|
||||
MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
|
||||
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
|
||||
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
|
||||
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
|
||||
PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
|
||||
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
|
||||
});
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
|
@ -11,5 +11,5 @@
|
||||
"PopHost": "pop.gmail.com",
|
||||
"PopPort": "995",
|
||||
"MailLogin": "lab7rpp@gmail.com",
|
||||
"MailPassword": "bvac xppu dkze ppcr"
|
||||
"MailPassword": "bzoh xhcm oecc glud"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user