コード例 #1
0
        private void GetRowsAndColumnsToRender(out bool[] rowsToRender, out bool[] columnsToRender)
        {
            ReportParameterInfoCollection paramInfos           = m_paramInfos;
            GridLayoutDefinition          gridLayoutDefinition = m_paramLayout.GridLayoutDefinition;
            ParameterControlCollection    paramControls        = m_paramControls;
            int num  = -1;
            int num2 = -1;
            Dictionary <string, GridLayoutCellDefinition> dictionary = new Dictionary <string, GridLayoutCellDefinition>();

            bool?[] array  = new bool?[gridLayoutDefinition.NumberOfRows];
            bool?[] array2 = new bool?[gridLayoutDefinition.NumberOfColumns];
            rowsToRender    = new bool[gridLayoutDefinition.NumberOfRows];
            columnsToRender = new bool[gridLayoutDefinition.NumberOfColumns];
            foreach (GridLayoutCellDefinition cellDefinition in gridLayoutDefinition.CellDefinitions)
            {
                dictionary.Add(cellDefinition.ParameterName, cellDefinition);
            }
            foreach (ReportParameterInfo item in paramInfos)
            {
                GridLayoutCellDefinition gridLayoutCellDefinition = dictionary[item.Name];
                if (paramControls.ContainsKey(item.Name))
                {
                    array[gridLayoutCellDefinition.Row]     = false;
                    array2[gridLayoutCellDefinition.Column] = false;
                    num  = Math.Max(gridLayoutCellDefinition.Row, num);
                    num2 = Math.Max(gridLayoutCellDefinition.Column, num2);
                    continue;
                }
                if (!array[gridLayoutCellDefinition.Row].HasValue)
                {
                    array[gridLayoutCellDefinition.Row] = true;
                }
                if (!array2[gridLayoutCellDefinition.Column].HasValue)
                {
                    array2[gridLayoutCellDefinition.Column] = true;
                }
            }
            for (int i = 0; i < gridLayoutDefinition.NumberOfRows; i++)
            {
                if (i > num)
                {
                    rowsToRender[i] = false;
                }
                else
                {
                    rowsToRender[i] = (array[i] != true);
                }
            }
            for (int j = 0; j < gridLayoutDefinition.NumberOfColumns; j++)
            {
                if (j > num2)
                {
                    columnsToRender[j] = false;
                }
                else
                {
                    columnsToRender[j] = (array2[j] != true);
                }
            }
        }
コード例 #2
0
        internal void SetDependencies(ReportParameterInfoCollection coll)
        {
            if (m_dependencyCollection != null)
            {
                return;
            }
            if (m_dependencies == null)
            {
                m_dependencyCollection = new ReportParameterInfoCollection();
                return;
            }
            List <ReportParameterInfo> list = new List <ReportParameterInfo>();

            string[] dependencies = m_dependencies;
            foreach (string name in dependencies)
            {
                ReportParameterInfo reportParameterInfo = coll[name];
                if (reportParameterInfo != null)
                {
                    list.Add(reportParameterInfo);
                    reportParameterInfo.m_dependentsCollectionConstruction.Add(this);
                }
            }
            m_dependencyCollection = new ReportParameterInfoCollection(list);
        }
