Example #1
0
 public void setSessionFilePDF(DocsPAWA.DocsPaWR.FileDocumento filePdf)
 {
     if (System.Web.HttpContext.Current.Session["SESSION_PDF"] == null)
     {
         System.Web.HttpContext.Current.Session.Add("SESSION_PDF", filePdf);
     }
 }
Example #2
0
        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);
            }
        }
Example #3
0
 /// <summary>
 /// Rendering del contenuto del documento
 /// </summary>
 /// <param name="fileDocument"></param>
 private void RenderDocumentContent(DocsPAWA.DocsPaWR.FileDocumento fileDocument)
 {
     Response.ContentType = fileDocument.contentType;
     Response.AddHeader("content-disposition", "inline;filename=" + fileDocument.name);
     Response.AddHeader("content-lenght", fileDocument.content.Length.ToString());
     Response.BinaryWrite(fileDocument.content);
 }
Example #4
0
        public DocsPAWA.DocsPaWR.FileDocumento getSessionFilePDF()
        {
            DocsPAWA.DocsPaWR.FileDocumento filePdf = new DocsPAWA.DocsPaWR.FileDocumento();

            if (System.Web.HttpContext.Current.Session["SESSION_PDF"] != null)
            {
                filePdf = (DocsPAWA.DocsPaWR.FileDocumento)System.Web.HttpContext.Current.Session["SESSION_PDF"];
            }
            return(filePdf);
        }
Example #5
0
        /// <summary>
        /// setSelectedFileReport: imposta il file report
        /// </summary>
        /// <param name="page">Pagina da cui viene richiamato il metodo</param>
        /// <param name="fileDoc">file da impostare</param>
        /// <param name="initialPath">repository</param>
        public static void setSelectedFileReport(Page page, DocsPAWA.DocsPaWR.FileDocumento fileDoc, string initialPath)
        {
            page.Session["FileManager.selectedReport"] = fileDoc;
            string visReportPath = "";

            if (initialPath != "")
            {
                visReportPath = initialPath + "/visualizzaReport.aspx";
            }
            else
            {
                visReportPath = "ProspettiRiepilogativi_RF.aspx";
            }
            //carica la new pg
            //string funct_dx2 = "top.principale.iFrame_dettagli.document.location='"+url+"'";
            //page.Response.Write("<script> " + funct_dx2 + "</script>");
            string funct_dx = "top.principale.iFrame_dettagli.document.location='" + visReportPath + "'";

            //string  funct_dx = " window.open('"+visReportPath+"','main')";
            page.Response.Write("<script> " + funct_dx + "</script>");
        }
