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.Type.ToString() );
             this.SubItems.Add(m_catalogItem.ModifiedDate.ToString());
        }
        private List<CatalogItem> buildSecureCatalogList(CatalogItem[] unsecureCatalogItems)
        {
            List<CatalogItem> secureCatalogList = new List<CatalogItem>(unsecureCatalogItems.Length);
            for (int checkNdx = unsecureCatalogItems.Length; checkNdx > 0; checkNdx--)
            {
                CatalogItem ci = unsecureCatalogItems[checkNdx - 1];

                string folderPath = string.Empty;

                if (ci.Type == ItemTypeEnum.Folder)
                {
                    folderPath = ci.Path;
                }
                else
                {
                    int lastSlash = ci.Path.LastIndexOf('/');
                    folderPath = ci.Path.Substring(0, lastSlash);
                }

                if (!string.IsNullOrEmpty(folderPath))
                {
                    if (_authenticatedUserManager.CheckItemAccess(folderPath) == AccessStateType.Allowed)
                    {
                        secureCatalogList.Insert(0, ci);
                    }
                }
            }
            return secureCatalogList;
        }
        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;
            rs2005.DataSourceCredentials[] credentials = null;
            rs2005.ParameterValue[] reportHistoryParameters = null;

            // Define variables needed for GetParameters() method
            bool forRendering = false;
            rs2005.ReportParameter[] 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.GetReportParameters(selItem.Path, historyID,
                    forRendering, reportHistoryParameters, credentials);

                foreach (rs2005.ReportParameter 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)
        {
            rs2005.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;
            }
        }
        //Based on the path, the child items would be displayed in the Listview control
        private void DisplayChildren(String path)
        {
            CatalogItem[] childrenItems;

            lblReportItemDetails.Text = "The folders under the path : " + path.ToString();
            lvChildren.Items.Clear();

            //Get the list of children
            childrenItems = listChildItems(path);
            if (childrenItems != null)
            {
                            //Iterate through list of children, and add those items to the Listview control
                            for (int i = 0; i < childrenItems.Length; i++)
                            {
                                CatalogItem item = new CatalogItem();
                                item = childrenItems[i];

                                String childPath = item.Path.Substring(1);
                                String[] pathNodes = childPath.Split(new char[] { '/' });

                                lvChildren.SmallImageList = smallImageList;

                                ListViewItem childItem = new ListViewItem();
                                childItem.ImageIndex = GetItemTypeImage(item.Type);
                                childItem.Text = item.Name;

                                if (path == "/")
                                {
                                    childItem.ToolTipText = path + item.Name;
                                }
                                else
                                {
                                    childItem.ToolTipText = path + "/" + item.Name;
                                }

                                lvChildren.Items.Add(childItem);

                            }
                        }
        }