Merge branch 'main' of http://student.git.athene.tech/shadowik/CourseWork_BankYouBankrupt
This commit is contained in:
commit
08b2eb05c0
@ -6,10 +6,6 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Implements\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
|
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||||
|
@ -0,0 +1,107 @@
|
|||||||
|
using BankYouBankruptBusinessLogic.OfficePackage;
|
||||||
|
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||||||
|
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 ReportCashierLogic : IReportCashierLogic
|
||||||
|
{
|
||||||
|
private readonly IMoneyTransferStorage _moneyTransferStorage;
|
||||||
|
|
||||||
|
private readonly ICashWithdrawalStorage _cashWithdrawalStorage;
|
||||||
|
|
||||||
|
private readonly IAccountStorage _accountStorage;
|
||||||
|
|
||||||
|
private readonly AbstractSaveToExcelCashier _saveToExcel;
|
||||||
|
|
||||||
|
private readonly AbstractSaveToWordCashier _saveToWord;
|
||||||
|
|
||||||
|
private readonly AbstractSaveToPdfCashier _saveToPdf;
|
||||||
|
|
||||||
|
//инициализируем поля класса через контейнер
|
||||||
|
public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage,
|
||||||
|
IAccountStorage accountStorage, AbstractSaveToExcelCashier saveToExcel, AbstractSaveToWordCashier saveToWord,
|
||||||
|
AbstractSaveToPdfCashier saveToPdf)
|
||||||
|
{
|
||||||
|
_moneyTransferStorage = moneyTransferStorage;
|
||||||
|
_cashWithdrawalStorage = cashWithdrawalStorage;
|
||||||
|
_accountStorage = accountStorage;
|
||||||
|
|
||||||
|
_saveToExcel = saveToExcel;
|
||||||
|
_saveToWord = saveToWord;
|
||||||
|
_saveToPdf = saveToPdf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReportCashierViewModel>? GetMoneyTransfers(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
return _moneyTransferStorage.GetFilteredList(new MoneyTransferSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo})
|
||||||
|
.Select(x => new ReportCashierViewModel
|
||||||
|
{
|
||||||
|
AccountId = x.Id,
|
||||||
|
DateOperation = x.DateOperation,
|
||||||
|
ClientName = x.ClientName,
|
||||||
|
SumOperation = x.SumOperation,
|
||||||
|
TypeOperation = x.TypeOperation
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReportCashierViewModel>? GetCashWithrawals(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
return _cashWithdrawalStorage.GetFilteredList(new CashWithdrawalSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo })
|
||||||
|
.Select(x => new ReportOrdersViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
DateCreate = x.DateCreate,
|
||||||
|
ManufactureName = x.ManufactureName,
|
||||||
|
Sum = x.Sum,
|
||||||
|
OrderStatus = x.Status.ToString()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Сохранение мороженных в файл-Word
|
||||||
|
public void SaveAccountsToWordFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список изделий",
|
||||||
|
Accounts = _accountStorage.GetFullList()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Сохранение заготовок с указаеним изделий в файл-Excel
|
||||||
|
public void SaveAccountsToExcelFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToExcel.CreateReport(new ExcelInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список заготовок",
|
||||||
|
Accounts = _accountStorage.GetFullList()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Сохранение заказов в файл-Pdf
|
||||||
|
public void SaveAccountsToPdfFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToPdf.CreateDoc(new PdfInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список заказов",
|
||||||
|
DateFrom = model.DateFrom!.Value,
|
||||||
|
DateTo = model.DateTo!.Value,
|
||||||
|
ReportAccounts = GetAccounts(model)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using BankYouBankruptContracts.ViewModels;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -14,5 +15,8 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
|
|||||||
|
|
||||||
//заголовок
|
//заголовок
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
}
|
|
||||||
|
//список счетов для вывода и сохранения
|
||||||
|
public List<AccountViewModel> Accounts { get; set; } = new();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,6 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
|
|||||||
public DateTime DateTo { get; set; }
|
public DateTime DateTo { get; set; }
|
||||||
|
|
||||||
//перечень заказов за указанный период для вывода/сохранения
|
//перечень заказов за указанный период для вывода/сохранения
|
||||||
public List<ReportCashierViewModel> reportAccounts { get; set; } = new();
|
public List<ReportCashierViewModel> ReportAccounts { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,12 @@ namespace BankYouBankruptContracts.BusinessLogicsContracts
|
|||||||
{
|
{
|
||||||
public interface IReportCashierLogic
|
public interface IReportCashierLogic
|
||||||
{
|
{
|
||||||
List<ReportCashierViewModel>? GetAccounts(ReportBindingModel model);
|
List<ReportCashierViewModel>? GetMoneyTransfers(ReportBindingModel model);
|
||||||
|
|
||||||
//Сохранение отчёта по счетам в файл-Word
|
List<ReportCashierViewModel>? GetCashWithrawals(ReportBindingModel model);
|
||||||
void SaveAccountsToWordFile(ReportBindingModel model);
|
|
||||||
|
//Сохранение отчёта по счетам в файл-Word
|
||||||
|
void SaveAccountsToWordFile(ReportBindingModel model);
|
||||||
|
|
||||||
//Сохранение отчёта по счетам в файл-Excel
|
//Сохранение отчёта по счетам в файл-Excel
|
||||||
void SaveAccountsToExcelFile(ReportBindingModel model);
|
void SaveAccountsToExcelFile(ReportBindingModel model);
|
||||||
|
@ -16,6 +16,8 @@ namespace BankYouBankruptContracts.SearchModels
|
|||||||
|
|
||||||
public int? AccountPayeeId { get; set; }
|
public int? AccountPayeeId { get; set; }
|
||||||
|
|
||||||
public DateTime? DateOperation { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user