Example #6
0
        private void Export()
        {
            string oggetto   = this.hd_export.Value;
            string tipologia = string.Empty;
            string titolo    = this.txt_titolo.Text;

            DocsPaWR.InfoUtente    userInfo  = UserManager.getInfoUtente(this);
            DocsPaWR.Ruolo         userRuolo = UserManager.getRuolo(this);
            DocsPaWR.FileDocumento file      = new DocsPAWA.DocsPaWR.FileDocumento();
            string docOrFasc = Request.QueryString["docOrFasc"];

            // Lista dei system id degli elementi selezionati
            String[] objSystemId = null;

            // Se nella request c'è il valore fromMassiveOperation...
            if (Request["fromMassiveOperation"] != null)
            {
                List <MassiveOperationTarget> temp = MassiveOperationUtils.GetSelectedItems();
                objSystemId = new String[temp.Count];
                for (int i = 0; i < temp.Count; i++)
                {
                    objSystemId[i] = temp[i].Id;
                }
            }

            // Reperimento dalla sessione del contesto di ricerca fulltext
            DocsPAWA.DocsPaWR.FullTextSearchContext context = Session["FULL_TEXT_CONTEXT"] as DocsPAWA.DocsPaWR.FullTextSearchContext;

            if (rbl_XlsOrPdf.SelectedValue == "PDF")
            {
                tipologia = "PDF";
            }
            else if (rbl_XlsOrPdf.SelectedValue == "XLS")
            {
                tipologia = "XLS";
            }
            else if (rbl_XlsOrPdf.SelectedValue == "Model")
            {
                tipologia = "Model";
            }
            else if (rbl_XlsOrPdf.SelectedValue == "ODS")
            {
                tipologia = "ODS";
            }
            try
            {
                //Se la tipologia scelta è "XLS" recupero i campi scelti dall'utente
                if (tipologia == "XLS" || tipologia == "ODS")
                {
                    ArrayList campiSelezionati = getCampiSelezionati();

                    if ((campiSelezionati.Count != 0) || (hd_export.Value.Equals("rubrica")))
                    {
                        exportDatiManager manager = new exportDatiManager(oggetto, tipologia, titolo, userInfo, userRuolo, context, docOrFasc, campiSelezionati, objSystemId);
                        file = manager.Export();
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "noCampi", "alert('Selezionare almeno un campo per da esportare.');", true);
                    }
                }
                else
                {
                    if (tipologia == "Model")
                    {
                        ArrayList campiSelezionati = getCampiSelezionati();

                        if ((campiSelezionati.Count != 0))
                        {
                            exportDatiManager manager = new exportDatiManager(oggetto, tipologia, titolo, userInfo, userRuolo, context, docOrFasc, campiSelezionati, objSystemId);
                            file = manager.Export();
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(this.GetType(), "noCampi", "alert('Selezionare almeno un campo per da esportare.');", true);
                        }
                    }
                    else
                    {
                        if (tipologia == "PDF")
                        {
                            exportDatiManager manager = new exportDatiManager(oggetto, tipologia, titolo, userInfo, userRuolo, context, docOrFasc, objSystemId);
                            file = manager.Export();
                        }
                    }
                }


                if (file == null || file.content == null || file.content.Length == 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "noRisultatiRicerca", "alert('Nessun documento trovato.');", true);
                    ClientScript.RegisterStartupScript(this.GetType(), "openFile", "OpenFile('" + tipologia + "');", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "openFile", "OpenFile('" + tipologia + "');", true);
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "errore", "alert('Errore di sistema: " + ex.Message.Replace("'", "\\'") + "');", true);
            }
        }
