Я футбольный мячик, бе бе бе
This commit is contained in:
parent
6c04fe617a
commit
26bc87fda9
@ -0,0 +1,58 @@
|
|||||||
|
using ElectronicsShopBusinessLogic.OfficePackage;
|
||||||
|
using ElectronicsShopBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
using ElectronicsShopContracts.BindingModels;
|
||||||
|
using ElectronicsShopContracts.BusinessLogicContracts;
|
||||||
|
using ElectronicsShopContracts.SearchModels;
|
||||||
|
using ElectronicsShopContracts.StorageContracts;
|
||||||
|
using ElectronicsShopContracts.ViewModels;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ElectronicsShopBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
public class ReportClientLogic : IReportClientLogic
|
||||||
|
{
|
||||||
|
private readonly IPaymeantStorage _paymeantstorage;
|
||||||
|
private readonly AbstractSaveToExcelClient _saveToExcel;
|
||||||
|
|
||||||
|
private readonly AbstractSaveToWordClient _saveToWord;
|
||||||
|
public ReportClientLogic(AbstractSaveToExcelClient abstractSaveToExcelClient, AbstractSaveToWordClient abstractSaveToWordClient, IPaymeantStorage paymeantStorage) {
|
||||||
|
_saveToExcel = abstractSaveToExcelClient;
|
||||||
|
_saveToWord= abstractSaveToWordClient;
|
||||||
|
_paymeantstorage= paymeantStorage;
|
||||||
|
}
|
||||||
|
public List<ReportPaymeantsViewModel> GetPaymeants(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
var paymeants = _paymeantstorage.GetFullList();
|
||||||
|
var list = new List<ReportPaymeantsViewModel>();
|
||||||
|
foreach(var paymeant in paymeants)
|
||||||
|
{
|
||||||
|
var record = new ReportPaymeantsViewModel
|
||||||
|
{
|
||||||
|
PaymeantName = paymeant.ID.ToString(),
|
||||||
|
//PaymeantsList=
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SavePaymeantToExcelFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToExcel.CreateReport(new ExcelInfoClient
|
||||||
|
{
|
||||||
|
FileName = model.ProductName,
|
||||||
|
Title = "Список оплат",
|
||||||
|
Paymeants = _paymeantstorage.GetFullList(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SavePaymeantToWordFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateDoc(new WordInfoClient
|
||||||
|
{
|
||||||
|
FileName = model.ProductName,
|
||||||
|
Title = "Список оплат",
|
||||||
|
ListPaymeant = _paymeantstorage.GetFullList(),
|
||||||
|
}) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -29,7 +29,7 @@ namespace ElectronicsShopBusinessLogic.OfficePackage
|
|||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)>
|
Texts = new List<(string, WordTextProperties)>
|
||||||
{ (pre.PaymeantName, new WordTextProperties { Size = "24", Bold=true})},
|
{ (pre.OrderID.ToString(), new WordTextProperties { Size = "24", Bold=true})},
|
||||||
TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
{
|
{
|
||||||
Size = "24",
|
Size = "24",
|
||||||
@ -37,21 +37,36 @@ namespace ElectronicsShopBusinessLogic.OfficePackage
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var route in pre.PaymeantsList)
|
|
||||||
{
|
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)>
|
Texts = new List<(string, WordTextProperties)>
|
||||||
{ (route.PayOption.ToString(), new WordTextProperties { Size = "20", Bold=false})},
|
{ (pre.PayOption.ToString(), new WordTextProperties { Size = "20", Bold=false})},
|
||||||
TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
{
|
{
|
||||||
Size = "24",
|
Size = "24",
|
||||||
JustificationType = WordJustificationType.Both
|
JustificationType = WordJustificationType.Both
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//Вот тут явно этого будет не хватать, но пока пусть будет только статуст
|
CreateParagraph(new WordParagraph
|
||||||
//Это AbstractSaveToWordClient
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)>
|
||||||
|
{ (pre.ProductID.ToString(), new WordTextProperties { Size = "20", Bold=false})},
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Both
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)>
|
||||||
|
{ (pre.SumPayment.ToString(), new WordTextProperties { Size = "20", Bold=false})},
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Both
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveWord(info);
|
SaveWord(info);
|
||||||
|
@ -8,6 +8,6 @@ namespace ElectronicsShopBusinessLogic.OfficePackage.HelperModels
|
|||||||
|
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
public List<ReportPaymeantsViewModel> Paymeants { get; set; } = new();
|
public List<PaymeantViewModel> Paymeants { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,6 @@ namespace ElectronicsShopBusinessLogic.OfficePackage.HelperModels
|
|||||||
|
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
public List<ReportPaymeantsViewModel> ListPaymeant { get; set; } = new();
|
public List<PaymeantViewModel> ListPaymeant { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ namespace ElectronicsShopContracts.BusinessLogicContracts
|
|||||||
{
|
{
|
||||||
public interface IReportClientLogic
|
public interface IReportClientLogic
|
||||||
{
|
{
|
||||||
List<ReportPaymeantsViewModel> GetPaymeants(ReportPaymeantBindingModel model);
|
List<ReportPaymeantsViewModel> GetPaymeants(ReportBindingModel model);
|
||||||
void SavePreservesToWordFile(ReportPaymeantBindingModel model);
|
void SavePaymeantToWordFile(ReportBindingModel model);
|
||||||
void SavePreservesToExcelFile(ReportPaymeantBindingModel model);
|
void SavePaymeantToExcelFile(ReportBindingModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,12 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IClientLogic _logic;
|
private readonly IClientLogic _logic;
|
||||||
|
private readonly IReportClientLogic _report;
|
||||||
|
|
||||||
public ClientController(ILogger<ClientController> logger, IClientLogic logic) {
|
public ClientController(ILogger<ClientController> logger, IClientLogic logic, IReportClientLogic reportClientLogic) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
|
_report = reportClientLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -54,5 +56,29 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateServiceListWordFile(ReportPaymeantBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_report.SavePaymeantToWordFile(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateServiceListExcelFile(ReportPaymeantBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_report.SavePaymeantToExcelFile(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,15 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
private readonly IEmployeeLogic _logic;
|
private readonly IEmployeeLogic _logic;
|
||||||
private readonly ICostItemLogic _costItem;
|
private readonly ICostItemLogic _costItem;
|
||||||
private readonly IProductLogic _productLogic;
|
private readonly IProductLogic _productLogic;
|
||||||
|
private readonly IReportEmployeeLogic _report;
|
||||||
|
|
||||||
public EmployeeController(ILogger<EmployeeController> logger, IEmployeeLogic logic, ICostItemLogic costItem, IProductLogic productLogic) {
|
public EmployeeController(ILogger<EmployeeController> logger, IEmployeeLogic logic, ICostItemLogic costItem,
|
||||||
|
IProductLogic productLogic, IReportEmployeeLogic reportEmployeeLogic) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
_costItem = costItem;
|
_costItem = costItem;
|
||||||
_productLogic = productLogic;
|
_productLogic = productLogic;
|
||||||
|
_report = reportEmployeeLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -147,5 +150,29 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateServiceListWordFile(ReportProductBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_report.SaveRoutesToWordFile(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateServiceListExcelFile(ReportProductBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_report.SaveRoutesToExcelFile(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
private readonly IOrderLogic _order;
|
private readonly IOrderLogic _order;
|
||||||
private readonly IMessageInfoLogic _message;
|
private readonly IMessageInfoLogic _message;
|
||||||
|
|
||||||
|
|
||||||
private Dictionary<int, (IProductModel, int)> _productlist;
|
private Dictionary<int, (IProductModel, int)> _productlist;
|
||||||
|
|
||||||
public MainController(ILogger<MainController> logger, IProductLogic product,
|
public MainController(ILogger<MainController> logger, IProductLogic product,
|
||||||
@ -159,5 +160,21 @@ namespace ElectronicsShopRestAPI.Controllers {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public List<ReportPaymeantsViewModel>? GetReportClient(int _clientID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return null;/*
|
||||||
|
{
|
||||||
|
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения списка заказов клиента id = {Id} ", _clientID);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,9 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
public class HomeController : Controller {
|
public class HomeController : Controller {
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
private Dictionary<int, (IProductModel, int)> _productList;
|
private Dictionary<int, (IProductModel, int)> _productList;
|
||||||
//private readonly IOrderLogic _order;
|
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger/*, IOrderLogic orderLogic*/) {
|
public HomeController(ILogger<HomeController> logger) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
//_order = orderLogic;
|
|
||||||
_productList = new Dictionary<int, (IProductModel, int)>();
|
_productList = new Dictionary<int, (IProductModel, int)>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,5 +162,18 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
var _product = APIClient.GetRequset<ProductViewModel>($"api/main/getproduct?_productid={product}");
|
var _product = APIClient.GetRequset<ProductViewModel>($"api/main/getproduct?_productid={product}");
|
||||||
return count * (_product?.Price ?? 1);
|
return count * (_product?.Price ?? 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Report()
|
||||||
|
{
|
||||||
|
//ViewBag.Reports = APIClient.GetRequset<List<ProductViewModel>>($"api/main/getproducts"); íàïèñàòü íîðìàëüíûå äàííûå îá îò÷¸òàõ
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Message()
|
||||||
|
{
|
||||||
|
//ViewBag.Reports = APIClient.GetRequset<List<ProductViewModel>>($"api/main/getproducts"); Ïèñåì òàê æå ïîêà íåìà
|
||||||
|
return View();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Отчёты</h1>
|
<h1 class="display-4">Письма</h1>
|
||||||
<a asp-action="CreateProduct">Создать товар</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@{
|
@{
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Report";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Отчёты</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<div class="align-content-center row mb-3">
|
||||||
|
<div class="col-sm-auto">
|
||||||
|
<label for="startDate">С:</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<input name="startDate" id="startDate" class="form-control" type="date" />
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-auto">
|
||||||
|
<label for="endDate">По:</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<input name="endDate" id="endDate" class="form-control" type="date" />
|
||||||
|
</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<input type="submit" name="getReport" class="btn btn-primary" value="Сформировать отчет" />
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<input type="submit" name="sendToMail" class="btn btn-primary" value="Отправить на почту" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
@ -35,7 +35,10 @@
|
|||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Orders">Корзины</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Orders">Корзины</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Message">Отчёты</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Report">Отчёты</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Message">Письма</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user