public StateOperationContext( MarketMakerStatus currentStatus, MarketMakerStatus targetStatus, string comment, string userId, MarketMakerError error = MarketMakerError.None, string errorMessage = null) { CurrentStatus = currentStatus; TargetStatus = targetStatus; Error = error; ErrorMessage = errorMessage; Comment = comment; UserId = userId; }
private async Task SetStateAsync(MarketMakerStatus status, MarketMakerError marketMakerError, string errorMessages, string comment, string userId) { var marketMakerState = new MarketMakerState { Time = DateTime.UtcNow, Status = status, Error = marketMakerError, ErrorMessage = errorMessages }; MarketMakerState currentMarketMakerState = await GetStateAsync(); await _marketMakerStateRepository.InsertOrReplaceAsync(marketMakerState); _cache.Set(marketMakerState); _log.InfoWithDetails("Market maker state is changed.", new StateOperationContext(currentMarketMakerState.Status, marketMakerState.Status, comment, userId, marketMakerState.Error, marketMakerState.ErrorMessage)); }
public Task SetStateAsync(MarketMakerError marketMakerError, string errorMessages, string comment) => SetStateAsync(MarketMakerStatus.Error, marketMakerError, errorMessages, comment, null);