Example #7
0
        public static DocsPAWA.DocsPaWR.FileDocumento CreaReportPianiRientro(Page page, int id_registro, string registro, string dataInizio, string dataFine)
        {
            string        temporaryXSLFilePath = string.Empty;
            StreamWriter  writer = null;
            StringBuilder sb     = new StringBuilder();
            int           res    = 0;

            DocsPAWA.DocsPaWR.FileDocumento file = new DocsPAWA.DocsPaWR.FileDocumento();

            try
            {
                //Creazione stringa XML
                sb = creaXML(id_registro, registro, dataInizio, dataFine, out res);

                //Salva e chiudi il file
                //temporaryXSLFilePath = HttpContext.Current.Server.MapPath(@"../../xls/PianiDiRientro-" + registro + ".xls");

                temporaryXSLFilePath = DocsPaUtils.Configuration.InitConfigurationKeys.GetValue("0", "BE_TEMP_PATH");
                temporaryXSLFilePath = Path.Combine(temporaryXSLFilePath, "Report");
                if (!Directory.Exists(temporaryXSLFilePath))
                {
                    Directory.CreateDirectory(temporaryXSLFilePath);
                }

                temporaryXSLFilePath = Path.Combine(temporaryXSLFilePath, "PianiDiRientro-" + registro + ".xls");

                writer           = new StreamWriter(temporaryXSLFilePath, true);
                writer.AutoFlush = true;
                writer.WriteLine(sb.ToString());
                writer.Flush();
                writer.Close();

                //crea il file
                FileStream stream = new FileStream(temporaryXSLFilePath, FileMode.Open, FileAccess.Read);
                if (stream != null)
                {
                    byte[] contentExcel = new byte[stream.Length];
                    stream.Read(contentExcel, 0, contentExcel.Length);
                    stream.Flush();
                    stream.Close();
                    stream              = null;
                    file.content        = contentExcel;
                    file.length         = contentExcel.Length;
                    file.estensioneFile = "xls";
                    file.name           = "PianiRientro";
                    file.contentType    = "application/vnd.ms-excel";
                }
                File.Delete(temporaryXSLFilePath);

                //gestione errore
                if (res != 0)
                {
                    throw new Exception("Si è verificato un errore nella creazione del report");
                }
                else
                if (res == 0 && file == null)
                {
                    page.Response.Write("<script>alert('Non ci sono dati per il Rapporto selezionato')</script>");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                file = null;
                logger.Error(ex);
                DocsPAWA.ErrorManager.redirect(page, ex);
            }
            return(file);
        }
Example #8
0
        /// <summary>
        /// Upload del documento
        /// </summary>
        /// <param name="fileDoc"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public bool Upload(DocsPAWA.DocsPaWR.FileDocumento fileDoc, bool conversionePDFServer, out string errorMessage)
        {
            bool retValue = false;

            errorMessage = string.Empty;

            try
            {
                ProtocollazioneIngressoLog.WriteLogEntry(
                    string.Format("UploadDocumento (FileName: {0} - Dim: {1}", fileDoc.name, fileDoc.content.Length.ToString()));
            }
            catch
            {
            }

            DocsPAWA.DocsPaWR.FileRequest fileReq = this.GetFileRequest(fileDoc.name);

            // Booleano utilizzato per indicare se è necessario convertire in PDF in modalità Asincrona
            bool convertAsync = false;

            if (fileReq != null)
            {
                fileReq.cartaceo = fileDoc.cartaceo;

                ProtocollazioneIngresso.Login.LoginMng loginMng = new ProtocollazioneIngresso.Login.LoginMng(this._page);

                DocsPAWA.DocsPaWR.DocsPaWebService ws = new DocsPAWA.DocsPaWR.DocsPaWebService();
                ws.Timeout = System.Threading.Timeout.Infinite;

                // Se è attiva la conversione PDF sincrona, si prova a convertire il file facendo vincere lei
                // se la conversione va a buon fine, viene associato il file pdf al documento altrimenti viene
                // acquisito il TIF e si prova ad eseguire la conversione asincrona
                if (Utils.IsEbabledConversionePdfLatoServerSincrona().ToLower() == "true")
                {
                    FileDocumento convertedDoc = ws.GeneratePDFInSyncMod(fileDoc);

                    if (convertedDoc == null)
                    {
                        convertAsync = true;
                    }

                    if (convertedDoc != null && convertedDoc.content.Length > 0)
                    {
                        fileDoc = convertedDoc;
                    }
                }


                retValue = ws.DocumentoPutFileNoException(ref fileReq, fileDoc, loginMng.GetInfoUtente(), out errorMessage);
            }

            //Se abilitata la conversione lato server ed è necessario effettuare la conversione asincrona,
            // chiamo il webmethod che mette in coda il file da convertire
            if (retValue && conversionePDFServer && convertAsync)
            {
                DocsPAWA.DocsPaWR.SchedaDocumento documento = null;

                if (fileReq.GetType() == typeof(DocsPAWA.DocsPaWR.Allegato))
                {
                    // Il documento acquisito è un allegato: reperimento della scheda documento
                    documento = DocumentManager.getDettaglioDocumento(this._page, fileReq.docNumber, fileReq.docNumber);
                }
                else
                {
                    ProtocollazioneIngresso.Protocollo.ProtocolloMng protocolloMng = new ProtocollazioneIngresso.Protocollo.ProtocolloMng(this._page);

                    documento = protocolloMng.GetDocumentoCorrente();
                }

                FileManager.EnqueueServerPdfConversion(this._page,
                                                       UserManager.getInfoUtente(this._page),
                                                       fileDoc.content,
                                                       fileDoc.name,
                                                       documento);
            }

            return(retValue);
        }
Example #9
0
 private void AmmStampaOrganigramma(XmlDocument xmlDoc)
 {
     AmmUtils.WebServiceLink ws = new AmmUtils.WebServiceLink();
     this._filePDF = ws.AmmStampaOrganigramma(xmlDoc);
     ws            = null;
 }
Example #10
0
        private void btn_stampa_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            DocsPAWA.DocsPaWR.FileDocumento fileRep = new DocsPAWA.DocsPaWR.FileDocumento();
            try
            {
                string dataInizio = "";
                string dataFine   = "";

                #region controllo che i campi data non siano vuoti
                if (this.txt_initDataScadenza.Text.Equals("") || this.txt_fineDataScadenza.Text.Equals(""))
                {
                    Response.Write("<script>alert('Attenzione inserire il periodo di riferimento.');</script>");
                    string s = "<SCRIPT language='javascript'>document.getElementById('" + txt_initDataScadenza.ID + "').focus();</SCRIPT>";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "focus", s);
                    do_openinRightFrame(this, "whitepage.htm");
                    return;
                }

                if (!this.txt_initDataScadenza.Text.Equals(""))
                {
                    //controllo validità di data iniziale
                    if (!DocsPAWA.Utils.isDate(this.txt_initDataScadenza.Text))
                    {
                        Response.Write("<script>alert('Il formato della data non è valido. \\nIl formato richiesto è gg/mm/aaaa');</script>");
                        string s = "<SCRIPT language='javascript'>document.getElementById('" + txt_initDataScadenza.ID + "').focus();</SCRIPT>";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "focus", s);
                        do_openinRightFrame(this, "whitepage.htm");
                        return;
                    }
                }
                if (!this.txt_fineDataScadenza.Text.Equals(""))
                {
                    //controllo validità di data finale
                    if (!DocsPAWA.Utils.isDate(this.txt_fineDataScadenza.Text))
                    {
                        Response.Write("<script>alert('Il formato della data non è valido. \\nIl formato richiesto è gg/mm/aaaa');</script>");
                        string s = "<SCRIPT language='javascript'>document.getElementById('" + txt_fineDataScadenza.ID + "').focus();</SCRIPT>";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "focus", s);
                        do_openinRightFrame(this, "whitepage.htm");
                        return;
                    }
                }
                if (DocsPAWA.Utils.verificaIntervalloDate(txt_initDataScadenza.Text, txt_fineDataScadenza.Text))
                {
                    //controllo periodo data
                    Response.Write("<script>alert('Verificare intervallo date !');</script>");
                    string s = "<SCRIPT language='javascript'>document.getElementById('" + txt_initDataScadenza.ID + "').focus();</SCRIPT>";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "focus", s);
                    do_openinRightFrame(this, "whitepage.htm");
                    return;
                }
                #endregion

                dataInizio = this.txt_initDataScadenza.Text;
                dataFine   = this.txt_fineDataScadenza.Text;
                int id_reg = Convert.ToInt32(ddl_registro.SelectedValue);
                fileRep = XlsReport.CreaReportPianiRientro(this, id_reg, ddl_registro.SelectedItem.Text, dataInizio, dataFine);
                if (fileRep != null)
                {
                    DocsPAWA.exportDati.exportDatiSessionManager session = new DocsPAWA.exportDati.exportDatiSessionManager();
                    session.SetSessionExportFile(fileRep);
                }
            }
            catch (Exception ex)
            {
                DocsPAWA.ErrorManager.redirectToErrorPage(this, ex);
            }
            if (fileRep != null)
            {
                if (fileRep.content != null && fileRep.content.Length > 0)
                {
                    this.executeJS("<SCRIPT>OpenFile();</SCRIPT>");
                    do_openinRightFrame(this, "whitepage.htm");
                }
                else
                {
                    this.executeJS("<SCRIPT>alert('Impossibile generare il file xls');</SCRIPT>");
                }
            }
            else
            {
                do_alert(this, "Non ci sono dati per il Rapporto selezionato");
                do_openinRightFrame(this, "whitepage.htm");
            }
        }
