99 lines
3.3 KiB
C#
99 lines
3.3 KiB
C#
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||
using BankYouBankruptBusinessLogic.OfficePackage;
|
||
using BankYouBankruptContracts.BindingModels;
|
||
using BankYouBankruptContracts.BusinessLogicsContracts;
|
||
using BankYouBankruptContracts.SearchModels;
|
||
using BankYouBankruptContracts.StoragesContracts;
|
||
using BankYouBankruptContracts.ViewModels;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||
{
|
||
public class ReportClientLogic : IReportClientLogic
|
||
{
|
||
private readonly ICreditingStorage _creditingStorage;
|
||
private readonly IDebitingStorage _debitingStorage;
|
||
|
||
private readonly AbstractSaveToExcelClient _saveToExcel;
|
||
private readonly AbstractSaveToWordClient _saveToWord;
|
||
private readonly AbstractSaveToPdfClient _saveToPdf;
|
||
|
||
public ReportClientLogic(ICreditingStorage creditingStorage, IDebitingStorage debitingStorage,
|
||
AbstractSaveToExcelClient saveToExcel, AbstractSaveToWordClient saveToWord, AbstractSaveToPdfClient saveToPdf)
|
||
{
|
||
_creditingStorage = creditingStorage;
|
||
_debitingStorage = debitingStorage;
|
||
|
||
_saveToExcel = saveToExcel;
|
||
_saveToWord = saveToWord;
|
||
_saveToPdf = saveToPdf;
|
||
}
|
||
|
||
public List<ReportClientViewModel>? GetCrediting(ReportBindingModel model)
|
||
{
|
||
return _creditingStorage.GetFilteredList(new CreditingSearchModel
|
||
{
|
||
DateFrom = model.DateFrom,
|
||
DateTo = model.DateTo,
|
||
}).Select(x => new ReportClientViewModel
|
||
{
|
||
CardNumber = x.CardNumber,
|
||
SumOperation = x.Sum,
|
||
DateComplite = x.DateOpen
|
||
}).ToList();
|
||
}
|
||
|
||
public List<ReportClientViewModel>? GetDebiting(ReportBindingModel model)
|
||
{
|
||
return _debitingStorage.GetFilteredList(new DebitingSearchModel
|
||
{
|
||
DateTo = model.DateFrom,
|
||
DateFrom = model.DateTo,
|
||
}).Select(x => new ReportClientViewModel
|
||
{
|
||
CardNumber = x.CardNumber,
|
||
SumOperation = x.Sum,
|
||
DateComplite = x.DateClose
|
||
}).ToList();
|
||
}
|
||
|
||
public void SaveCreditingToExcelFile(ReportBindingModel model)
|
||
{
|
||
throw new NotImplementedException();
|
||
}
|
||
|
||
public void SaveCreditingToWordFile(ReportBindingModel model)
|
||
{
|
||
throw new NotImplementedException();
|
||
}
|
||
|
||
public void SaveDebitingToExcelFile(ReportBindingModel model)
|
||
{
|
||
throw new NotImplementedException();
|
||
}
|
||
|
||
public void SaveDebitingToWordFile(ReportBindingModel model)
|
||
{
|
||
throw new NotImplementedException();
|
||
}
|
||
|
||
//отчёт в формате PDF для клиента
|
||
public void SaveClientReportToPdfFile(ReportBindingModel model)
|
||
{
|
||
_saveToPdf.CreateDoc(new PdfInfoClient
|
||
{
|
||
FileName = model.FileName,
|
||
Title = "Отчёт по операциям с картой",
|
||
DateFrom = model.DateFrom!.Value,
|
||
DateTo = model.DateTo!.Value,
|
||
ReportCrediting = GetCrediting(model),
|
||
ReportDebiting = GetDebiting(model)
|
||
});
|
||
}
|
||
}
|
||
}
|