コード例 #3
0
        private void SetInial(string strWinTitle, string strReportName)
        {
            this.Text     = strWinTitle;
            this.Rept_Key = strReportName;
            string strFilePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\SysRpt\\" + strReportName + ".rdlc";

            if (!File.Exists(strFilePath))
            {
                throw new Exception("不存在报表文件:" + strReportName);
            }
            reportViewer1.ProcessingMode                   = Microsoft.Reporting.WinForms.ProcessingMode.Local;
            reportViewer1.LocalReport.DisplayName          = strWinTitle;
            reportViewer1.LocalReport.ReportPath           = strFilePath;
            reportViewer1.LocalReport.EnableExternalImages = true;
            reportViewer1.LocalReport.EnableHyperlinks     = true;

            Microsoft.Reporting.WinForms.ReportParameterInfoCollection RParameter = this.reportViewer1.LocalReport.GetParameters();
            for (int r = 0; r < RParameter.Count; r++)
            {
                if (RParameter[r].Name == "strUser")
                {
                    this.AddRpParameterItem(RParameter[r].Name, CApplication.App.CurrentSession.UserId.ToString());
                }
                else if (RParameter[r].Name == "strDept")
                {
                    this.AddRpParameterItem(RParameter[r].Name, CApplication.App.CurrentSession.DeptId.ToString());
                }
                else if (RParameter[r].Name == "strFy")
                {
                    this.AddRpParameterItem(RParameter[r].Name, CApplication.App.CurrentSession.FyId.ToString());
                }
            }
        }
コード例 #4
0
 internal override ParametersPaneLayout GetParametersPaneLayout()
 {
     lock (m_syncObject)
     {
         EnsureExecutionSession();
         if (m_processingHost.ExecutionInfo.ReportParameters != null && m_processingHost.ExecutionInfo.ReportParameters.ParametersLayout != null)
         {
             ReportParameterInfoCollection paramsInfo = ParameterInfoCollectionToApi(m_processingHost.ExecutionInfo.ReportParameters, SupportsQueries);
             return(BuildParameterPaneLayout(m_processingHost.ExecutionInfo.ReportParameters.ParametersLayout, paramsInfo));
         }
         return(null);
     }
 }
コード例 #5
0
 public override ReportParameterInfoCollection GetParameters()
 {
     lock (m_syncObject)
     {
         EnsureExecutionSession();
         ReportParameterInfoCollection parameters = m_executionInfo.Parameters;
         if (parameters != null)
         {
             for (int i = 0; i < parameters.Count; i++)
             {
                 parameters[i].Visible = !m_hiddenParameters.Contains(i);
             }
         }
         return(parameters);
     }
 }
コード例 #6
0
        private void CreateParameterPrompts(ReportParameterInfoCollection parameterInfos)
        {
            ReportParameterInfoCollection reportParameterInfoCollection = parameterInfos;

            if (reportParameterInfoCollection == null)
            {
                reportParameterInfoCollection = Report.GetParameters();
            }
            ParametersPaneLayout parametersPaneLayout = Report.GetParametersPaneLayout();
            bool isQueryExecutionAllowed = true;

            if (ViewerControl.ProcessingMode == ProcessingMode.Remote)
            {
                isQueryExecutionAllowed = ViewerControl.ServerReport.IsQueryExecutionAllowed();
            }
            m_paramControls.Populate(reportParameterInfoCollection, isQueryExecutionAllowed, toolTipForParams, Font, parametersPaneLayout);
        }
コード例 #7
0
 private void EnsureParamsLoaded(bool forceCredentialsShown, ReportParameterInfoCollection parameterInfos)
 {
     try
     {
         promptPanel.SuspendLayout();
         Clear();
         ReportDataSourceInfoCollection dataSources = GetDataSources(out m_allCredentialsSatisfied);
         if (!m_allCredentialsSatisfied || forceCredentialsShown)
         {
             if (ViewerControl.ShowCredentialPrompts)
             {
                 AddDataSourcePrompts(dataSources);
                 return;
             }
             throw new MissingDataSourceCredentialsException();
         }
         CreateParameterPrompts(parameterInfos);
         if (ViewerControl.ShowParameterPrompts)
         {
             AddParameterPrompts();
             if (!m_paramControls.VisibleParameterNeedsValue && m_paramControls.HiddenParameterThatNeedsValue != null)
             {
                 throw new MissingParameterException(m_paramControls.HiddenParameterThatNeedsValue);
             }
         }
         else
         {
             ValidateReportInputsSatisfied();
         }
         SetCredentialLinkVisibility(dataSources.Count > 0 && ViewerControl.ShowCredentialPrompts);
     }
     finally
     {
         SetViewReportPosition();
         try
         {
             m_paramInfos  = Report.GetParameters();
             m_paramLayout = Report.GetParametersPaneLayout();
         }
         catch (Exception)
         {
         }
         promptPanel.ResumeLayout();
         promptPanel.AutoScroll = true;
     }
 }
