protected async Task ProcessTransactions(BlockWithTransactionHashes block)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            foreach (var txnHash in block.TransactionHashes)
            {
                await TransactionProcessor.ProcessTransactionAsync(txnHash, block).ConfigureAwait(false);
            }
            stopwatch.Stop();
            System.Console.WriteLine("Total Transaction : " + block.TransactionHashes.Length);
            System.Console.WriteLine("Blok içindeki transaction bilgilerini alma : " + stopwatch.Elapsed.TotalSeconds);


            await _transactionRepository.AddTransactions();
        }
        public ImportTransactionsResponse Handle(ImportTransactionsRequest message)
        {
            var parsedTransactions = new List <TransactionEntity>();

            foreach (var transaction in message.Transactions)
            {
                var entity = new TransactionEntity();
                entity.UserId = _identity.Id;

                var headers = message.OrderedHeaders;
                for (var ii = 0; ii < headers.Count; ii++)
                {
                    if (headers[ii].Equals("Amount"))
                    {
                        entity.Amount = double.Parse(transaction[ii]);
                    }
                    else if (headers[ii].Equals("Description"))
                    {
                        entity.Description = transaction[ii];
                    }
                    else if (headers[ii].Equals("CreatedDate"))
                    {
                        entity.TransactionDate = DateTime.Parse(transaction[ii]);
                    }
                    else
                    {
                        throw new NotImplementedException(headers[ii]);
                    }
                }

                parsedTransactions.Add(entity);
            }

            _transactionRepository.AddTransactions(parsedTransactions);

            return(new ImportTransactionsResponse());
        }
        public bool AddTransactions(IEnumerable <Entities.Crypto.Transaction> entities)
        {
            var result = _repo.AddTransactions(entities);

            return(result.IsCompleted ? true : false);
        }
Exemple #4
0
        public async Task <Transactions> AddTransactions(Transactions transactions)
        {
            await _transaction.AddTransactions(transactions);

            return(null);
        }