public reportviewer(MainWindow window, SQLServerConnection connexion) { this.connexion = connexion; this.window = window; InitializeComponent(); _reportViewer.Load += _reportViewer_Load; } void _reportViewer_Load(object sender, EventArgs e) { if (!_isReportViewerLoaded) { ReportDataSource reportDatasource1 = new ReportDataSource(); dataset = new DB_DataSet(); reportDatasource1.Name = "DB_DataSet"; reportDatasource1.Value = dataset.general; this._reportViewer.LocalReport.DataSources.Add(reportDatasource1); SetReportParameters(); List<string> ExportPath = new List<string>(); ExportPath = window.ConfigParameters["ExportPDF_Path"].Split('\\').ToList(); for (int index = 0; index < ExportPath.Count; index++) { if (ExportPath[index] == "") { ExportPath.RemoveAt(index); } } foreach (string ElementPath in ExportPath) { if (ElementPath != ExportPath[0]) { Path_Export += @"/" + ElementPath; } else { Path_Export = ExportPath[0]; } } //Selecting output report switch (window.NomBouton) { case "Rapport normal": this._reportViewer.LocalReport.ReportPath = "NormalReport.rdlc"; Path_Export += @"/" + PDFName + ".pdf"; NameAttachement = PDFName + ".pdf"; break; case "Rapport QSP": this._reportViewer.LocalReport.ReportPath = "VendorName.rdlc"; Path_Export += @"/" + PDFName + "2" + ".pdf"; NameAttachement = PDFName + "2" + ".pdf"; ; break; case "Rapport Bulletin sans nom": this._reportViewer.LocalReport.ReportPath = "HidenNameReport.rdlc"; Path_Export += @"/" + PDFName + "HidenName" + ".pdf"; NameAttachement = PDFName + "HidenName" + ".pdf"; break; } _reportViewer.SetDisplayMode(DisplayMode.PrintLayout); this.Title = PDFName; _reportViewer.RefreshReport(); SavePDF(); if (window.ConfigParameters["AutoSend E-Mail"] == "True") { Mail = new Thread(new ThreadStart(SendMail)); Mail.Start(); while (Mail.IsAlive) { } Mail.Abort(); } _isReportViewerLoaded = true; }
Program Files
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)