コード例 #8
0
        public void Populate(ReportParameterInfoCollection reportParameters, bool isQueryExecutionAllowed, ToolTip tooltip, Font font, ParametersPaneLayout layout = null)
        {
            GridLayoutCellDefinitionCollection gridLayoutCellDefinitionCollection = null;

            Clear();
            m_hiddenParameterThatNeedsValue = null;
            m_anyParameterThatNeedsValue    = null;
            m_visibleParameterNeedsValue    = false;
            HasLayout = (layout != null);
            if (HasLayout)
            {
                NumberOfCols = layout.GridLayoutDefinition.NumberOfColumns;
                NumberOfRows = layout.GridLayoutDefinition.NumberOfRows;
                gridLayoutCellDefinitionCollection = layout.GridLayoutDefinition.CellDefinitions;
            }
            foreach (ReportParameterInfo reportParameter in reportParameters)
            {
                if (!ShouldDisplayParameter(reportParameter))
                {
                    if (reportParameter.State != 0 && m_hiddenParameterThatNeedsValue == null)
                    {
                        m_hiddenParameterThatNeedsValue = reportParameter.Name;
                    }
                }
                else
                {
                    GridLayoutCellDefinition cellDefinition = null;
                    if (HasLayout)
                    {
                        cellDefinition = gridLayoutCellDefinitionCollection.GetByName(reportParameter.Name);
                    }
                    ParameterControl value = ParameterControl.Create(reportParameter, tooltip, font, isQueryExecutionAllowed, cellDefinition);
                    Add(reportParameter.Name, value);
                    if (reportParameter.State != 0)
                    {
                        m_visibleParameterNeedsValue = true;
                    }
                }
                if (reportParameter.State != 0 && m_anyParameterThatNeedsValue == null)
                {
                    m_anyParameterThatNeedsValue = reportParameter.Name;
                }
            }
        }
コード例 #9
0
 private void OnDependencyChanged(object sender, EventArgs e)
 {
     try
     {
         SaveControlValuesToReport(autoSubmit: true);
         ParameterControl parameterControl = (ParameterControl)sender;
         ReportParameterInfoCollection reportParameterInfoCollection = ViewerControl.Report.GetParameters();
         if (reportParameterInfoCollection[parameterControl.ParameterInfo.Name].HasUnsatisfiedDownstreamParametersWithDefaults)
         {
             ViewerControl.Report.SetParameters(new ReportParameter[0]);
             reportParameterInfoCollection = null;
         }
         EnsureParamsLoaded(forceCredentialsShown: false, reportParameterInfoCollection);
     }
     catch (Exception e2)
     {
         ViewerControl.UpdateUIState(e2);
     }
 }
コード例 #10
0
 public ExecutionInfo(string executionId, string historyId, string reportPath, int numPages, bool hasDocumentMap, int autoRefreshInterval, bool credentialsRequired, bool parametersRequired, bool hasSnapshot, bool needsProcessing, DateTime expirationDateTime, bool allowQueryExecution, PageCountMode pageCountMode, ReportDataSourceInfoCollection dataSourcePrompts, ReportParameterInfoCollection parameters, ReportPageSettings pageSettings, ParametersPaneLayout parametersPaneLayout)
 {
     ExecutionID          = executionId;
     HistoryID            = historyId;
     ReportPath           = reportPath;
     NumPages             = numPages;
     HasDocumentMap       = hasDocumentMap;
     AutoRefreshInterval  = autoRefreshInterval;
     CredentialsRequired  = credentialsRequired;
     ParametersRequired   = parametersRequired;
     HasSnapshot          = hasSnapshot;
     NeedsProcessing      = needsProcessing;
     ExpirationDateTime   = expirationDateTime;
     AllowQueryExecution  = allowQueryExecution;
     PageCountMode        = pageCountMode;
     DataSourcePrompts    = dataSourcePrompts;
     Parameters           = parameters;
     ReportPageSettings   = pageSettings;
     ParametersPaneLayout = parametersPaneLayout;
 }
