예제 #1
0
        /// <summary>
        /// Adds transaction log.
        /// </summary>
        /// <param name="transactionLog">The transactionLog.</param>
        /// <returns>BlueprintTransactionLog.</returns>
        public async Task <BlueprintTransactionLog> AddTransactionLogAsync(BlueprintTransactionLog transactionLog)
        {
            try
            {
                if (transactionLog.CorrelationId == Guid.Empty || transactionLog.CorrelationId == null)
                {
                    transactionLog.CorrelationId = Guid.NewGuid();
                }

                transactionLog.HostName     = Dns.GetHostName();
                transactionLog.CreatedBy    = AuthorizationConstants.SITE_ADMIN_ROLE;
                transactionLog.CreatedDate  = DateTime.UtcNow;
                transactionLog.ModifiedBy   = AuthorizationConstants.SITE_ADMIN_ROLE;
                transactionLog.ModifiedDate = DateTime.UtcNow;

                _logger.LogInformation($"Call to {nameof(AddTransactionLogAsync)} with LogData: {JsonConvert.SerializeObject(transactionLog)}.");

                await _transactionLogRepository.AddAsync(transactionLog);

                await _transactionLogRepository.CommitAsync();

                return(transactionLog);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Call to {nameof(AddTransactionLogAsync)} failed.");
                return(transactionLog);
            }
        }
예제 #2
0
        public async Task LogErrorAsync(string invalidTransactionsJson)
        {
            var logEntity = new TransactionLogEntity()
            {
                CreatedAt = DateTime.UtcNow,
                LogType   = LogType.Error,
                InvalidTransactionsJson = invalidTransactionsJson
            };

            await _transactionLogRepository.AddAsync(logEntity);
        }