private void ImpostaRpt(bool FromWebCad) { string Eq_id = String.Empty; if (FromWebCad) { Eq_id = Request["id_eq"]; } else { Eq_id = recuperaEqId(); } DatiShcedeEq myDati = new DatiShcedeEq(Eq_id); NewDataSet ds = myDati.GetDsTipizzato(); if (ds.Tables["TblGenerale"].Rows.Count > 0) { foreach (DataRow dr in ds.Tables["TblGenerale"].Rows) { if (dr["EQ_IMAGE_EQ_ASSY"] != DBNull.Value) { if (ControllaFoto(dr["EQ_IMAGE_EQ_ASSY"].ToString())) { dr["EQ_IMMAGINI_IMMAGINE"] = GetPhoto(dr["EQ_IMAGE_EQ_ASSY"].ToString()); } else { dr["EQ_IMMAGINI_IMMAGINE"] = GetPhoto("ImmagineNonDisponibile.jpg"); } } else { dr["EQ_IMMAGINI_IMMAGINE"] = GetPhoto("ImmagineNonDisponibile.jpg"); } } } // DataGrid1.DataSource = ds.Tables["TblAllegatiEstesa"]; // DataGrid1.DataBind(); // DataGrid2.DataSource = ds.Tables["TblManRic"]; // DataGrid2.DataBind(); // DataGrid3.DataSource = ds.Tables["TblManProg"]; // DataGrid3.DataBind(); // DataGrid4.DataSource = ds.Tables["TblManStra"]; // DataGrid4.DataBind(); // ds.WriteXmlSchema(@"c:/tmp/ScmReport.xsd"); // string pathRptSource = Server.MapPath(Request.ApplicationPath + ConfigurationSettings.AppSettings["SourceReports"]); crReportDocument.Load(pathRptSource + "RptChedeEq_V9.rpt"); crReportDocument.SetDataSource(ds); CryVwSchedaEq.ReportSource = crReportDocument; // DataGrid1.DataSource = ds.Tables["TblAllegati"]; // DataGrid1.DataBind(); }
private void GeneraRptPdf() { DatiShcedeEq myDati = new DatiShcedeEq(recuperaEqId()); NewDataSet ds = myDati.GetDsTipizzato(); foreach (DataRow dr in ds.Tables["TblGenerale"].Rows) { if (dr["EQ_IMAGE_EQ_ASSY"] != DBNull.Value) { if (ControllaFoto(dr["EQ_IMAGE_EQ_ASSY"].ToString())) { dr["EQ_IMMAGINI_IMMAGINE"] = GetPhoto(dr["EQ_IMAGE_EQ_ASSY"].ToString()); } else { dr["EQ_IMMAGINI_IMMAGINE"] = GetPhoto("ImmagineNonDisponibile.jpg"); } } else { dr["EQ_IMMAGINI_IMMAGINE"] = GetPhoto("ImmagineNonDisponibile.jpg"); } } // ds.WriteXmlSchema(@"c:/tmp/ScmReport.xsd"); // string pathRptSource = Server.MapPath(Request.ApplicationPath + ConfigurationSettings.AppSettings["SourceReports"]); crReportDocument.Load(pathRptSource + "RptChedeEq_V9.rpt"); crReportDocument.SetDataSource(ds); string Fname = pathRptSource + Session.SessionID.ToString() + ".pdf"; crDiskFileDestinationOptions = new DiskFileDestinationOptions(); crDiskFileDestinationOptions.DiskFileName = Fname; crExportOptions = crReportDocument.ExportOptions; crExportOptions.DestinationOptions = crDiskFileDestinationOptions; crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; crReportDocument.Export(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.WriteFile(Fname); Response.Flush(); Response.Close(); System.IO.File.Delete(Fname); }