예제 #1
0
        internal void SaveControlValuesToReport(bool autoSubmit)
        {
            if (m_credentialsHaveChanged)
            {
                DataSourceCredentialsCollection dataSourceCredentialsCollection = new DataSourceCredentialsCollection();
                foreach (DataSourcePromptControl dataSourcePrompt in m_dataSourcePrompts)
                {
                    DataSourceCredentials dataSourceCredentials = new DataSourceCredentials();
                    dataSourceCredentials.Name     = dataSourcePrompt.DataSourceInfo.Name;
                    dataSourceCredentials.UserId   = dataSourcePrompt.UserName;
                    dataSourceCredentials.Password = dataSourcePrompt.Password;
                    dataSourceCredentialsCollection.Add(dataSourceCredentials);
                }
                ReportCredentialsEventArgs reportCredentialsEventArgs = new ReportCredentialsEventArgs(dataSourceCredentialsCollection);
                if (this.SubmitDataSourceCredentials != null)
                {
                    this.SubmitDataSourceCredentials(this, reportCredentialsEventArgs);
                }
                if (!reportCredentialsEventArgs.Cancel && dataSourceCredentialsCollection.Count > 0 && ViewerControl.ProcessingMode == ProcessingMode.Remote)
                {
                    ViewerControl.ServerReport.SetDataSourceCredentials(dataSourceCredentialsCollection);
                }
                return;
            }
            ReportParameterCollection reportParameterCollection = new ReportParameterCollection();

            foreach (ParameterControl value in m_paramControls.Values)
            {
                if (value.Enabled)
                {
                    string[] currentValue = value.CurrentValue;
                    if (currentValue != null)
                    {
                        ReportParameter reportParameter = new ReportParameter();
                        reportParameter.Name = value.ParameterInfo.Name;
                        reportParameter.Values.AddRange(currentValue);
                        reportParameterCollection.Add(reportParameter);
                    }
                }
            }
            if (this.SubmitParameters != null && reportParameterCollection.Count > 0)
            {
                ReportParametersEventArgs reportParametersEventArgs = new ReportParametersEventArgs(reportParameterCollection, autoSubmit);
                this.SubmitParameters(this, reportParametersEventArgs);
                if (!reportParametersEventArgs.Cancel && reportParameterCollection.Count > 0)
                {
                    ViewerControl.Report.SetParameters(reportParameterCollection);
                }
            }
        }
 internal ReportCredentialsEventArgs(DataSourceCredentialsCollection credentials)
 {
     m_credentials = credentials;
 }