private void Handle_All_Languages_For_Indicators(CategorySchemeTypes categorySchemeType, CategoryType Category, string IndicatorGId)
        {
            DataTable DtTable;
            DIQueries DIQueriesLanguage;
            string Query, Language;

            Query = string.Empty;

            if (this.MultiLanguageHandlingRequired)
            {
                foreach (DataRow LanguageRow in this.DIConnection.DILanguages(this.DIQueries.DataPrefix).Rows)
                {
                    Language = LanguageRow[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Language.LanguageCode].ToString();

                    if (Language != this.DIQueries.LanguageCode.Substring(1))
                    {
                        DIQueriesLanguage = new DIQueries(this.DIQueries.DataPrefix, Language);
                        Query = DIQueriesLanguage.Indicators.GetIndicator(FilterFieldType.GId, IndicatorGId, FieldSelection.Light);

                        DtTable = this.DIConnection.ExecuteDataTable(Query);
                        if (DtTable.Rows.Count > 0)
                        {
                            Category.Name.Add(new TextType(Language, DtTable.Rows[0][Indicator.IndicatorName].ToString()));
                        }
                    }
                }
            }
        }
        private void Handle_All_Languages(CategorySchemeTypes categorySchemeType, CategoryType Category, string ICGId)
        {
            DataTable DtTable;
            string Query, Language;

            Query = string.Empty;

            if (this.MultiLanguageHandlingRequired)
            {
                foreach (DataRow LanguageRow in this.DIConnection.DILanguages(this.DIQueries.DataPrefix).Rows)
                {
                    Language = LanguageRow[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Language.LanguageCode].ToString();
                    if (Language != this.DIQueries.LanguageCode.Substring(1))
                    {
                        Query = this.Get_Language_Specific_Query(categorySchemeType, FilterFieldType.GId, Constants.Apostophe + ICGId + Constants.Apostophe, Language);
                        DtTable = this.DIConnection.ExecuteDataTable(Query);
                        if (DtTable.Rows.Count > 0)
                        {
                            Category.Name.Add(new TextType(Language, DtTable.Rows[0][IndicatorClassifications.ICName].ToString()));
                        }
                    }
                }
            }
        }
        private void Add_Children_Categories(CategorySchemeTypes categorySchemeType, CategoryType ParentCategory, string ICParent_NId, DataTable DtICs)
        {
            CategoryType ChildCategory;
            string ICGId, ICNId, ICName, IndicatorNId, IndicatorGId, IndicatorName;
            DataTable DtIndicators;
            DataRow[] ICRows;

            ICRows = DtICs.Select(IndicatorClassifications.ICParent_NId + Constants.EqualsTo + ICParent_NId);

            if (ICRows.Length > 0)
            {
                foreach (DataRow DrICs in ICRows)
                {
                    ICNId = DrICs[IndicatorClassifications.ICNId].ToString();
                    ICGId = DrICs[IndicatorClassifications.ICGId].ToString();
                    ICName = DrICs[IndicatorClassifications.ICName].ToString();

                    ChildCategory = new CategoryType(ICGId, ICName, string.Empty, this.Language, null);
                    if (this.MultiLanguageHandlingRequired)
                    {
                        this.Handle_All_Languages(categorySchemeType, ChildCategory, ICGId);
                    }

                    this.Add_Annotation(ChildCategory, Constants.Annotations.CategoryType, Constants.Annotations.IC);
                    this.Add_Children_Categories(categorySchemeType, ChildCategory, ICNId, DtICs);
                    ParentCategory.Items.Add(ChildCategory);
                }
            }
            else
            {
                DtIndicators = this.DIConnection.ExecuteDataTable(this.Get_Language_Specific_Query_For_Indicators(categorySchemeType, ICParent_NId, this.Language));
                foreach (DataRow DrIndicators in DtIndicators.Rows)
                {
                    IndicatorNId = DrIndicators[Indicator.IndicatorNId].ToString();
                    IndicatorGId = DrIndicators[Indicator.IndicatorGId].ToString();
                    IndicatorName = DrIndicators[Indicator.IndicatorName].ToString();

                    if (this._dictIndicatorMapping == null || this._dictIndicatorMapping.Keys.Count == 0)
                    {
                        ChildCategory = new CategoryType(IndicatorGId, IndicatorName, string.Empty, this.Language, null);
                        if (this.MultiLanguageHandlingRequired)
                        {
                            this.Handle_All_Languages_For_Indicators(categorySchemeType, ChildCategory, IndicatorGId);
                        }

                        this.Add_Annotation(ChildCategory, Constants.Annotations.CategoryType, Constants.Annotations.Indicator);
                        ParentCategory.Items.Add(ChildCategory);
                    }
                    else
                    {
                        if (this._dictIndicatorMapping.ContainsKey(IndicatorGId))
                        {
                            ChildCategory = new CategoryType(this._dictIndicatorMapping[IndicatorGId], this._dictIndicator[this._dictIndicatorMapping[IndicatorGId]], string.Empty, Constants.DefaultLanguage, null);
                            this.Add_Annotation(ChildCategory, Constants.Annotations.CategoryType, Constants.Annotations.Indicator);
                            ParentCategory.Items.Add(ChildCategory);
                        }
                    }
                }
            }
        }
        private ArtefactInfo Generate_Theme_CategoryScheme()
        {
            ArtefactInfo RetVal;
            CategorySchemeType CategoryScheme;
            CategoryType Category;
            string ICGId, ICNId, ICName;
            string Query;
            DataTable DtICs;
            RetVal = null;

            try
            {
                CategoryScheme = new CategorySchemeType(Constants.CategoryScheme.Theme.Id, this.AgencyId, Constants.CategoryScheme.Theme.Version, Constants.CategoryScheme.Theme.Name, Constants.CategoryScheme.Theme.Description, Constants.DefaultLanguage, null);

                if (this._completeOrSummaryFlag == true)
                {
                    Query = this.Get_Language_Specific_Query(CategorySchemeTypes.Theme, FilterFieldType.None, string.Empty, this.Language);
                    DtICs = this.DIConnection.ExecuteDataTable(Query);

                    foreach (DataRow DrICs in DtICs.Select(IndicatorClassifications.ICParent_NId + Constants.EqualsTo + Constants.MinusOne))
                    {
                        ICNId = DrICs[IndicatorClassifications.ICNId].ToString();
                        ICGId = DrICs[IndicatorClassifications.ICGId].ToString();
                        ICName = DrICs[IndicatorClassifications.ICName].ToString();

                        Category = new CategoryType(ICGId, ICName, string.Empty, this.Language, null);
                        if (this.MultiLanguageHandlingRequired)
                        {
                            this.Handle_All_Languages(CategorySchemeTypes.Theme, Category, ICGId);
                        }

                        this.Add_Children_Categories(CategorySchemeTypes.Theme, Category, ICNId, DtICs);
                        CategoryScheme.Items.Add(Category);
                    }

                    if (CategoryScheme.Items.Count > 0)
                    {
                        RetVal = this.Prepare_ArtefactInfo_From_CategoryScheme(CategoryScheme, this.Get_File_Name(CategorySchemeTypes.Theme));
                    }
                }
                else
                {
                    RetVal = this.Prepare_ArtefactInfo_From_CategoryScheme(CategoryScheme, this.Get_File_Name(CategorySchemeTypes.Theme));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
 private void Add_Annotation(CategoryType Category, string title, string text)
 {
     if (Category.Annotations == null)
     {
         Category.Annotations = new List<AnnotationType>();
     }
     AnnotationType Annotation = new AnnotationType();
     Annotation.AnnotationTitle = title;
     Annotation.AnnotationText = new List<TextType>();
     Annotation.AnnotationText.Add(new TextType(null, text));
     Category.Annotations.Add(Annotation);
 }