Merge branch 'main' of http://student.git.athene.tech/shadowik/CourseWork_BankYouBankrupt
This commit is contained in:
commit
5f765a77cf
@ -1,36 +0,0 @@
|
||||
using BankYouBankruptContracts.BusinessLogicsContracts;
|
||||
using DocumentFormat.OpenXml.ExtendedProperties;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ReportLoad : IReportLoad
|
||||
{
|
||||
public byte[] LoadFile(bool whoRequested)
|
||||
{
|
||||
string pdfFilePath;
|
||||
|
||||
//если пришло true, то загружаем отчёт клиента
|
||||
if (whoRequested)
|
||||
{
|
||||
pdfFilePath = "C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт_по_картам.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
pdfFilePath = "C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт_по_счетам.pdf";
|
||||
}
|
||||
|
||||
byte[] bytes = System.IO.File.ReadAllBytes(pdfFilePath);
|
||||
|
||||
System.IO.File.WriteAllBytes(pdfFilePath, bytes);
|
||||
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
@ -35,8 +35,8 @@ namespace BankYouBankruptСlientApp
|
||||
}
|
||||
}
|
||||
|
||||
//Post-запрос
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
//Post-запрос
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
@ -254,7 +254,9 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View();
|
||||
ViewBag.DataOfClientReport = null;
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@ -265,12 +267,14 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
throw new Exception("Не авторизованы");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateClientReport", new ReportSupportBindingModel()
|
||||
APIClient.PostRequest("api/Report/CreateClientReport", new ReportSupportBindingModel()
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
});
|
||||
|
||||
ViewBag.DataOfClientReport = APIClient.GetRequest<ReportClientViewModelForHTML>($"api/Report/GetDataOfClientReport");
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
@{
|
||||
@using BankYouBankruptContracts.ViewModels;
|
||||
|
||||
@model ReportClientViewModelForHTML
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Создание отчёта";
|
||||
}
|
||||
|
||||
@ -24,6 +28,87 @@
|
||||
<input id="createReport" type="submit" value="Сформировать отчёт" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
@if (Model != null)
|
||||
{
|
||||
<div class="row">
|
||||
<p>Отчёт по пополнениям</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер операции
|
||||
</th>
|
||||
<th>
|
||||
Номер карты
|
||||
</th>
|
||||
<th>
|
||||
Сумма
|
||||
</th>
|
||||
<th>
|
||||
Дата операции
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.ReportCrediting)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.OperationId)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CardNumber)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SumOperation)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DateComplite)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>Отчёт по снятиям</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер операции
|
||||
</th>
|
||||
<th>
|
||||
Номер карты
|
||||
</th>
|
||||
<th>
|
||||
Сумма
|
||||
</th>
|
||||
<th>
|
||||
Дата операции
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.ReportDebiting)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.OperationId)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CardNumber)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.SumOperation)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DateComplite)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</form>
|
||||
|
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IReportLoad
|
||||
{
|
||||
byte[] LoadFile(bool whoRequested);
|
||||
}
|
||||
}
|
@ -18,29 +18,29 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
//private readonly IReportCashierLogic _reportCashierLogic;
|
||||
|
||||
private readonly IReportClientLogic _reportClientLogic;
|
||||
|
||||
private readonly IReportCashierLogic _reportCashierLogic;
|
||||
|
||||
private readonly IReportLoad _reportLoad;
|
||||
//хранят данные для отображения отчёта на вебе
|
||||
private ReportClientViewModelForHTML _reportClientViewModelForHTML;
|
||||
|
||||
public ReportController(ILogger<ReportController> logger, IReportClientLogic reportClientLogic, IReportCashierLogic reportCashierLogic, IReportLoad reportLoad)
|
||||
private ReportCashierViewModelForHTML _reportCashierViewModelForHTML;
|
||||
|
||||
public ReportController(ILogger<ReportController> logger, IReportClientLogic reportClientLogic, IReportCashierLogic reportCashierLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_reportClientLogic = reportClientLogic;
|
||||
_reportCashierLogic = reportCashierLogic;
|
||||
_reportLoad = reportLoad;
|
||||
}
|
||||
|
||||
//метод генерации отчёта за период по картам клиента
|
||||
[HttpPost]
|
||||
public ReportClientViewModelForHTML CreateClientReport(ReportSupportBindingModel model)
|
||||
public void CreateClientReport(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
||||
_reportClientViewModelForHTML = _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт_по_картам.pdf",
|
||||
DateFrom = model.DateFrom,
|
||||
@ -56,11 +56,11 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
|
||||
//метод генерации отчёта по всем счетм клиентов
|
||||
[HttpPost]
|
||||
public ReportCashierViewModelForHTML CreateCashierReport(ReportSupportBindingModel model)
|
||||
public void CreateCashierReport(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _reportCashierLogic.SaveAccountsToPdfFile(new ReportBindingModel
|
||||
_reportCashierViewModelForHTML = _reportCashierLogic.SaveAccountsToPdfFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт_по_счетам.pdf",
|
||||
ClientId = model.ClientId,
|
||||
@ -74,5 +74,78 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//передача данных из отчёта клиента
|
||||
[HttpGet]
|
||||
public ReportClientViewModelForHTML GetDataOfClientReport()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _reportClientViewModelForHTML;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//передача данных из отчёта кассира
|
||||
[HttpGet]
|
||||
public ReportCashierViewModelForHTML GetDataOfCashierReport()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _reportCashierViewModelForHTML;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//метод генерации отчёта за период по картам клиента
|
||||
[HttpPost]
|
||||
public void CreateClientReport(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportClientViewModelForHTML = _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт_по_картам.pdf",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//метод генерации отчёта по всем счетм клиентов
|
||||
[HttpPost]
|
||||
public void CreateCashierReport(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportCashierViewModelForHTML = _reportCashierLogic.SaveAccountsToPdfFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт_по_счетам.pdf",
|
||||
ClientId = model.ClientId,
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -34,14 +34,11 @@ builder.Services.AddTransient<IDebitingLogic, DebitingLogic>();
|
||||
builder.Services.AddTransient<ICashWithdrawalLogic, CashWithdrawalLogic>();
|
||||
|
||||
builder.Services.AddTransient<IReportClientLogic, ReportClientLogic>();
|
||||
builder.Services.AddTransient<IReportCashierLogic, ReportCashierLogic>();
|
||||
|
||||
//для отправки файла в приложение
|
||||
builder.Services.AddTransient<IReportLoad, ReportLoad>();
|
||||
builder.Services.AddSingleton<IReportCashierLogic, ReportCashierLogic>();
|
||||
|
||||
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||
|
||||
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
|
||||
|
||||
//теперь общий
|
||||
builder.Services.AddTransient<AbstractSaveToPdfClient, SaveToPdf>();
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user