Exemplo n.º 1
0
 public void SetReportParameters(NameValueCollection allReportParameters, IParametersTranslator paramsTranslator)
 {
     if (allReportParameters != null)
     {
         string text = allReportParameters["rs:StoredParametersID"];
         if (text != null)
         {
             ExternalItemPath    externalItemPath    = default(ExternalItemPath);
             NameValueCollection nameValueCollection = default(NameValueCollection);
             paramsTranslator.GetParamsInstance(text, out externalItemPath, out nameValueCollection);
             if (nameValueCollection == null)
             {
                 throw new StoredParameterNotFoundException(text.MarkAsPrivate());
             }
             NameValueCollection nameValueCollection2 = new NameValueCollection();
             foreach (string item in nameValueCollection)
             {
                 string[] values = nameValueCollection.GetValues(item);
                 RSRequestParameters.TryToAddToCollection(item, values, "", true, nameValueCollection2);
             }
             this.m_reportParameters = nameValueCollection2;
             return;
         }
     }
     this.SetReportParameters(allReportParameters);
 }
Exemplo n.º 2
0
        public static NameValueCollection ExtractReportParameters(NameValueCollection allParametersCollection, ref bool[] whichParamsAreShared, out NameValueCollection otherParameters)
        {
            NameValueCollection nameValueCollection = new NameValueCollection();

            otherParameters = new NameValueCollection();
            List <bool> list = new List <bool>();

            for (int i = 0; i < allParametersCollection.Count; i++)
            {
                string   text  = allParametersCollection.GetKey(i);
                string[] array = allParametersCollection.GetValues(i);
                if (array != null && text != null)
                {
                    if (StringSupport.EndsWith(text, ":isnull", true, CultureInfo.InvariantCulture))
                    {
                        text = text.Substring(0, text.Length - ":isnull".Length);
                        string[] array2 = new string[1];
                        array = array2;
                    }
                    if (StringSupport.EndsWith(text, ":isnull", true, CultureInfo.InvariantCulture))
                    {
                        text = text.Substring(0, text.Length - ":isnull".Length);
                        string[] array3 = new string[1];
                        array = array3;
                    }
                    if (StringSupport.StartsWith(text, "rs:", true, CultureInfo.InvariantCulture) || StringSupport.StartsWith(text, "rc:", true, CultureInfo.InvariantCulture) || StringSupport.StartsWith(text, "dsu:", true, CultureInfo.InvariantCulture) || StringSupport.StartsWith(text, "dsp:", true, CultureInfo.InvariantCulture))
                    {
                        if (!RSRequestParameters.TryToAddToCollection(text, array, null, false, otherParameters))
                        {
                            throw new InternalCatalogException("expected to add parameter to collection" + text.MarkAsUserContent());
                        }
                    }
                    else
                    {
                        if (!RSRequestParameters.TryToAddToCollection(text, array, "", true, nameValueCollection))
                        {
                            throw new InternalCatalogException("expected to add parameter to collection" + text.MarkAsUserContent());
                        }
                        if (whichParamsAreShared != null && whichParamsAreShared.Length > 0)
                        {
                            list.Add(whichParamsAreShared[i]);
                        }
                    }
                }
            }
            if (whichParamsAreShared != null && whichParamsAreShared.Length > 0)
            {
                whichParamsAreShared = list.ToArray();
            }
            return(nameValueCollection);
        }
