/// <remarks/>
 public void FindItemsAsync(string Folder, BooleanOperatorEnum BooleanOperator, SearchCondition[] Conditions, object userState)
 {
     if ((this.FindItemsOperationCompleted == null)) {
         this.FindItemsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnFindItemsOperationCompleted);
     }
     this.InvokeAsync("FindItems", new object[] {
                 Folder,
                 BooleanOperator,
                 Conditions}, this.FindItemsOperationCompleted, userState);
 }
 public CatalogItem[] FindItems(string Folder, BooleanOperatorEnum BooleanOperator, SearchCondition[] Conditions)
 {
     object[] results = this.Invoke("FindItems", new object[] {
                 Folder,
                 BooleanOperator,
                 Conditions});
     return ((CatalogItem[])(results[0]));
 }
 /// <remarks/>
 public void FindItemsAsync(string Folder, BooleanOperatorEnum BooleanOperator, SearchCondition[] Conditions)
 {
     this.FindItemsAsync(Folder, BooleanOperator, Conditions, null);
 }
        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 rs2005.ReportingService2005();
                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["ReportingService2005"];
                rsExec.Url = ConfigurationManager.AppSettings["ReportExecutionService"];

                rs2005.SearchCondition[] conditions;

                if (conditionComboBox.SelectedIndex == NAME)
                {
                    // Create Name search condition
                    rs2005.SearchCondition condition = new rs2005.SearchCondition();
                    condition.Condition = rs2005.ConditionEnum.Contains;
                    condition.ConditionSpecified = true;
                    condition.Name = "Name";
                    condition.Value = searchTextBox.Text;

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

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

                    // Create Desription
                    rs2005.SearchCondition descCondition = new rs2005.SearchCondition();
                    descCondition.Condition = rs2005.ConditionEnum.Contains;
                    descCondition.ConditionSpecified = true;
                    descCondition.Name = "Description";
                    descCondition.Value = searchTextBox.Text;

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

                try
                {
                    // Return a list of items based on the search conditions that
                    // apply
                    returnedItems = rs.FindItems("/", rs2005.BooleanOperatorEnum.Or,
                        conditions );

                    if (returnedItems != null && returnedItems.Length != 0)
                    {
                        foreach (rs2005.CatalogItem ci in returnedItems)
                        {
                            //Create a ListView item containing a report catalog item
                            if (ci.Type == rs2005.ItemTypeEnum.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;
                }
            }
        }