예제 #1
0
        public void Loaded(object sender, RoutedEventArgs e)
        {
            if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                Window mainWindow = sender as Window;
                Syncfusion.Windows.Reports.Viewer.ReportViewer viewer = mainWindow.FindName("viewer") as Syncfusion.Windows.Reports.Viewer.ReportViewer;

                List <DataSourceCredentials> crdentials = new List <DataSourceCredentials>();

                foreach (var dataSource in viewer.GetDataSources())
                {
                    DataSourceCredentials credn = new DataSourceCredentials();
                    credn.Name     = dataSource.Name;
                    credn.UserId   = "ssrs1";
                    credn.Password = "******";
                    crdentials.Add(credn);
                }

                viewer.SetDataSourceCredentials(crdentials);
                viewer.RefreshReport();
            }

            else
            {
                MessageBox.Show("Internet connection is required to run this sample", "SSRS Demo", MessageBoxButton.OK);
            }
        }
예제 #2
0
        //private void TreeViewItem_Selected(object sender, MouseButtonEventArgs e)
        private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
        {
            try
            {
                TreeViewItem item = sender as TreeViewItem;


                if (item == e.OriginalSource)
                {
                    var MultiTag = (TagMultiple)(sender as TreeViewItem).Tag;

                    if (MultiTag.IsRep == true)
                    {
                        switch (MultiTag.typePnt)
                        {
                        case "1":    //abre un tab interno de esta pantalla
                            Syncfusion.Windows.Reports.Viewer.ReportViewer viewer = new Syncfusion.Windows.Reports.Viewer.ReportViewer();
                            viewer.ReportPath             = MultiTag.urlRep;
                            viewer.ReportServerUrl        = MultiTag.serverIp;
                            viewer.ProcessingMode         = ProcessingMode.Remote;
                            viewer.ReportServerCredential = new System.Net.NetworkCredential(MultiTag.userServer, MultiTag.userServerPass);
                            List <DataSourceCredentials> crdentials = new List <DataSourceCredentials>();

                            foreach (var dataSource in viewer.GetDataSources())
                            {
                                DataSourceCredentials credn = new DataSourceCredentials();
                                credn.Name     = dataSource.Name;
                                credn.UserId   = "*****@*****.**";
                                credn.Password = "******";
                                crdentials.Add(credn);
                            }
                            viewer.SetDataSourceCredentials(crdentials);
                            viewer.RefreshReport();

                            TabItemExt tabItemExt1 = new TabItemExt();
                            tabItemExt1.Header  = MultiTag.NamePnt;
                            tabItemExt1.Content = viewer;
                            TabControlPricipal.Items.Add(tabItemExt1);
                            break;

                        case "3":
                            dynamic ww = SiaWin.WindowExt(9531, "MenuReporteWindow");
                            ww.tipo                  = MultiTag.IsRep;
                            ww.Server                = MultiTag.serverIp;
                            ww.UserServer            = MultiTag.userServer;
                            ww.UserServerPass        = MultiTag.userServerPass;
                            ww.carpeta               = MultiTag.urlRep;
                            ww.ShowInTaskbar         = false;
                            ww.Owner                 = Application.Current.MainWindow;
                            ww.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            ww.ShowDialog();
                            break;
                        }
                    }
                    else
                    {
                        switch (MultiTag.typePnt)
                        {
                        case "2":    //userconotrol reporte
                            SiaWin.TabU(MultiTag.Id_screen);
                            break;

                        case "4":
                            WebBrowser webPowBi = new WebBrowser();
                            string     urlPowBi = MultiTag.urlRep;
                            webPowBi.Navigate(urlPowBi);
                            TabItemExt tabItemExtPowBi = new TabItemExt();
                            tabItemExtPowBi.Header  = MultiTag.NamePnt;
                            tabItemExtPowBi.Content = webPowBi;
                            TabControlPricipal.Items.Add(tabItemExtPowBi);
                            break;

                        case "5":
                            WebBrowser web = new WebBrowser();
                            string     url = MultiTag.urlRep;
                            web.Navigate(url);
                            TabItemExt tabItemExt = new TabItemExt();
                            tabItemExt.Header  = MultiTag.NamePnt;
                            tabItemExt.Content = web;
                            TabControlPricipal.Items.Add(tabItemExt);
                            break;
                        }
                    }

                    //item.IsSelected = false;
                    //e.Handled = true;
                }
            }
            catch (Exception w)
            {
                MessageBox.Show("error en el select del item consulte con el administrador:" + w);
            }
        }