public async Task <StatisticsScenarioInfo> GetStatisticsInfoForScenario(ScenarioBase scenario, ScenarioActionSource source) { if (scenario.SecuritySettings.IsAvailableForUser(source.User, source.Source, source.Action)) { if (scenario is RemoteScenario remoteScenario) { try { if (!scenario.GetIsAvailable()) { throw new ScenarioExecutionException(ScenarioExecutionError.NotAvailable); } var scenarioInfo = new ScenarioInfo(); scenarioInfo.ScenarioId = remoteScenario.RemoteScenarioId; scenarioInfo.ValueType = scenario.ValueType; var client = ServiceClientFactory.Current.GetClient(remoteScenario.Credentials); var remoteScenarioInfo = await client.GetStatisticsInfoForScenario(scenarioInfo); remoteScenarioInfo.ID = scenario.Id; // Set current scenario id remoteScenarioInfo.Name = scenario.Name; return(remoteScenarioInfo); } catch (Exception e) { throw e; } } else { return(_dataManager.GetInfo(scenario.Id, scenario.Name, ActionsDomain.Utils.GetValueTypeClassName(scenario.ValueType.GetType()))); } } throw new ScenarioExecutionException(ScenarioExecutionError.AccessDenied); }