private string GetNumericRangeUpdateQuery(BlockExecutionStatus executionStatus) { if (executionStatus == BlockExecutionStatus.Completed || executionStatus == BlockExecutionStatus.Failed) { return(BlockExecutionQueryBuilder.SetRangeBlockExecutionAsCompleted); } return(BlockExecutionQueryBuilder.SetBlockExecutionStatusToStarted); }
public BlockExecutionChangeStatusRequest(TaskId taskId, string taskExecutionId, BlockType blockType, string blockExecutionId, BlockExecutionStatus blockExecutionStatus) : base(taskId, taskExecutionId, blockType, blockExecutionId) { BlockExecutionStatus = blockExecutionStatus; }
public BlockExecutionChangeStatusRequest(TaskId taskId, string taskExecutionId, BlockType blockType, string blockExecutionId, BlockExecutionStatus blockExecutionStatus) : base(taskId, taskExecutionId, blockType, blockExecutionId) { BlockExecutionStatus = blockExecutionStatus; }
private string GetNumericRangeUpdateQuery(BlockExecutionStatus executionStatus) { if (executionStatus == BlockExecutionStatus.Completed || executionStatus == BlockExecutionStatus.Failed) return BlockExecutionQueryBuilder.SetRangeBlockExecutionAsCompleted; return BlockExecutionQueryBuilder.SetBlockExecutionStatusToStarted; }
private int GetBlockExecutionCountByStatus(string applicationName, string taskName, BlockExecutionStatus blockExecutionStatus, string query) { using (var connection = new SqlConnection(TestConstants.TestConnectionString)) { connection.Open(); var command = connection.CreateCommand(); command.CommandText = query; command.Parameters.Add("@ApplicationName", SqlDbType.VarChar, 200).Value = applicationName; command.Parameters.Add("@TaskName", SqlDbType.VarChar, 200).Value = taskName; command.Parameters.Add("@BlockExecutionStatus", SqlDbType.TinyInt).Value = (byte)blockExecutionStatus; return((int)command.ExecuteScalar()); } }
public int GetBlockExecutionCountByStatus(string applicationName, string taskName, BlockExecutionStatus blockExecutionStatus) { return(GetBlockExecutionCountByStatus(applicationName, taskName, blockExecutionStatus, GetBlockExecutionsCountByStatusQuery)); }
public long InsertBlockExecution(string taskExecutionId, long blockId, DateTime createdAt, DateTime?startedAt, DateTime?completedAt, BlockExecutionStatus executionStatus, int attempt = 1) { using (var connection = new SqlConnection(TestConstants.TestConnectionString)) { connection.Open(); var command = connection.CreateCommand(); command.CommandText = InsertBlockExecutionQuery; command.Parameters.Add("@TaskExecutionId", SqlDbType.Int).Value = int.Parse(taskExecutionId); command.Parameters.Add("@BlockId", SqlDbType.BigInt).Value = blockId; command.Parameters.Add("@CreatedAt", SqlDbType.DateTime).Value = createdAt; command.Parameters.Add("@Attempt", SqlDbType.BigInt).Value = attempt; if (startedAt.HasValue) { command.Parameters.Add("@StartedAt", SqlDbType.DateTime).Value = startedAt.Value; } else { command.Parameters.Add("@StartedAt", SqlDbType.DateTime).Value = DBNull.Value; } if (completedAt.HasValue) { command.Parameters.Add("@CompletedAt", SqlDbType.DateTime).Value = completedAt.Value; } else { command.Parameters.Add("@CompletedAt", SqlDbType.DateTime).Value = DBNull.Value; } command.Parameters.Add("@BlockExecutionStatus", SqlDbType.TinyInt).Value = (byte)executionStatus; return((long)command.ExecuteScalar()); } }