private void ProcessParameter(ParameterInfoCollection aParameters, int aParamIndex)
        {
            ParameterInfo parameterInfo = aParameters[aParamIndex];

            parameterInfo.MissingUpstreamDataSourcePrompt = false;
            IParameterDef parameterDef = null;
            bool          flag         = aParameters.UserProfileState != UserProfileState.None;

            if (this.m_processingContext.SnapshotProcessing && parameterInfo.UsedInQuery)
            {
                parameterInfo.State = ReportParameterState.HasValidValue;
                parameterInfo.StoreLabels();
            }
            else
            {
                if (parameterInfo.DynamicDefaultValue || parameterInfo.DynamicValidValues || parameterInfo.DynamicPrompt)
                {
                    this.UpdateParametersContext(aParameters, this.m_lastDynamicParam, aParamIndex);
                    this.m_lastDynamicParam = aParamIndex;
                    parameterDef            = this.GetParameterDef(aParamIndex);
                    Global.Tracer.Assert(null != parameterDef, "null != paramDef, parameter {0}", parameterInfo.Name.MarkAsPrivate());
                    Global.Tracer.Assert(parameterInfo.DataType == parameterDef.DataType, "paramInfo.DataType == paramDef.DataType, parameter {0}", parameterInfo.Name.MarkAsPrivate());
                    this.AssertAreSameParameterByName(parameterInfo, parameterDef);
                }
                bool flag2 = this.m_dependenciesSubmitted.ContainsKey(parameterInfo.Name);
                if (parameterInfo.DynamicPrompt && (flag2 || !parameterInfo.IsUserSupplied || flag))
                {
                    this.SetupExprHost(parameterDef);
                    string text = this.EvaluatePromptExpr(parameterInfo, parameterDef);
                    if (text == null || text.Equals(string.Empty))
                    {
                        text = parameterInfo.Name;
                    }
                    parameterInfo.Prompt = text;
                }
                switch (parameterInfo.CalculateDependencyStatus())
                {
                case ReportParameterDependencyState.HasOutstandingDependencies:
                    parameterInfo.State  = ReportParameterState.HasOutstandingDependencies;
                    parameterInfo.Values = null;
                    if (parameterInfo.DynamicDefaultValue)
                    {
                        parameterInfo.DefaultValues = null;
                    }
                    if (parameterInfo.DynamicValidValues)
                    {
                        parameterInfo.ValidValues = null;
                    }
                    return;

                case ReportParameterDependencyState.MissingUpstreamDataSourcePrompt:
                    parameterInfo.MissingUpstreamDataSourcePrompt = true;
                    parameterInfo.State = ReportParameterState.DynamicValuesUnavailable;
                    return;

                default:
                    Global.Tracer.Assert(false, "Unexpected dependency state.");
                    break;

                case ReportParameterDependencyState.AllDependenciesSpecified:
                    break;
                }
                bool flag3 = parameterInfo.DynamicDefaultValue && (parameterInfo.Values == null || (parameterInfo.Values != null && !parameterInfo.IsUserSupplied)) && ((this.m_processingContext.SnapshotProcessing && parameterDef.HasDefaultValuesExpressions() && (flag || (parameterInfo.DependencyList != null && (parameterInfo.Values == null || (!parameterInfo.IsUserSupplied && flag2))))) || (!this.m_processingContext.SnapshotProcessing && (flag2 || parameterInfo.Values == null)));
                if (parameterInfo.DynamicValidValues && ((this.m_processingContext.SnapshotProcessing && parameterDef.HasValidValuesValueExpressions() && (parameterInfo.DependencyList != null || (flag && flag3))) || (!this.m_processingContext.SnapshotProcessing && ((parameterInfo.ValidValues != null && flag2) || parameterInfo.ValidValues == null))) && !this.ProcessValidValues(parameterInfo, parameterDef, flag3))
                {
                    parameterInfo.State = ReportParameterState.DynamicValuesUnavailable;
                }
                else if (!flag3 && parameterInfo.Values != null)
                {
                    if (parameterInfo.ValueIsValid())
                    {
                        parameterInfo.State = ReportParameterState.HasValidValue;
                        parameterInfo.StoreLabels();
                    }
                    else
                    {
                        parameterInfo.State  = ReportParameterState.InvalidValueProvided;
                        parameterInfo.Values = null;
                        parameterInfo.EnsureLabelsAreGenerated();
                    }
                }
                else
                {
                    parameterInfo.Values = null;
                    parameterInfo.State  = ReportParameterState.MissingValidValue;
                    if (flag3 && !this.ProcessDefaultValue(parameterInfo, parameterDef))
                    {
                        parameterInfo.State = ReportParameterState.DynamicValuesUnavailable;
                    }
                    else
                    {
                        if (parameterInfo.DefaultValues != null)
                        {
                            parameterInfo.Values = parameterInfo.DefaultValues;
                            if (!parameterInfo.ValueIsValid())
                            {
                                parameterInfo.Values = null;
                                parameterInfo.State  = ReportParameterState.DefaultValueInvalid;
                                parameterInfo.EnsureLabelsAreGenerated();
                            }
                            else
                            {
                                parameterInfo.State = ReportParameterState.HasValidValue;
                                parameterInfo.StoreLabels();
                            }
                        }
                        this.m_paramDataSetCache = null;
                    }
                }
            }
        }
 public bool ProcessDefaultValue(ParameterInfo parameter, IParameterDef paramDef)
 {
     if (parameter != null && paramDef != null)
     {
         object obj = null;
         if (paramDef.HasDefaultValuesExpressions())
         {
             int num = paramDef.DefaultValuesExpressionCount;
             Global.Tracer.Assert(0 != num, "(0 != count)");
             if (!paramDef.MultiValue)
             {
                 num = 1;
             }
             this.SetupExprHost(paramDef);
             ArrayList arrayList = new ArrayList(num);
             for (int i = 0; i < num; i++)
             {
                 obj = this.EvaluateDefaultValueExpr(paramDef, i);
                 if (obj is object[])
                 {
                     object[] array = obj as object[];
                     foreach (object o in array)
                     {
                         object obj2 = this.ConvertValue(o, paramDef, true);
                         if (!this.ValidateValue(obj2, paramDef, "DefaultValue"))
                         {
                             return(true);
                         }
                         arrayList.Add(obj2);
                     }
                     continue;
                 }
                 obj = this.ConvertValue(obj, paramDef, true);
                 if (!this.ValidateValue(obj, paramDef, "DefaultValue"))
                 {
                     return(true);
                 }
                 arrayList.Add(obj);
             }
             Global.Tracer.Assert(null != arrayList, "(null != defaultValues)");
             if (paramDef.MultiValue)
             {
                 parameter.DefaultValues = new object[arrayList.Count];
                 arrayList.CopyTo(parameter.DefaultValues);
             }
             else if (arrayList.Count > 0)
             {
                 parameter.DefaultValues    = new object[1];
                 parameter.DefaultValues[0] = arrayList[0];
             }
             else
             {
                 parameter.DefaultValues = new object[0];
             }
         }
         else if (paramDef.HasDefaultValuesDataSource() && this.m_processingContext.EnableDataBackedParameters)
         {
             IParameterDataSource defaultDataSource     = paramDef.DefaultDataSource;
             IParameterDataSource validValuesDataSource = paramDef.ValidValuesDataSource;
             List <object>        list = null;
             if (this.m_paramDataSetCache != null && validValuesDataSource != null && defaultDataSource.DataSourceIndex == validValuesDataSource.DataSourceIndex && defaultDataSource.DataSetIndex == validValuesDataSource.DataSetIndex)
             {
                 list = this.m_paramDataSetCache.DefaultValues;
             }
             else
             {
                 if (this.NeedPrompt(defaultDataSource))
                 {
                     parameter.MissingUpstreamDataSourcePrompt = true;
                     return(false);
                 }
                 ReportParameterDataSetCache reportParameterDataSetCache = this.ProcessReportParameterDataSet(parameter, paramDef, defaultDataSource, false, true);
                 list = reportParameterDataSetCache.DefaultValues;
                 if (Global.Tracer.TraceVerbose && (list == null || list.Count == 0))
                 {
                     Global.Tracer.Trace(TraceLevel.Verbose, "Parameter '{0}' default value list does not contain any values.", parameter.Name.MarkAsPrivate());
                 }
             }
             if (list != null)
             {
                 int count = list.Count;
                 parameter.DefaultValues = new object[count];
                 int num2 = 0;
                 while (num2 < count)
                 {
                     obj = list[num2];
                     if (this.ValidateValue(obj, paramDef, "DefaultValue"))
                     {
                         parameter.DefaultValues[num2] = obj;
                         num2++;
                         continue;
                     }
                     if (Global.Tracer.TraceVerbose)
                     {
                         Global.Tracer.Trace(TraceLevel.Verbose, "Parameter '{0}' has a default value '{1}' which is not a valid value.", parameter.Name.MarkAsPrivate(), obj.ToString().MarkAsPrivate());
                     }
                     parameter.DefaultValues = null;
                     return(true);
                 }
             }
         }
         return(true);
     }
     return(true);
 }