예제 #1
0
        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());
        }
예제 #2
0
        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++;
            }
        }
예제 #3
0
        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++;
            }

            // Build the first facet list
            if ((Facet_Data.Tables.Count > table_counter) && (Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > 0))
            {
                First_Facets_MetadataTypeID = Facet_Types[0];
                foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows)
                {
                    First_Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1])));
                }

                // Build the second facet list
                table_counter++;
                if ((Facet_Data.Tables.Count > table_counter) && (Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > 1))
                {
                    Second_Facets_MetadataTypeID = Facet_Types[1];
                    foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows)
                    {
                        Second_Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1])));
                    }

                    // Build the third facet list
                    table_counter++;
                    if ((Facet_Data.Tables.Count > table_counter) && (Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > 2))
                    {
                        Third_Facets_MetadataTypeID = Facet_Types[2];
                        foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows)
                        {
                            Third_Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1])));
                        }

                        // Build the fourth facet list
                        table_counter++;
                        if ((Facet_Data.Tables.Count > table_counter) && (Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > 3))
                        {
                            Fourth_Facets_MetadataTypeID = Facet_Types[3];
                            foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows)
                            {
                                Fourth_Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1])));
                            }

                            // Build the fifth facet list
                            table_counter++;
                            if ((Facet_Data.Tables.Count > table_counter) && (Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > 4))
                            {
                                Fifth_Facets_MetadataTypeID = Facet_Types[4];
                                foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows)
                                {
                                    Fifth_Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1])));
                                }

                                // Build the sixth facet list
                                table_counter++;
                                if ((Facet_Data.Tables.Count > table_counter) && (Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > 5))
                                {
                                    Sixth_Facets_MetadataTypeID = Facet_Types[5];
                                    foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows)
                                    {
                                        Sixth_Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1])));
                                    }

                                    // Build the seventh facet list
                                    table_counter++;
                                    if ((Facet_Data.Tables.Count > table_counter) && (Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > 6))
                                    {
                                        Seventh_Facets_MetadataTypeID = Facet_Types[6];
                                        foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows)
                                        {
                                            Seventh_Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1])));
                                        }

                                        // Build the eighth facet list
                                        table_counter++;
                                        if ((Facet_Data.Tables.Count > table_counter) && (Facet_Data.Tables[table_counter].Columns.Count == 2) && (Facet_Types.Count > 7))
                                        {
                                            Eighth_Facets_MetadataTypeID = Facet_Types[5];
                                            foreach (DataRow thisRow in Facet_Data.Tables[table_counter].Rows)
                                            {
                                                Eighth_Facets.Add(new Search_Facet(thisRow[0].ToString(), Convert.ToInt32(thisRow[1])));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #4
0
        private void Convert_Facet_Tables_To_Facet_Lists(SqlDataReader 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)));
                }

                // Go to the next table
                if (!reader.NextResult())
                {
                    return;
                }
            }

            // Build the first facet list
            if ((reader.FieldCount == 2) && (Facet_Types.Count > 0))
            {
                // Assign the first facet type
                First_Facets_MetadataTypeID = Facet_Types[0];

                // Read all the individual facet values
                while (reader.Read())
                {
                    First_Facets.Add(new Search_Facet(reader.GetString(0), reader.GetInt32(1)));
                }

                // Go to the next table
                if (!reader.NextResult())
                {
                    return;
                }
            }

            // Build the second facet list
            if ((reader.FieldCount == 2) && (Facet_Types.Count > 1))
            {
                // Assign the second facet type
                Second_Facets_MetadataTypeID = Facet_Types[1];

                // Read all the individual facet values
                while (reader.Read())
                {
                    Second_Facets.Add(new Search_Facet(reader.GetString(0), reader.GetInt32(1)));
                }

                // Go to the next table
                if (!reader.NextResult())
                {
                    return;
                }
            }

            // Build the third facet list
            if ((reader.FieldCount == 2) && (Facet_Types.Count > 2))
            {
                // Assign the third facet type
                Third_Facets_MetadataTypeID = Facet_Types[2];

                // Read all the individual facet values
                while (reader.Read())
                {
                    Third_Facets.Add(new Search_Facet(reader.GetString(0), reader.GetInt32(1)));
                }

                // Go to the next table
                if (!reader.NextResult())
                {
                    return;
                }
            }

            // Build the fourth facet list
            if ((reader.FieldCount == 2) && (Facet_Types.Count > 3))
            {
                // Assign the fourth facet type
                Fourth_Facets_MetadataTypeID = Facet_Types[3];

                // Read all the individual facet values
                while (reader.Read())
                {
                    Fourth_Facets.Add(new Search_Facet(reader.GetString(0), reader.GetInt32(1)));
                }

                // Go to the next table
                if (!reader.NextResult())
                {
                    return;
                }
            }

            // Build the fifth facet list
            if ((reader.FieldCount == 2) && (Facet_Types.Count > 4))
            {
                // Assign the fifth facet type
                Fifth_Facets_MetadataTypeID = Facet_Types[4];

                // Read all the individual facet values
                while (reader.Read())
                {
                    Fifth_Facets.Add(new Search_Facet(reader.GetString(0), reader.GetInt32(1)));
                }

                // Go to the next table
                if (!reader.NextResult())
                {
                    return;
                }
            }

            // Build the sixth facet list
            if ((reader.FieldCount == 2) && (Facet_Types.Count > 5))
            {
                // Assign the sixth facet type
                Sixth_Facets_MetadataTypeID = Facet_Types[5];

                // Read all the individual facet values
                while (reader.Read())
                {
                    Sixth_Facets.Add(new Search_Facet(reader.GetString(0), reader.GetInt32(1)));
                }

                // Go to the next table
                if (!reader.NextResult())
                {
                    return;
                }
            }

            // Build the seventh facet list
            if ((reader.FieldCount == 2) && (Facet_Types.Count > 6))
            {
                // Assign the seventh facet type
                Seventh_Facets_MetadataTypeID = Facet_Types[6];

                // Read all the individual facet values
                while (reader.Read())
                {
                    Seventh_Facets.Add(new Search_Facet(reader.GetString(0), reader.GetInt32(1)));
                }

                // Go to the next table
                if (!reader.NextResult())
                {
                    return;
                }
            }

            // Build the eighth facet list
            if ((reader.FieldCount == 2) && (Facet_Types.Count > 7))
            {
                // Assign the eighth facet type
                Eighth_Facets_MetadataTypeID = Facet_Types[7];

                // Read all the individual facet values
                while (reader.Read())
                {
                    Eighth_Facets.Add(new Search_Facet(reader.GetString(0), reader.GetInt32(1)));
                }
            }
        }