public async Task <QueryFieldsResponse> GetQueryColumn(string queryId) { QueryFieldsResponse response = new QueryFieldsResponse(); response.GroupByFields = new List <QueryDefinitionResponse>(); response.AggregationFields = new List <QueryDefinitionResponse>(); var queryData = await HttpProvider.GetHttpRequest(StaticParams.TfsUrl, "Enterprise/_apis/wit/queries/" + queryId + "?api-version=2.2&$expand=all"); QueryDefinitionRequest queryDataObject = JsonConvert.DeserializeObject <QueryDefinitionRequest>(queryData); foreach (var item in queryDataObject.columns) { var columnData = new QueryDefinitionResponse() { Name = item.name, ReferenceName = item.referenceName }; if (columnData.Name != "ID") { response.GroupByFields.Add(columnData); var columnType = await GetColumnType(item.referenceName); if (columnType.type == "integer" || columnType.type == "double") { response.AggregationFields.Add(columnData); } } } return(response); }
//public async Task<IEnumerable<Report>> GetReportsNameByCategoryId(string categoryId) //{ // var responseData = new QueriesDataResponse(); // List<QueryData> Querieslst = new List<QueryData>(); // ReportsDal reportsDal = new ReportsDal(); // int categoryIdNum = 0; // int.TryParse(categoryId, out categoryIdNum); // return reportsDal.GetReportsByCategoryId(categoryIdNum); //} public async Task <IEnumerable <QueryDefinitionResponse> > GetQueryColumn(string queryId) { List <QueryDefinitionResponse> responselst = new List <QueryDefinitionResponse>(); var queryData = await HttpProvider.GetHttpRequest("Enterprise/_apis/wit/queries/" + queryId + "?api-version=2.2&$expand=all"); QueryDefinitionRequest queryDataObject = JsonConvert.DeserializeObject <QueryDefinitionRequest>(queryData); foreach (var item in queryDataObject.columns) { var columnData = new QueryDefinitionResponse() { Name = item.name, ReferenceName = item.referenceName }; responselst.Add(columnData); } return(responselst); }