/// <summary> Populates the code manager object for translating SobekCM codes to greenstone collection codes </summary>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <param name="Codes"> Code object to populate with the all the code and aggregation information</param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        /// <remarks> This calls the 'SobekCM_Get_Codes' stored procedure </remarks> 
        public static bool Populate_Code_Manager(Aggregation_Code_Manager Codes, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("SobekCM_Database.Populate_Code_Manager", String.Empty);
            }

            // Create the connection
            using (SqlConnection connect = new SqlConnection(connectionString))
            {
                SqlCommand executeCommand = new SqlCommand("SobekCM_Get_Codes", connect);

                // Create the data reader
                connect.Open();
                using (SqlDataReader reader = executeCommand.ExecuteReader())
                {
                    // Clear the codes list and then move in the new data
                    Codes.Clear();

                    // get the column indexes out
                    const int CODE_COL = 0;
                    const int TYPE_COL = 1;
                    const int NAME_COL = 2;
                    const int SHORT_NAME_COL = 3;
                    const int IS_ACTIVE_COL = 4;
                    const int HIDDEN_COL = 5;
                    const int ID_COL = 6;
                    const int DESC_COL = 7;
                    const int THEME_COL = 8;
                    const int LINK_COL = 9;

                    while (reader.Read())
                    {
                        // Get the list key values out
                        string code = reader.GetString(CODE_COL).ToUpper();
                        string type = reader.GetString( TYPE_COL);
                        int theme = reader.GetInt32(THEME_COL);

                        // Only do anything else if this is not somehow a repeat
                        if ( !Codes.isValidCode(code))
                        {
                            // Create the object
                            Item_Aggregation_Related_Aggregations thisAggr =
                                new Item_Aggregation_Related_Aggregations(code, reader.GetString(NAME_COL),
                                                                          reader.GetString(SHORT_NAME_COL), type,
                                                                          reader.GetBoolean(IS_ACTIVE_COL),
                                                                          reader.GetBoolean(HIDDEN_COL),
                                                                          reader.GetString(DESC_COL),
                                                                          (ushort) reader.GetInt32(ID_COL))
                                    {External_Link = reader.GetString(LINK_COL)};

                            // Add this to the codes manager
                            Codes.Add_Collection(thisAggr, theme );
                        }
                    }
                    reader.Close();
                }
                connect.Close();
            }

            // Succesful
            return true;
        }
        /// <summary> Populates the code manager object for translating SobekCM codes to greenstone collection codes </summary>
        /// <param name="tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <param name="Codes"> Code object to populate with the all the code and aggregation information</param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        /// <remarks> This calls the 'SobekCM_Get_Codes' stored procedure </remarks> 
        public static bool Populate_Code_Manager(Aggregation_Code_Manager Codes, Custom_Tracer tracer)
        {
            if (tracer != null)
            {
                tracer.Add_Trace("SobekCM_Database.Populate_Code_Manager", String.Empty);
            }

            // Create the connection
            using (SqlConnection connect = new SqlConnection(connectionString))
            {
                SqlCommand executeCommand = new SqlCommand("SobekCM_Get_Codes", connect);

                // Create the data reader
                connect.Open();
                using (SqlDataReader reader = executeCommand.ExecuteReader())
                {
                    // Clear the codes list and then move in the new data
                    Codes.Clear();

                    // get the column indexes out
                    const int codeCol = 0;
                    const int typeCol = 1;
                    const int nameCol = 2;
                    const int shortNameCol = 3;
                    const int isActiveCol = 4;
                    const int hiddenCol = 5;
                    const int idCol = 6;
                    const int descCol = 7;
                    const int themeCol = 8;
                    const int linkCol = 9;

                    while (reader.Read())
                    {
                        // Get the list key values out
                        string code = reader.GetString(codeCol).ToUpper();
                        string type = reader.GetString( typeCol);
                        int theme = reader.GetInt32(themeCol);

                        // Only do anything else if this is not somehow a repeat
                        if ( !Codes.isValidCode(code))
                        {
                            // Create the object
                            Item_Aggregation_Related_Aggregations thisAggr =
                                new Item_Aggregation_Related_Aggregations(code, reader.GetString(nameCol),
                                                                          reader.GetString(shortNameCol), type,
                                                                          reader.GetBoolean(isActiveCol),
                                                                          reader.GetBoolean(hiddenCol),
                                                                          reader.GetString(descCol),
                                                                          (ushort) reader.GetInt32(idCol))
                                    {External_Link = reader.GetString(linkCol)};

                            // Add this to the codes manager
                            Codes.Add_Collection(thisAggr, theme );
                        }
                    }
                    reader.Close();
                }
                connect.Close();
            }

            // Succesful
            return true;
        }