Пример #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Working...");

            var reportingService2010 = new ReportingService2010();

            reportingService2010.Credentials = CredentialCache.DefaultCredentials;

            var results = reportingService2010.ListChildren("/", true);

            var reportMetas = new List<ReportMeta>();

            reportMetas.Add(new ReportMeta { CreatedBy = "CreatedBy", Folder = "Folder", ModifiedBy = "ModifiedBy", Name = "Name", ReportItemType = ReportItemType.Type, LastModifiedDate = "LastModifiedDate" });

            foreach (var result in results)
            {
                var reportMeta = new ReportMeta();
                reportMeta.Name = result.Name;
                reportMeta.CreatedBy = result.CreatedBy;
                reportMeta.ModifiedBy = result.ModifiedBy;
                reportMeta.LastModifiedDate = result.ModifiedDate.ToString("yyyy-MM-dd hh:mm");
                reportMeta.Folder = result.Path;

                switch (result.TypeName)
                {
                    case "Folder":
                        reportMeta.ReportItemType = ReportItemType.Folder;

                        break;

                    case "Report":
                        reportMeta.ReportItemType = ReportItemType.Report;
                        break;

                    case "DataSource":
                        reportMeta.ReportItemType = ReportItemType.DataSource;
                        break;

                    case "Component":
                        reportMeta.ReportItemType = ReportItemType.Component;
                        break;

                    case "Resource":
                        reportMeta.ReportItemType = ReportItemType.Resource;
                        break;
                }

                reportMetas.Add(reportMeta);
            }

            if (File.Exists(Settings.Default.TargetFile))
                File.Delete(Settings.Default.TargetFile);

            File.WriteAllLines(Settings.Default.TargetFile, reportMetas.Select(obj => obj.ToString()));

            Console.WriteLine("Done!");
        }
        private void searchButton_Click(object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            // Clear out the current descripton and path fields
            descriptionTextBox.Clear();
            pathTextBox.Clear();

            // Disable save button on new search
            saveReportButton.Enabled = false;

            // Check to see if the 'Search By' string is valid.
            if (conditionComboBox.SelectedIndex == -1)
            {
                MessageBox.Show(
                    "Please select a valid 'Search By' string by clicking the drop down arrow!",
                    "Invalid 'Search By' String",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            // Check to see if a search string is entered
            if (searchTextBox.Text == null || searchTextBox.Text == "")
            {
                MessageBox.Show(
                    Resources.invalidSearchStringErrorMessage,
                    Resources.invalidSearchStringMessageBoxTitle,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            else
            {
                reportListView.Items.Clear();

                // Create a new proxy to the web service
                rs = new rs2010.ReportingService2010();
                rsExec = new rsExecService.ReportExecutionService();

                // Authenticate to the Web service using Windows credentials
                rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
                rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;

                // Assign the URL of the Web service
                rs.Url = ConfigurationManager.AppSettings["ReportingService2010"];
                rsExec.Url = ConfigurationManager.AppSettings["ReportExecutionService"];

                rs2010.SearchCondition[] conditions;

                if (conditionComboBox.SelectedIndex == NAME)
                {
                    // Create Name search condition
                    rs2010.SearchCondition condition = new rs2010.SearchCondition();
                    condition.Condition = rs2010.ConditionEnum.Contains;
                    condition.ConditionSpecified = true;
                    condition.Name = "Name";
                    string[] val = {searchTextBox.Text};
                    condition.Values = val;

                    conditions = new rs2010.SearchCondition[1];
                    conditions[0] = condition;
                }
                else if (conditionComboBox.SelectedIndex == DESC)
                {
                    // Create Description search condition
                    rs2010.SearchCondition condition = new rs2010.SearchCondition();
                    condition.Condition = rs2010.ConditionEnum.Contains;
                    condition.ConditionSpecified = true;
                    condition.Name = "Description";
                    condition.Values[0] = searchTextBox.Text;

                    // Add conditions to the conditions argument to be used for
                    // FindItems
                    conditions = new rs2010.SearchCondition[1];
                    conditions[0] = condition;
                }
                else
                {
                    // Create Name
                    rs2010.SearchCondition nameCondition = new rs2010.SearchCondition();
                    nameCondition.Condition = rs2010.ConditionEnum.Contains;
                    nameCondition.ConditionSpecified = true;
                    nameCondition.Name = "Name";
                    nameCondition.Values[0] = searchTextBox.Text;

                    // Create Desription
                    rs2010.SearchCondition descCondition = new rs2010.SearchCondition();
                    descCondition.Condition = rs2010.ConditionEnum.Contains;
                    descCondition.ConditionSpecified = true;
                    descCondition.Name = "Description";
                    descCondition.Values[0] = searchTextBox.Text;

                    // Add conditions to the conditions argument to be used for
                    // FindItems
                    conditions = new rs2010.SearchCondition[2];
                    conditions[0] = nameCondition;
                    conditions[1] = descCondition;
                }

                try
                {
                    // Return a list of items based on the search conditions that
                    // apply
                    rs2010.Property[] SearchOptions = new rs2010.Property[1];
                    rs2010.Property SearchOption = new rs2010.Property();
                    SearchOption.Name = "Recursive";
                    SearchOption.Value = "True";
                    SearchOptions[0] = SearchOption;

                    returnedItems = rs.FindItems("/", rs2010.BooleanOperatorEnum.Or, SearchOptions, conditions);

                    if (returnedItems != null && returnedItems.Length != 0)
                    {
                        foreach (rs2010.CatalogItem ci in returnedItems)
                        {
                            //Create a ListView item containing a report catalog item
                            if (ci.TypeName == "Report")
                            {
                                // Add the items to the list view
                                CatalogListViewItem newItem = new CatalogListViewItem(ci);
                                reportListView.Items.Add(newItem);
                            }
                        }
                    }
                    else
                        MessageBox.Show(
                            Resources.noItemsFoundInfoMessage,
                            Resources.noItemsFoundMessageBoxTitle,
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                catch (Exception exception)
                {
                    HandleException(exception);
                }

                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Пример #3
0
 private void ConnectToServer()
 {
     // Init UI
     EnableButtons(true);
     this.Path = Root;
     string serverPath = serverPathTextbox.Text;
     try
     {
         // Connect to Reporting Services
         Cursor.Current = Cursors.WaitCursor;
         rs = new rs2010.ReportingService2010();
         // A production application would perform a complete check on the url path
         this.Connect(serverPath);
         // Display root items
         DisplayItems(Path);
     }
     catch (Exception ex)
     {
         EnableButtons(false);
         this.HandleGeneralException(ex);
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
Пример #4
0
        public void Connect(string url)
        {
            // Create an instance of the Web service proxy and set the Url property
            rs = new rs2010.ReportingService2010();
            rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
            soapUrl = url + wsdl;

            rs.Url = soapUrl;
        }
Пример #5
0
 public ReportDeployment(ReportingService2010 rs)
 {
     _rs = rs;
 }
Пример #6
0
 public ReportDeployment()
 {
     _rs = new ReportingService2010 {Credentials = Credentials, Url = Url};
 }
Пример #7
0
 public ReportManager2010(string url, string userName, string password)
 {
     ReportingService = new ReportingService2010();
     InitializeSSRS(url, userName, password);
 }
        public void Connect(string url)
        {
            this.m_service = new ReportingService2010();
            this.m_service.Credentials = this.Credentials;
            this.m_url = url;
            this.m_soapUrl = this.m_url + wsdl;

            this.m_service.Url = this.m_soapUrl;
        }