59 lines
2.1 KiB
C#
59 lines
2.1 KiB
C#
|
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(),
|
|||
|
}) ;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|