Exemplo n.º 3
0
        private static void ResolveServerParameters(IParametersTranslator paramsTranslator, NameValueCollection allParametersCollection, NameValueCollection rsParameters, NameValueCollection rcParameters, NameValueCollection dsuParameters, NameValueCollection dspParameters, NameValueCollection reportParameters, out Hashtable reverseLookup, out ExternalItemPath itemPath)
        {
            reverseLookup = new Hashtable();
            itemPath      = null;
            StringCollection stringCollection = new StringCollection();

            for (int i = 0; i < allParametersCollection.Count; i++)
            {
                string key = allParametersCollection.GetKey(i);
                if (key != null && StringComparer.OrdinalIgnoreCase.Compare(key, "rs:StoredParametersID") == 0)
                {
                    string text = allParametersCollection[i];
                    NameValueCollection nameValueCollection = default(NameValueCollection);
                    paramsTranslator.GetParamsInstance(text, out itemPath, out nameValueCollection);
                    if (nameValueCollection == null)
                    {
                        throw new StoredParameterNotFoundException(text.MarkAsPrivate());
                    }
                    reverseLookup.Add(new ReportParameterCollection(nameValueCollection), text);
                    stringCollection.Add(key);
                    foreach (string item in nameValueCollection)
                    {
                        string[] values = nameValueCollection.GetValues(item);
                        if (!RSRequestParameters.TryToAddToCollection(item, values, "rs:", false, rsParameters) && !RSRequestParameters.TryToAddToCollection(item, values, "rc:", false, rcParameters) && !RSRequestParameters.TryToAddToCollection(item, values, "dsu:", false, dsuParameters) && !RSRequestParameters.TryToAddToCollection(item, values, "dsp:", false, dspParameters))
                        {
                            RSRequestParameters.TryToAddToCollection(item, values, "", true, reportParameters);
                        }
                    }
                }
            }
            StringEnumerator enumerator2 = stringCollection.GetEnumerator();

            try
            {
                while (enumerator2.MoveNext())
                {
                    string current = enumerator2.Current;
                    allParametersCollection.Remove(current);
                }
            }
            finally
            {
                IDisposable disposable = enumerator2 as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Exemplo n.º 4
0
        private static void ParseQueryString(ExternalItemPath itemPath, IParametersTranslator paramsTranslator, NameValueCollection allParametersCollection, out NameValueCollection rsParameters, out NameValueCollection rcParameters, out NameValueCollection reportParameters, out DatasourceCredentialsCollection dsParameters, out Hashtable reverseLookup)
        {
            dsParameters     = null;
            reverseLookup    = null;
            rsParameters     = new NameValueCollection();
            rcParameters     = new NameValueCollection();
            reportParameters = new NameValueCollection();
            NameValueCollection nameValueCollection  = new NameValueCollection();
            NameValueCollection nameValueCollection2 = new NameValueCollection();
            ExternalItemPath    externalItemPath     = null;

            if (allParametersCollection != null)
            {
                RSRequestParameters.ResolveServerParameters(paramsTranslator, allParametersCollection, rsParameters, rcParameters, nameValueCollection, nameValueCollection2, reportParameters, out reverseLookup, out externalItemPath);
                if (externalItemPath != null && Localization.CatalogCultureCompare(itemPath.Value, externalItemPath.Value) != 0)
                {
                    rsParameters         = new NameValueCollection();
                    rcParameters         = new NameValueCollection();
                    nameValueCollection  = new NameValueCollection();
                    nameValueCollection2 = new NameValueCollection();
                    reportParameters     = new NameValueCollection();
                    reverseLookup        = null;
                    if (RSTrace.CatalogTrace.TraceInfo)
                    {
                        string message = string.Format(CultureInfo.InvariantCulture, "Requested item path '{0}' doesn't match stored parameters path '{1}'.", itemPath.Value.MarkAsPrivate(), externalItemPath.Value.MarkAsPrivate());
                        RSTrace.CatalogTrace.Trace(TraceLevel.Info, message);
                    }
                }
                for (int i = 0; i < allParametersCollection.Count; i++)
                {
                    string   text  = allParametersCollection.GetKey(i);
                    string[] array = allParametersCollection.GetValues(i);
                    if (array != null && text != null)
                    {
                        if (StringSupport.EndsWith(text, ":isnull", true, CultureInfo.InvariantCulture))
                        {
                            text = text.Substring(0, text.Length - ":isnull".Length);
                            string[] array2 = new string[1];
                            array = array2;
                        }
                        if (!RSRequestParameters.TryToAddToCollection(text, array, "rs:", false, rsParameters) && !RSRequestParameters.TryToAddToCollection(text, array, "rc:", false, rcParameters) && !RSRequestParameters.TryToAddToCollection(text, array, "dsu:", false, nameValueCollection) && !RSRequestParameters.TryToAddToCollection(text, array, "dsp:", false, nameValueCollection2))
                        {
                            RSRequestParameters.TryToAddToCollection(text, array, "", true, reportParameters);
                        }
                    }
                }
                dsParameters = new DatasourceCredentialsCollection(nameValueCollection, nameValueCollection2);
            }
        }