Мелкие правки.
This commit is contained in:
parent
5aea0a136f
commit
8b96d82fa2
@ -21,11 +21,15 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
private readonly IDebitingStorage _debitingStorage;
|
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;
|
_logger = logger;
|
||||||
_cashWithdrawalStorage = cashWithdrawalStorage;
|
_cashWithdrawalStorage = cashWithdrawalStorage;
|
||||||
_debitingStorage = debitingStorage;
|
_debitingStorage = debitingStorage;
|
||||||
|
_cardStorage = cardStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CashWithdrawalViewModel? ReadElement(CashWithdrawalSearchModel model)
|
public CashWithdrawalViewModel? ReadElement(CashWithdrawalSearchModel model)
|
||||||
@ -77,19 +81,32 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
if (_cashWithdrawalStorage.Insert(model) == null)
|
//проверка на то, что карта не просрочилась
|
||||||
|
if (CheckCardPeriod(model))
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Insert operation failed");
|
if (_cashWithdrawalStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_debitingStorage.Update(new DebitingBindingModel
|
||||||
|
{
|
||||||
|
Id = model.DebitingId,
|
||||||
|
DateClose = DateTime.Now,
|
||||||
|
Status = StatusEnum.Закрыта
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
_debitingStorage.Update(new DebitingBindingModel
|
|
||||||
{
|
{
|
||||||
Id = model.DebitingId,
|
_debitingStorage.Update(new DebitingBindingModel
|
||||||
DateClose = DateTime.Now,
|
{
|
||||||
Status = StatusEnum.Закрыта
|
Id = model.DebitingId,
|
||||||
});
|
DateClose = DateTime.Now,
|
||||||
|
Status = StatusEnum.Карта_просрочена
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -169,5 +186,26 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
_logger.LogInformation("CashWithdrawal: AccountId:{AccountId}. Sum:{Sum}. DateOperation:{DateOperation}. Id:{Id}",
|
_logger.LogInformation("CashWithdrawal: AccountId:{AccountId}. Sum:{Sum}. DateOperation:{DateOperation}. Id:{Id}",
|
||||||
model.AccountId, model.Sum, model.DateOperation, model?.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.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
|
||||||
|
|
||||||
namespace BankYouBankruptClientApp.Controllers
|
namespace BankYouBankruptClientApp.Controllers
|
||||||
{
|
{
|
||||||
@ -497,9 +496,11 @@ namespace BankYouBankruptClientApp.Controllers
|
|||||||
Operations = result,
|
Operations = result,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[HttpGet]
|
#region Диаграмма
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
public IActionResult Diagram() {
|
public IActionResult Diagram() {
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Client == null)
|
||||||
{
|
{
|
||||||
@ -527,5 +528,7 @@ namespace BankYouBankruptClientApp.Controllers
|
|||||||
Elements = APIClient.GetRequest<List<ClientDiagramElementsViewModel>>($"api/Card/getCardMonthResult?cardId={cardId}")
|
Elements = APIClient.GetRequest<List<ClientDiagramElementsViewModel>>($"api/Card/getCardMonthResult?cardId={cardId}")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,4 +1,6 @@
|
|||||||
@using BankYouBankruptContracts.ViewModels.Client.Reports;
|
@using BankYouBankruptContracts.ViewModels.Client.Reports;
|
||||||
|
@using Microsoft.JSInterop;
|
||||||
|
@inject IJSRuntime JS
|
||||||
|
|
||||||
@model ReportClientCardsViewModel
|
@model ReportClientCardsViewModel
|
||||||
|
|
||||||
@ -105,4 +107,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,6 +12,8 @@ namespace BankYouBankruptDataModels.Enums
|
|||||||
|
|
||||||
Закрыта = 1,
|
Закрыта = 1,
|
||||||
|
|
||||||
Отклонено = 2
|
Отклонено = 2,
|
||||||
|
|
||||||
|
Карта_просрочена = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user