private rs2010.Property[] CreateDescriptionProperty(string description) { rs2010.Property[] rsProperties = new rs2010.Property[1]; rs2010.Property rsProperty = new rs2010.Property(); rsProperty.Name = "Description"; rsProperty.Value = description; rsProperties[0] = rsProperty; return rsProperties; }
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 rs2010.Property[] CreatePropertesArray(string name) { rs2010.Property rsProperty = new rs2010.Property(); rsProperty.Name = name; rs2010.Property[] rsProperties = new rs2010.Property[1]; rsProperties[0] = rsProperty; return rsProperties; }