public Task <WebApiAgentResult <TransactionCollectionResult> > GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging = null, WebApiRequestOptions?requestOptions = null) { return(base.GetCollectionResultAsync <TransactionCollectionResult, TransactionCollection, Transaction>("api/v1/banking/accounts/{accountId}/transactions", requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <string?>("accountId", accountId), new WebApiArg <TransactionArgs?>("args", args, WebApiArgType.FromUriUseProperties), new WebApiPagingArgsArg("paging", paging) })); }
public Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) { return(ManagerInvoker.Current.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Read; Cleaner.CleanUp(accountId, args); MultiValidator.Create() .Add(accountId.Validate(nameof(accountId)).Mandatory().Common(Validators.AccountId)) .Add(args.Validate(nameof(args)).Entity(TransactionArgsValidator.Default)) .Run().ThrowOnError(); return Cleaner.Clean(await _dataService.GetTransactionsAsync(accountId, args, paging).ConfigureAwait(false)); })); }
/// <summary> /// Perform the query filering for the GetTransactions. /// </summary> private IQueryable <Model.Transaction> GetTransactionsOnQuery(IQueryable <Model.Transaction> query, string?_, TransactionArgs?args, ICosmosDbArgs?__) { if (args == null || args.IsInitial) { return(query.OrderByDescending(x => x.TransactionDateTime)); } var q = query.WhereWith(args.FromDate, x => x.TransactionDateTime >= args.FromDate); q = q.WhereWith(args.ToDate, x => x.TransactionDateTime <= args.ToDate); q = q.WhereWith(args.MinAmount, x => x.Amount >= args.MinAmount); q = q.WhereWith(args.MaxAmount, x => x.Amount <= args.MaxAmount); // The text filtering will perform a case-insensitive (based on uppercase) comparison on Description and Reference properties. q = q.WhereWith(args.Text, x => x.Description !.ToUpper().Contains(args.Text !.ToUpper()) || x.Reference !.ToUpper().Contains(args.Text !.ToUpper())); // Order by TransactionDateTime in descending order. return(q.OrderByDescending(x => x.TransactionDateTime)); }
public Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) => DataInvoker.Current.InvokeAsync(this, async() => {
public Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) { return(DataInvoker.Current.InvokeAsync(this, async() => { TransactionCollectionResult __result = new TransactionCollectionResult(paging); var __dataArgs = CosmosMapper.Default.CreateArgs("Transaction", __result.Paging !, new PartitionKey(accountId), onCreate: _onDataArgsCreate); __result.Result = _cosmos.Container(__dataArgs).Query(q => _getTransactionsOnQuery?.Invoke(q, accountId, args, __dataArgs) ?? q).SelectQuery <TransactionCollection>(); return await Task.FromResult(__result).ConfigureAwait(false); }));
public Task <WebApiAgentResult <TransactionCollectionResult> > GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging = null, WebApiRequestOptions?requestOptions = null) { return(TransactionServiceAgent.GetTransactionsAsync(accountId, args, paging, requestOptions)); }
public Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) { return(DataSvcInvoker.Current.InvokeAsync(typeof(TransactionDataSvc), async() => { var __result = await _data.GetTransactionsAsync(accountId, args, paging).ConfigureAwait(false); return __result; })); }
public Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) { return(ManagerInvoker.Default.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Read; EntityBase.CleanUp(accountId, args); if (_getTransactionsOnPreValidateAsync != null) { await _getTransactionsOnPreValidateAsync(accountId, args, paging).ConfigureAwait(false); } MultiValidator.Create() .Add(accountId.Validate(nameof(accountId)).Mandatory().Common(Validators.AccountId)) .Add(args.Validate(nameof(args)).Entity(TransactionArgsValidator.Default)) .Additional((__mv) => _getTransactionsOnValidate?.Invoke(__mv, accountId, args, paging)) .Run().ThrowOnError(); if (_getTransactionsOnBeforeAsync != null) { await _getTransactionsOnBeforeAsync(accountId, args, paging).ConfigureAwait(false); } var __result = await TransactionDataSvc.GetTransactionsAsync(accountId, args, paging).ConfigureAwait(false); if (_getTransactionsOnAfterAsync != null) { await _getTransactionsOnAfterAsync(__result, accountId, args, paging).ConfigureAwait(false); } Cleaner.Clean(__result); return __result; })); }
public static Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) { return(DataSvcInvoker.Default.InvokeAsync(typeof(TransactionDataSvc), async() => { var __result = await Factory.Create <ITransactionData>().GetTransactionsAsync(accountId, args, paging).ConfigureAwait(false); if (_getTransactionsOnAfterAsync != null) { await _getTransactionsOnAfterAsync(__result, accountId, args, paging).ConfigureAwait(false); } return __result; })); }
public async Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) => await ManagerInvoker.Current.InvokeAsync(this, async() => { Cleaner.CleanUp(accountId, args); await MultiValidator.Create() .Add(accountId.Validate(nameof(accountId)).Mandatory().Common(Validators.AccountId)) .Add(args.Validate(nameof(args)).Entity().With <IValidator <TransactionArgs> >()) .RunAsync(throwOnError: true).ConfigureAwait(false); return(Cleaner.Clean(await _dataService.GetTransactionsAsync(accountId, args, paging).ConfigureAwait(false))); }, BusinessInvokerArgs.Read).ConfigureAwait(false);
public Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) { return(DataInvoker.Default.InvokeAsync(this, async() => { TransactionCollectionResult __result = new TransactionCollectionResult(paging); var __dataArgs = CosmosMapper.Default.CreateArgs("Transaction", __result.Paging !, new PartitionKey(accountId)); _onDataArgsCreate?.Invoke(__dataArgs); if (_getTransactionsOnBeforeAsync != null) { await _getTransactionsOnBeforeAsync(accountId, args, __dataArgs).ConfigureAwait(false); } __result.Result = CosmosDb.Default.Container(__dataArgs).Query(q => _getTransactionsOnQuery == null ? q : _getTransactionsOnQuery(q, accountId, args, __dataArgs)).SelectQuery <TransactionCollection>(); if (_getTransactionsOnAfterAsync != null) { await _getTransactionsOnAfterAsync(__result, accountId, args).ConfigureAwait(false); } return __result; }, new BusinessInvokerArgs {