protected void Page_Load(object sender, EventArgs e) { try { Response.Expires = -1; // Recupero della storia del ruolo RoleHistoryResponse response = UserManager.GetRoleHistory(new RoleHistoryRequest() { IdCorrGlobRole = Request["idCorr"] }); // Impostazione delle informazioni necessarie per l'eventuale generazione del report ReportingUtils.PrintRequest = new PrintReportObjectTransformationRequest() { ContextName = "GestioneRuolo", ReportKey = "StoriaRuolo", DataObject = response.RoleHistoryItems }; // Impostazione del link per l'apertura della pagina del report this.btnEsporta.OnClientClick = ReportingUtils.GetOpenReportPageScript(false); this.dgHistory.DataSource = response.RoleHistoryItems; this.dgHistory.DataBind(); } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Si è verificato un errore durante la ricostruzione della storia del ruolo.');self.close();", true); } }
/// <summary> /// Esportazione del report /// </summary> protected void btnExport_Click(object sender, EventArgs e) { // Impostazione delle proprietà del report da produrre ReportingUtils.PrintRequest.ReportKey = this.ddlReport.SelectedValue; ReportingUtils.PrintRequest.ReportType = (ReportTypeEnum)Enum.Parse(typeof(ReportTypeEnum), this.ddlExportFormat.SelectedValue, true); ReportingUtils.PrintRequest.SubTitle = String.IsNullOrEmpty(this.txtReportSubtitle.Text) ? this.tbwSubtitle.WatermarkText : this.txtReportSubtitle.Text; ReportingUtils.PrintRequest.Title = this.txtReportTitle.Text; ReportingUtils.PrintRequest.ColumnsToExport = this.ReportRegistry.Where(r => r.ReportKey == this.ddlReport.SelectedValue).First().ExportableFields; FileDocumento temp = null; try { temp = ReportingUtils.GenerateReport(ReportingUtils.PrintRequest); } catch { this.messageBox.ShowMessage("Errore durante la generazione del report richiesto."); } if (temp != null) { CallContextStack.CurrentContext.ContextState["documentFile"] = temp; this.reportContent.Attributes["src"] = "ReportContent.aspx"; } }
public async Task <IActionResult> GetReport([FromBody] ReportingDto reportingData) { var reportingUtils = new ReportingUtils(); var reportType = reportingData.ReportType != null ? (OutputPresentationType)reportingData.ReportType.Value : OutputPresentationType.PDF; var reportStream = reportingUtils.GetReport(reportingData.TemplateName, reportingData.ParamList, reportType); switch (reportType) { case OutputPresentationType.HTML: //html 0 case OutputPresentationType.XML: //xml 4 case OutputPresentationType.ASPHTML: //ASPHTML 5 case OutputPresentationType.Internal: //Internal 6 case OutputPresentationType.MHTML: //MHTML 7 case OutputPresentationType.CSV: //CSV 8 return(new ObjectResult(reportStream)); case OutputPresentationType.RenderPdf_iTextSharp: //pdf_itext 1 case OutputPresentationType.PDF: //pdf 2 case OutputPresentationType.PDFOldStyle: //PDFOldStyle 3 return(new FileStreamResult(reportStream, "application/pdf")); case OutputPresentationType.RTF: //RTF 9 return(new FileStreamResult(reportStream, "application/rtf")); case OutputPresentationType.Word: //word 10 return(new FileStreamResult(reportStream, "application/vnd.ms-word")); case OutputPresentationType.Excel: //Excel 11 return(new FileStreamResult(reportStream, "application/vnd.ms-excel")); case OutputPresentationType.TIF: //TIF 12 case OutputPresentationType.TIFBW: //TIFBW 13 return(new FileStreamResult(reportStream, "image/tiff")); case OutputPresentationType.Excel2003: //Excel2003 14 return(new FileStreamResult(reportStream, "application/vnd.ms-excel")); } return(new FileStreamResult(reportStream, "application/pdf")); }
protected void btn_esporta_Click(object sender, EventArgs e) { InfoUtente userInfo = UserManager.getInfoUtente(); // Inizializzazione del call context if (CallContextStack.CurrentContext == null) { CallContextStack.CurrentContext = new CallContext("ReportingContext"); } string userRole = ""; //CH: Modifica per avere evidenza sul report dei problemi durante lo scarico della posta if (this.panelCheckResponse.InnerText != "OK") { userRole = "Utente: " + UserManager.getUtente().descrizione + ", Ruolo: " + UserManager.getRuoloById(userInfo.idCorrGlobali, this.Page).descrizione + ". \r\n ESITO CONTROLLO CASELLA: " + this.panelCheckResponse.InnerText; } else { //Estraggo le informazioni da visualizzare su utente, ruolo userRole = "Utente: " + UserManager.getUtente().descrizione + ", Ruolo: " + UserManager.getRuoloById(userInfo.idCorrGlobali, this.Page).descrizione; } // Salvataggio della request nel call context PrintReportRequestDataset request = new PrintReportRequestDataset() { ContextName = "CasellaIstituzionale", SearchFilters = null, UserInfo = userInfo, InputDataset = reportDataSet, AdditionalInformation = userRole }; ReportingUtils.PrintRequest = request; Page.ClientScript.RegisterStartupScript(this.GetType(), "openReport", ReportingUtils.GetOpenReportPageScript(true), true); }
protected void btnExport_Click(object sender, EventArgs e) { // Recupero dell informazioni sull'utente / amministratore loggato InfoUtente userInfo = null; if (this.UserType == UserTypeEnum.Administrator) { SessionManager sm = new SessionManager(); userInfo = sm.getUserAmmSession(); string[] amministrazione = ((string)Session["AMMDATASET"]).Split('@'); string codiceAmministrazione = amministrazione[0]; userInfo.idAmministrazione = new DocsPaWebService().getIdAmmByCod(codiceAmministrazione); } else { userInfo = UserManager.getInfoUtente(); } // Inizializzazione del call context if (CallContextStack.CurrentContext == null) { CallContextStack.CurrentContext = new CallContext("ReportingContext"); } // Salvataggio della request nel call context PrintReportRequest request = new PrintReportRequest() { ContextName = this.SearchContext, SearchFilters = this.CreateSearchFilters(), UserInfo = userInfo }; ReportingUtils.PrintRequest = request; Page.ClientScript.RegisterStartupScript(this.GetType(), "openReport", ReportingUtils.GetOpenReportPageScript(false), true); }
/// <summary> /// Funzione per l'inizializzazione della pagina /// </summary> private void InitializeControls() { Response.Expires = -1; // Recupero anagrafica dei report try { this.ReportRegistry = ReportingUtils.GetReportRegistry(ReportingUtils.PrintRequest.ContextName); // DataBinding con la drop down list dei report this.ddlReport.DataSource = this.ReportRegistry; this.ddlReport.DataBind(); this.ShowReportMetadata(this.ReportRegistry[0]); // Per default il sottotitolo viene impostato con la data di creazione this.tbwSubtitle.WatermarkText = String.Format("Report generato {0} alle {1}", DateTime.Now.ToString("dddd, dd MMMM yyyy"), DateTime.Now.ToString("HH:mm.ss")); if (!string.IsNullOrEmpty(this.Request.QueryString["readOnlySubTitle"])) { this.txtReportSubtitle.Enabled = false; } } catch { this.messageBox.ShowMessage("Non è stato possibile reperire informazioni sui report registrati."); } }
private int creaGrigioDaReport(bool trasmDoc) { InfoUtente userInfo = UserManager.getInfoUtente(); Ruolo ruolo = UserManager.getRuolo(); if (CallContextStack.CurrentContext == null) { CallContextStack.CurrentContext = new CallContext("ReportingContext"); } PrintReportRequestDataset request = new PrintReportRequestDataset() { ContextName = "CasellaIstituzionale", ReportType = ReportTypeEnum.PDF, ReportKey = "RicercaCasellaIstituzionale", Title = "Casella Istituzionale", SubTitle = String.Format("Report generato {0} alle {1}", DateTime.Now.ToString("dddd, dd MMMM yyyy"), (DateTime.Now).ToString("HH:mm:ss")), SearchFilters = null, UserInfo = userInfo, InputDataset = reportDataSetDocGrigio }; ReportingUtils.PrintRequest = request; this.ReportRegistry = ReportingUtils.GetReportRegistry(ReportingUtils.PrintRequest.ContextName); ReportingUtils.PrintRequest.ColumnsToExport = this.ReportRegistry.Where(r => r.ReportKey == request.ReportKey).First().ExportableFields; FileDocumento fd = ReportingUtils.GenerateReport(request); int retValue = 0; try { DocsPaWR.SchedaDocumento scheda = new SchedaDocumento(); DocsPaWR.Oggetto ogg = new Oggetto(); DocsPaWR.FileRequest fr = null; //Report Casella Istituzional del RF: codice/descrizione ogg.descrizione = String.Format("Report Casella Istituzionale {0} del {1} alle {2}", txtCodiceRegistro.Text, DateTime.Now.ToString("dddd, dd MMMM yyyy"), (DateTime.Now).ToString("HH:mm:ss")); scheda.oggetto = ogg; scheda.personale = "0"; scheda.privato = "0"; scheda.userId = UserManager.getInfoUtente().userId; scheda.typeId = "LETTERA"; scheda.tipoProto = "G"; scheda.appId = "ACROBAT"; scheda.idPeople = UserManager.getInfoUtente().idPeople; scheda = docsPaWS.DocumentoAddDocGrigia(scheda, UserManager.getInfoUtente(), UserManager.getRuolo()); fr = (DocsPAWA.DocsPaWR.FileRequest)scheda.documenti[0]; fr.docNumber = scheda.docNumber; fr = docsPaWS.DocumentoPutFile(fr, fd, UserManager.getInfoUtente()); if (fr != null) { retValue = 1; } //disabilito il pulsante di creazione doc grigio btnDocGrigio.Enabled = false; if (trasmDoc) { CreateAndTrasmDoc(scheda, userInfo, ruolo); } } catch (Exception ex) { retValue = 0; } return(retValue); }
protected void btnExport_Click(object sender, EventArgs e) { InfoUtente userInfo = UserManager.getInfoUtente(); // Inizializzazione del call context if (CallContextStack.CurrentContext == null) { CallContextStack.CurrentContext = new CallContext("ReportingContext"); } // Salvataggio della request nel call context if (this.ModelloTrasmissioneArray != null) { PrintReportObjectTransformationRequest request = new PrintReportObjectTransformationRequest() { ContextName = "FindAndReplace", SearchFilters = null, UserInfo = userInfo, DataObject = this.ModelloTrasmissioneArray, AdditionalInformation = String.Format("Ruolo da sostituire: {0} ({1})\nRuolo da utilizzare per la sostituzione: {2} ({3})", this.txtFindDescrizione.Text, this.txtFindCodice.Text, this.txtReplaceDescrizione.Text, this.txtReplaceCodice.Text) }; ReportingUtils.PrintRequest = request; ScriptManager.RegisterStartupScript(this, this.GetType(), "openReport", ReportingUtils.GetOpenReportPageScript(false), true); } }