internal void NextRow(object aRow) { if (m_processValidValues) { IParameterDataSource validValuesDataSource = m_parameterDef.ValidValuesDataSource; object obj = null; object value = null; string output = null; bool flag = false; try { flag = false; obj = GetFieldValue(aRow, validValuesDataSource.ValueFieldIndex); if (validValuesDataSource.LabelFieldIndex >= 0) { flag = true; value = GetFieldValue(aRow, validValuesDataSource.LabelFieldIndex); } if (!Microsoft.ReportingServices.RdlExpressions.ReportRuntime.ProcessObjectToString(value, autocast: true, out output)) { m_paramProcessor.ProcessingContext.ErrorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Warning, ObjectType.ReportParameter, m_parameterDef.Name, "Label"); } m_paramProcessor.ConvertAndAddValidValue(m_parameter, m_parameterDef, obj, output); } catch (ReportProcessingException_FieldError aError) { int aFieldIndex = flag ? validValuesDataSource.LabelFieldIndex : validValuesDataSource.ValueFieldIndex; m_paramProcessor.ThrowExceptionForQueryBackedParameter(aError, m_parameterDef.Name, validValuesDataSource.DataSourceIndex, validValuesDataSource.DataSetIndex, aFieldIndex, "ValidValue"); } } if (!m_processDefaultValues) { return; } IParameterDataSource defaultDataSource = m_parameterDef.DefaultDataSource; try { if (m_parameterDef.MultiValue || m_defaultValues.Count == 0) { object fieldValue = GetFieldValue(aRow, defaultDataSource.ValueFieldIndex); fieldValue = m_paramProcessor.ConvertValue(fieldValue, m_parameterDef, isDefaultValue: true); m_defaultValues.Add(fieldValue); } } catch (ReportProcessingException_FieldError aError2) { m_paramProcessor.ThrowExceptionForQueryBackedParameter(aError2, m_parameterDef.Name, defaultDataSource.DataSourceIndex, defaultDataSource.DataSetIndex, defaultDataSource.ValueFieldIndex, "DefaultValue"); } }
public override bool NeedPrompt(IParameterDataSource paramDS) { bool result = false; AspNetCore.ReportingServices.ReportProcessing.DataSource dataSource = this.m_report.DataSources[paramDS.DataSourceIndex]; if (this.GetLegacyContext().DataSourceInfos != null) { DataSourceInfo byID = this.GetLegacyContext().DataSourceInfos.GetByID(dataSource.ID); if (byID != null) { result = byID.NeedPrompt; } } return(result); }
internal override bool NeedPrompt(IParameterDataSource paramDS) { bool result = false; Microsoft.ReportingServices.ReportIntermediateFormat.DataSource dataSource = m_report.DataSources[paramDS.DataSourceIndex]; if (GetOnDemandContext().DataSourceInfos != null) { DataSourceInfo byID = GetOnDemandContext().DataSourceInfos.GetByID(dataSource.ID); if (byID != null) { result = byID.NeedPrompt; } } return(result); }
public void NextRow(object aRow) { if (this.m_processValidValues) { IParameterDataSource validValuesDataSource = this.m_parameterDef.ValidValuesDataSource; object obj = null; object value = null; string label = null; bool flag = false; try { flag = false; obj = this.GetFieldValue(aRow, validValuesDataSource.ValueFieldIndex); if (validValuesDataSource.LabelFieldIndex >= 0) { flag = true; value = this.GetFieldValue(aRow, validValuesDataSource.LabelFieldIndex); } if (!AspNetCore.ReportingServices.RdlExpressions.ReportRuntime.ProcessObjectToString(value, true, out label)) { this.m_paramProcessor.ProcessingContext.ErrorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Warning, ObjectType.ReportParameter, this.m_parameterDef.Name, "Label"); } this.m_paramProcessor.ConvertAndAddValidValue(this.m_parameter, this.m_parameterDef, obj, label); } catch (ReportProcessingException_FieldError aError) { int aFieldIndex = flag ? validValuesDataSource.LabelFieldIndex : validValuesDataSource.ValueFieldIndex; this.m_paramProcessor.ThrowExceptionForQueryBackedParameter(aError, this.m_parameterDef.Name, validValuesDataSource.DataSourceIndex, validValuesDataSource.DataSetIndex, aFieldIndex, "ValidValue"); } } if (this.m_processDefaultValues) { IParameterDataSource defaultDataSource = this.m_parameterDef.DefaultDataSource; try { if (this.m_parameterDef.MultiValue || this.m_defaultValues.Count == 0) { object fieldValue = this.GetFieldValue(aRow, defaultDataSource.ValueFieldIndex); fieldValue = this.m_paramProcessor.ConvertValue(fieldValue, this.m_parameterDef, true); this.m_defaultValues.Add(fieldValue); } } catch (ReportProcessingException_FieldError aError2) { this.m_paramProcessor.ThrowExceptionForQueryBackedParameter(aError2, this.m_parameterDef.Name, defaultDataSource.DataSourceIndex, defaultDataSource.DataSetIndex, defaultDataSource.ValueFieldIndex, "DefaultValue"); } } }
/// <summary> /// Return an IEnumerable providing data for use with the /// supplied parameter. /// </summary> /// <param name="parameter">A ParameterInfo representing one /// argument to a parameterized test</param> /// <returns> /// An IEnumerable providing the required data /// </returns> public IEnumerable GetDataFor(ParameterInfo parameter) { ObjectList data = new ObjectList(); foreach (Attribute attr in parameter.GetCustomAttributes(typeof(DataAttribute), false)) { IParameterDataSource source = attr as IParameterDataSource; if (source != null) { foreach (object item in source.GetData(parameter)) { data.Add(item); } } } return(data); }
public IEnumerable GetDataFor(ParameterInfo parameter) { ObjectList objectList = new ObjectList(); object[] customAttributes = parameter.GetCustomAttributes(typeof(DataAttribute), inherit: false); for (int i = 0; i < customAttributes.Length; i++) { Attribute attribute = (Attribute)customAttributes[i]; IParameterDataSource parameterDataSource = attribute as IParameterDataSource; if (parameterDataSource == null) { continue; } foreach (object datum in parameterDataSource.GetData(parameter)) { objectList.Add(datum); } } return(objectList); }
public override ReportParameterDataSetCache ProcessReportParameterDataSet(ParameterInfo aParam, IParameterDef aParamDef, IParameterDataSource paramDS, bool aRetrieveValidValues, bool aRetrievalDefaultValues) { EventHandler eventHandler = null; LegacyReportParameterDataSetCache legacyReportParameterDataSetCache = new LegacyReportParameterDataSetCache(this, aParam, (ParameterDef)aParamDef, aRetrieveValidValues, aRetrievalDefaultValues); AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportProcessingContext legacyContext = this.GetLegacyContext(); try { this.m_runtimeDataSourceNode = new AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportRuntimeDataSourceNode(this.m_report, this.m_report.DataSources[paramDS.DataSourceIndex], paramDS.DataSetIndex, legacyContext, legacyReportParameterDataSetCache); eventHandler = this.AbortHandler; legacyContext.AbortInfo.ProcessingAbortEvent += eventHandler; if (Global.Tracer.TraceVerbose) { Global.Tracer.Trace(TraceLevel.Verbose, "Abort handler registered."); } this.m_runtimeDataSourceNode.InitProcessingParams(false, true); this.m_runtimeDataSourceNode.ProcessConcurrent(null); legacyContext.CheckAndThrowIfAborted(); AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.RuntimeDataSetNode runtimeDataSetNode = this.m_runtimeDataSourceNode.RuntimeDataSetNodes[0]; return(legacyReportParameterDataSetCache); } finally { if (eventHandler != null) { legacyContext.AbortInfo.ProcessingAbortEvent -= eventHandler; } if (this.m_runtimeDataSourceNode != null) { this.m_runtimeDataSourceNode.Cleanup(); } } }
public RandomDataConverter(IParameterDataSource source) { _source = source; }
public bool ProcessValidValues(ParameterInfo parameter, IParameterDef paramDef, bool aEvaluateDefaultValues) { if (parameter != null && paramDef != null) { IParameterDataSource validValuesDataSource = paramDef.ValidValuesDataSource; if (paramDef.HasValidValuesDataSource()) { if (this.m_processingContext.EnableDataBackedParameters) { if (this.NeedPrompt(validValuesDataSource)) { parameter.MissingUpstreamDataSourcePrompt = true; return(false); } IParameterDataSource defaultDataSource = paramDef.DefaultDataSource; bool aRetrievalDefaultValues = aEvaluateDefaultValues && defaultDataSource != null && defaultDataSource.DataSourceIndex == validValuesDataSource.DataSourceIndex && defaultDataSource.DataSetIndex == validValuesDataSource.DataSetIndex; this.m_paramDataSetCache = this.ProcessReportParameterDataSet(parameter, paramDef, validValuesDataSource, 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(0 != validValuesValueExpressionCount, "(0 != count)"); Global.Tracer.Assert(paramDef.HasValidValuesLabelExpressions() && validValuesValueExpressionCount == paramDef.ValidValuesLabelExpressionCount); this.SetupExprHost(paramDef); parameter.ValidValues = new ValidValueList(validValuesValueExpressionCount); for (int i = 0; i < validValuesValueExpressionCount; i++) { object obj = this.EvaluateValidValueExpr(paramDef, i); object obj2 = this.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) { this.m_processingContext.ErrorContext.Register(ProcessingErrorCode.rsInvalidValidValueList, Severity.Error, ObjectType.ReportParameter, paramDef.Name, "ValidValues"); throw new ReportProcessingException(this.m_processingContext.ErrorContext.Messages); } int num = array.Length; for (int j = 0; j < num; j++) { obj2 = ((array2 == null) ? null : array2[j]); this.ConvertAndAddValidValue(parameter, paramDef, array[j], obj2); } continue; } if (!flag && (!flag2 || obj2 == null)) { this.ConvertAndAddValidValue(parameter, paramDef, obj, obj2); continue; } this.m_processingContext.ErrorContext.Register(ProcessingErrorCode.rsInvalidValidValueList, Severity.Error, ObjectType.ReportParameter, paramDef.Name, "ValidValues"); throw new ReportProcessingException(this.m_processingContext.ErrorContext.Messages); } } return(true); } return(true); }
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); }
public abstract ReportParameterDataSetCache ProcessReportParameterDataSet(ParameterInfo aParam, IParameterDef aParamDef, IParameterDataSource paramDS, bool aRetrieveValidValues, bool aRetrievalDefaultValues);
public RandomDataConverter(RandomDataSource source) : base(source.DataType) { _source = source; }
public override ReportParameterDataSetCache ProcessReportParameterDataSet(ParameterInfo aParam, IParameterDef aParamDef, IParameterDataSource paramDS, bool aRetrieveValidValues, bool aRetrievalDefaultValues) { ReportParameterDataSetCache reportParameterDataSetCache = new OnDemandReportParameterDataSetCache(this, aParam, (AspNetCore.ReportingServices.ReportIntermediateFormat.ParameterDef)aParamDef, aRetrieveValidValues, aRetrievalDefaultValues); RetrievalManager retrievalManager = new RetrievalManager(this.m_report, this.GetOnDemandContext()); retrievalManager.FetchParameterData(reportParameterDataSetCache, paramDS.DataSourceIndex, paramDS.DataSetIndex); return(reportParameterDataSetCache); }
internal override ReportParameterDataSetCache ProcessReportParameterDataSet(ParameterInfo aParam, IParameterDef aParamDef, IParameterDataSource paramDS, bool aRetrieveValidValues, bool aRetrievalDefaultValues) { throw new NotSupportedException(); }
public abstract bool NeedPrompt(IParameterDataSource paramDS);
internal override bool NeedPrompt(IParameterDataSource paramDS) { return(false); }
internal abstract bool NeedPrompt(IParameterDataSource paramDS);