diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs new file mode 100644 index 0000000..2abcb59 --- /dev/null +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs @@ -0,0 +1,99 @@ +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 IAccountStorage _accauntStorage; + private readonly ICardStorage _cardStorage; + private readonly ICashierStorage _cashierStorage; + private readonly ICashWithdrawalStorage _cashWithdrawalStorage; + private readonly IClientStorage _clientStorage; + private readonly ICreditingStorage _creditingStorage; + private readonly IDebitingStorage _debitingStorage; + private readonly IMoneyTransferStorage _moneyTransferStorage; + + private readonly AbstractSaveToExcelClient _saveToExcel; + private readonly AbstractSaveToWordClient _saveToWord; + private readonly AbstractSaveToPdfClient _saveToPdf; + + public ReportClientLogic(IAccountStorage accauntStorage, ICardStorage cardStorage, ICashierStorage cashierStorage, + ICashWithdrawalStorage cashWithdrawalStorage, IClientStorage clientStorage, ICreditingStorage creditingStorage, + IDebitingStorage debitingStorage, IMoneyTransferStorage moneyTransferStorage, + AbstractSaveToExcelClient saveToExcel, AbstractSaveToWordClient saveToWord, AbstractSaveToPdfClient saveToPdf) + { + _accauntStorage = accauntStorage; + _cardStorage = cardStorage; + _cashierStorage = cashierStorage; + _cashWithdrawalStorage = cashWithdrawalStorage; + _clientStorage = clientStorage; + _creditingStorage = creditingStorage; + _debitingStorage = debitingStorage; + _moneyTransferStorage = moneyTransferStorage; + + _saveToExcel = saveToExcel; + _saveToWord = saveToWord; + _saveToPdf = saveToPdf; + } + + public List? GetCrediting(ReportBindingModel model) + { + return _creditingStorage.GetFilteredList(new CreditingSearchModel + { + dateFrom = model.DateFrom, + dateTo = model.DateTo, + }).Select(x => new ReportClientViewModel + { + CardId = x.CardId, + SumOperation = x.Sum, + DateComplite = x.Date + }).ToList(); + } + + public List? GetDebiting(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SaveCreditingToExcelFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SaveCreditingToPdfFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SaveCreditingToWordFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SaveDebitingToExcelFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SaveDebitingToPdfFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + + public void SaveDebitingToWordFile(ReportBindingModel model) + { + throw new NotImplementedException(); + } + } +} diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs index 96fd1fd..0e4a565 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace BankYouBankruptBusinessLogic.OfficePackage { - public abstract class AbstractSaveToPdfCLient + public abstract class AbstractSaveToPdfClient { //публичный метод создания документа. Описание методов ниже public void CreateDoc(PdfInfo info) diff --git a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs index 5673da3..f69ce26 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/BusinessLogicsContracts/IReportClientLogic.cs @@ -11,15 +11,19 @@ namespace BankYouBankruptContracts.BusinessLogicsContracts { public interface IReportClientLogic { - List? GetCards(ReportBindingModel model); + List? GetCrediting(ReportBindingModel model); + + List? GetDebiting(ReportBindingModel model); //Сохранение отчёта по картам в файл-Word - void SaveCardsToWordFile(ReportBindingModel model); + void SaveCreditingToWordFile(ReportBindingModel model); + void SaveDebitingToWordFile(ReportBindingModel model); //Сохранение отчёта по картам в файл-Excel - void SaveCardsToExcelFile(ReportBindingModel model); - + void SaveCreditingToExcelFile(ReportBindingModel model); + void SaveDebitingToExcelFile(ReportBindingModel model); //Сохранение отчёта по картам в файл-Pdf - void SaveCardsToPdfFile(ReportBindingModel model); + void SaveCreditingToPdfFile(ReportBindingModel model); + void SaveDebitingToPdfFile(ReportBindingModel model); } } diff --git a/BankYouBankrupt/BankYouBankruptContracts/SearchModels/CreditingSearchModel.cs b/BankYouBankrupt/BankYouBankruptContracts/SearchModels/CreditingSearchModel.cs index 6d41e00..c6690c4 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/SearchModels/CreditingSearchModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/SearchModels/CreditingSearchModel.cs @@ -14,6 +14,8 @@ namespace BankYouBankruptContracts.SearchModels public int? Sum { get; set; } - public DateTime? date { get; set; } + public DateTime? dateFrom { get; set; } + + public DateTime? dateTo { get; set; } } } diff --git a/BankYouBankrupt/BankYouBankruptContracts/SearchModels/DebitingSearchModel.cs b/BankYouBankrupt/BankYouBankruptContracts/SearchModels/DebitingSearchModel.cs index 6000569..80e2719 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/SearchModels/DebitingSearchModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/SearchModels/DebitingSearchModel.cs @@ -14,6 +14,8 @@ namespace BankYouBankruptContracts.SearchModels public int? Sum { get; set; } - public DateTime? date { get; set; } + public DateTime? dateFrom { get; set; } + + public DateTime? dateTo { get; set; } } } diff --git a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICreditingStorage.cs b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICreditingStorage.cs index bd7cea9..306b8a4 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICreditingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/ICreditingStorage.cs @@ -9,18 +9,18 @@ using System.Threading.Tasks; namespace BankYouBankruptContracts.StoragesContracts { - public interface IDebitingStorage + public interface ICreditingStorage { - List GetFullList(); + List GetFullList(); - List GetFilteredList(DebitingSearchModel model); + List GetFilteredList(CreditingSearchModel model); - DebitingViewModel? GetElement(DebitingSearchModel model); + CreditingViewModel? GetElement(CreditingSearchModel model); - DebitingViewModel? Insert(DebitingBindingModel model); + CreditingViewModel? Insert(CreditingBindingModel model); - DebitingViewModel? Update(DebitingBindingModel model); + CreditingViewModel? Update(CreditingBindingModel model); - DebitingViewModel? Delete(DebitingBindingModel model); + CreditingViewModel? Delete(CreditingBindingModel model); } } \ No newline at end of file diff --git a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IDebitingStorage.cs b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IDebitingStorage.cs index 306b8a4..bd7cea9 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IDebitingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/StoragesContracts/IDebitingStorage.cs @@ -9,18 +9,18 @@ using System.Threading.Tasks; namespace BankYouBankruptContracts.StoragesContracts { - public interface ICreditingStorage + public interface IDebitingStorage { - List GetFullList(); + List GetFullList(); - List GetFilteredList(CreditingSearchModel model); + List GetFilteredList(DebitingSearchModel model); - CreditingViewModel? GetElement(CreditingSearchModel model); + DebitingViewModel? GetElement(DebitingSearchModel model); - CreditingViewModel? Insert(CreditingBindingModel model); + DebitingViewModel? Insert(DebitingBindingModel model); - CreditingViewModel? Update(CreditingBindingModel model); + DebitingViewModel? Update(DebitingBindingModel model); - CreditingViewModel? Delete(CreditingBindingModel model); + DebitingViewModel? Delete(DebitingBindingModel model); } } \ No newline at end of file diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs index 3bfafe6..7deedd8 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs @@ -10,8 +10,6 @@ namespace BankYouBankruptContracts.ViewModels { public int CardId { get; set; } - public string TypeOperation { get; set; } = string.Empty; - public double SumOperation { get; set; } public DateTime DateComplite { get; set; }