Ура, почти всё. Чё там с дедлайном?
Мать жива?
This commit is contained in:
parent
3134b5f6e1
commit
740f8ec2ef
@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Mail;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CaseAccountingContracts.BindingModels;
|
||||||
|
|
||||||
|
namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class MailSender
|
||||||
|
{
|
||||||
|
private string mailLogin = string.Empty;
|
||||||
|
private string mailPassword = string.Empty;
|
||||||
|
private string smtpClientHost = string.Empty;
|
||||||
|
private int smtpClientPort;
|
||||||
|
|
||||||
|
public MailSender(){}
|
||||||
|
|
||||||
|
public void MailConfig(MailConfigBindingModel config)
|
||||||
|
{
|
||||||
|
mailLogin = config.MailLogin;
|
||||||
|
mailPassword = config.MailPassword;
|
||||||
|
smtpClientHost = config.SmtpClientHost;
|
||||||
|
smtpClientPort = config.SmtpClientPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void SendMailAsync(MailSendInfoBindingModel info)
|
||||||
|
{
|
||||||
|
using var objMailMessage = new MailMessage();
|
||||||
|
using var objSmtpClient = new SmtpClient(smtpClientHost, smtpClientPort);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
objMailMessage.From = new MailAddress(mailLogin);
|
||||||
|
objMailMessage.To.Add(new MailAddress(info.MailAddress));
|
||||||
|
objMailMessage.Subject = info.Subject;
|
||||||
|
objMailMessage.Body = info.Text;
|
||||||
|
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||||
|
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||||
|
|
||||||
|
MemoryStream ms = new(info.File);
|
||||||
|
objMailMessage.Attachments.Add(new Attachment(ms, "report.pdf", "application/pdf"));
|
||||||
|
|
||||||
|
objSmtpClient.UseDefaultCredentials = false;
|
||||||
|
objSmtpClient.EnableSsl = true;
|
||||||
|
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||||
|
objSmtpClient.Credentials = new NetworkCredential(mailLogin, mailPassword);
|
||||||
|
|
||||||
|
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using CaseAccountingBusinessLogic.OfficePackage;
|
using CaseAccountingBusinessLogic.BusinessLogic.OfficePackage;
|
||||||
|
using CaseAccountingBusinessLogic.OfficePackage;
|
||||||
using CaseAccountingContracts.BindingModels;
|
using CaseAccountingContracts.BindingModels;
|
||||||
using CaseAccountingContracts.BusinessLogicContracts;
|
using CaseAccountingContracts.BusinessLogicContracts;
|
||||||
using CaseAccountingContracts.SearchModels;
|
using CaseAccountingContracts.SearchModels;
|
||||||
@ -20,10 +21,12 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
|||||||
private readonly ILawyerStorage _lawyerStorage;
|
private readonly ILawyerStorage _lawyerStorage;
|
||||||
private readonly WordBuilderProvider _wordBuilder;
|
private readonly WordBuilderProvider _wordBuilder;
|
||||||
private readonly ExcelBuilderProvider _excelBuilder;
|
private readonly ExcelBuilderProvider _excelBuilder;
|
||||||
/*private readonly PdfBuilderProvider _pdfBuilder;
|
private readonly PdfBuilderProvider _pdfBuilder;
|
||||||
private readonly MailSender _mailSender;*/
|
private readonly MailSender _mailSender;
|
||||||
|
|
||||||
public ReportProviderLogic(ICaseStorage caseStorage, ISpecializationStorage specializationStorage, IHearingStorage hearingStorage, ILawyerStorage lawyerStorage, WordBuilderProvider wordBuilder, ExcelBuilderProvider excelBuilder)
|
public ReportProviderLogic(ICaseStorage caseStorage, ISpecializationStorage specializationStorage, IHearingStorage hearingStorage,
|
||||||
|
ILawyerStorage lawyerStorage, WordBuilderProvider wordBuilder, ExcelBuilderProvider excelBuilder,
|
||||||
|
PdfBuilderProvider pdfBuilder, MailSender mailSender)
|
||||||
{
|
{
|
||||||
_caseStorage = caseStorage ?? throw new ArgumentNullException(nameof(caseStorage));
|
_caseStorage = caseStorage ?? throw new ArgumentNullException(nameof(caseStorage));
|
||||||
_specializationStorage = specializationStorage ?? throw new ArgumentNullException(nameof(specializationStorage));
|
_specializationStorage = specializationStorage ?? throw new ArgumentNullException(nameof(specializationStorage));
|
||||||
@ -31,6 +34,8 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
|||||||
_lawyerStorage = lawyerStorage ?? throw new ArgumentNullException(nameof(lawyerStorage));
|
_lawyerStorage = lawyerStorage ?? throw new ArgumentNullException(nameof(lawyerStorage));
|
||||||
_wordBuilder = wordBuilder ?? throw new ArgumentNullException(nameof(wordBuilder));
|
_wordBuilder = wordBuilder ?? throw new ArgumentNullException(nameof(wordBuilder));
|
||||||
_excelBuilder = excelBuilder ?? throw new ArgumentNullException(nameof(excelBuilder));
|
_excelBuilder = excelBuilder ?? throw new ArgumentNullException(nameof(excelBuilder));
|
||||||
|
_pdfBuilder = pdfBuilder ?? throw new ArgumentNullException(nameof(pdfBuilder));
|
||||||
|
_mailSender = mailSender ?? throw new ArgumentNullException(nameof(mailSender));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReportCaseSpecializationViewModel> GetCaseSpecialization(List<CaseViewModel> models)
|
public List<ReportCaseSpecializationViewModel> GetCaseSpecialization(List<CaseViewModel> models)
|
||||||
@ -77,33 +82,37 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model)
|
public List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
/*var hearings = _hearingStorage
|
var hearings = _hearingStorage
|
||||||
.GetFilteredList(new HearingSearchModel { UserId = model.UserId})
|
.GetFilteredList(new HearingSearchModel { UserId = model.UserId })
|
||||||
.Where(x => model.DateFrom <= x.Date && model.DateTo >= x.Date);
|
.Where(x => model.DateFrom <= x.Date && model.DateTo >= x.Date);
|
||||||
var list = new List<ReportHearingLawyerViewModel>();
|
var list = new List<ReportHearingLawyerViewModel>();
|
||||||
foreach (var hearing in hearings)
|
foreach (var hearing in hearings)
|
||||||
{
|
{
|
||||||
var record = new ReportHearingLawyerViewModel
|
var record = new ReportHearingLawyerViewModel
|
||||||
{
|
{
|
||||||
Information = hearing.Information,
|
Hearing = "Номер слушания #" + hearing.Id.ToString(),
|
||||||
Date = hearing.Date,
|
CaseLawyers = new()
|
||||||
Lawyers = new List<(string Surname, string Name, string Patronymic)>()
|
|
||||||
};
|
};
|
||||||
foreach (var lawyer in _caseStorage.GetElement(new CaseSearchModel { Id = hearing.CaseId }).Lawyers.Values)
|
var caseId = _caseStorage.GetElement(new CaseSearchModel { Id = hearing.CaseId }).Id;
|
||||||
|
foreach (var lawyer in _lawyerStorage.GetLawyerMTM(caseId))
|
||||||
{
|
{
|
||||||
record.Lawyers.Add((lawyer.Surname, lawyer.Name, lawyer.Patronymic));
|
record.CaseLawyers.Add(new CaseLawyerViewModel
|
||||||
|
{
|
||||||
|
Case = "Дело #" + caseId.ToString(),
|
||||||
|
Date = hearing.Date,
|
||||||
|
Lawyer = lawyer.Surname + " " + lawyer.Name + " " + lawyer.Patronymic
|
||||||
|
});
|
||||||
}
|
}
|
||||||
list.Add(record);
|
list.Add(record);
|
||||||
}
|
}
|
||||||
return list;*/
|
return list;
|
||||||
return new();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] SaveListFile(CaseSpecializationListBindingModel model)
|
public byte[] SaveListFile(CaseSpecializationListBindingModel model)
|
||||||
{
|
{
|
||||||
byte[] file = Array.Empty<byte>();
|
byte[] file = Array.Empty<byte>();
|
||||||
|
|
||||||
string title = "Список дисциплин по выбранным студентам";
|
string title = "Список специализаций по выбраным делам";
|
||||||
|
|
||||||
if (model.FileType == "docx")
|
if (model.FileType == "docx")
|
||||||
{
|
{
|
||||||
@ -122,23 +131,23 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void SendByMailStatusReport(ReportBindingModel reportModel)
|
public void SendByMailStatusReport(ReportBindingModel reportModel)
|
||||||
{
|
{
|
||||||
byte[] file = _pdfBuilder.GetEducationStatusReportFile(new()
|
byte[] file = _pdfBuilder.GetHearingLawyerReportFile(new()
|
||||||
{
|
{
|
||||||
Title = "Отчет по статусам обучения",
|
Title = "Отчет по слушаниям",
|
||||||
DateFrom = reportModel.DateFrom,
|
DateFrom = reportModel.DateFrom,
|
||||||
DateTo = reportModel.DateTo,
|
DateTo = reportModel.DateTo,
|
||||||
Records = GetStreamStudentEdStatPeriod(reportModel)
|
Records = GetHearingLawyer(reportModel)
|
||||||
});
|
});
|
||||||
_mailSender.SendMailAsync(new()
|
_mailSender.SendMailAsync(new()
|
||||||
{
|
{
|
||||||
MailAddress = reportModel.UserEmail,
|
MailAddress = reportModel.UserEmail,
|
||||||
Subject = "Отчет по статусам обучения",
|
Subject = "Отчет по слушаниям",
|
||||||
Text = $"За период с {reportModel.DateFrom.ToShortDateString()} " +
|
Text = $"За период с {reportModel.DateFrom.ToShortDateString()} " +
|
||||||
$"по {reportModel.DateTo.ToShortDateString()}.",
|
$"по {reportModel.DateTo.ToShortDateString()}.",
|
||||||
File = file
|
File = file
|
||||||
});
|
});
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
|
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -5,7 +5,6 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
||||||
using CaseAccountingContracts.ViewModels;
|
using CaseAccountingContracts.ViewModels;
|
||||||
using ComputersShopBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using DocumentFormat.OpenXml;
|
using DocumentFormat.OpenXml;
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using CaseAccountingBusinessLogic.OfficePackage;
|
using CaseAccountingBusinessLogic.OfficePackage;
|
||||||
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
||||||
using CaseAccountingContracts.ViewModels;
|
using CaseAccountingContracts.ViewModels;
|
||||||
using ComputersShopBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using DocumentFormat.OpenXml;
|
using DocumentFormat.OpenXml;
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums
|
||||||
{
|
{
|
||||||
public enum ExcelStyleInfoType
|
public enum ExcelStyleInfoType
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums
|
||||||
{
|
{
|
||||||
public enum PdfParagraphAlignmentType
|
public enum PdfParagraphAlignmentType
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperEnums
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperEnums
|
||||||
{
|
{
|
||||||
public enum WordJustificationType
|
public enum WordJustificationType
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using ComputersShopBusinessLogic.OfficePackage.HelperEnums;
|
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class ExcelCellParameters
|
public class ExcelCellParameters
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class ExcelMergeParameters
|
public class ExcelMergeParameters
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using ComputersShopBusinessLogic.OfficePackage.HelperEnums;
|
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class PdfParagraph
|
public class PdfParagraph
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using ComputersShopBusinessLogic.OfficePackage.HelperEnums;
|
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class PdfRowParameters
|
public class PdfRowParameters
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class WordParagraph
|
public class WordParagraph
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using ComputersShopBusinessLogic.OfficePackage.HelperEnums;
|
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ComputersShopBusinessLogic.OfficePackage.HelperModels
|
namespace CaseAccountingBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class WordTextProperties
|
public class WordTextProperties
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,183 @@
|
|||||||
|
using CaseAccountingBusinessLogic.OfficePackage;
|
||||||
|
using CaseAccountingBusinessLogic.OfficePackage.HelperEnums;
|
||||||
|
using CaseAccountingBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using CaseAccountingContracts.ViewModels;
|
||||||
|
using MigraDoc.DocumentObjectModel;
|
||||||
|
using MigraDoc.DocumentObjectModel.Tables;
|
||||||
|
using MigraDoc.Rendering;
|
||||||
|
using PdfSharp.Pdf;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CaseAccountingBusinessLogic.BusinessLogic.OfficePackage
|
||||||
|
{
|
||||||
|
public class PdfBuilderProvider
|
||||||
|
{
|
||||||
|
private readonly string tempFileName = "temp.pdf";
|
||||||
|
private Document? document;
|
||||||
|
private Section? section;
|
||||||
|
private Table? table;
|
||||||
|
|
||||||
|
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
|
{
|
||||||
|
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
||||||
|
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
||||||
|
_ => ParagraphAlignment.Justify,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DefineStyles(Document document)
|
||||||
|
{
|
||||||
|
var style = document.Styles["Normal"];
|
||||||
|
style.Font.Name = "Times New Roman";
|
||||||
|
style.Font.Size = 14;
|
||||||
|
|
||||||
|
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
||||||
|
style.Font.Bold = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateDocument()
|
||||||
|
{
|
||||||
|
document = new Document();
|
||||||
|
DefineStyles(document);
|
||||||
|
section = document.AddSection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateParagraph(PdfParagraph pdfParagraph)
|
||||||
|
{
|
||||||
|
if (section == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var paragraph = section.AddParagraph(pdfParagraph.Text);
|
||||||
|
paragraph.Format.SpaceAfter = "1cm";
|
||||||
|
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
||||||
|
paragraph.Style = pdfParagraph.Style;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateTable(List<string> columns)
|
||||||
|
{
|
||||||
|
if (document == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
table = document.LastSection.AddTable();
|
||||||
|
foreach (var elem in columns)
|
||||||
|
{
|
||||||
|
table.AddColumn(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateRow(PdfRowParameters rowParameters)
|
||||||
|
{
|
||||||
|
if (table == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var row = table.AddRow();
|
||||||
|
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
||||||
|
{
|
||||||
|
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
||||||
|
if (!string.IsNullOrEmpty(rowParameters.Style))
|
||||||
|
{
|
||||||
|
row.Cells[i].Style = rowParameters.Style;
|
||||||
|
}
|
||||||
|
Unit borderWidth = 0.5;
|
||||||
|
row.Cells[i].Borders.Left.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Right.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Top.Width = borderWidth;
|
||||||
|
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
||||||
|
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
||||||
|
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Save()
|
||||||
|
{
|
||||||
|
|
||||||
|
// Регистрация провайдера кодировки для кодировки 1252, без этого ошибОчка была
|
||||||
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
|
|
||||||
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
|
{
|
||||||
|
Document = document
|
||||||
|
};
|
||||||
|
renderer.RenderDocument();
|
||||||
|
renderer.PdfDocument.Save(tempFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] GetFile()
|
||||||
|
{
|
||||||
|
Save();
|
||||||
|
byte[] file = File.ReadAllBytes(tempFileName);
|
||||||
|
File.Delete(tempFileName);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] GetHearingLawyerReportFile(PdfData<ReportHearingLawyerViewModel> data)
|
||||||
|
{
|
||||||
|
CreateDocument();
|
||||||
|
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = data.Title,
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateParagraph(new PdfParagraph
|
||||||
|
{
|
||||||
|
Text = $"за период с {data.DateFrom.ToShortDateString()} " +
|
||||||
|
$"по {data.DateTo.ToShortDateString()}",
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateTable(new List<string> { "4cm","5cm", "3cm", "3cm" });
|
||||||
|
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Номер слушания", "Дело", "Дата проведения", "Юрист" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var record in data.Records)
|
||||||
|
{
|
||||||
|
List<CaseLawyerViewModel> casesAndLawyes = record.CaseLawyers;
|
||||||
|
int recordHeight = casesAndLawyes.Count + 1;
|
||||||
|
for (int i = 0; i < recordHeight; i++)
|
||||||
|
{
|
||||||
|
List<string> cellsData = new() { "", "", "", "" };
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
cellsData[0] = record.Hearing;
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = cellsData,
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int k = i - 1;
|
||||||
|
if (k < casesAndLawyes.Count)
|
||||||
|
{
|
||||||
|
cellsData[1] = casesAndLawyes[k].Case;
|
||||||
|
cellsData[2] = casesAndLawyes[k].Date.ToString("yyyy-MM-dd");
|
||||||
|
cellsData[3] = casesAndLawyes[k].Lawyer;
|
||||||
|
}
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = cellsData,
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CaseAccountingContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class MailConfigBindingModel
|
||||||
|
{
|
||||||
|
public string MailLogin { get; set; } = string.Empty;
|
||||||
|
public string MailPassword { get; set; } = string.Empty;
|
||||||
|
public string SmtpClientHost { get; set; } = string.Empty;
|
||||||
|
public int SmtpClientPort { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CaseAccountingContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class MailSendInfoBindingModel
|
||||||
|
{
|
||||||
|
public string MailAddress { get; set; } = string.Empty;
|
||||||
|
public string Subject { get; set; } = string.Empty;
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
public byte[] File { get; set; } = Array.Empty<byte>();
|
||||||
|
}
|
||||||
|
}
|
@ -9,12 +9,9 @@ namespace CaseAccountingContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public class ReportBindingModel
|
public class ReportBindingModel
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string UserEmail { get; set; } = string.Empty;
|
||||||
|
public DateTime DateFrom { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime DateTo { get; set; }
|
||||||
|
|
||||||
public DateTime? DateTo { get; set; }
|
|
||||||
|
|
||||||
public int? UserId { get; set; }
|
public int? UserId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,7 @@ namespace CaseAccountingContracts.BusinessLogicContracts
|
|||||||
List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model);
|
List<ReportHearingLawyerViewModel> GetHearingLawyer(ReportBindingModel model);
|
||||||
|
|
||||||
byte[] SaveListFile(CaseSpecializationListBindingModel model);
|
byte[] SaveListFile(CaseSpecializationListBindingModel model);
|
||||||
|
|
||||||
|
void SendByMailStatusReport(ReportBindingModel reportModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,6 @@ namespace CaseAccountingContracts.StoragesContracts
|
|||||||
LawyerViewModel? Insert(LawyerBindingModel model);
|
LawyerViewModel? Insert(LawyerBindingModel model);
|
||||||
LawyerViewModel? Update(LawyerBindingModel model);
|
LawyerViewModel? Update(LawyerBindingModel model);
|
||||||
LawyerViewModel? Delete(LawyerBindingModel model);
|
LawyerViewModel? Delete(LawyerBindingModel model);
|
||||||
|
List<LawyerViewModel> GetLawyerMTM(int caseId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CaseAccountingContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class CaseLawyerViewModel
|
||||||
|
{
|
||||||
|
public string Case { get; set; } = string.Empty;
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
public string Lawyer { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -8,8 +8,7 @@ namespace CaseAccountingContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ReportHearingLawyerViewModel
|
public class ReportHearingLawyerViewModel
|
||||||
{
|
{
|
||||||
public string Information { get; set; } = string.Empty;
|
public string Hearing { get; set; } = string.Empty;
|
||||||
public DateTime Date { get; set; }
|
public List<CaseLawyerViewModel> CaseLawyers { get; set; } = new();
|
||||||
public List<(string Surname, string Name, string Patronymic)> Lawyers { get; set; } = new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ namespace CaseAccountingDataBaseImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_case.Update(model);
|
_case.Update(context, model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
_case.UpdateLawyers(context, model);
|
_case.UpdateLawyers(context, model);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
|
@ -129,7 +129,7 @@ namespace CaseAccountingDataBaseImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
hearing.Update(model);
|
hearing.Update(context, model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return context.Hearings
|
return context.Hearings
|
||||||
.Include(x => x.Case)
|
.Include(x => x.Case)
|
||||||
|
@ -89,6 +89,20 @@ namespace CaseAccountingDataBaseImplement.Implements
|
|||||||
.Select(x => x.GetViewModel).ToList();
|
.Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LawyerViewModel> GetLawyerMTM(int caseId)
|
||||||
|
{
|
||||||
|
using var context = new CaseAccountingDatabase();
|
||||||
|
var lawyersId = context.CaseLawyers
|
||||||
|
.Where(x => x.CaseId == caseId)
|
||||||
|
.Select(x => x.LawyerId).ToList();
|
||||||
|
return context.Lawyers
|
||||||
|
.Include(x => x.Specialization)
|
||||||
|
.Include(x => x.User)
|
||||||
|
.Where(X => lawyersId.Contains(X.Id))
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public LawyerViewModel? Insert(LawyerBindingModel model)
|
public LawyerViewModel? Insert(LawyerBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new CaseAccountingDatabase();
|
using var context = new CaseAccountingDatabase();
|
||||||
|
@ -87,15 +87,19 @@ namespace CaseAccountingDataBaseImplement.Models
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(CaseBindingModel model)
|
public void Update(CaseAccountingDatabase context, CaseBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Name = model.Name;
|
Name = model.Name;
|
||||||
|
Applicant = model.Applicant;
|
||||||
|
Defendant = model.Defendant;
|
||||||
|
SpecializationId = model.SpecializationId;
|
||||||
|
Specialization = context.Specializations.FirstOrDefault(x => x.Id == model.SpecializationId) ?? throw new Exception("Specialization не существует");
|
||||||
Annotation = model.Annotation;
|
Annotation = model.Annotation;
|
||||||
Date = model.Date;
|
Date = DateTime.SpecifyKind(model.Date, DateTimeKind.Utc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateLawyers(CaseAccountingDatabase context, CaseBindingModel model)
|
public void UpdateLawyers(CaseAccountingDatabase context, CaseBindingModel model)
|
||||||
|
@ -80,7 +80,7 @@ namespace CaseAccountingDataBaseImplement.Models
|
|||||||
}
|
}
|
||||||
Subject = model.Subject;
|
Subject = model.Subject;
|
||||||
Responsibilities = model.Responsibilities;
|
Responsibilities = model.Responsibilities;
|
||||||
Date = model.Date;
|
Date = DateTime.SpecifyKind(model.Date, DateTimeKind.Utc);
|
||||||
if (model.Contracts.Count > 0)
|
if (model.Contracts.Count > 0)
|
||||||
{
|
{
|
||||||
Contracts = model.Contracts.Select(x => new DealContract
|
Contracts = model.Contracts.Select(x => new DealContract
|
||||||
|
@ -47,14 +47,16 @@ namespace CaseAccountingDataBaseImplement.Models
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update (HearingBindingModel? model)
|
public void Update (CaseAccountingDatabase context, HearingBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Information = model.Information;
|
Information = model.Information;
|
||||||
Date = model.Date;
|
CaseId = model.CaseId;
|
||||||
|
Case = context.Cases.FirstOrDefault(x => x.Id == model.CaseId) ?? throw new Exception("Case не существует");
|
||||||
|
DateTime.SpecifyKind(model.Date, DateTimeKind.Utc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HearingViewModel GetViewModel => new()
|
public HearingViewModel GetViewModel => new()
|
||||||
|
@ -52,6 +52,36 @@ namespace CaseAccountingProviderView.Controllers
|
|||||||
return file!.Select(b => (int)b).ToArray();
|
return file!.Select(b => (int)b).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IActionResult GetReport()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public List<ReportHearingLawyerViewModel>? GetReport([FromBody] ReportBindingModel reportModel)
|
||||||
|
{
|
||||||
|
if (APIUser.User == null)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
reportModel.UserId = APIUser.User.Id;
|
||||||
|
reportModel.UserEmail = APIUser.User.Login;
|
||||||
|
List<ReportHearingLawyerViewModel>? list = APIUser.PostRequestWithResult<ReportBindingModel, List<ReportHearingLawyerViewModel>>
|
||||||
|
("api/reportprovider/getreportdata", reportModel);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void SendByMailStatusReport([FromBody] ReportBindingModel reportModel)
|
||||||
|
{
|
||||||
|
if (APIUser.User == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reportModel.UserId = APIUser.User.Id;
|
||||||
|
reportModel.UserEmail = APIUser.User.Login;
|
||||||
|
APIUser.PostRequest("api/reportprovider/sendbymailstatusreport", reportModel);
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Login(string login, string password)
|
public void Login(string login, string password)
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Отчет";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Отчет по слушаниям</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="error-div-shell" class="error-div-shell mb-2">
|
||||||
|
<div>
|
||||||
|
<p id="error-p" class="error-p"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex flex-wrap gap-1 align-items-end mb-2">
|
||||||
|
<div class="mb-2">
|
||||||
|
<p class="mb-0">Дата начала:</p>
|
||||||
|
<input id="date-from-input" class="form-control" type="date" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-2">
|
||||||
|
<p class="mb-0">Дата конца:</p>
|
||||||
|
<input id="date-to-input" class="form-control" type="date" />
|
||||||
|
</div>
|
||||||
|
<button id="generate-button" class="btn btn-primary mb-2">
|
||||||
|
Показать
|
||||||
|
</button>
|
||||||
|
<button id="send-by-mail-button" class="btn btn-primary mb-2">
|
||||||
|
На почту
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="mb-0">
|
||||||
|
<span>За период с </span>
|
||||||
|
<span id="date-from-span" class="fw-bold">...</span>
|
||||||
|
<span> по </span>
|
||||||
|
<span id="date-to-span" class="fw-bold">...</span>
|
||||||
|
</p>
|
||||||
|
<div class="table-shell mb-2 border">
|
||||||
|
<table class="table mb-0">
|
||||||
|
<thead class="table-head">
|
||||||
|
<tr>
|
||||||
|
<th>Номер слушания</th>
|
||||||
|
<th>Дело</th>
|
||||||
|
<th>Дата проведения</th>
|
||||||
|
<th>Юрист</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody">
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="table"></div>
|
||||||
|
|
||||||
|
<script src="~/js/report/reportpdf.js" asp-append-version="true"></script>
|
@ -22,7 +22,7 @@
|
|||||||
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Deals">Договора</a>
|
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Deals">Договора</a>
|
||||||
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Hearings">Слушания</a>
|
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Hearings">Слушания</a>
|
||||||
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="SpecializationCaselist">Получение список</a>
|
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="SpecializationCaselist">Получение список</a>
|
||||||
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Hearings">Получение отчёта</a>
|
<a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="GetReport">Получение отчёта</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
const dateFromInput = document.getElementById("date-from-input");
|
||||||
|
const dateToInput = document.getElementById("date-to-input");
|
||||||
|
const generateButton = document.getElementById("generate-button");
|
||||||
|
const sendByMailButton = document.getElementById("send-by-mail-button");
|
||||||
|
const dateToSpan = document.getElementById("date-to-span");
|
||||||
|
const dateFromSpan = document.getElementById("date-from-span");
|
||||||
|
const tbody = document.getElementById("tbody");
|
||||||
|
|
||||||
|
generateButton.addEventListener("click", () => {
|
||||||
|
const dateFrom = new Date(dateFromInput.value);
|
||||||
|
const dateTo = new Date(dateToInput.value);
|
||||||
|
const reportModel = {
|
||||||
|
"DateFrom": dateFrom,
|
||||||
|
"DateTo": dateTo
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
url: "/home/getreport",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json",
|
||||||
|
data: JSON.stringify(reportModel)
|
||||||
|
}).done((data) => {
|
||||||
|
dateFromSpan.innerHTML = reportModel["DateFrom"].toLocaleDateString();
|
||||||
|
dateToSpan.innerHTML = reportModel["DateTo"].toLocaleDateString();
|
||||||
|
renderTable(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const formatDate = (dateString) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||||
|
const day = ('0' + date.getDate()).slice(-2);
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
sendByMailButton.addEventListener("click", () => {
|
||||||
|
const dateFrom = new Date(dateFromInput.value);
|
||||||
|
const dateTo = new Date(dateToInput.value);
|
||||||
|
const reportModel = {
|
||||||
|
"DateFrom": dateFrom,
|
||||||
|
"DateTo": dateTo
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
url: "/home/sendbymailstatusreport",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json",
|
||||||
|
data: JSON.stringify(reportModel)
|
||||||
|
}).done(() => {
|
||||||
|
alert("Отчет успешно отправлен на вашу почту!")
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const renderTable = (data) => {
|
||||||
|
tbody.innerHTML = "";
|
||||||
|
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
var hearingData = data[i];
|
||||||
|
var hearingName = hearingData.hearing;
|
||||||
|
|
||||||
|
for (var j = 0; j < hearingData.caseLawyers.length; j++) {
|
||||||
|
var info = hearingData.caseLawyers[j];
|
||||||
|
|
||||||
|
if (j === 0) {
|
||||||
|
var row = tbody.insertRow();
|
||||||
|
var hearingNameCell = row.insertCell()
|
||||||
|
hearingNameCell.textContent = hearingName;
|
||||||
|
var caseNameCell = row.insertCell();
|
||||||
|
var dateCell = row.insertCell();
|
||||||
|
var lawyerCell = row.insertCell();
|
||||||
|
tbody.appendChild(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
var row = tbody.insertRow();
|
||||||
|
var hearingNameCell = row.insertCell()
|
||||||
|
var caseNameCell = row.insertCell();
|
||||||
|
caseNameCell.textContent = info.case;
|
||||||
|
var dateCell = row.insertCell();
|
||||||
|
dateCell.textContent = formatDate(info.date);
|
||||||
|
var lawyerCell = row.insertCell();
|
||||||
|
lawyerCell.textContent = info.lawyer;
|
||||||
|
|
||||||
|
tbody.appendChild(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using CaseAccountingContracts.BindingModels;
|
using CaseAccountingContracts.BindingModels;
|
||||||
using CaseAccountingContracts.BusinessLogicContracts;
|
using CaseAccountingContracts.BusinessLogicContracts;
|
||||||
|
using CaseAccountingContracts.ViewModels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace CaseAccountingRestApi.Controllers
|
namespace CaseAccountingRestApi.Controllers
|
||||||
@ -21,5 +22,18 @@ namespace CaseAccountingRestApi.Controllers
|
|||||||
byte[] file = reportLogic.SaveListFile(listModel);
|
byte[] file = reportLogic.SaveListFile(listModel);
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public List<ReportHearingLawyerViewModel> GetReportData(ReportBindingModel reportModel)
|
||||||
|
{
|
||||||
|
var list = reportLogic.GetHearingLawyer(reportModel);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void SendByMailStatusReport(ReportBindingModel reportModel)
|
||||||
|
{
|
||||||
|
reportLogic.SendByMailStatusReport(reportModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
using CaseAccountingBusinessLogic.BusinessLogic.OfficePackage;
|
||||||
using CaseAccountingBusinessLogic.BusinessLogics;
|
using CaseAccountingBusinessLogic.BusinessLogics;
|
||||||
using CaseAccountingBusinessLogic.OfficePackage;
|
using CaseAccountingBusinessLogic.OfficePackage;
|
||||||
|
using CaseAccountingContracts.BindingModels;
|
||||||
using CaseAccountingContracts.BusinessLogicContracts;
|
using CaseAccountingContracts.BusinessLogicContracts;
|
||||||
using CaseAccountingContracts.StoragesContracts;
|
using CaseAccountingContracts.StoragesContracts;
|
||||||
using CaseAccountingDataBaseImplement.Implements;
|
using CaseAccountingDataBaseImplement.Implements;
|
||||||
@ -31,6 +33,9 @@ builder.Services.AddTransient<IReportProviderLogic, ReportProviderLogic>();
|
|||||||
|
|
||||||
builder.Services.AddTransient<WordBuilderProvider>();
|
builder.Services.AddTransient<WordBuilderProvider>();
|
||||||
builder.Services.AddTransient<ExcelBuilderProvider>();
|
builder.Services.AddTransient<ExcelBuilderProvider>();
|
||||||
|
builder.Services.AddTransient<PdfBuilderProvider>();
|
||||||
|
|
||||||
|
builder.Services.AddSingleton<MailSender>();
|
||||||
|
|
||||||
builder.Services.AddControllers().AddNewtonsoftJson();
|
builder.Services.AddControllers().AddNewtonsoftJson();
|
||||||
|
|
||||||
@ -48,6 +53,15 @@ builder.Services.AddSwaggerGen(c =>
|
|||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
var mailSender = app.Services.GetService<MailSender>();
|
||||||
|
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()),
|
||||||
|
});
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
@ -5,5 +5,11 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"SmtpClientHost": "smtp.gmail.com",
|
||||||
|
"SmtpClientPort": "587",
|
||||||
|
"PopHost": "pop.gmail.com",
|
||||||
|
"PopPort": "995",
|
||||||
|
"MailLogin": "rpplabs098@gmail.com",
|
||||||
|
"MailPassword": "sxwf ohjr cgba wext"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user