コード例 #11
0
        private static ExecutionInfo FromSoapExecutionInfo(Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.ExecutionInfo soapExecutionInfo)
        {
            if (soapExecutionInfo == null)
            {
                return(null);
            }
            ReportParameterInfoCollection reportParameterInfoCollection = null;

            Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.ReportParameter[] parameters = soapExecutionInfo.Parameters;
            if (parameters != null)
            {
                ReportParameterInfo[] array = new ReportParameterInfo[parameters.Length];
                for (int i = 0; i < parameters.Length; i++)
                {
                    array[i] = SoapParameterToReportParameterInfo(parameters[i]);
                }
                reportParameterInfoCollection = new ReportParameterInfoCollection(array);
            }
            else
            {
                reportParameterInfoCollection = new ReportParameterInfoCollection();
            }
            PageCountMode  pageCountMode = PageCountMode.Actual;
            ExecutionInfo2 executionInfo = soapExecutionInfo as ExecutionInfo2;

            if (executionInfo != null && executionInfo.PageCountMode == Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.PageCountMode.Estimate)
            {
                pageCountMode = PageCountMode.Estimate;
            }
            ParametersPaneLayout parametersPaneLayout = null;
            ExecutionInfo3       executionInfo2       = soapExecutionInfo as ExecutionInfo3;

            if (executionInfo2 != null && executionInfo2.ParametersLayout != null && parameters != null)
            {
                parametersPaneLayout = new ParametersPaneLayout();
                SoapExecutionInfoToParametersLayout(parametersPaneLayout, executionInfo2, reportParameterInfoCollection);
            }
            ReportPageSettings pageSettings = new ReportPageSettings(soapExecutionInfo.ReportPageSettings.PaperSize.Height, soapExecutionInfo.ReportPageSettings.PaperSize.Width, soapExecutionInfo.ReportPageSettings.Margins.Left, soapExecutionInfo.ReportPageSettings.Margins.Right, soapExecutionInfo.ReportPageSettings.Margins.Top, soapExecutionInfo.ReportPageSettings.Margins.Bottom);

            return(new ExecutionInfo(soapExecutionInfo.ExecutionID, soapExecutionInfo.HistoryID, soapExecutionInfo.ReportPath, soapExecutionInfo.NumPages, soapExecutionInfo.HasDocumentMap, soapExecutionInfo.AutoRefreshInterval, soapExecutionInfo.CredentialsRequired, soapExecutionInfo.ParametersRequired, soapExecutionInfo.HasSnapshot, soapExecutionInfo.NeedsProcessing, soapExecutionInfo.ExpirationDateTime, soapExecutionInfo.AllowQueryExecution, pageCountMode, ReportDataSourceInfoCollection.FromSoapDataSourcePrompts(soapExecutionInfo.DataSourcePrompts), reportParameterInfoCollection, pageSettings, parametersPaneLayout));
        }
コード例 #12
0
        private ParametersPaneLayout BuildParameterPaneLayout(ParametersGridLayout processingParameterLayout, ReportParameterInfoCollection paramsInfo)
        {
            List <GridLayoutCellDefinition> list = new List <GridLayoutCellDefinition>(processingParameterLayout.CellDefinitions.Count);

            foreach (ParameterGridLayoutCellDefinition cellDefinition in processingParameterLayout.CellDefinitions)
            {
                list.Add(new GridLayoutCellDefinition
                {
                    Column        = cellDefinition.ColumnIndex,
                    Row           = cellDefinition.RowIndex,
                    ParameterName = cellDefinition.ParameterName
                });
            }
            return(new ParametersPaneLayout
            {
                GridLayoutDefinition = new GridLayoutDefinition(new GridLayoutCellDefinitionCollection(list), processingParameterLayout.NumberOfRows, processingParameterLayout.NumberOfColumns, paramsInfo)
            });
        }
