示例#1
0
文件: RSUtil.cs 项目: saveenr/saveenr
 public static ReportService2005.ReportingService2005 ConnectToReportingService()
 {
     Console.WriteLine("Connecting To Reporting Service");
     var rep_svc = new ReportService2005.ReportingService2005();
     rep_svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
     return rep_svc;
 }
        public ActionResult Create(ReportViewModel reportviewModel)
        {
            ReportModel reportModel = reportviewModel.rm;

            if (db.ReportModels.Where(x => x.path == reportModel.path).Any())
            {
                ViewBag.ErrorMessage = "This Report already exists.";
                SelectList sl = Utility.GetReportsDDL();
                reportviewModel.lsReports = sl;
                return(View(reportviewModel));
            }
            else
            {
                ReportService2005.ReportingService2005 rs = new ReportService2005.ReportingService2005();
                rs.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["userName"].ToString(), ConfigurationManager.AppSettings["Password"].ToString());
                rs.Timeout     = Convert.ToInt32(ConfigurationManager.AppSettings["SOAPTimeout"].ToString());
                rs.Url         = ConfigurationManager.AppSettings["webServiceURL"].ToString();
                ReportService2005.CatalogItem[] items = rs.ListChildren("/", true);
                ReportService2005.CatalogItem   item  = items.Where(x => x.Path == reportModel.path).Single();
                reportModel.name        = item.Name;
                reportModel.description = item.Description;
                reportModel.ts          = DateTime.Now;
                reportModel.isActive    = true;
                db.ReportModels.Add(reportModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
        }
示例#3
0
        public static SelectList GetReportsDDL()
        {
            ApplicationDbContext db = new ApplicationDbContext();

            ReportService2005.ReportingService2005 rs = new ReportService2005.ReportingService2005();
            rs.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["userName"].ToString(), ConfigurationManager.AppSettings["Password"].ToString());
            rs.Timeout     = Convert.ToInt32(ConfigurationManager.AppSettings["SOAPTimeout"].ToString());
            rs.Url         = ConfigurationManager.AppSettings["webServiceURL"].ToString();
            ReportService2005.CatalogItem[] items   = rs.ListChildren("/", true);
            List <SelectListItem>           slItems = new List <SelectListItem>();

            foreach (ReportService2005.CatalogItem item in items)
            {
                if (item.Type == ReportService2005.ItemTypeEnum.Report || item.Type == ReportService2005.ItemTypeEnum.LinkedReport)
                {
                    if (!db.ReportModels.Where(x => x.path == item.Path).Any())
                    {
                        SelectListItem sli = new SelectListItem();
                        sli.Value = item.Path;
                        sli.Text  = item.Name + " || " + item.Path;
                        slItems.Add(sli);
                    }
                }
            }
            SelectList sl = new SelectList(slItems, "Value", "Text");

            return(sl);
        }
示例#4
0
        public static ReportService2005.ReportingService2005 ConnectToReportingService()
        {
            Console.WriteLine("Connecting To Reporting Service");
            var rep_svc = new ReportService2005.ReportingService2005();

            rep_svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
            return(rep_svc);
        }
示例#5
0
        public static System.Xml.Linq.XDocument GetRDLXML(ReportService2005.ReportingService2005 rep_svc, Microsoft.Reporting.WinForms.ServerReport report)
        {
            var xml_bytes = rep_svc.GetReportDefinition(report.ReportPath);
            var memstream = new System.IO.MemoryStream(xml_bytes);
            var xmlreader = new System.Xml.XmlTextReader(memstream);
            var xdoc      = System.Xml.Linq.XDocument.Load(xmlreader);

            return(xdoc);
        }
示例#6
0
        static void Main(string[] args)
        {
            var rs = new ReportService2005.ReportingService2005 {
                Credentials = CredentialCache.DefaultCredentials
            };

            var sourceFolder      = @"C:\Banlaw\Code\_FT\FuelTrack\FMS.Reports\bin\Debug";
            var targetFolder      = "/These/Are/Mine";
            var dataSourcesFolder = "/Data Sources";

            var ru = new ReportUploader(sourceFolder, targetFolder, dataSourcesFolder, rs);

            ru.Upload();
        }