public CatalogListViewItem( CatalogItem catalogItem )
            : base()
        {
            _catalogItem = catalogItem;

                // Assign Name to the base ListViewItem Text property -
                // this will cause Name to display by default:
                Text = _catalogItem.Name;
        }
        // How To - Create a Listview class that displays CatalogItems
        public CatalogListViewItem( CatalogItem catalogItem )
            : base()
        {
            m_catalogItem = catalogItem;

             // Assign Name to the base ListViewItem Text property -
             // this will cause Name to display by default:
             Text = m_catalogItem.Name;

             // Map the other class data to sub-items of the ListItem
             // These aren't necessarily displayed...
             this.SubItems.Add(m_catalogItem.Size.ToString() );
             this.SubItems.Add(m_catalogItem.TypeName );
             this.SubItems.Add(m_catalogItem.ModifiedDate.ToString());
        }
        private void saveReportButton_Click(object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            // Define variables needed for the Render() method.
            string historyID = null;
            string format = formatComboBox.Text;
            rs2010.DataSourceCredentials[] credentials = null;
            rs2010.ParameterValue[] reportHistoryParameters = null;

            // Define variables needed for GetParameters() method
            bool forRendering = false;
            rs2010.ItemParameter[] parameters = null;
            bool noDefault = false;

            // Create a variable containing the selected item
            selItem = ((CatalogListViewItem)reportListView.SelectedItems[0]).Item;

            try
            {
                // If the report uses parameters for which there is no default
                // value, then the report cannot be rendered and saved by this
                // application
                parameters = rs.GetItemParameters(selItem.Path, historyID,
                    forRendering, reportHistoryParameters, credentials);

                foreach (rs2010.ItemParameter parameter in parameters)
                {
                    if (parameter.DefaultValues == null)
                    {
                        noDefault = true;
                        break;
                    }
                }

                if (noDefault)
                {
                    MessageBox.Show(
                        Resources.missingDefaultParametersErrorMessage,
                        Resources.missingDefaultParametersMessageBoxTitle,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
                else
                {
                    SaveAs();
                }
            }

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

            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        private void reportListView_SelectedIndexChanged(object sender, 
		    System.EventArgs e)
        {
            rs2010.CatalogItem selItem;

            // Once a report is selected, enable the save button.
            saveReportButton.Enabled = true;

            descriptionTextBox.Clear();
            pathTextBox.Clear();
            if (reportListView.SelectedItems.Count > 0)
            {
                selItem = ((CatalogListViewItem)reportListView.SelectedItems[0]).Item;

                //Show the description
                if ( selItem.Description != null)
                    descriptionTextBox.Text = selItem.Description;

                // Show the path
                pathTextBox.Text = selItem.Path;
            }
        }
        private void DownloadItem(string localDirectory, CatalogItem item)
        {
            byte[] reportDefinition = null;
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();

            reportDefinition = ReportingService.GetItemDefinition(item.Path);
            MemoryStream stream = new MemoryStream(reportDefinition);

            doc.Load(stream);
            doc.Save(Path.Combine(localDirectory + @"/",
                item.Name + GetExtensionfromType(item.TypeName)));
        }
        /// <summary>
        /// Render a Tabular element containing Name/Value pair for CreatedBy and CreationDate properties.
        /// </summary>
        /// <param name="catalogItem"></param>
        private void TabularPreview(CatalogItem catalogItem)
        {
            //Start Tabular
            xmlQueryResponse.WriteStartElement("Tabular");
            //CreatedBy Record
            xmlQueryResponse.WriteStartElement("Record");
            xmlQueryResponse.WriteElementString("Name",
                string.Format(CultureInfo.InvariantCulture, Resources.Resources.CreatedBy));
            xmlQueryResponse.WriteElementString("Value",
                string.Format(CultureInfo.InvariantCulture, catalogItem.CreatedBy));
            xmlQueryResponse.WriteEndElement();
            //CreationDate Record
            xmlQueryResponse.WriteStartElement("Record");
            xmlQueryResponse.WriteElementString("Name",
                string.Format(CultureInfo.InvariantCulture, Resources.Resources.CreationDate));
            xmlQueryResponse.WriteElementString("Value",
                string.Format(CultureInfo.InvariantCulture, catalogItem.CreationDate.ToString()));
            xmlQueryResponse.WriteEndElement();

            xmlQueryResponse.WriteEndElement();
        }