Example #11
0
        /* ABBATANGELI GIANLUIGI
         * Aggiunto come ultimo parametro la cartella root
         * da utilizzare come root per l'acquisizione massiva*/
        public static int checkORCreateDocFolderFasc(Page page, DocsPAWA.DocsPaWR.Fascicolo fasc, string absolutePath, DocsPAWA.DocsPaWR.FileDocumento fd, string foldName, string type, DocsPAWA.DocsPaWR.Folder folder_Root)
        {
            int retValue = 0;

            DocsPaWR.SchedaDocumento scheda = new SchedaDocumento();
            DocsPaWR.Oggetto         ogg    = new Oggetto();
            DocsPaWR.FileRequest     fr     = null;
            bool daAggiornareUffRef;
            bool inFolder;
            bool fileFormat = false;

            try
            {
                DocsPaWR.Folder folderRoot = null;
                if (folder_Root == null)
                {
                    //get folder dal fascicolo Fasc:
                    folderRoot = FascicoliManager.getFolder(page, fasc);
                }
                else
                {
                    folderRoot = FascicoliManager.getFolder(page, folder_Root);
                }

                //verifico formato file se chiave attiva su backend
                if (docsPaWS.IsEnabledSupportedFileTypes())
                {
                    fileFormat = true;
                }

                ArrayList splitData  = getSplitPath(absolutePath);
                ArrayList rootFolder = findRootFolder(splitData, foldName);

                if ((rootFolder.Count > 0))
                {
                    for (int i = 0; i < rootFolder.Count; i++)
                    {
                        if (type == "DIR")
                        {
                            retValue = checkExsistNode(page, ref folderRoot, rootFolder[i].ToString());
                        }

                        if (type == "FILE")
                        {
                            if (i != rootFolder.Count - 1)
                            {
                                retValue = checkExsistNode(page, ref folderRoot, rootFolder[i].ToString());
                            }

                            else
                            if (verifyFileFormat(page, getExt(rootFolder[i].ToString()), fileFormat))
                            {
                                if (fd.content.Length > 0)
                                {
                                    ogg.descrizione  = rootFolder[i].ToString();
                                    scheda.oggetto   = ogg;
                                    scheda.personale = "0";
                                    scheda.privato   = "0";
                                    scheda.userId    = UserManager.getInfoUtente(page).userId;
                                    scheda.typeId    = "LETTERA";
                                    scheda.tipoProto = "G";
                                    scheda.appId     = "ACROBAT";
                                    scheda.idPeople  = UserManager.getInfoUtente(page).idPeople;
                                    scheda           = docsPaWS.DocumentoAddDocGrigia(scheda, UserManager.getInfoUtente(page), UserManager.getRuolo(page));
                                    // setto le prop di fileDocumento
                                    fd.length = fd.content.Length;
                                    fd.name   = rootFolder[i].ToString();

                                    String message = String.Empty;
                                    //fascicolazione
                                    DocumentManager.addDocumentoInFolder(page, scheda.systemId, folderRoot.systemID, false, out inFolder, out message);

                                    //acq img
                                    if (scheda.documenti != null && scheda.documenti[0] != null)
                                    {
                                        fr = (DocsPAWA.DocsPaWR.FileRequest)scheda.documenti[0];
                                        fr = docsPaWS.DocumentoPutFile(fr, fd, UserManager.getInfoUtente(page));

                                        if (fr != null)
                                        {
                                            retValue = 1;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                retValue = 2;
                            }
                        }
                    }
                }
            }

            catch (Exception ex) { retValue = 0; }

            return(retValue);
        }