Esempio n. 1
0
        public async Task Create(ISystemProcessOperation entity)
        {
            if (entity == null || string.IsNullOrWhiteSpace(entity.SystemProcessId))
            {
                return;
            }

            lock (this._lock)
            {
                try
                {
                    this._logger.LogInformation($"SystemProcessOperationRepository SAVING {entity}");
                    using (var dbConnection = this._dbConnectionFactory.BuildConn())
                        using (var conn = dbConnection.QuerySingleAsync <int>(CreateSql, entity))
                        {
                            entity.Id = conn.Result;
                        }
                }
                catch (Exception e)
                {
                    this._logger.LogError(
                        $"System Process Operation Repository Create Method For {entity.Id} {entity.OperationEnd}. {e.Message}");
                }
            }
        }
        public void Log(Exception e, ISystemProcessOperation operation)
        {
            if (operation == null)
            {
                this.Log(e);
                return;
            }

            var dto = new ExceptionDto
            {
                ExceptionMessage         = e.Message,
                InnerExceptionMessage    = e.InnerException?.Message,
                StackTrace               = e.StackTrace,
                SystemProcessOperationId = operation.Id,
                SystemProcessId          = operation.SystemProcessId
            };

            this._exceptionRepository.Save(dto);
        }
Esempio n. 3
0
        public async Task Update(ISystemProcessOperation entity)
        {
            if (entity == null)
            {
                return;
            }

            try
            {
                using (var dbConnection = this._dbConnectionFactory.BuildConn())
                    using (var conn = dbConnection.ExecuteAsync(UpdateSql, entity))
                    {
                        await conn;
                    }
            }
            catch (Exception e)
            {
                this._logger.LogError(e, $"System Process Operation Repository Update Method For {entity.Id} {entity.OperationEnd}.");
            }
        }
 public void StartEvent(ISystemProcessOperation processOperation)
 {
     this._systemProcessOperation = processOperation;
     this._systemProcessOperationRepository.Create(processOperation);
 }