public override object this[string key]
 {
     get
     {
         if (key == null)
         {
             return(null);
         }
         m_reportOM.PerformPendingFieldValueUpdate();
         m_usedInExpression = true;
         if (ReportProcessing.CompareWithInvariantCulture(key, "Value", ignoreCase: true) == 0)
         {
             return(Value);
         }
         if (ReportProcessing.CompareWithInvariantCulture(key, "IsMissing", ignoreCase: true) == 0)
         {
             return(IsMissing);
         }
         if (ReportProcessing.CompareWithInvariantCulture(key, "LevelNumber", ignoreCase: true) == 0)
         {
             return(LevelNumber);
         }
         return(GetProperty(key));
     }
 }
 private static bool CompareWithInvariantCulture(string strOne, string strTwo)
 {
     if (ReportProcessing.CompareWithInvariantCulture(strOne, strTwo, false) == 0)
     {
         return(true);
     }
     return(false);
 }
Example #3
0
 internal static bool CompareWithInvariantCulture(string strOne, string strTwo)
 {
     if (ReportProcessing.CompareWithInvariantCulture(strOne, strTwo, ignoreCase: false) == 0)
     {
         return(true);
     }
     return(false);
 }
Example #4
0
 public override object this[string key]
 {
     get
     {
         if (key == null)
         {
             return(null);
         }
         if (ReportProcessing.CompareWithInvariantCulture(key, "Value", ignoreCase: true) == 0)
         {
             return(Value);
         }
         if (ReportProcessing.CompareWithInvariantCulture(key, "IsMissing", ignoreCase: true) == 0)
         {
             return(IsMissing);
         }
         if (ReportProcessing.CompareWithInvariantCulture(key, "LevelNumber", ignoreCase: true) == 0)
         {
             return(LevelNumber);
         }
         return(GetProperty(key));
     }
 }
Example #5
0
 private void CornerInitialize(InitializationContext context)
 {
     if (this.m_categoryAxis != null)
     {
         context.ExprHostBuilder.ChartCategoryAxisStart();
         this.m_categoryAxis.Initialize(context, Axis.Mode.CategoryAxis);
         context.ExprHostBuilder.ChartCategoryAxisEnd();
     }
     if (this.m_valueAxis != null)
     {
         context.ExprHostBuilder.ChartValueAxisStart();
         this.m_valueAxis.Initialize(context, Axis.Mode.ValueAxis);
         context.ExprHostBuilder.ChartValueAxisEnd();
     }
     if (this.m_multiChart != null)
     {
         this.m_multiChart.Initialize(context);
     }
     if (this.m_legend != null)
     {
         this.m_legend.Initialize(context);
     }
     if (this.m_title != null)
     {
         this.m_title.Initialize(context);
     }
     if (this.m_3dProperties != null)
     {
         this.m_3dProperties.Initialize(context);
     }
     if (this.m_plotArea != null)
     {
         this.m_plotArea.Initialize(context);
     }
     if (this.m_categoryAxis != null && this.m_categoryAxis.Scalar)
     {
         Global.Tracer.Assert(null != this.m_columns);
         if (this.m_columns.SubHeading != null)
         {
             context.ErrorContext.Register(ProcessingErrorCode.rsMultipleGroupingsOnChartScalarAxis, Severity.Error, context.ObjectType, context.ObjectName, "CategoryAxis");
         }
         else if (this.StaticColumns != null && this.StaticColumns.Labels != null)
         {
             context.ErrorContext.Register(ProcessingErrorCode.rsStaticGroupingOnChartScalarAxis, Severity.Error, context.ObjectType, context.ObjectName, "CategoryAxis");
         }
         else if (this.m_columns.Grouping != null && this.m_columns.Grouping.GroupExpressions != null && 1 < this.m_columns.Grouping.GroupExpressions.Count)
         {
             context.ErrorContext.Register(ProcessingErrorCode.rsMultipleGroupExpressionsOnChartScalarAxis, Severity.Error, context.ObjectType, context.ObjectName, "CategoryAxis");
         }
         else
         {
             Global.Tracer.Assert(null == this.m_columns.SubHeading);
             Global.Tracer.Assert(this.StaticColumns == null || null == this.StaticColumns.Labels);
             this.m_columns.ChartGroupExpression = true;
             if (this.m_columns.Labels != null && this.m_columns.Grouping != null && this.m_columns.Grouping.GroupExpressions != null && ReportProcessing.CompareWithInvariantCulture(this.m_columns.Labels[0].Value, this.m_columns.Grouping.GroupExpressions[0].Value, true) != 0)
             {
                 context.ErrorContext.Register(ProcessingErrorCode.rsLabelExpressionOnChartScalarAxisIsIgnored, Severity.Warning, context.ObjectType, context.ObjectName, "CategoryAxis");
                 this.m_columns.Labels = null;
             }
             if (this.m_columns.Grouping != null && ChartTypes.Area == this.m_type)
             {
                 Global.Tracer.Assert(null != this.m_columns.Grouping.GroupExpressions);
                 if (this.m_columns.Sorting == null || this.m_columns.Sorting.SortExpressions == null || this.m_columns.Sorting.SortExpressions[0] == null)
                 {
                     this.m_columns.Grouping.GroupAndSort   = true;
                     this.m_columns.Grouping.SortDirections = new BoolList(1);
                     this.m_columns.Grouping.SortDirections.Add(true);
                 }
                 else if (ReportProcessing.CompareWithInvariantCulture(this.m_columns.Grouping.GroupExpressions[0].Value, this.m_columns.Sorting.SortExpressions[0].Value, true) != 0)
                 {
                     context.ErrorContext.Register(ProcessingErrorCode.rsUnsortedCategoryInAreaChart, Severity.Error, context.ObjectType, context.ObjectName, "CategoryGrouping", this.m_columns.Grouping.Name);
                 }
             }
             else if (this.m_columns.Grouping != null)
             {
                 if (ChartTypes.Line != this.m_type)
                 {
                     if (this.m_type != 0)
                     {
                         return;
                     }
                     if (!this.m_hasSeriesPlotTypeLine)
                     {
                         return;
                     }
                 }
                 Global.Tracer.Assert(null != this.m_columns.Grouping.GroupExpressions);
                 if (!this.m_columns.Grouping.GroupAndSort)
                 {
                     bool flag = false;
                     if (this.m_columns.Sorting == null || this.m_columns.Sorting.SortExpressions == null || this.m_columns.Sorting.SortExpressions[0] == null)
                     {
                         flag = true;
                     }
                     else if (ReportProcessing.CompareWithInvariantCulture(this.m_columns.Grouping.GroupExpressions[0].Value, this.m_columns.Sorting.SortExpressions[0].Value, true) != 0)
                     {
                         flag = true;
                     }
                     if (flag)
                     {
                         context.ErrorContext.Register(ProcessingErrorCode.rsLineChartMightScatter, Severity.Warning, context.ObjectType, context.ObjectName, "CategoryGrouping");
                     }
                 }
             }
         }
     }
 }
