fix filtration of transfers and withdrawals
This commit is contained in:
parent
8c46958f77
commit
1ee37f618c
@ -101,7 +101,7 @@ namespace BankBusinessLogic.OfficePackage
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var transfer in transfer.Transfers)
|
||||
foreach (var transfer1 in transfer.Transfers)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
|
@ -33,8 +33,7 @@ namespace BankDatabaseImplement.Implements
|
||||
.Include(x => x.Operation)
|
||||
.Where(x =>
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(!model.ManagerId.HasValue || (x.SenderAccount != null && x.SenderAccount.ManagerId == model.ManagerId) ||
|
||||
(x.RecipientAccount != null && x.RecipientAccount.ManagerId == model.ManagerId)) &&
|
||||
(!model.ManagerId.HasValue || (x.SenderAccount != null && x.SenderAccount.ManagerId == model.ManagerId)) &&
|
||||
(!model.SenderAccountId.HasValue || x.SenderAccountId == model.SenderAccountId) &&
|
||||
(!model.RecipientAccountId.HasValue || x.RecipientAccountId == model.RecipientAccountId) &&
|
||||
(!model.OperationId.HasValue || x.OperationId == model.OperationId) &&
|
||||
|
@ -29,18 +29,32 @@ namespace BankDatabaseImplement.Implements
|
||||
public List<WithdrawalViewModel> GetFilteredList(WithdrawalSearchModel model)
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.Withdrawals
|
||||
.Include(x => x.Request)
|
||||
.Include(x => x.Accounts)
|
||||
.ThenInclude(x => x.Account)
|
||||
.Where(x =>
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(!model.RequestId.HasValue || x.RequestId == model.RequestId) &&
|
||||
(!model.DateFrom.HasValue || x.WithdrawalTime >= model.DateFrom) &&
|
||||
(!model.DateTo.HasValue || x.WithdrawalTime <= model.DateTo))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
if (model.ManagerId == null)
|
||||
return context.Withdrawals
|
||||
.Include(x => x.Request)
|
||||
.Include(x => x.Accounts)
|
||||
.ThenInclude(x => x.Account)
|
||||
.Where(x =>
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(!model.RequestId.HasValue || x.RequestId == model.RequestId) &&
|
||||
(!model.DateFrom.HasValue || x.WithdrawalTime >= model.DateFrom) &&
|
||||
(!model.DateTo.HasValue || x.WithdrawalTime <= model.DateTo))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
return context.AccountWithdrawals
|
||||
.Include(x => x.Account)
|
||||
.Include (x => x.Withdrawal)
|
||||
.Where(x => x.Account.ManagerId == model.ManagerId)
|
||||
.Select(x => x.Withdrawal)
|
||||
.Distinct()
|
||||
.Where(x =>
|
||||
(!model.Id.HasValue || x.Id == model.Id) &&
|
||||
(!model.RequestId.HasValue || x.RequestId == model.RequestId) &&
|
||||
(!model.DateFrom.HasValue || x.WithdrawalTime >= model.DateFrom) &&
|
||||
(!model.DateTo.HasValue || x.WithdrawalTime <= model.DateTo))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public WithdrawalViewModel? GetElement(WithdrawalSearchModel model)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user