コード例 #13
0
 private static void SoapExecutionInfoToParametersLayout(ParametersPaneLayout paramPaneLayout, ExecutionInfo3 soapExecInfo3, ReportParameterInfoCollection paramInfoCollection)
 {
     if (soapExecInfo3.ParametersLayout.CellDefinitions != null)
     {
         int num = soapExecInfo3.ParametersLayout.CellDefinitions.Length;
         GridLayoutCellDefinition[] array = new GridLayoutCellDefinition[num];
         for (int i = 0; i < num; i++)
         {
             GridLayoutCellDefinition gridLayoutCellDefinition = new GridLayoutCellDefinition();
             gridLayoutCellDefinition.Column        = soapExecInfo3.ParametersLayout.CellDefinitions[i].ColumnsIndex;
             gridLayoutCellDefinition.Row           = soapExecInfo3.ParametersLayout.CellDefinitions[i].RowIndex;
             gridLayoutCellDefinition.ParameterName = soapExecInfo3.ParametersLayout.CellDefinitions[i].ParameterName;
             array[i] = gridLayoutCellDefinition;
         }
         GridLayoutDefinition gridLayoutDefinition = paramPaneLayout.GridLayoutDefinition = new GridLayoutDefinition(new GridLayoutCellDefinitionCollection(array), soapExecInfo3.ParametersLayout.NumberOfRows, soapExecInfo3.ParametersLayout.NumberOfColumns, paramInfoCollection);
     }
 }
コード例 #14
0
 internal SubreportProcessingEventArgs(string subreportName, ReportParameterInfoCollection paramMetaData, string[] dataSetNames)
 {
     m_subReportName = subreportName;
     m_paramMetaData = paramMetaData;
     m_dsNames       = new ReadOnlyCollection <string>(dataSetNames);
 }
コード例 #15
0
        internal GridLayoutDefinition(GridLayoutCellDefinitionCollection cellDefs, int numRows, int numColumns, ReportParameterInfoCollection paramInfoCollection)
        {
            m_cellDefinitions   = cellDefs;
            m_numberOfRows      = numRows;
            m_numberOfColumns   = numColumns;
            m_columnsVisibility = new bool[numColumns];
            m_rowsVisibility    = new bool[numRows];
            if (paramInfoCollection == null || !paramInfoCollection.Any())
            {
                return;
            }
            int j;

            for (j = 0; j < m_numberOfColumns; j++)
            {
                IEnumerable <GridLayoutCellDefinition> enumerable = m_cellDefinitions.Where((GridLayoutCellDefinition p) => p.Column == j);
                if (!enumerable.Any() && j < m_cellDefinitions.Max((GridLayoutCellDefinition p) => p.Column))
                {
                    m_columnsVisibility[j] = true;
                }
                foreach (GridLayoutCellDefinition param in enumerable)
                {
                    if (paramInfoCollection.Any((ReportParameterInfo p) => p.Name == param.ParameterName && IsParamVisible(p)))
                    {
                        m_columnsVisibility[j]      = true;
                        m_rowsVisibility[param.Row] = true;
                    }
                }
            }
            int i;

            for (i = 0; i < m_numberOfRows; i++)
            {
                if (!m_cellDefinitions.Where((GridLayoutCellDefinition p) => p.Row == i).Any() && i < m_cellDefinitions.Max((GridLayoutCellDefinition p) => p.Row))
                {
                    m_rowsVisibility[i] = true;
                }
            }
        }