Example #6
0
        public string FormatValue(object value, string formatString, TypeCode typeCode, bool addDateTimeOffsetSuffix)
        {
            CultureInfo cultureInfo   = null;
            string      text          = null;
            bool        flag          = false;
            bool        flag2         = false;
            bool        flag3         = false;
            int         languageState = 0;
            bool        flag4         = false;
            string      text2         = null;
            Calendar    calendar      = null;
            bool        flag5         = false;

            try
            {
                if (this.m_styleClass != null)
                {
                    if (formatString == null)
                    {
                        this.m_styleClass.GetStyleAttribute(this.m_objectType, this.m_objectName, "Format", this.m_context, ref this.m_sharedFormatSettings, out formatString);
                    }
                    languageState = this.m_styleClass.GetStyleAttribute(this.m_objectType, this.m_objectName, "Language", this.m_context, ref this.m_sharedFormatSettings, out text);
                    if (!this.GetCulture(text, ref cultureInfo, ref flag2, ref languageState))
                    {
                        text2 = RPRes.rsExpressionErrorValue;
                        flag5 = true;
                    }
                    if (!flag5 && typeCode == TypeCode.DateTime && !this.m_calendarValidated)
                    {
                        this.CreateAndValidateCalendar(languageState, cultureInfo);
                    }
                }
                if (!flag5 && cultureInfo != null && this.m_formattingCalendar != null)
                {
                    if (flag2)
                    {
                        if (cultureInfo.DateTimeFormat.IsReadOnly)
                        {
                            cultureInfo = (CultureInfo)cultureInfo.Clone();
                            flag3       = true;
                        }
                        else
                        {
                            calendar = cultureInfo.DateTimeFormat.Calendar;
                        }
                    }
                    cultureInfo.DateTimeFormat.Calendar = this.m_formattingCalendar;
                }
                if (!flag5 && formatString != null && value is IFormattable)
                {
                    try
                    {
                        if (cultureInfo == null)
                        {
                            cultureInfo = Thread.CurrentThread.CurrentCulture;
                            flag2       = true;
                        }
                        if (ReportProcessing.CompareWithInvariantCulture(formatString, "x", true) == 0)
                        {
                            flag4 = true;
                        }
                        text2 = ((IFormattable)value).ToString(formatString, cultureInfo);
                        if (addDateTimeOffsetSuffix)
                        {
                            text2 += " +0".ToString(cultureInfo);
                        }
                    }
                    catch (Exception ex)
                    {
                        text2 = RPRes.rsExpressionErrorValue;
                        this.m_context.ErrorContext.Register(ProcessingErrorCode.rsInvalidFormatString, Severity.Warning, this.m_objectType, this.m_objectName, "Format", ex.Message);
                    }
                    flag5 = true;
                }
                CultureInfo cultureInfo2;
                if (!flag5)
                {
                    cultureInfo2 = null;
                    if (!flag2 && cultureInfo != null)
                    {
                        goto IL_01be;
                    }
                    if (flag3)
                    {
                        goto IL_01be;
                    }
                    text2 = value.ToString();
                }
                goto end_IL_001a;
IL_01be:
                cultureInfo2 = Thread.CurrentThread.CurrentCulture;
                Thread.CurrentThread.CurrentCulture = cultureInfo;
                try
                {
                    text2 = value.ToString();
                }
                finally
                {
                    if (cultureInfo2 != null)
                    {
                        Thread.CurrentThread.CurrentCulture = cultureInfo2;
                    }
                }
                end_IL_001a :;
            }
            finally
            {
                if (flag2 && calendar != null)
                {
                    Global.Tracer.Assert(!Thread.CurrentThread.CurrentCulture.DateTimeFormat.IsReadOnly, "(!System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.IsReadOnly)");
                    Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar = calendar;
                }
            }
            if (!flag4 && this.m_styleClass != null)
            {
                switch (typeCode)
                {
                case TypeCode.SByte:
                case TypeCode.Byte:
                case TypeCode.Int16:
                case TypeCode.UInt16:
                case TypeCode.Int32:
                case TypeCode.UInt32:
                case TypeCode.Int64:
                case TypeCode.UInt64:
                case TypeCode.Single:
                case TypeCode.Double:
                case TypeCode.Decimal:
                    flag = true;
                    break;
                }
                if (flag)
                {
                    int num = 1;
                    this.m_styleClass.GetStyleAttribute(this.m_objectType, this.m_objectName, "NumeralVariant", this.m_context, ref this.m_sharedFormatSettings, out num);
                    if (num > 2)
                    {
                        CultureInfo cultureInfo3 = cultureInfo;
                        if (cultureInfo3 == null)
                        {
                            cultureInfo3 = Thread.CurrentThread.CurrentCulture;
                        }
                        string numberDecimalSeparator = cultureInfo3.NumberFormat.NumberDecimalSeparator;
                        this.m_styleClass.GetStyleAttribute(this.m_objectType, this.m_objectName, "NumeralLanguage", this.m_context, ref this.m_sharedFormatSettings, out text);
                        if (text != null)
                        {
                            cultureInfo = new CultureInfo(text, false);
                        }
                        else if (cultureInfo == null)
                        {
                            cultureInfo = cultureInfo3;
                        }
                        bool flag6 = true;
                        text2 = FormatDigitReplacement.FormatNumeralVariant(text2, num, cultureInfo, numberDecimalSeparator, out flag6);
                        if (!flag6)
                        {
                            this.m_context.ErrorContext.Register(ProcessingErrorCode.rsInvalidNumeralVariantForLanguage, Severity.Warning, this.m_objectType, this.m_objectName, "NumeralVariant", num.ToString(CultureInfo.InvariantCulture), cultureInfo.Name);
                        }
                    }
                }
            }
            return(text2);
        }
 internal static bool IsRenderFormat(string format, string targetFormat)
 {
     return(ReportProcessing.CompareWithInvariantCulture(format, targetFormat, ignoreCase: true) == 0);
 }
        internal string FormatValue(object value, string formatString, TypeCode typeCode, bool addDateTimeOffsetSuffix)
        {
            CultureInfo formattingCulture = null;
            string      styleStringValue  = null;
            bool        flag            = false;
            bool        isThreadCulture = false;
            bool        flag2           = false;
            int         num             = 0;
            bool        flag3           = false;
            string      text            = null;
            Calendar    calendar        = null;
            bool        flag4           = false;

            try
            {
                if (m_styleClass != null)
                {
                    if (formatString == null)
                    {
                        m_styleClass.GetStyleAttribute(m_objectType, m_objectName, "Format", m_context, ref m_sharedFormatSettings, out formatString);
                    }
                    num = m_styleClass.GetStyleAttribute(m_objectType, m_objectName, "Language", m_context, ref m_sharedFormatSettings, out styleStringValue);
                    if (!GetCulture(styleStringValue, ref formattingCulture, ref isThreadCulture, ref num))
                    {
                        text  = RPRes.rsExpressionErrorValue;
                        flag4 = true;
                    }
                    if (!flag4 && typeCode == TypeCode.DateTime && !m_calendarValidated)
                    {
                        CreateAndValidateCalendar(num, formattingCulture);
                    }
                }
                if (!flag4 && formattingCulture != null && m_formattingCalendar != null)
                {
                    if (isThreadCulture)
                    {
                        if (formattingCulture.DateTimeFormat.IsReadOnly)
                        {
                            formattingCulture = (CultureInfo)formattingCulture.Clone();
                            flag2             = true;
                        }
                        else
                        {
                            calendar = formattingCulture.DateTimeFormat.Calendar;
                        }
                    }
                    formattingCulture.DateTimeFormat.Calendar = m_formattingCalendar;
                }
                if (!flag4 && formatString != null && value is IFormattable)
                {
                    try
                    {
                        if (formattingCulture == null)
                        {
                            formattingCulture = Thread.CurrentThread.CurrentCulture;
                            isThreadCulture   = true;
                        }
                        if (ReportProcessing.CompareWithInvariantCulture(formatString, "x", ignoreCase: true) == 0)
                        {
                            flag3 = true;
                        }
                        text = ((IFormattable)value).ToString(formatString, formattingCulture);
                        if (addDateTimeOffsetSuffix)
                        {
                            text += " +0".ToString(formattingCulture);
                        }
                    }
                    catch (Exception ex)
                    {
                        text = RPRes.rsExpressionErrorValue;
                        m_context.ErrorContext.Register(ProcessingErrorCode.rsInvalidFormatString, Severity.Warning, m_objectType, m_objectName, "Format", ex.Message);
                    }
                    flag4 = true;
                }
                if (!flag4)
                {
                    CultureInfo cultureInfo = null;
                    if ((!isThreadCulture && formattingCulture != null) || flag2)
                    {
                        cultureInfo = Thread.CurrentThread.CurrentCulture;
                        Thread.CurrentThread.CurrentCulture = formattingCulture;
                        try
                        {
                            text = value.ToString();
                        }
                        finally
                        {
                            if (cultureInfo != null)
                            {
                                Thread.CurrentThread.CurrentCulture = cultureInfo;
                            }
                        }
                    }
                    else
                    {
                        text = value.ToString();
                    }
                }
            }
            finally
            {
                if (isThreadCulture && calendar != null)
                {
                    Global.Tracer.Assert(!Thread.CurrentThread.CurrentCulture.DateTimeFormat.IsReadOnly, "(!System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.IsReadOnly)");
                    Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar = calendar;
                }
            }
            if (!flag3 && m_styleClass != null)
            {
                if ((uint)(typeCode - 5) <= 10u)
                {
                    flag = true;
                }
                if (flag)
                {
                    int styleIntValue = 1;
                    m_styleClass.GetStyleAttribute(m_objectType, m_objectName, "NumeralVariant", m_context, ref m_sharedFormatSettings, out styleIntValue);
                    if (styleIntValue > 2)
                    {
                        CultureInfo cultureInfo2 = formattingCulture;
                        if (cultureInfo2 == null)
                        {
                            cultureInfo2 = Thread.CurrentThread.CurrentCulture;
                        }
                        string numberDecimalSeparator = cultureInfo2.NumberFormat.NumberDecimalSeparator;
                        m_styleClass.GetStyleAttribute(m_objectType, m_objectName, "NumeralLanguage", m_context, ref m_sharedFormatSettings, out styleStringValue);
                        if (styleStringValue != null)
                        {
                            formattingCulture = new CultureInfo(styleStringValue, useUserOverride: false);
                        }
                        else if (formattingCulture == null)
                        {
                            formattingCulture = cultureInfo2;
                        }
                        bool numberTranslated = true;
                        text = FormatDigitReplacement.FormatNumeralVariant(text, styleIntValue, formattingCulture, numberDecimalSeparator, out numberTranslated);
                        if (!numberTranslated)
                        {
                            m_context.ErrorContext.Register(ProcessingErrorCode.rsInvalidNumeralVariantForLanguage, Severity.Warning, m_objectType, m_objectName, "NumeralVariant", styleIntValue.ToString(CultureInfo.InvariantCulture), formattingCulture.Name);
                        }
                    }
                }
            }
            return(text);
        }
 public static bool IsRenderFormat(string format, string targetFormat)
 {
     return(0 == ReportProcessing.CompareWithInvariantCulture(format, targetFormat, true));
 }