private void Convert_Facet_Tables_To_Facet_Lists(DbDataReader Reader, List <short> Facet_Types) { // Go to the next table if (!Reader.NextResult()) { return; } // Incrementor going through tables (and skipping aggregation table maybe) if (Reader.FieldCount > 2) { // Read all the aggregation fields while (Reader.Read()) { Aggregation_Facets.Add(new Search_Facet_Aggregation(Reader.GetString(1), Reader.GetInt32(2), Reader.GetString(0))); } if (!Reader.NextResult()) { return; } } // Add all the other facets, reading each subsequent table in the results int current_facet_index = 0; do { // Build this facet list if ((Reader.FieldCount == 2) && (Facet_Types.Count > current_facet_index)) { // Create the collection and and assifn the metadata type id Search_Facet_Collection thisCollection = new Search_Facet_Collection(Facet_Types[current_facet_index]); // Read all the individual facet values while (Reader.Read()) { thisCollection.Facets.Add(new Search_Facet(Reader.GetString(0), Reader.GetInt32(1))); } // If there was an id and facets added, save this to the search statistics if ((thisCollection.MetadataTypeID > 0) && (thisCollection.Facets.Count > 0)) { Facet_Collections.Add(thisCollection); } } current_facet_index++; } while (Reader.NextResult()); }
private void Convert_Facet_Tables_To_Facet_Lists(DataSet Facet_Data, List <short> Facet_Types) { // Incrementor going through tables (and skipping aggregation table maybe) int table_counter = 2; if ((Facet_Data.Tables.Count > 2) && (Facet_Data.Tables[2].Columns.Count > 2)) { foreach (DataRow thisRow in Facet_Data.Tables[2].Rows) { Aggregation_Facets.Add(new Search_Facet_Aggregation(thisRow[1].ToString(), Convert.ToInt32(thisRow[2]), thisRow[0].ToString())); } table_counter++; } // Add all the other facets, reading each subsequent table in the results int facet_index = 0; while (Facet_Data.Tables.Count > table_counter) { // Build this facet list if ((Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > facet_index)) { // Create the collection and and assifn the metadata type id Search_Facet_Collection thisCollection = new Search_Facet_Collection(Facet_Types[facet_index]); // Read all the individual facet values foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows) { thisCollection.Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1]))); } // If there was an id and facets added, save this to the search statistics if ((thisCollection.MetadataTypeID > 0) && (thisCollection.Facets.Count > 0)) { Facet_Collections.Add(thisCollection); } } table_counter++; facet_index++; } }
private void Convert_Facet_Tables_To_Facet_Lists( DataSet Facet_Data, List<short> Facet_Types ) { // Incrementor going through tables (and skipping aggregation table maybe) int table_counter = 2; if ((Facet_Data.Tables.Count > 2) && (Facet_Data.Tables[2].Columns.Count > 2)) { foreach (DataRow thisRow in Facet_Data.Tables[2].Rows) { Aggregation_Facets.Add(new Search_Facet_Aggregation(thisRow[1].ToString(), Convert.ToInt32(thisRow[2]), thisRow[0].ToString())); } table_counter++; } // Add all the other facets, reading each subsequent table in the results int facet_index = 0; while (Facet_Data.Tables.Count > table_counter) { // Build this facet list if ((Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > facet_index)) { // Create the collection and and assifn the metadata type id Search_Facet_Collection thisCollection = new Search_Facet_Collection(Facet_Types[facet_index]); // Read all the individual facet values foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows) { thisCollection.Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1]))); } // If there was an id and facets added, save this to the search statistics if ((thisCollection.MetadataTypeID > 0) && (thisCollection.Facets.Count > 0)) { Facet_Collections.Add(thisCollection); } } table_counter++; facet_index++; } }
private void Convert_Facet_Tables_To_Facet_Lists(DbDataReader Reader, List<short> Facet_Types) { // Go to the next table if (!Reader.NextResult()) return; // Incrementor going through tables (and skipping aggregation table maybe) if (Reader.FieldCount > 2) { // Read all the aggregation fields while (Reader.Read()) { Aggregation_Facets.Add(new Search_Facet_Aggregation(Reader.GetString(1), Reader.GetInt32(2), Reader.GetString(0))); } if (!Reader.NextResult()) return; } // Add all the other facets, reading each subsequent table in the results int current_facet_index = 0; do { // Build this facet list if ((Reader.FieldCount == 2) && (Facet_Types.Count > current_facet_index)) { // Create the collection and and assifn the metadata type id Search_Facet_Collection thisCollection = new Search_Facet_Collection(Facet_Types[current_facet_index]); // Read all the individual facet values while (Reader.Read()) { thisCollection.Facets.Add(new Search_Facet(Reader.GetString(0), Reader.GetInt32(1))); } // If there was an id and facets added, save this to the search statistics if ((thisCollection.MetadataTypeID > 0) && (thisCollection.Facets.Count > 0)) { Facet_Collections.Add(thisCollection); } } current_facet_index++; } while (Reader.NextResult()); }