private string SetColumnFormatAndVisibility()

in BismNormalizer/BismNormalizer/TabularCompare/MultidimensionalMetadata/Table.cs [417:538]


        private string SetColumnFormatAndVisibility(DimensionAttribute attribute)
        {
            string columnDef = "";

            if (attribute != null && attribute.Annotations != null && attribute.Annotations.Contains("Format") && attribute.Annotations["Format"].Value.Attributes["Format"] != null)
            {
                switch (attribute.Annotations["Format"].Value.Attributes["Format"].Value)
                {
                    case "General":
                        columnDef += "Data Format: General";
                        break;
                    case "NumberDecimal":
                        columnDef += "Data Format: Decimal Number" +
                                             (attribute.Annotations["Format"].Value.Attributes["Accuracy"] != null ? ", Decimal Places: " + attribute.Annotations["Format"].Value.Attributes["Accuracy"].Value : "") +
                                             (attribute.Annotations["Format"].Value.Attributes["ThousandSeparator"] != null ? ", Show Thousand Separator: " + attribute.Annotations["Format"].Value.Attributes["ThousandSeparator"].Value : "");
                        break;
                    case "NumberWhole":
                        columnDef += "Data Format: Whole Number" +
                                             (attribute.Annotations["Format"].Value.Attributes["ThousandSeparator"] != null ? ", Show Thousand Separator: " + attribute.Annotations["Format"].Value.Attributes["ThousandSeparator"].Value : "");
                        break;
                    case "Percentage":
                        columnDef += "Data Format: Percentage" +
                                             (attribute.Annotations["Format"].Value.Attributes["Accuracy"] != null ? ", Decimal Places: " + attribute.Annotations["Format"].Value.Attributes["Accuracy"].Value : "") +
                                             (attribute.Annotations["Format"].Value.Attributes["ThousandSeparator"] != null ? ", Show Thousand Separator: " + attribute.Annotations["Format"].Value.Attributes["ThousandSeparator"].Value : "");
                        break;
                    case "Scientific":
                        columnDef += "Data Format: Scientific" +
                                             (attribute.Annotations["Format"].Value.Attributes["Accuracy"] != null ? ", Decimal Places: " + attribute.Annotations["Format"].Value.Attributes["Accuracy"].Value : "");
                        break;
                    case "Currency":
                        columnDef += "Data Format: Currency" +
                                             (attribute.Annotations["Format"].Value.Attributes["Accuracy"] != null ? ", Decimal Places: " + attribute.Annotations["Format"].Value.Attributes["Accuracy"].Value : "") +
                                             (attribute.Annotations["Format"].Value.HasChildNodes &&
                                               attribute.Annotations["Format"].Value.ChildNodes[0].Attributes["DisplayName"] != null
                                               ? ", Currency Symbol: " + attribute.Annotations["Format"].Value.ChildNodes[0].Attributes["DisplayName"].Value : "");
                        break;
                    case "DateTimeCustom":
                        columnDef += "Data Format: Date" +
                                             (attribute.Annotations["Format"].Value.HasChildNodes &&
                                               attribute.Annotations["Format"].Value.ChildNodes[0].HasChildNodes &&
                                               attribute.Annotations["Format"].Value.ChildNodes[0].ChildNodes[0].Attributes["FormatString"] != null
                                               ? ", Date Format: " + attribute.Annotations["Format"].Value.ChildNodes[0].ChildNodes[0].Attributes["FormatString"].Value : "");
                        break;
                    case "DateTimeGeneral":
                        columnDef += "Data Format: General";
                        break;
                    case "Text":
                        columnDef += "Data Format: Text";
                        break;
                    case "Boolean":
                        columnDef += "Data Format: TRUE/FALSE";
                        break;
                    default:
                        break;
                }
            }
            else
            {
                // Sometimes annotations are not populated, so just show the default formats (which are text/general)
                switch (attribute.KeyColumns[0].DataType)
                {
                    case System.Data.OleDb.OleDbType.WChar:
                        columnDef += "Data Format: Text";
                        break;
                    case System.Data.OleDb.OleDbType.BigInt:
                    case System.Data.OleDb.OleDbType.Integer:
                    case System.Data.OleDb.OleDbType.SmallInt:
                    case System.Data.OleDb.OleDbType.Double:
                    case System.Data.OleDb.OleDbType.Currency:
                    case System.Data.OleDb.OleDbType.Date:
                    case System.Data.OleDb.OleDbType.Binary:
                        columnDef += "Data Format: General";
                        break;
                    case System.Data.OleDb.OleDbType.Boolean:
                        columnDef += "Data Format: TRUE/FALSE";
                        break;
                    default:
                        break;
                }
            }

            columnDef += ", Hidden: " + (!attribute.AttributeHierarchyVisible).ToString();

            //if (_parentTabularModel.ComparisonInfo.OptionsInfo.OptionDisplayFolders)
            //{
            //    columnDef += ", Display Folder: ";
            //    if (attribute.AttributeHierarchyDisplayFolder != null)
            //    {
            //        columnDef += attribute.AttributeHierarchyDisplayFolder;
            //    }
            //}

            //if (_parentTabularModel.ComparisonInfo.OptionsInfo.OptionTranslations)
            //{
            //    columnDef += ", Column Translations: ";
            //    if (attribute.Translations.Count > 0)
            //    {
            //        columnDef += "[";
            //        foreach (AttributeTranslation attributeTranslation in attribute.Translations)
            //        {
            //            columnDef += CultureInfo.GetCultureInfo(attributeTranslation.Language).DisplayName + ": " + attributeTranslation.Caption + ", ";
            //        }
            //        columnDef = columnDef.Substring(0, columnDef.Length - 2) + "]";
            //    }

            //    if (_parentTabularModel.ComparisonInfo.OptionsInfo.OptionDisplayFolders)
            //    {
            //        columnDef += ", Display Folder Translations: ";
            //        if (attribute.Translations.Count > 0)
            //        {
            //            columnDef += "[";
            //            foreach (AttributeTranslation attributeTranslation in attribute.Translations)
            //            {
            //                columnDef += CultureInfo.GetCultureInfo(attributeTranslation.Language).DisplayName + ": " + attributeTranslation.DisplayFolder + ", ";
            //            }
            //            columnDef = columnDef.Substring(0, columnDef.Length - 2) + "]";
            //        }
            //    }
            //}

            return columnDef;
        }