Exemple #1
0
        public static FieldSchema GetSchemaForType(PivotViewerPropertyType type)
        {
            switch (type)
            {
            case PivotViewerPropertyType.DateTime:
                return(dateTimeSchema);

            case PivotViewerPropertyType.Decimal:
                return(decimalSchema);

            case PivotViewerPropertyType.Text:
                return(stringSchema);

            case PivotViewerPropertyType.Link:
                return(linkSchema);
            }
            return(null);
        }
Exemple #2
0
        private static string GetFormatString(FacetCategory category, PivotViewerPropertyType propType)
        {
            var format = category.Format;

            // special case for decimal with the "C[#]" format
            if (propType == PivotViewerPropertyType.Decimal && !string.IsNullOrEmpty(category.Format) && category.Format.StartsWith("C"))
            {
                format = "'$'##,0";
                if (category.Format.Length <= 1 || !int.TryParse(category.Format.Substring(1, 1), NumberStyles.Any, CultureInfo.InvariantCulture, out int digits))
                {
                    digits = 2;
                }
                if (digits > 0)
                {
                    format = string.Concat(format, ".");
                    format.PadRight(digits, '0');
                }
            }

            return(format);
        }
Exemple #3
0
        private static PivotViewerPropertyOptions GetPropertyOptions(FacetCategory category, PivotViewerPropertyType type)
        {
            var option = PivotViewerPropertyOptions.None;

            if (category.Type == FacetType.LongString)
            {
                option |= PivotViewerPropertyOptions.WrappingText;
            }

            if (!category.IsFilterVisibleSpecified || category.IsFilterVisible)
            {
                option |= PivotViewerPropertyOptions.CanFilter;
            }

            if (category.IsMetaDataVisibleSpecified && !category.IsMetaDataVisible)
            {
                option |= PivotViewerPropertyOptions.Private;
            }

            if ((!category.IsWordWheelVisibleSpecified || category.IsWordWheelVisible) && PivotViewerProperty.IsSearchableSchemaType(type))
            {
                option |= PivotViewerPropertyOptions.CanSearchText;
            }

            return(option);
        }