示例#1
0
 internal RuntimeDataSourceParameters(Microsoft.ReportingServices.ReportIntermediateFormat.Report report, Microsoft.ReportingServices.ReportIntermediateFormat.DataSource dataSource, OnDemandProcessingContext processingContext, int parameterDataSetIndex, ReportParameterDataSetCache aCache)
     : base(report, dataSource, processingContext, mergeTransactions: false)
 {
     Global.Tracer.Assert(parameterDataSetIndex != -1, "Parameter DataSet index must be specified when processing parameters");
     m_parameterDataSetIndex = parameterDataSetIndex;
     m_paramDataCache        = aCache;
 }
        internal void FetchParameterData(ReportParameterDataSetCache aCache, int aDataSourceIndex, int aDataSetIndex)
        {
            RuntimeDataSourceParameters item = new RuntimeDataSourceParameters(m_report, m_report.DataSources[aDataSourceIndex], m_odpContext, aDataSetIndex, aCache);

            m_runtimeDataSources.Add(item);
            FetchData();
        }
        private void ProcessParameter(ParameterInfoCollection aParameters, int aParamIndex)
        {
            ParameterInfo parameterInfo = aParameters[aParamIndex];

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

            if (m_processingContext.SnapshotProcessing && parameterInfo.UsedInQuery)
            {
                parameterInfo.State = ReportParameterState.HasValidValue;
                parameterInfo.StoreLabels();
                return;
            }
            if (parameterInfo.DynamicDefaultValue || parameterInfo.DynamicValidValues || parameterInfo.DynamicPrompt)
            {
                UpdateParametersContext(aParameters, m_lastDynamicParam, aParamIndex);
                m_lastDynamicParam = aParamIndex;
                parameterDef       = GetParameterDef(aParamIndex);
                Global.Tracer.Assert(parameterDef != null, "null != paramDef, parameter {0}", parameterInfo.Name.MarkAsPrivate());
                Global.Tracer.Assert(parameterInfo.DataType == parameterDef.DataType, "paramInfo.DataType == paramDef.DataType, parameter {0}", parameterInfo.Name.MarkAsPrivate());
                AssertAreSameParameterByName(parameterInfo, parameterDef);
            }
            bool flag2 = m_dependenciesSubmitted.ContainsKey(parameterInfo.Name);

            if (parameterInfo.DynamicPrompt && (flag2 || !parameterInfo.IsUserSupplied || flag))
            {
                SetupExprHost(parameterDef);
                string text = 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(condition: false, "Unexpected dependency state.");
                break;

            case ReportParameterDependencyState.AllDependenciesSpecified:
                break;
            }
            bool flag3 = parameterInfo.DynamicDefaultValue && (parameterInfo.Values == null || (parameterInfo.Values != null && !parameterInfo.IsUserSupplied)) && ((m_processingContext.SnapshotProcessing && parameterDef.HasDefaultValuesExpressions() && (flag || (parameterInfo.DependencyList != null && (parameterInfo.Values == null || (!parameterInfo.IsUserSupplied && flag2))))) || (!m_processingContext.SnapshotProcessing && (flag2 || parameterInfo.Values == null)));

            if (parameterInfo.DynamicValidValues && ((m_processingContext.SnapshotProcessing && parameterDef.HasValidValuesValueExpressions() && (parameterInfo.DependencyList != null || (flag && flag3))) || (!m_processingContext.SnapshotProcessing && ((parameterInfo.ValidValues != null && flag2) || parameterInfo.ValidValues == null))) && !ProcessValidValues(parameterInfo, parameterDef, flag3))
            {
                parameterInfo.State = ReportParameterState.DynamicValuesUnavailable;
                return;
            }
            if (!flag3 && parameterInfo.Values != null)
            {
                if (parameterInfo.ValueIsValid())
                {
                    parameterInfo.State = ReportParameterState.HasValidValue;
                    parameterInfo.StoreLabels();
                }
                else
                {
                    parameterInfo.State  = ReportParameterState.InvalidValueProvided;
                    parameterInfo.Values = null;
                    parameterInfo.EnsureLabelsAreGenerated();
                }
                return;
            }
            parameterInfo.Values = null;
            parameterInfo.State  = ReportParameterState.MissingValidValue;
            if (flag3 && !ProcessDefaultValue(parameterInfo, parameterDef))
            {
                parameterInfo.State = ReportParameterState.DynamicValuesUnavailable;
                return;
            }
            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();
                }
            }
            m_paramDataSetCache = null;
        }
        internal bool ProcessValidValues(ParameterInfo parameter, IParameterDef paramDef, bool aEvaluateDefaultValues)
        {
            if (parameter == null || paramDef == null)
            {
                return(true);
            }
            IParameterDataSource validValuesDataSource = paramDef.ValidValuesDataSource;

            if (paramDef.HasValidValuesDataSource())
            {
                if (m_processingContext.EnableDataBackedParameters)
                {
                    if (NeedPrompt(validValuesDataSource))
                    {
                        parameter.MissingUpstreamDataSourcePrompt = true;
                        return(false);
                    }
                    IParameterDataSource defaultDataSource = paramDef.DefaultDataSource;
                    bool aRetrievalDefaultValues           = aEvaluateDefaultValues && defaultDataSource != null && defaultDataSource.DataSourceIndex == validValuesDataSource.DataSourceIndex && defaultDataSource.DataSetIndex == validValuesDataSource.DataSetIndex;
                    m_paramDataSetCache = ProcessReportParameterDataSet(parameter, paramDef, validValuesDataSource, aRetrieveValidValues: true, aRetrievalDefaultValues);
                    if (Global.Tracer.TraceVerbose && parameter.ValidValues != null && parameter.ValidValues.Count == 0)
                    {
                        Global.Tracer.Trace(TraceLevel.Verbose, "Parameter '{0}' dynamic valid value list does not contain any values.", parameter.Name.MarkAsPrivate());
                    }
                }
            }
            else if (paramDef.HasValidValuesValueExpressions())
            {
                int validValuesValueExpressionCount = paramDef.ValidValuesValueExpressionCount;
                Global.Tracer.Assert(validValuesValueExpressionCount != 0, "(0 != count)");
                Global.Tracer.Assert(paramDef.HasValidValuesLabelExpressions() && validValuesValueExpressionCount == paramDef.ValidValuesLabelExpressionCount);
                SetupExprHost(paramDef);
                parameter.ValidValues = new ValidValueList(validValuesValueExpressionCount);
                for (int i = 0; i < validValuesValueExpressionCount; i++)
                {
                    object obj   = EvaluateValidValueExpr(paramDef, i);
                    object obj2  = EvaluateValidValueLabelExpr(paramDef, i);
                    bool   flag  = obj is object[];
                    bool   flag2 = obj2 is object[];
                    if (flag && (flag2 || obj2 == null))
                    {
                        object[] array  = obj as object[];
                        object[] array2 = obj2 as object[];
                        if (array2 != null && array.Length != array2.Length)
                        {
                            m_processingContext.ErrorContext.Register(ProcessingErrorCode.rsInvalidValidValueList, Severity.Error, ObjectType.ReportParameter, paramDef.Name, "ValidValues");
                            throw new ReportProcessingException(m_processingContext.ErrorContext.Messages);
                        }
                        int num = array.Length;
                        for (int j = 0; j < num; j++)
                        {
                            obj2 = ((array2 == null) ? null : array2[j]);
                            ConvertAndAddValidValue(parameter, paramDef, array[j], obj2);
                        }
                    }
                    else
                    {
                        if (flag || (flag2 && obj2 != null))
                        {
                            m_processingContext.ErrorContext.Register(ProcessingErrorCode.rsInvalidValidValueList, Severity.Error, ObjectType.ReportParameter, paramDef.Name, "ValidValues");
                            throw new ReportProcessingException(m_processingContext.ErrorContext.Messages);
                        }
                        ConvertAndAddValidValue(parameter, paramDef, obj, obj2);
                    }
                }
            }
            return(true);
        }
 public RuntimeParameterDataSet(Microsoft.ReportingServices.ReportIntermediateFormat.DataSource dataSource, Microsoft.ReportingServices.ReportIntermediateFormat.DataSet dataSet, DataSetInstance dataSetInstance, OnDemandProcessingContext processingContext, bool mustEvaluateThroughReportObjectModel, ReportParameterDataSetCache aCache)
     : base(dataSource, dataSet, dataSetInstance, processingContext, processRetrievedData: true)
 {
     m_parameterDataSetObj = aCache;
     m_mustEvaluateThroughReportObjectModel = mustEvaluateThroughReportObjectModel;
 }