/// <remarks/>
 public void FindItemsAsync(string Folder, BooleanOperatorEnum BooleanOperator, Property[] SearchOptions, SearchCondition[] SearchConditions)
 {
     this.FindItemsAsync(Folder, BooleanOperator, SearchOptions, SearchConditions, null);
 }
 /// <remarks/>
 public void FindItemsAsync(string Folder, BooleanOperatorEnum BooleanOperator, Property[] SearchOptions, SearchCondition[] SearchConditions, object userState)
 {
     if ((this.FindItemsOperationCompleted == null)) {
         this.FindItemsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnFindItemsOperationCompleted);
     }
     this.InvokeAsync("FindItems", new object[] {
                 Folder,
                 BooleanOperator,
                 SearchOptions,
                 SearchConditions}, this.FindItemsOperationCompleted, userState);
 }
 /// <remarks/>
 public System.IAsyncResult BeginFindItems(string Folder, BooleanOperatorEnum BooleanOperator, Property[] SearchOptions, SearchCondition[] SearchConditions, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("FindItems", new object[] {
                 Folder,
                 BooleanOperator,
                 SearchOptions,
                 SearchConditions}, callback, asyncState);
 }
 public CatalogItem[] FindItems(string Folder, BooleanOperatorEnum BooleanOperator, Property[] SearchOptions, SearchCondition[] SearchConditions)
 {
     object[] results = this.Invoke("FindItems", new object[] {
                 Folder,
                 BooleanOperator,
                 SearchOptions,
                 SearchConditions});
     return ((CatalogItem[])(results[0]));
 }
        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;
                }
            }
        }
        public CatalogItem[] AdvancedSearch(string folder, BooleanOperatorEnum booleanOperator,
            SearchCondition[] searchConditions)
        {
            Property[] SearchOptions = new Property[1];
            Property SearchOption = new Property();
            SearchOption.Name = "Recursive";
            SearchOption.Value = "True";
            SearchOptions[0] = SearchOption;

            return this.RSWebService.FindItems(folder, booleanOperator,SearchOptions, searchConditions);
        }
        public CatalogItem[] FindItems(string queryText)
        {
            //Create conditions
            SearchCondition[] conditions = new SearchCondition[1];

            SearchCondition condition = new SearchCondition();
            condition.Condition = ConditionEnum.Contains;
            condition.ConditionSpecified = true;
            condition.Name = "Name";
            string[] val = { queryText };
            condition.Values = val;

            conditions[0] = condition;

            Property[] SearchOptions = new Property[1];
            Property SearchOption = new Property();
            SearchOption.Name = "Recursive";
            SearchOption.Value = "True";
            SearchOptions[0] = SearchOption;

            return this.RSWebService.FindItems( "/", BooleanOperatorEnum.Or,SearchOptions, conditions );
        }
예제 #8
0
        /// <summary>
        /// Create single condition sample based on "?" in queryText.
        /// Supports Folder to Search and Name Contains Or Description contains
        /// </summary>
        private SearchCondition[] SearchConditions()
        {
            SearchCondition searchCondition = null;
            Hashtable searchValues = new Hashtable();

            foreach (DictionaryEntry item in queryValues)
            {
                string key = item.Key.ToString();

                if (key.StartsWith("SearchCondition."))
                {
                    searchValues.Add(key, item.Value.ToString());
                }

            }

            SearchCondition[] conditions = new SearchCondition[searchValues.Count];
            int i = -1;
            foreach (DictionaryEntry searchItem in searchValues)
            {
                i++;
                string delimStr = ".";
                char[] delimiter = delimStr.ToCharArray();
                string searchName = searchItem.Key.ToString().Split(delimiter)[1];

                searchCondition = CreateSearchCondition(searchName, searchItem.Value.ToString());
                conditions[i] = searchCondition;
            }

            return conditions;
        }
예제 #9
0
        private SearchCondition CreateSearchCondition(string name, string value)
        {
            SearchCondition searchCondition = new SearchCondition();
            searchCondition.Condition = ConditionEnum.Contains;
            searchCondition.ConditionSpecified = true;
            searchCondition.Name = name;
            searchCondition.Values[0] = value;

            return searchCondition;
        }