public WebReport GetReport(string OPID, string DDL_License_Name, string DDL_PlanID) { RegisteredObjects.AddConnection(typeof(MsSqlDataConnection)); var webReport = new WebReport(); var sqlConnection = new MsSqlDataConnection { ConnectionString = "Data Source=10.29.1.116;Initial Catalog=sptosystem;Persist Security Info=True;User ID=sa;Password=pwpolicy;Application Name=SPTO_SYSTEM" }; //sqlConnection.ConnectionString = sqlConnection; sqlConnection.CreateAllTables(); webReport.Report.Dictionary.Connections.Add(sqlConnection); webReport.Report.Load($@"Reports/Untitled.frx"); //var string staffop = OPID ; //const string planid = "T2220-0001"; //const string license = "CO1001"; webReport.Report.SetParameterValue("PAM_OP", OPID); webReport.Report.SetParameterValue("PAM_PLANID", DDL_PlanID); webReport.Report.SetParameterValue("PAM_License", DDL_License_Name); ViewBag.WebReport = webReport; ViewBag.OPID = OPID; return(webReport); }
public IActionResult Generate([FromBody] ReportDto query) { string mime = "application/pdf"; //MIME-header with default value string webRootPath = _hostingEnvironment.WebRootPath; //Define the path to the wwwroot folder string reportPath = (webRootPath + "/Report.frx"); //Define the path to the report using (MemoryStream stream = new MemoryStream()) //Create the stream for the report { try { using (DataSet dataSet = new DataSet()) { RegisteredObjects.AddConnection(typeof(MsSqlDataConnection)); WebReport webReport = new WebReport(); MsSqlDataConnection sqlConnection = new MsSqlDataConnection(); sqlConnection.ConnectionString = Configuration.GetConnectionString("DefaultConnection"); sqlConnection.CreateAllTables(); webReport.Report.Dictionary.Connections.Add(sqlConnection); webReport.Report.Load(reportPath); webReport.Report.SetParameterValue("AmostraId", query.AmostraId); for (int i = 0; i < query.Ensaios.Length; i++) { webReport.Report.SetParameterValue($"EnsaioSelecionados{i+1}", query.Ensaios[i]); } webReport.Report.Prepare(); PDFSimpleExport pdfExport = new PDFSimpleExport(); pdfExport.Export(webReport.Report, stream); } //Get the name of resulting report file with needed extension var file = String.Concat($"Laudo-{DateTime.Now}", ".", "pdf"); return(File(stream.ToArray(), mime, file)); // attachment } catch (Exception ex) { throw new AppError(ex.Message); return(new NoContentResult()); } finally { stream.Dispose(); } } }
private void SetReportAccountTree() { var webRoot = _hostingEnvironment.WebRootPath + "\\Reporting\\AccountTree\\"; webReport.Width = "1000"; // Set the width of the report webReport.Height = "1000"; // Set the height of the report var file = Path.Combine(webRoot, "AccountTreeReport.frx"); string report_path = file; MsSqlDataConnection sqlConnection = new MsSqlDataConnection { ConnectionString = _configuration.GetConnectionString("DefaultConnection") }; sqlConnection.CreateAllTables(); webReport.Report.Dictionary.Connections.Add(sqlConnection); webReport.Report.Load(file); }
private void SetReportAccountTree(int accountLevel, string accName, string accNo) { var webRoot = _hostingEnvironment.WebRootPath + "\\Reporting\\AccountTree\\"; webReport.Width = "1000"; // Set the width of the report webReport.Height = "1000"; // Set the height of the report var file = Path.Combine(webRoot, "AccountTreeFilterReport.frx"); string report_path = file; var connection = _configuration.GetConnectionString("DefaultConnection"); MsSqlDataConnection sqlConnection = new MsSqlDataConnection { ConnectionString = _configuration.GetConnectionString("DefaultConnection") }; sqlConnection.CreateAllTables(); webReport.Report.Dictionary.Connections.Add(sqlConnection); webReport.Report.Load(file); webReport.Report.SetParameterValue("AccountLevel", accountLevel); webReport.Report.SetParameterValue("AccountName", accName); webReport.Report.Prepare(); }
public IActionResult Index(string reportName) { if (string.IsNullOrEmpty(reportName)) { reportName = "GameReport"; } RegisteredObjects.AddConnection(typeof(MsSqlDataConnection)); WebReport webReport = new WebReport(); MsSqlDataConnection sqlConnection = new MsSqlDataConnection(); sqlConnection.ConnectionString = @"Data Source=prog3050.daehwa.ca;Initial Catalog=TheWizardsGameShop;Persist Security Info=True;User ID=sa;Password=TheWizards!"; sqlConnection.CreateAllTables(); webReport.Report.Dictionary.Connections.Add(sqlConnection); webReport.Report.Load($".//Reports//{reportName}.frx"); webReport.ShowPreparedReport = false; webReport.ShowExports = false; webReport.ShowZoomButton = false; ViewBag.report = webReport; return(View()); }
private void SetReportContract(string FromDate, string ToDate, string Country, int LateDate, string ForiegnAgency) { var webRoot = _hostingEnvironment.WebRootPath + "\\Reporting\\Contracts\\"; webReport.Width = "1000"; // Set the width of the report webReport.Height = "1000"; // Set the height of the report var file = Path.Combine(webRoot, "ContractFilterReport.frx"); string report_path = file; MsSqlDataConnection sqlConnection = new MsSqlDataConnection { ConnectionString = _configuration.GetConnectionString("DefaultConnection") }; sqlConnection.CreateAllTables(); webReport.Report.Dictionary.Connections.Add(sqlConnection); webReport.Report.Load(file); //webReport.Report.SetParameterValue("FromDate", FromDate); //webReport.Report.SetParameterValue("ToDate", ToDate); webReport.Report.SetParameterValue("Country", Country); webReport.Report.SetParameterValue("LateDate", LateDate); webReport.Report.SetParameterValue("ForiegnAgency", ForiegnAgency); webReport.Report.Prepare(); }