コード例 #1
0
 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) }));
 }
コード例 #2
0
ファイル: TransactionManager.cs プロジェクト: mtikoian/Beef
        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));
            }));
        }
コード例 #3
0
        /// <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));
        }
コード例 #4
0
 public Task <TransactionCollectionResult> GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging) => DataInvoker.Current.InvokeAsync(this, async() =>
 {
コード例 #5
0
 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);
     }));
コード例 #6
0
ファイル: TransactionAgent.cs プロジェクト: osmnozcn/Beef
 public Task <WebApiAgentResult <TransactionCollectionResult> > GetTransactionsAsync(string?accountId, TransactionArgs?args, PagingArgs?paging = null, WebApiRequestOptions?requestOptions = null)
 {
     return(TransactionServiceAgent.GetTransactionsAsync(accountId, args, paging, requestOptions));
 }
コード例 #7
0
ファイル: TransactionDataSvc.cs プロジェクト: mtikoian/Beef
 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;
     }));
 }
コード例 #8
0
        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;
            }));
        }
コード例 #9
0
 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;
     }));
 }
コード例 #10
0
ファイル: TransactionManager.cs プロジェクト: ostat/Beef
        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);
コード例 #11
0
ファイル: TransactionData.cs プロジェクト: mdesenfants/Beef
 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 {