public void StartEvent(ISystemProcessOperationUploadFile upload)
        {
            if (upload == null)
            {
                return;
            }

            this.FileUpload = upload;
            this._repository.Create(upload).Wait();
        }
        public void Log(Exception e, ISystemProcessOperationUploadFile uploadRule)
        {
            if (uploadRule == null)
            {
                this.Log(e);
                return;
            }

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

            this._exceptionRepository.Save(dto);
        }
        private void LinkFileUploadDataToUpload(
            ISystemProcessOperationUploadFile fileUploadId,
            IReadOnlyCollection <string> allocationIds)
        {
            if (allocationIds == null || !allocationIds.Any())
            {
                this.Logger.LogInformation(
                    "AllocationFileMonitor had no inserted allocation ids to link the file upload to.");
                return;
            }

            if (fileUploadId?.Id != null)
            {
                this._fileUploadRepository.Create(allocationIds, fileUploadId.Id).Wait();

                var uploadMessage = new AutoScheduleMessage();

                this._messageSender.Send(uploadMessage).Wait();
            }
            else
            {
                this.Logger.LogInformation("AllocationFileMonitor received a null or empty file upload id. Exiting");
            }
        }
        public async Task Create(ISystemProcessOperationUploadFile entity)
        {
            if (entity == null)
            {
                return;
            }

            lock (this._lock)
            {
                try
                {
                    this._logger.LogInformation($"SystemProcessOperationUploadFileRepository 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(e, $"System Process Operation Upload File Repository Create Method For {entity.Id} {entity.SystemProcessId}.");
                }
            }
        }