Мелкие правки.
This commit is contained in:
parent
5aea0a136f
commit
8b96d82fa2
@ -21,11 +21,15 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
private readonly IDebitingStorage _debitingStorage;
|
||||
|
||||
public CashWithdrawalLogic(ILogger<CashWithdrawalLogic> logger, ICashWithdrawalStorage cashWithdrawalStorage, IDebitingStorage debitingStorage)
|
||||
private readonly ICardStorage _cardStorage;
|
||||
|
||||
public CashWithdrawalLogic(ILogger<CashWithdrawalLogic> logger, ICashWithdrawalStorage cashWithdrawalStorage,
|
||||
IDebitingStorage debitingStorage, ICardStorage cardStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_cashWithdrawalStorage = cashWithdrawalStorage;
|
||||
_debitingStorage = debitingStorage;
|
||||
_cardStorage = cardStorage;
|
||||
}
|
||||
|
||||
public CashWithdrawalViewModel? ReadElement(CashWithdrawalSearchModel model)
|
||||
@ -76,6 +80,9 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
CheckModel(model);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
//проверка на то, что карта не просрочилась
|
||||
if (CheckCardPeriod(model))
|
||||
{
|
||||
if (_cashWithdrawalStorage.Insert(model) == null)
|
||||
{
|
||||
@ -92,6 +99,16 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_debitingStorage.Update(new DebitingBindingModel
|
||||
{
|
||||
Id = model.DebitingId,
|
||||
DateClose = DateTime.Now,
|
||||
Status = StatusEnum.Карта_просрочена
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_debitingStorage.Update(new DebitingBindingModel
|
||||
{
|
||||
@ -169,5 +186,26 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
_logger.LogInformation("CashWithdrawal: AccountId:{AccountId}. Sum:{Sum}. DateOperation:{DateOperation}. Id:{Id}",
|
||||
model.AccountId, model.Sum, model.DateOperation, model?.Id);
|
||||
}
|
||||
|
||||
bool CheckCardPeriod(CashWithdrawalBindingModel model)
|
||||
{
|
||||
var debiting = _debitingStorage.GetElement(new DebitingSearchModel
|
||||
{
|
||||
Id = model.DebitingId
|
||||
});
|
||||
|
||||
var card = _cardStorage.GetElement(new CardSearchModel
|
||||
{
|
||||
Id = debiting.CardId
|
||||
});
|
||||
|
||||
//если карта просрочена
|
||||
if(card.Period < DateTime.Now)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace BankYouBankruptClientApp.Controllers
|
||||
{
|
||||
@ -499,6 +498,8 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Диаграмма
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Diagram() {
|
||||
if (APIClient.Client == null)
|
||||
@ -527,5 +528,7 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
Elements = APIClient.GetRequest<List<ClientDiagramElementsViewModel>>($"api/Card/getCardMonthResult?cardId={cardId}")
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
@using BankYouBankruptContracts.ViewModels.Client.Reports;
|
||||
@using Microsoft.JSInterop;
|
||||
@inject IJSRuntime JS
|
||||
|
||||
@model ReportClientCardsViewModel
|
||||
|
||||
|
@ -12,6 +12,8 @@ namespace BankYouBankruptDataModels.Enums
|
||||
|
||||
Закрыта = 1,
|
||||
|
||||
Отклонено = 2
|
||||
Отклонено = 2,
|
||||
|
||||
Карта_просрочена = 3
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user