Exemple #1
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])));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #2
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)));
                }
            }
        }