Ejemplo n.º 1
0
        public void GetReportFile(string ReportPath, string FileSystemPath, string FileName)
        {
            byte[]      ReportDefinition = null;
            XmlDocument doc = new XmlDocument();

            if (!FileName.EndsWith(".rdl"))
            {
                FileName += ".rdl";
            }

            ReportDefinition = rs.GetReportDefinition(ReportPath);
            MemoryStream Stream = new MemoryStream(ReportDefinition);

            doc.Load(Stream);
            doc.Save(FileSystemPath + "\\" + FileName);
        }
Ejemplo n.º 2
0
 private void saveTreeNodes(TreeNodeCollection nodes)
 {
     foreach (TreeNode node in nodes)
     {
         var destPath = txtLocalPath.Text + "\\" + node.FullPath;
         if (node.Checked)
         {
             if (node.Nodes.Count > 0)
             {
                 //check if dir exists
                 if (!Directory.Exists(destPath))
                 {
                     Directory.CreateDirectory(destPath);
                 }
                 saveTreeNodes(node.Nodes);
             }
             else
             {
                 var itemPath = ROOT_FOLDER + node.FullPath.Replace("\\", "/");
                 var itemType = sourceRS.GetItemType(itemPath);
                 if (itemType == ItemTypeEnum.Resource)
                 {
                     //Download the resource
                     string resourceType;
                     var    contents = sourceRS.GetResourceContents(itemPath, out resourceType);
                     File.WriteAllBytes(destPath, contents);
                     continue;
                 }
                 else if (itemType == ItemTypeEnum.Report || itemType == ItemTypeEnum.LinkedReport)
                 {
                     var         reportDef = sourceRS.GetReportDefinition(itemPath);
                     XmlDocument rdl       = new XmlDocument();
                     rdl.Load(new MemoryStream(reportDef));
                     rdl.Save(destPath + ".rdl");
                 }
             }
             processedNodeCount++;
             bwDownload.ReportProgress(processedNodeCount * 100 / selectedNodeCount);
         }
     }
 }
        /// <summary>
        /// Deploys the report.
        /// </summary>
        /// <param name="rsSource">Report Server Source object //ReportingService2005</param>
        /// <param name="reportNameSource">Report Source Name</param>
        /// <param name="reportSourcePath">Report Source path</param>
        /// <param name="reportDestinationPath">Report Destination Path</param>
        /// <param name="dataSource">Report Destination DataSource</param>
        /// <param name="dataSourceLocation">Report DataSource Path</param>
        /// <returns>True or False</returns>
        public bool DeployReport(ReportingService2005 rsSource,
                                 string reportNameSource,
                                 string reportSourcePath,
                                 string reportDestinationPath,
                                 string dataSource,
                                 string dataSourceLocation)
        {
            bool resVal;

            try
            {
                if (rsSource == null)
                {
                    return(false);
                }

                byte[] reportDefinition = rsSource.GetReportDefinition(reportSourcePath.Replace(@"\", "/"));

                DeleteItem(ItemTypeEnum.Report,
                           reportDestinationPath.Replace(reportNameSource, string.Empty).Replace(@"\", "/"),
                           reportNameSource);

                ReportsServerInstance2005.CreateReport(reportNameSource,
                                                       reportDestinationPath.Replace(reportNameSource, string.Empty).Replace(@"\", "/"),
                                                       true,
                                                       reportDefinition,
                                                       null);
                try
                {
                    AttachDataSourceToReport(dataSource,
                                             dataSourceLocation.Replace(dataSource, string.Empty).Replace(@"\", "/"),
                                             reportNameSource,
                                             reportDestinationPath.Replace(reportNameSource, string.Empty).Replace(@"\", "/"));
                }
                catch (Exception)
                {
                    MessageBox.Show(string.Format("The Report {0} was created but the report's Datasource cannot be updated! Please do it manually... (if you want)", reportNameSource));
                }

                resVal = true;
            }
            catch (Exception)
            {
                resVal = false;
            }


            return(resVal);
        }
Ejemplo n.º 4
0
 public byte[] GetReportDefinition(string reportPath)
 {
     return(_reportService.GetReportDefinition(reportPath));
 }
Ejemplo n.º 5
0
 private void LoadReport(ReportItem item)
 {
     item.ReportDefinition = _Service.GetReportDefinition(item.Path);
     item.DataSources      = _Service.GetItemDataSources(item.Path);
 }
Ejemplo n.º 6
0
 public byte[] GetReportDefinition(string path)
 {
     return(webserviceProxy.GetReportDefinition(path));
 }