protected void Export(List <DocsPaWR.ItemReportPregressi> reportInErr) { DocsPaWR.FileDocumento file = new DocsPAWA.DocsPaWR.FileDocumento(); try { file = GetFile(reportInErr); //Andrea De Marco - Aggiunto importFileName al Nome del File: EsitoControllo_nomefile. if (file != null) { file.name = file.name + importFileName; } if (file == null || file.content == null || file.content.Length == 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "noRisultatiRicerca", "alert('Nessun documento trovato.');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "openFile", "OpenFile('" + file.name.ToString() + "');", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "errore", "alert('Errore di sistema: " + ex.Message.Replace("'", "\\'") + "');", true); } }
/// <summary> /// /// </summary> /// <param name="xmlDom"></param> /// <param name="nodeName"></param> /// <param name="addVersion"></param> /// <param name="errorMessage"></param> /// <returns></returns> private bool AppendFile(XmlDocument xmlDom, string nodeName, bool addVersion, bool convertPdfServer, out string errorMessage) { bool retValue = true; errorMessage = string.Empty; XmlNode file = xmlDom.SelectSingleNode("root/" + nodeName); if (file != null) { string fileBuf = file.FirstChild.Value; DocsPAWA.DocsPaWR.FileDocumento fileDoc = new DocsPAWA.DocsPaWR.FileDocumento(); fileDoc.name = file.Attributes["FileName"].Value; fileDoc.cartaceo = true; fileDoc.fullName = fileDoc.name; fileDoc.content = Convert.FromBase64String(fileBuf); fileDoc.length = fileDoc.content.Length; DocumentUploader docUploader = new DocumentUploader(this); retValue = docUploader.Upload(fileDoc, convertPdfServer, out errorMessage); } return(retValue); }
private void Page_Load(object sender, System.EventArgs e) { try { DocsPaWR.FileDocumento filePdf = new DocsPAWA.DocsPaWR.FileDocumento(); Amministrazione.Manager.OrganigrammaManager manager = new Amministrazione.Manager.OrganigrammaManager(); filePdf = manager.getSessionFilePDF(); manager.releaseSessionFilePDF(); if (filePdf.content.Length > 0) { Response.ContentType = filePdf.contentType; Response.AddHeader("content-disposition", "inline;filename=" + filePdf.fullName); Response.AddHeader("content-lenght", filePdf.content.Length.ToString()); Response.BinaryWrite(filePdf.content); } else { this.executeJS("<SCRIPT>alert('Si è verificato un errore nella generazione del file PDF da stampare');self.close();</SCRIPT>"); } } catch (Exception ex) { this.executeJS("<SCRIPT>alert('Errore di sistema: " + ex.Message.Replace("'", "\\'") + "');self.close();</SCRIPT>"); } }
/// <summary> /// /// </summary> /// <param name="document"></param> /// <param name="errorMessage"></param> /// <returns></returns> private bool UploadFile(XmlDocument document, out string errorMessage) { bool retValue = false; errorMessage = string.Empty; DocsPAWA.DocsPaWR.FileDocumento fileDoc = new DocsPAWA.DocsPaWR.FileDocumento(); XmlNode rootNode = document.SelectSingleNode("File"); if (rootNode != null) { fileDoc.name = rootNode.Attributes.GetNamedItem("name").Value; fileDoc.fullName = rootNode.Attributes.GetNamedItem("fullPath").Value; fileDoc.cartaceo = true; string content = rootNode.Attributes.GetNamedItem("content").Value; fileDoc.content = Convert.FromBase64String(content); fileDoc.length = fileDoc.content.Length; DocumentUploader docUploader = new DocumentUploader(this); retValue = docUploader.Upload(fileDoc, false, out errorMessage); } return(retValue); }
private void Page_Load(object sender, System.EventArgs e) { try { DocsPaWR.FileDocumento file = new DocsPAWA.DocsPaWR.FileDocumento(); exportLogSessionManager sessioneManager = new exportLogSessionManager(); file = sessioneManager.GetSessionExportFile(); sessioneManager.ReleaseSessionExportFile(); if (file != null && file.content.Length > 0) { Response.ContentType = file.contentType; Response.AddHeader("content-disposition", "inline;filename=" + file.fullName); Response.AddHeader("content-lenght", file.content.Length.ToString()); Response.BinaryWrite(file.content); } else { this.executeJS("<SCRIPT>alert('Impossibile generare il documento di esportazione dei dati.\nContattare l'amministratore di sistema.');self.close();</SCRIPT>"); } } catch { this.executeJS("<SCRIPT>alert('Impossibile generare il documento di esportazione dei dati.\nContattare l'amministratore di sistema.');self.close();</SCRIPT>"); } }
/// <summary> /// Imposta la sessione dell'export /// </summary> public void SetSessionExportFile(DocsPAWA.DocsPaWR.FileDocumento file) { if (System.Web.HttpContext.Current.Session[EXPORT_FILE_SESSION] == null) { System.Web.HttpContext.Current.Session.Add(EXPORT_FILE_SESSION, file); } }
protected void Page_Load(object sender, EventArgs e) { DocsPAWA.DocsPaWR.FileDocumento result = null; Response.Expires = -1; FirmaDigitale.FirmaDigitaleMng firmaDigitaleMng = new FirmaDigitale.FirmaDigitaleMng(); DocsPAWA.DocsPaWR.FileDocumento fileFirmato = firmaDigitaleMng.GetSignedDocument(this); firmaDigitaleMng = null; // Se ho un file fisico da poter convertire if (fileFirmato != null) { // procedo con la conversione sincrona result = new DocsPAWA.DocsPaWR.DocsPaWebService().GeneratePDFInSyncMod(fileFirmato); } if (result != null) { this.Response.ContentType = "application/pdf"; this.Response.AddHeader("content-length", result.content.Length.ToString()); this.Response.BinaryWrite(result.content); } else { this.Response.StatusCode = 500; this.Response.StatusDescription = "Non è stato possibile convertire il documento in PDF lato server"; } }
/// <summary> /// Pulsante di Stampa /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_stampa_Click(object sender, System.Web.UI.ImageClickEventArgs e) { try { XmlDocument xmlDoc = this.exportToXML(); if (xmlDoc != null && (xmlDoc.InnerXml != string.Empty || xmlDoc.InnerXml != "")) { DocsPaWR.FileDocumento filePdf = new DocsPAWA.DocsPaWR.FileDocumento(); Amministrazione.Manager.OrganigrammaManager manager = new Amministrazione.Manager.OrganigrammaManager(); manager.StampaOrganigramma(xmlDoc); filePdf = manager.getFilePDF(); if (filePdf != null && filePdf.content.Length > 0) { manager.setSessionFilePDF(filePdf); this.executeJS("<SCRIPT>stampa();</SCRIPT>"); } } } catch (Exception ex) { this.executeJS("<SCRIPT>alert('Errore di sistema: " + ex.Message.Replace("'", "\\'") + "');</SCRIPT>"); } }
protected void btn_conferma_Click(object sender, EventArgs e) { try { // selezione tipo report string reportType = this.lbl_type.Text.Trim(); // selezione formato string formato = this.ddl_format.SelectedValue; // reperimento dati amministrazione string idAmm = AmmUtils.UtilsXml.GetAmmDataSession((string)Session["AMMDATASET"], "3"); DocsPAWA.DocsPaWR.FileDocumento fileDoc = new DocsPAWA.DocsPaWR.FileDocumento(); AmmUtils.WebServiceLink ws = new AmmUtils.WebServiceLink(); fileDoc = ws.GetReportFunzioni(reportType, formato, this.lbl_cod.Text.Trim(), idAmm); if (fileDoc != null) { Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fileDoc.name); Response.BinaryWrite(fileDoc.content); Response.Flush(); Response.End(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "exportFailed", "alert('Si è verificato un errore nel processo di esportazione.');", true); } }
/// <summary> /// /// </summary> /// <param name="xmlDom"></param> /// <param name="nodeName"></param> /// <param name="addVersion"></param> /// <param name="cartaceo"></param> private void UploadFile(XmlDocument xmlDom, string nodeName, bool addVersion, bool cartaceo, bool convertiPDF, bool convertiPDFServer, bool conversionePDFServerSincrona) { XmlNode file = xmlDom.SelectSingleNode("root/" + nodeName); if (file != null) { string fileBuf = file.FirstChild.Value; DocsPaWR.FileDocumento fileDoc = new DocsPAWA.DocsPaWR.FileDocumento(); fileDoc.name = file.Attributes["FileName"].Value; fileDoc.fullName = fileDoc.name; fileDoc.content = Convert.FromBase64String(fileBuf); fileDoc.length = fileDoc.content.Length; fileDoc.cartaceo = cartaceo; //if(Convert.ToBoolean(DocsPAWA.Utils.isEnableConversionePdfLatoServer()) || Boolean.Parse(Utils.IsEbabledConversionePdfLatoServerSincrona())) // Se è richiesta conversione pdf centralizzata if (convertiPDF && convertiPDFServer) { FileManager.getInstance(Session.SessionID).uploadFile(this, fileDoc, addVersion, convertiPDFServer, conversionePDFServerSincrona); } else { // ...altrimenti si procede con upload del file senza coversione FileManager.getInstance(Session.SessionID).uploadFile(this, fileDoc, addVersion); } } }
/// <summary> /// Recupera l'export in sessione /// </summary> /// <returns></returns> public DocsPAWA.DocsPaWR.FileDocumento GetSessionExportFile() { DocsPaWR.FileDocumento filePdf = new DocsPAWA.DocsPaWR.FileDocumento(); if (System.Web.HttpContext.Current.Session[EXPORT_FILE_SESSION] != null) { filePdf = (DocsPAWA.DocsPaWR.FileDocumento)System.Web.HttpContext.Current.Session[EXPORT_FILE_SESSION]; } return(filePdf); }
private void Page_Load(object sender, System.EventArgs e) { Response.Expires = -1; bool getHash = false; string signType = this.Request.QueryString["signType"]; if (!String.IsNullOrEmpty(signType)) { if (signType == "P" || signType == "C") { getHash = true; } } bool cosign = false; string cosignStr = this.Request.QueryString["tipoFirma"]; if (!String.IsNullOrEmpty(cosignStr)) { if (cosignStr.ToLower().Equals("cosign")) { cosign = true; } } FirmaDigitale.FirmaDigitaleMng firmaDigitaleMng = new FirmaDigitale.FirmaDigitaleMng(); if (!getHash) { DocsPAWA.DocsPaWR.FileDocumento fileFirmato = firmaDigitaleMng.GetSignedDocument(this); firmaDigitaleMng = null; if (fileFirmato != null) { Response.BinaryWrite(fileFirmato.content); } } else { if (!cosign) { bool pades = (signType == "P"); Response.BinaryWrite(System.Text.ASCIIEncoding.ASCII.GetBytes(firmaDigitaleMng.GetSignedDocumentHash(this, pades))); } else { Response.BinaryWrite(System.Text.ASCIIEncoding.ASCII.GetBytes(firmaDigitaleMng.GetCoSignDocumentHash(this))); } } }
/// <summary> /// Reperimento del documento firmato /// </summary> /// <param name="page"></param> /// <param name="fileRequest"></param> /// <returns></returns> public DocsPAWA.DocsPaWR.FileDocumento GetSignedDocument(System.Web.UI.Page page, DocsPaWR.FileRequest fileRequest) { DocsPAWA.DocsPaWR.DocsPaWebService ws = DocsPAWA.ProxyManager.getWS(); DocsPAWA.DocsPaWR.FileDocumento retValue = ws.DocumentoGetFileFirmato(fileRequest, DocsPAWA.UserManager.getInfoUtente()); if (retValue == null) { throw new ApplicationException("Attenzione! il file non è visualizzabile.<br><br>Verificare:<br>• l'esistenza del file in:<br>" + fileRequest.docServerLoc + fileRequest.path + fileRequest.fileName + "<br><br>• la stringa di Impronta sulla base dati."); } return(retValue); }
protected void Page_Load(object sender, EventArgs e) { int statusCode = 0; if ((Request.QueryString["Absolutepath"] != null) && (Request.QueryString["Absolutepath"] != "")) { //1. controllo se arriva la path assoluta absolutePath = decodeQueryString(Request.QueryString["Absolutepath"].ToString()); //1.1 Leggo il content del file byte[] ba = Request.BinaryRead(Request.ContentLength); fd = new DocsPAWA.DocsPaWR.FileDocumento(); fd.content = ba; //1.2 leggo il codice fascicolo if (Request.QueryString["codFasc"] != null && Request.QueryString["codFasc"] != "") { codFasc = decodeQueryString(Request.QueryString["codFasc"].ToString()); //fasc = FascicoliManager.getFascicoloDaCodice(this.Page, codFasc); fasc = FascicoliManager.getFascicoloDaCodice2(this.Page, codFasc, Request.QueryString["idTitolario"]); } //1.4. tipo passato if (Request.QueryString["type"] != null && Request.QueryString["type"] != "") { type = Request.QueryString["type"].ToString(); } if (Request.QueryString["foldName"] != null && Request.QueryString["foldName"] != "") { foldName = decodeQueryString(Request.QueryString["foldName"].ToString()); } //1.5. se tutte le condizioni sono ok... procedo if ((codFasc != "") && (absolutePath != "")) { /* ABBATANGELI GIANLUIGI * prendo la cartella selezionata per l'acquisizione massiva */ DocsPaWR.Folder folder = null; if (Session["fascDocumenti.FolderSel"] != null) { folder = (DocsPaWR.Folder)Session["fascDocumenti.FolderSel"]; } statusCode = importDocManager.checkORCreateDocFolderFasc(this.Page, fasc, absolutePath, fd, foldName, type, folder); // parsing degli stati parseStatusCode(statusCode); } } }
private void Page_Load(object sender, System.EventArgs e) { Response.Expires = -1; DocsPAWA.DocsPaWR.FileDocumento theDoc = null; theDoc = (DocsPAWA.DocsPaWR.FileDocumento)utility.getSelectedFileReport(this); if (theDoc != null) { Response.ContentType = theDoc.contentType; Response.AddHeader("content-disposition", "inline;filename=" + theDoc.name); Response.AddHeader("content-lenght", theDoc.content.Length.ToString()); Response.BinaryWrite(theDoc.content); } }
protected void btnConferma_Click(object sender, EventArgs e) { try { string exportType = this.Request.QueryString["ExportType"]; DocsPAWA.DocsPaWR.FileDocumento fileDoc = new DocsPAWA.DocsPaWR.FileDocumento(); // selezione formato string formato = this.ddl_format.SelectedValue; if (string.IsNullOrEmpty(exportType)) { string idRuoloTitolare = !string.IsNullOrEmpty(this.Request.QueryString["idRuoloTitolare"]) ? this.Request.QueryString["idRuoloTitolare"].ToString() : string.Empty; string idUtenteTitolare = !string.IsNullOrEmpty(this.Request.QueryString["idUtenteTitolare"]) ? this.Request.QueryString["idUtenteTitolare"].ToString() : string.Empty; AmmUtils.WebServiceLink ws = new AmmUtils.WebServiceLink(); fileDoc = ws.GetReportProcessiFirma(idRuoloTitolare, idUtenteTitolare, formato); } else { switch (exportType) { case "TRASM_UTENTE": string idPeople = this.Request.QueryString["idPeople"]; string idCorrGlobali = this.Request.QueryString["idCorrGlobali"]; AmmUtils.WebServiceLink ws = new AmmUtils.WebServiceLink(); fileDoc = ws.GetReportTrasmissioniPendentiUtente(idPeople, idCorrGlobali, formato); break; } } if (fileDoc != null) { // Inizializzazione del call context if (CallContextStack.CurrentContext == null) { CallContextStack.CurrentContext = new CallContext("ReportingContext"); } CallContextStack.CurrentContext.ContextState["documentFile"] = fileDoc; this.reportContent.Attributes["src"] = "../../popup/Reporting/ReportContent.aspx"; } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "exportFailed", "alert('Si è verificato un errore nel processo di esportazione.');", true); } }
private void UploadFile(XmlDocument document) { DocsPaWR.FileDocumento fileDoc = new DocsPAWA.DocsPaWR.FileDocumento(); XmlNode rootNode = document.SelectSingleNode("File"); if (rootNode != null) { fileDoc.name = rootNode.Attributes.GetNamedItem("name").Value; fileDoc.fullName = rootNode.Attributes.GetNamedItem("fullPath").Value; fileDoc.cartaceo = this.Cartaceo; string content = rootNode.Attributes.GetNamedItem("content").Value; fileDoc.content = Convert.FromBase64String(content); fileDoc.length = fileDoc.content.Length; FileManager.getInstance(Session.SessionID).uploadFile(this, fileDoc, false); } }
protected void Export() { DocsPaWR.FileDocumento file = new DocsPAWA.DocsPaWR.FileDocumento(); try { file = GetFile(); if (file == null || file.content == null || file.content.Length == 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "noRisultatiRicerca", "alert('Nessun documento trovato.');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "openFile", "OpenFile();", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "errore", "alert('Errore di sistema: " + ex.Message.Replace("'", "\\'") + "');", true); } }
protected void Page_Load(object sender, EventArgs e) { string templateFilePath = Server.MapPath("formatPdfExport.xml"); DocsPAWA.DocsPaWR.FileDocumento fileRep = new DocsPAWA.DocsPaWR.FileDocumento(); if ((Session["dsData"] != null) && (Session["dsData"].ToString() != "")) { fileRep = global::ProspettiRiepilogativi.Frontend.PdfReport.do_MakePdfReport(global::ProspettiRiepilogativi.Frontend.ReportDisponibili.ReportLogMassiveImport, templateFilePath, (DataSet)Session["dsData"], null); if (fileRep.length > 0) { Response.ContentType = fileRep.contentType; Response.AddHeader("content-disposition", "inline; filename=" + fileRep.name); Response.AddHeader("content-length", fileRep.content.Length.ToString()); Response.BinaryWrite(fileRep.content); Response.Flush(); } } }
protected void img_exportIndice_Click(object sender, ImageClickEventArgs e) { DocsPAWA.DocsPaWR.OrgTitolario titolario = new DocsPAWA.DocsPaWR.OrgTitolario(); titolario.ID = idTitolario; /* Andrea De Marco - Integra * modificato il timeout ad infinito perchè il servizio * impiegava più di tre minuti per l'ExportIndiceSistematico * * Dopo il rilascio è opportuno utilizzare soluzioni più performanti * che traducano il dataset in xml. */ wws.Timeout = System.Threading.Timeout.Infinite; //End - Andrea De Marco - Integra DocsPAWA.DocsPaWR.FileDocumento fileDoc = wws.ExportIndiceSistematico(titolario); if (fileDoc != null) { DocsPAWA.exportDati.exportDatiSessionManager session = new DocsPAWA.exportDati.exportDatiSessionManager(); session.SetSessionExportFile(fileDoc); ClientScript.RegisterStartupScript(this.GetType(), "openFile", "OpenFile();", true); } }
private void Page_Load(object sender, System.EventArgs e) { Response.Expires = -1; DocsPAWA.DocsPaWR.FileDocumento theDoc = null; theDoc = (DocsPAWA.DocsPaWR.FileDocumento)utility.getSelectedFileReport(this); if (theDoc != null) { Response.ContentType = theDoc.contentType; if (Session["percorso"] != null || !String.IsNullOrEmpty(Request["showAsAttachment"])) { Response.AddHeader("content-disposition", "attachment; filename=" + theDoc.name); Session.Remove("percorso"); } else { Response.AddHeader("content-disposition", "inline; filename=" + theDoc.name); } Response.AddHeader("content-length", theDoc.content.Length.ToString()); Response.BinaryWrite(theDoc.content); Response.Flush(); } }
public static DocsPAWA.DocsPaWR.FileDocumento do_MakePdfReport(ReportDisponibili tipoReport, string templateFilePath, string titolo, DataSet ds, ArrayList parametriPDF) { //inizializzazione dei parametri di input //templateFilePath = templateFilePath + "XMLProspettoRiepilogativo.xml"; StampaPDF.Report stampaReport; string RootPathTemplate = AppDomain.CurrentDomain.BaseDirectory + "ProspettiRiepilogativi/Frontend/TemplateXML/"; string schemaFilePath = RootPathTemplate + "XMLReport.xsd"; string outputFilename = DateTime.Now.ToLongDateString() + ".pdf"; DataTable dt = new DataTable(); Byte[] dati; //variabili ausiliarie FileStream fs = null; MemoryStream memStream = null; //inizializzazione parametro di output (caso integrazione Docspa) DocsPAWA.DocsPaWR.FileDocumento doc = new DocsPAWA.DocsPaWR.FileDocumento(); doc.name = outputFilename; doc.path = ""; doc.fullName = "StampaReport_" + DateTime.Now.ToString(); doc.contentType = "application/pdf"; try { try { //lettura template XML fs = new FileStream(templateFilePath, FileMode.Open, FileAccess.Read); } catch (Exception ex) { throw ex; } try { //inizializzazione oggetto StampaPDF stampaReport = new StampaPDF.Report(fs, schemaFilePath, titolo); } catch (Exception ex) { throw ex; } try { //Agginta dei Paragrafi e della tabella //DataTable da inserire nel Report dt = ds.Tables[0]; //Non funziona se i template sono contenuti in IIS //DO_AppendTextInHeader(templateFilePath,"aaa","PIPPO"); DO_AppendObject(stampaReport, tipoReport, parametriPDF, dt); } catch (Exception ex) { throw ex; } try { //Chiusura template xml fs.Close(); //recupero dati per memory stream memStream = stampaReport.getStream(); //chiusura stream stampa stampaReport.close(); } catch (Exception ex) { throw ex; } try { //vettore di byte dati = memStream.GetBuffer(); #region Salviamo su FileSystem //Salviamo su FileSystem //I file si trovano al percorso: RootPathTemplate + nome file #region Determinazione del FileName //string fileName = ""; // switch(tipoReport) // { // case ReportDisponibili.Annuale_By_Registro: // fileName = RootPathTemplate +"\\"+"PDF\\annualeByReg.pdf"; // break; // case ReportDisponibili.Annuale_By_Fascicolo: // fileName = RootPathTemplate +"\\"+"PDF\\annualeByFasc.pdf"; // break; // case ReportDisponibili.Documenti_Classificati: // fileName = RootPathTemplate +"\\"+"PDF\\docClass.pdf"; // break; // case ReportDisponibili.Documenti_Trasmessi_Altre_AOO: // fileName = RootPathTemplate +"\\"+"PDF\\docTrasmToAOO.pdf"; // break; // case ReportDisponibili.Fascicoli_Per_VT: // fileName = RootPathTemplate +"\\"+"PDF\\fascPerVT.pdf"; // break; // case ReportDisponibili.TempiMediLavFascicoli: // fileName = RootPathTemplate +"\\"+"PDF\\TempiMediLavFasc.pdf"; // break; // } // #endregion // // if(fileName != "") // { // Stream outputStream = new FileStream(fileName,FileMode.Create,FileAccess.Write); // outputStream.Write(dati,0,dati.Length); // // outputStream.Flush(); // outputStream.Close(); // outputStream = null; // } #endregion #endregion //chiudo mem stream memStream.Close(); //aggiorno informazioni del doc : utilizzo un tipo infodocumento come output doc.length = (int)dati.Length; doc.content = dati; } catch (Exception ex) { throw ex; } } catch (Exception ex) { throw ex; } finally { //rilascio oggetti utilizzati if (fs != null) { fs.Close(); } if (memStream != null) { memStream.Close(); } //ritorno oggetto doc (caso integrazione Docspa) } return(doc); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_export_Click(object sender, System.EventArgs e) { string soggetto = this.hd_export.Value; string tipologia = string.Empty; string titolo = string.Empty; if (!string.IsNullOrEmpty(this.txt_titolo.Text)) { titolo = this.txt_titolo.Text; } else { titolo = "exportLog"; } DocsPaWR.FileDocumento file = new DocsPAWA.DocsPaWR.FileDocumento(); // Reperimento dalla sessione del contesto di ricerca fulltext //DocsPAWA.DocsPaWR.FullTextSearchContext context = Session["FULL_TEXT_CONTEXT"] as DocsPAWA.DocsPaWR.FullTextSearchContext; if (this.rd_formatoPDF.Checked) { tipologia = "PDF"; } else if (this.rd_formatoXLS.Checked) { tipologia = "XLS"; } try { string user = string.Empty; string data_da = null; string data_a = null; string oggetto = string.Empty; string azione = string.Empty; string esito = string.Empty; int tabelle = 0; Hashtable filtri = (Hashtable)Session["listaFiltriLog"]; // Filtro user if (filtri.ContainsKey("DATA_DA")) { data_da = (string)filtri["DATA_DA"]; } if (filtri.ContainsKey("DATA_A")) { data_a = (string)filtri["DATA_A"]; } if (filtri.ContainsKey("USER")) { user = (string)filtri["USER"]; } if (filtri.ContainsKey("OGGETTO")) { oggetto = (string)filtri["OGGETTO"]; } if (filtri.ContainsKey("AZIONE")) { azione = (string)filtri["AZIONE"]; } if (filtri.ContainsKey("ESITO")) { esito = (string)filtri["ESITO"]; } if (filtri.ContainsKey("TABELLE")) { tabelle = (int)filtri["TABELLE"]; } exportLogManager manager = new exportLogManager(soggetto, tipologia, titolo, this.codAmm, user, data_a, data_da, oggetto, azione, esito, tabelle); file = manager.Export(); if (file.content != null && file.content.Length > 0) { this.executeJS("<SCRIPT>OpenFile('" + tipologia + "', '" + titolo + "." + tipologia + "');</SCRIPT>"); } else { this.executeJS("<SCRIPT>alert('Impossibile generare il file " + tipologia + "');</SCRIPT>"); } } catch (Exception ex) { this.executeJS("<SCRIPT>alert('Errore di sistema: " + ex.Message.Replace("'", "\\'") + "');</SCRIPT>"); } }
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here try { Utils.startUp(this); this.ErrorPage = ""; this.Button1.Attributes.Add("onclick", "window.close();"); bool useHash = false; string signType = this.Request.QueryString["signType"]; if (!String.IsNullOrEmpty(signType)) { if (signType == "P" || signType == "C") { useHash = true; } } bool coSign = false; string cosignStr = this.Request.QueryString["tipoFirma"]; if (!String.IsNullOrEmpty(cosignStr)) { if (cosignStr.ToLower().Equals("cosign")) { coSign = true; } } if (Request.QueryString["tipofirma"] != null) { if (!Request.QueryString["tipofirma"].Equals("")) { tipofirma = Request.QueryString["tipofirma"]; } } if (tipofirma.Equals("cosign")) { firmabool = true; } else { firmabool = false; } byte[] ba = Request.BinaryRead(Request.ContentLength); DocsPaWR.DocsPaWebService DocsPaWS = ProxyManager.getWS(); DocsPaWR.FileDocumento fd = new DocsPAWA.DocsPaWR.FileDocumento(); //fd.content=ba; ASCIIEncoding ae = new ASCIIEncoding(); string base64content = ae.GetString(ba); if (UserManager.getBoolDocSalva(this) == null) { if (!IsPostBack) { // string prova=base64content.Replace(base64content.Substring(4,2),"Ds"); DocsPaWR.FileRequest fr = FileManager.getSelectedFile(this); if (!string.IsNullOrEmpty(Request.QueryString["signedAsPdf"])) { // Se il file è in formato pdf, viene modificato il nome del file bool signedAsPdf; bool.TryParse(Request.QueryString["signedAsPdf"], out signedAsPdf); if (signedAsPdf) { fr.fileName += ".pdf"; } } fr.dataInserimento = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); if (fr.GetType().Equals(typeof(DocsPAWA.DocsPaWR.Allegato))) { // Creazione di un nuovo allegato per il file firmato DocsPaWR.Allegato currentAllegato = (DocsPAWA.DocsPaWR.Allegato)fr; DocsPaWR.Allegato newAllegato = new DocsPAWA.DocsPaWR.Allegato(); newAllegato.descrizione = currentAllegato.descrizione; newAllegato.numeroPagine = currentAllegato.numeroPagine; newAllegato.fileName = fr.fileName; newAllegato.firmatari = currentAllegato.firmatari; newAllegato.docNumber = currentAllegato.docNumber; newAllegato.version = "0"; newAllegato.repositoryContext = DocumentManager.getDocumentoInLavorazione().repositoryContext; fr = newAllegato; } bool retValue = false; if (!useHash) { retValue = DocsPaWS.AppendDocumentoFirmato(base64content, firmabool, ref fr, UserManager.getInfoUtente(this)); } else { bool pades = (signType == "P"); DocsPaWR.MassSignature msReq = new DocsPaWR.MassSignature { fileRequest = fr, base64Signature = base64content, signPades = pades, cosign = coSign }; DocsPaWR.MassSignature msRet = DocsPaWS.signDocument(msReq, UserManager.getInfoUtente(this)); retValue = msRet.result; } if (!retValue) { logger.Error("Errore nel Page_Load (docs = NULL)"); throw new Exception(); } FileManager.setSelectedFile(this, fr); DocsPaWR.SchedaDocumento schedaDocumento = DocumentManager.getDocumentoSelezionato(this); if (fr.GetType().Equals(typeof(DocsPAWA.DocsPaWR.Allegato))) { schedaDocumento.allegati = DocumentManager.addAllegato(schedaDocumento.allegati, (DocsPAWA.DocsPaWR.Allegato)fr); } else { schedaDocumento.documenti = DocumentManager.addVersione(schedaDocumento.documenti, (DocsPAWA.DocsPaWR.Documento)fr); } DocumentManager.setDocumentoSelezionato(this, schedaDocumento); UserManager.setBoolDocSalva(this, "salvato"); } } } catch (Exception es) { ErrorManager.setError(this, es); } }