public async Task <int> UpdateEventAsync(WebhookEventQueueEntity updatingEvent) { int affectRows; using (IDbConnection connection = _dbConnection.CreateStagingConnection()) { affectRows = await connection.ExecuteAsync( $@"update dbo.WebhookEventQueue set [CorrelationId] = @CorrelationId , [EnqueueDtTm] = @EnqueueDtTm , [PickupDtTm] = @PickupDtTm , [StatusId] = @StatusId , [ThrottleId] = @ThrottleId , [WorkerId] = @WorkerId , [FinishDtTm] = @FinishDtTm , [ErrorMsgTxt] = @ErrorMsgTxt where Id=@Id", new { updatingEvent.CorrelationId, updatingEvent.EnqueueDtTm, updatingEvent.PickupDtTm, updatingEvent.StatusId, updatingEvent.ThrottleId, updatingEvent.WorkerId, updatingEvent.FinishDtTm, updatingEvent.ErrorMsgTxt, updatingEvent.Id }, commandType : CommandType.Text).ConfigureAwait(false); } return(affectRows); }
public async Task <int> PerformEventThrottlingAsync(string updatingIds, int throttleId, int throttleStatusId, DateTimeOffset pickupDateTime, DateTimeOffset finishDateTime, WebhookEventQueueEntity updatingEvent) { int throttledEvents; int processingEvent; using (var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { throttledEvents = await ThrottlingEventAsync(updatingIds, throttleId, throttleStatusId, pickupDateTime, finishDateTime).ConfigureAwait(false); processingEvent = await UpdateEventAsync(updatingEvent).ConfigureAwait(false); transaction.Complete(); } return(throttledEvents + processingEvent); }
public EnqueueEncompassEventEntity() { WebhookEvent = new WebhookEventEntity(); EventDetail = new EncompassEventDetail(); EventQueue = new WebhookEventQueueEntity(); }
private bool IsValidEventToProcess(WebhookEventQueueEntity eventQueue) { return(eventQueue.Id > 0); }