Ejemplo n.º 1
0
        public GetColumnMappingsResponse GetColumnMappings(string platform, int organizationId, int?userId, int?columnId = null, bool clearCache = false)
        {
            var result = new GetColumnMappingsResponse();

            try
            {
                using (new RequestTimer(result))
                {
                    var dataSource     = _reportsDataSourceFactory.GetDataSource(platform);
                    var columnProvider = dataSource.GetColumnProvider();

                    if (clearCache)
                    {
                        columnProvider.ClearCache(dataSource.DataSourceId);
                    }

                    var columns = columnProvider.GetAllColumnMappings(dataSource.DataSourceId, organizationId);
                    if (columnId != null)
                    {
                        columns = columns.Where(x => x.Id == columnId.Value).ToList();
                    }
                    result.Data = columns;
                }
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
                _logger.LogException(ex);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public GetColumnMappingsResponse GetColumnMappings(string platform, int organizationId, int?userId, int?columnId = null, bool clearCache = false)
        {
            var result = new GetColumnMappingsResponse();

            try
            {
                // GET
                var apiRequest = CreateRequest(Method.GET, "{platform}/columnMappings");
                apiRequest.AddUrlSegment("platform", platform);
                apiRequest.AddParameter("organizationid", organizationId, ParameterType.QueryString);
                if (userId != null)
                {
                    apiRequest.AddParameter("userid", userId, ParameterType.QueryString);
                }
                if (columnId != null)
                {
                    apiRequest.AddParameter("columnid", columnId, ParameterType.QueryString);
                }
                if (clearCache)
                {
                    apiRequest.AddParameter("clearcache", true, ParameterType.QueryString);
                }
                var response = Execute <GetColumnMappingsResponse>(apiRequest);
                return(response);
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public GetColumnMappingsResponse GetDependantColumns(string platform, string fieldName)
        {
            var result = new GetColumnMappingsResponse();

            try
            {
                // GET
                var apiRequest = CreateRequest(Method.GET, "{platform}/dependantColumnMappings");
                apiRequest.AddUrlSegment("platform", platform);
                apiRequest.AddParameter("fieldname", fieldName, ParameterType.QueryString);
                var response = Execute <GetColumnMappingsResponse>(apiRequest);
                return(response);
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public GetColumnMappingsResponse GetDependantColumns(string platform, string fieldName)
        {
            var result = new GetColumnMappingsResponse();

            try
            {
                using (new RequestTimer(result))
                {
                    var dataSource = _reportsDataSourceFactory.GetDataSource(platform);
                    var columns    = dataSource.GetDependantColumnMappings(dataSource.DataSourceId, fieldName);
                    result.Data = columns;
                }
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
                _logger.LogException(ex);
            }
            return(result);
        }
Ejemplo n.º 5
0
 public void Setup()
 {
     _client        = new ReportsServiceClient();
     _allColumnInfo = _client.GetColumnMappings(_platform, 1, null, clearCache: true);
     _allColumns    = _client.GetSelectableColumns(_platform, null, null);
 }