private void Window_Loaded(object sender, RoutedEventArgs e) { string ReportName = "ProjektDB.Reports.TestAs.rdlc"; db = new SteinbachEntities(); host = new WindowsFormsHost(); var Calc = from p in db.kalkulationstabellen where p.id == 155 select p.projektnummer; var detail = from d in db.kalkulationstabelle_details where d.id_kalkulationstabelle == 155 select d.beschreibung; var obj = new MergeData_DataSorce(String.Format("{0} - {1}", Calc.FirstOrDefault(), detail.FirstOrDefault()), "Zwei", "Drei", "Ein beliebiger Text", "", "", "", "", ""); reportViewer = new Microsoft.Reporting.WinForms.ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; //reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); reportViewer.LocalReport.ReportEmbeddedResource = ReportName; //"ProjektDB.Reports.Jets_Auftrag_SI.rdlc"; //ReportDataSource ds = new ReportDataSource("dsCalkProjekt", Calc); //ReportDataSource dsDetail = new ReportDataSource("dsCalcDetails", detail); ReportDataSource dsObj = new ReportDataSource("dsMergedData", obj.MergedData); //reportViewer.LocalReport.DataSources.Add(ds); //reportViewer.LocalReport.DataSources.Add(dsDetail); reportViewer.LocalReport.DataSources.Add(dsObj); reportViewer.RefreshReport(); host.Child = reportViewer; this.GridDisplay.Children.Add(host); }
private void Window_Loaded(object sender, RoutedEventArgs e) { string ReportName = "ProjektDB.Reports.LagerListe.rdlc"; db = new SteinbachEntities(); host = new WindowsFormsHost(); var temp = new Repositories.NavigationRepository(this.db); var query = temp.GetLagerlisteData(); var merge = new MergeData_DataSorce(DateTime.Now.ToShortDateString(), "", "", "", "", "", "", "", ""); reportViewer = new Microsoft.Reporting.WinForms.ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; //reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); reportViewer.LocalReport.ReportEmbeddedResource = ReportName; //"ProjektDB.Reports.Jets_Auftrag_SI.rdlc"; //ReportDataSource ds = new ReportDataSource("dsCalkProjekt", Calc); //ReportDataSource dsDetail = new ReportDataSource("dsCalcDetails", detail); ReportDataSource dsLL = new ReportDataSource("dsLagerListenOA", query); ReportDataSource Merger = new ReportDataSource("dsMerge", merge.MergedData); //reportViewer.LocalReport.DataSources.Add(ds); //reportViewer.LocalReport.DataSources.Add(dsDetail); reportViewer.LocalReport.DataSources.Add(dsLL); reportViewer.LocalReport.DataSources.Add(Merger); // RenderingExtension[] re = reportViewer.LocalReport.ListRenderingExtensions(); reportViewer.RefreshReport(); // reportViewer.ExportDialog(re[0], "", "Test.xml"); host.Child = reportViewer; this.GridDisplay.Children.Add(host); }