51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using ElectronicsShopBusinessLogic.OfficePackage;
|
|
using ElectronicsShopBusinessLogic.OfficePackage.HelperModels;
|
|
using ElectronicsShopContracts.BindingModels;
|
|
using ElectronicsShopContracts.BusinessLogicContracts;
|
|
using ElectronicsShopContracts.StorageContracts;
|
|
using ElectronicsShopContracts.ViewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ElectronicsShopBusinessLogic.BusinessLogic
|
|
{
|
|
public class ReportEmployeeLogic : IReportEmployeeLogic
|
|
{
|
|
private readonly IProductStorage _productStorage;
|
|
private readonly AbstractSaveToWordEmployee _saveToWord;
|
|
private readonly AbstractSaveToExcelEmployee _saveToExcel;
|
|
public ReportEmployeeLogic(AbstractSaveToExcelEmployee abstractSaveToExcelEmployee, AbstractSaveToWordEmployee abstractSaveToWordEmployee, IProductStorage productStorage) {
|
|
_productStorage = productStorage;
|
|
_saveToExcel = abstractSaveToExcelEmployee;
|
|
_saveToWord = abstractSaveToWordEmployee;
|
|
}
|
|
public List<ReportProductsViewModel> GetProduct(ReportProductBindingModel model)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void SaveProductsToExcelFile(ReportProductBindingModel model)
|
|
{
|
|
_saveToExcel.CreateReport(new ExcelInfoEmployee
|
|
{
|
|
FileName = model.FileName,
|
|
Title = "Список продуктов",
|
|
Products = _productStorage.GetFullList(),
|
|
});
|
|
}
|
|
|
|
public void SaveProductsToWordFile(ReportProductBindingModel model)
|
|
{
|
|
_saveToWord.CreateDoc(new WordInfoEmployee
|
|
{
|
|
FileName = model.FileName,
|
|
Title = "Список продуктов",
|
|
ListProduct = _productStorage.GetFullList()
|
|
});
|
|
}
|
|
}
|
|
}
|