protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (this.FileDocumento != null && this.FileDocumento.content.Length > 0)
         {
             Response.ContentType = this.FileDocumento.contentType;
             Response.AddHeader("content-disposition", "inline;filename=export.xls");
             Response.AddHeader("content-lenght", this.FileDocumento.content.Length.ToString());
             if (this.IsApplet || IsSocket)
             {
                 string base64String = System.Convert.ToBase64String(this.FileDocumento.content, 0, this.FileDocumento.content.Length);
                 Response.Write(base64String);
             }
             else
             {
                 Response.BinaryWrite(this.FileDocumento.content);
                 Response.Flush();
             }
             this.FileDocumento = null;
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "parent.ajaxDialogModal('ErrorExportDati', 'warning', '');", true);
         }
     }
     catch
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "parent.ajaxDialogModal('ErrorExportDati', 'warning', '');", true);
     }
 }
Ejemplo n.º 2
0
        private static DocsPaWR.FileDocumento getInvoicePreview(string invoice)
        {
            try
            {
                string urlXSL = System.Configuration.ConfigurationManager.AppSettings["FATTURAPA_XSL_URL"];

                XmlDocument previewInvoice = new XmlDocument();
                //string decl = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
                string decl       = "<?xml version=\"1.0\" encoding=\"utf-16\"?>";
                string pi         = "<?xml-stylesheet type=\"text/xsl\" href=\"" + urlXSL + "\"?>";
                string previewXml = invoice.Replace(decl, decl + "\n" + pi);
                previewInvoice.LoadXml(previewXml);

                Byte[] bytes = Encoding.UTF8.GetBytes(previewInvoice.OuterXml);
                DocsPaWR.FileDocumento fileDoc = new DocsPaWR.FileDocumento();

                fileDoc.cartaceo    = false;
                fileDoc.contentType = "text/xml";
                fileDoc.content     = bytes;
                fileDoc.length      = bytes.Length;

                return(fileDoc);
            }
            catch (Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return(null);
            }
        }
Ejemplo n.º 3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Response.Expires = -1;
            DocsPaWR.FileDocumento theDoc = null;

            if (Session["docToSign"] == null)
            {
                id = Request["id"];
                if (!(id != null && !id.Equals("")))
                {
                    id = Session.SessionID;
                }

                theDoc = FileManager.getInstance(id).getFile(this);
            }
            else
            {
                theDoc = (DocsPAWA.DocsPaWR.FileDocumento)Session["docToSign"];
            }

            if (theDoc != null)
            {
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-disposition", "inline;filename=" + theDoc.name);
                Response.AddHeader("content-lenght", theDoc.content.Length.ToString());
                Response.BinaryWrite(theDoc.content);
            }
        }
Ejemplo n.º 4
0
        private FileDocumento GetSignedDocumentFromSession()
        {
            bool loadSignedDocFromSession = this.LoadSignedDocumentFromSession();

            DocsPaWR.FileDocumento signedDocument = null;

            if (!loadSignedDocFromSession)
            {
                // Reperimento documento firmato da backend
                DocumentManager.RemoveSignedDocument();

                DocsPaWR.FileRequest fileRequest = FileManager.getSelectedFile(this);

                if (fileRequest != null && fileRequest.fileName != null && fileRequest.fileName != "")
                {
                    DocsPaWR.InfoUtente infoUtente = UserManager.getInfoUtente(this);

                    DocsPaWR.DocsPaWebService docsPaWS = new DocsPAWA.DocsPaWR.DocsPaWebService();
                    signedDocument = docsPaWS.DocumentoGetFile(fileRequest, infoUtente);
                    docsPaWS       = null;

                    DocumentManager.SetSignedDocument(signedDocument);
                }
            }
            else
            {
                // Reperimento documento firmato da session
                signedDocument       = DocumentManager.GetSignedDocument();
                Session["docToSign"] = signedDocument;
            }

            return(signedDocument);
        }
Ejemplo n.º 5
0
 protected void DocumentImgPrintReceipt_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(Utils.InitConfigurationKeys.GetValue("0", DBKeys.FE_RICEVUTA_PROTOCOLLO_PDF.ToString())) && Utils.InitConfigurationKeys.GetValue("0", DBKeys.FE_RICEVUTA_PROTOCOLLO_PDF.ToString()) == "1")
         {
             ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "PrintReceiptPDF", "ajaxModalPopupPrintReceiptPdf();", true);
         }
         else
         {
             HttpContext.Current.Session["visualReportAlreadyDownloaded" + Session.SessionID] = null;
             DocsPaWR.FileDocumento fileRep = DocumentManager.StampaRicevutaProtocolloRtf();
             FileManager.setSelectedFileReport(this.Page, fileRep, "../popup");
             if (fileRep != null)
             {
                 exportDatiSessionManager session = new exportDatiSessionManager();
                 session.SetSessionExportFile(fileRep);
             }
         }
     }
     catch (System.Exception ex)
     {
         UIManager.AdministrationManager.DiagnosticError(ex);
         return;
     }
 }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = -1;
            DocsPaWR.FileDocumento theDoc = null;
            string PosLabelPdf            = null;

            DocsPaWR.labelPdf label = new DocsPAWA.DocsPaWR.labelPdf();
            bool   tipo             = false;
            string rotazione        = null;
            string orientamento     = null;
            string carattere        = string.Empty;
            string colore           = string.Empty;

            DocsPaWR.SchedaDocumento schedaCorrente = DocumentManager.getDocumentoSelezionato(Page);

            DocsPaVO.documento.FileRequest fr = new DocsPaVO.documento.FileRequest();

            if (this.Session["personalize"] != null)
            {
                PosLabelPdf = this.Session["personalize"].ToString();
            }
            if (Session["tipoLabel"] != null)
            {
                tipo = System.Convert.ToBoolean(Session["tipoLabel"].ToString());
            }
            if (Session["rotazione"] != null)
            {
                rotazione = Session["rotazione"].ToString();
            }
            if (Session["carattere"] != null)
            {
                carattere = Session["carattere"].ToString();
            }
            if (Session["colore"] != null)
            {
                colore = Session["colore"].ToString();
            }
            if (Session["orientamento"] != null)
            {
                orientamento = Session["orientamento"].ToString();
            }
            //carico i dati dentro l'oggetto Label
            label.position       = PosLabelPdf;
            label.tipoLabel      = tipo;
            label.label_rotation = rotazione;
            label.sel_font       = carattere;
            label.sel_color      = colore;
            label.orientamento   = orientamento;
            theDoc = FileManager.getInstance(Session.SessionID).getVoidFileConSegnatura(fr, schedaCorrente, label, this);

            //aggiungo in session le info relative alle label
            Session.Add("labelProperties", theDoc.LabelPdf);
            if (theDoc != null)
            {
                Response.ContentType = theDoc.contentType;
                Response.AddHeader("content-disposition", "inline;filename=" + theDoc.name);
                Response.AddHeader("content-length", theDoc.content.Length.ToString());
                Response.BinaryWrite(theDoc.content);
            }
        }
Ejemplo n.º 7
0
        private void SetDataVisibilitaProcessiFirma()
        {
            DocsPaWR.InfoUtente  infoUtente = UserManager.GetInfoUser();
            List <ProcessoFirma> listaProcessiFirma;

            if (this.ProcessoDiFirmaSelected != null && !string.IsNullOrEmpty(this.ProcessoDiFirmaSelected.idProcesso))
            {
                listaProcessiFirma = new List <ProcessoFirma>()
                {
                    ProcessoDiFirmaSelected
                };
            }
            else
            {
                listaProcessiFirma = ListaProcessiDiFirma;
            }
            if (this._campiSelezionati == null)
            {
                this._campiSelezionati = new ArrayList();
            }

            this._file = docsPaWS.ExportVisibilitaProcessiFirma(infoUtente, this._tipologiaExport, this._titolo, this._campiSelezionati.ToArray(), listaProcessiFirma.ToArray());

            if (this._file != null)
            {
                exportDatiSessionManager session = new exportDatiSessionManager();
                session.SetSessionExportFile(this._file);
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Recupero dalla sessione il file documento
                DocsPaWR.FileDocumento file = (DocsPaWR.FileDocumento)Session["FileManager.selectedReport"];
                // Rimuovo dalla sessione il file documento
                Session.Remove("FileManager.selectedReport");

                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 file 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>");
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Reperimento contenuto del file
        /// </summary>
        /// <param name="versionId"></param>
        /// <returns></returns>
        public static byte[] GetFileContent()
        {
            String selectedVersionId = null;

            if (DocumentManager.getSelectedNumberVersion() != null && DocumentManager.ListDocVersions != null)
            {
                selectedVersionId = (from v in DocumentManager.ListDocVersions where v.version.Equals(DocumentManager.getSelectedNumberVersion()) select v.versionId).FirstOrDefault();
            }

            DocsPaWR.FileRequest fileInfo = (DocumentManager.getSelectedAttachId() != null) ?
                                            UIManager.FileManager.GetFileRequest(DocumentManager.getSelectedAttachId()) :
                                            UIManager.FileManager.GetFileRequest(selectedVersionId);

            DocsPaWR.FileDocumento fileDocumento = WsInstance.DocumentoGetFile(fileInfo, UIManager.UserManager.GetInfoUser());

            if (fileDocumento != null)
            {
                return(fileDocumento.content);
            }
            else
            {
                if (HttpContext.Current.Session["CheckOutPage.Content"] != null)
                {
                    return((byte[])HttpContext.Current.Session["CheckOutPage.Content"]);
                }
                else
                {
                    return(null);
                }
            }
        }
Ejemplo n.º 10
0
        private FileDocumento GetSignedDocument()
        {
            DocsPaWR.FileRequest fileRequest = null;
            if (DocumentManager.getSelectedAttachId() != null) // ho aggiunto il file ad un allegato
            {
                fileRequest = FileManager.GetFileRequest(DocumentManager.getSelectedAttachId());
            }
            else // ho aggiunto il file al documento principale
            {
                fileRequest = FileManager.getSelectedFile();
            }
            //Aggiunto per le versioni
            if (!IsForwarded)
            {
                if (DocumentManager.getSelectedNumberVersion() != null && DocumentManager.ListDocVersions != null)
                {
                    fileRequest = (from v in DocumentManager.ListDocVersions where v.version.Equals(DocumentManager.getSelectedNumberVersion()) select v).FirstOrDefault();
                }
            }
            DocsPaWR.FileDocumento signedDocument = null;
            if (fileRequest != null && fileRequest.fileName != null && fileRequest.fileName != "")
            {
                signedDocument = this.DocumentoGetFileCached(fileRequest);
            }

            return(signedDocument);
        }
Ejemplo n.º 11
0
        protected void btn_export_Click(object sender, EventArgs e)
        {
            if (this.checkInput())
            {
                DocsPAWA.DocsPaWR.ReportMonitoraggioPolicyRequest request = new DocsPaWR.ReportMonitoraggioPolicyRequest();
                request.IdAmm              = this.ddl_amministrazione.SelectedValue;
                request.Codice             = this.txtCodPolicy.Text.Trim();
                request.Descrizione        = this.txtDescPolicy.Text.Trim();
                request.TipoDataEsecuzione = this.ddl_dataEsecuzione.SelectedValue;
                if (request.TipoDataEsecuzione == "S")
                {
                    request.DataEsecuzioneFrom = this.lbl_dataCreazioneDa.Text;
                }
                if (request.TipoDataEsecuzione == "R")
                {
                    request.DataEsecuzioneFrom = this.lbl_dataCreazioneDa.Text;
                    request.DataEsecuzioneTo   = this.lbl_dataCreazioneA.Text;
                }

                AmmUtils.WebServiceLink ws  = new AmmUtils.WebServiceLink();
                DocsPaWR.FileDocumento  doc = ws.ReportMonitoraggioPolicy(request);

                if (doc != null)
                {
                    Response.ContentType = "application/vnd.ms-excel";
                    Response.AddHeader("Content-Disposition", "attachment; filename=test.xls");
                    Response.BinaryWrite(doc.content);
                    Response.Flush();
                    Response.End();
                }
                else
                {
                }
            }
        }
Ejemplo n.º 12
0
        protected void btn_associaTimestamp_Click(object source, EventArgs e)
        {
            FileManager fileManager = new FileManager();

            DocsPaWR.FileRequest   fileRequest   = FileManager.getSelectedFile(this);
            DocsPaWR.FileDocumento fileDocumento = fileManager.getFile(this, fileRequest, false, true);

            DocsPaWR.InfoUtente infoUtente = UserManager.getInfoUtente(this);

            string stringFile = BitConverter.ToString(fileDocumento.content);

            stringFile = stringFile.Replace("-", "");

            DocsPaWR.InputMarca inputMarca = new DocsPaWR.InputMarca();
            inputMarca.applicazione = infoUtente.urlWA;
            inputMarca.file_p7m     = stringFile;
            inputMarca.riferimento  = infoUtente.userId;

            String message = string.Empty;

            DocumentManager.executeAndSaveTSR(infoUtente, inputMarca, fileRequest, out message);

            if (message == "OK")
            {
                timestampsDoc = DocumentManager.getTimestampsDoc(infoUtente, fileRequest);
                caricaDgTimestamp();
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ErroreTimespamp", "alert('" + message + "');", true);
            }

            pnl_dettagli.Visible = false;
        }
Ejemplo n.º 13
0
        protected void ProjectImgStampaEtichette_Click(object o, EventArgs e)
        {
            //try
            //{
            //    this.EnumLabel = "1";
            //    PrintLabel_alreadyPrinted = false;
            //    PrintLabel_alreadyPrinted2 = false;
            //    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "print_labels", "ajaxModalPopupPrintLabel();", true);
            //}
            //catch (System.Exception ex)
            //{
            //    UIManager.AdministrationManager.DiagnosticError(ex);
            //    return;
            //}


            try
            {
                DocsPaWR.FileDocumento fileRep = ProjectManager.reportFascette(UIManager.ProjectManager.getProjectInSession().codice, null);

                HttpContext.Current.Session["visualReportAlreadyDownloaded" + Session.SessionID] = null;
                FileManager.setSelectedFileReport(this.Page, fileRep, "../popup");
                if (fileRep != null)
                {
                    exportDatiSessionManager session = new exportDatiSessionManager();
                    session.SetSessionExportFile(fileRep);
                }
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return;
            }
        }
Ejemplo n.º 14
0
        public static void salvaModificaStato(string docNumber, string idStato, DiagrammaStato diagramma, string idUtente, InfoUtente user, string dataScadenza, Page page)
        {
            try
            {
                docsPaWS.salvaModificaStato(docNumber, idStato, diagramma, idUtente, user, dataScadenza);

                SchedaDocumento docSel = DocumentManager.getSelectedRecord();

                //Controllo che lo stato sia uno stato di conversione pdf lato server
                //In caso affermativo faccio partire la conversione
                if (utils.isEnableConversionePdfLatoServer() == "true" &&
                    docSel != null && docSel.documenti != null && !String.IsNullOrEmpty(docSel.documenti[0].fileName))
                {
                    DocsPaWR.Stato statoAttuale = DiagrammiManager.GetStateDocument(docNumber);
                    if (statoAttuale != null && statoAttuale.CONVERSIONE_PDF)
                    {
                        FileManager            fileManager   = new FileManager();
                        DocsPaWR.FileDocumento fileDocumento = fileManager.getFile(page);
                        if (fileDocumento != null && fileDocumento.content != null && fileDocumento.name != null && fileDocumento.name != "")
                        {
                            FileManager.EnqueueServerPdfConversion(UserManager.GetInfoUser(), fileDocumento.content, fileDocumento.name, DocumentManager.getSelectedRecord());
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
            }
        }
Ejemplo n.º 15
0
        protected void BtnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                XmlDocument xmlDoc = this.exportToXML();

                if (xmlDoc != null && (xmlDoc.InnerXml != string.Empty || xmlDoc.InnerXml != ""))
                {
                    DocsPaWR.FileDocumento filePdf = new DocsPaWR.FileDocumento();
                    OrganigrammaManager    manager = new OrganigrammaManager();

                    manager.StampaOrganigramma(xmlDoc);

                    filePdf = manager.getFilePDF();

                    if (filePdf != null && filePdf.content.Length > 0)
                    {
                        manager.setSessionFilePDF(filePdf);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "stampa", "stampa('" + utils.FormatJs(componentType) + "');", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "dialog", "ajaxDialogModal('ErrorCustom', 'error', '', '" + utils.FormatJs(ex.Message) + "');", true);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        ///
        /// </summary>
        private void SetDataTrasm()
        {
            string tipoRicerca = (string)System.Web.HttpContext.Current.Session["typeSearch"];

            if (tipoRicerca != null && (tipoRicerca.Equals("R") || tipoRicerca.Equals("E")))
            {
                this.getFiltriTrasm();

                this._user = UserManager.GetUserInSession();

                DocsPaWR.TrasmissioneOggettoTrasm oggettoTrasm = new DocsPaWR.TrasmissioneOggettoTrasm();

                if (this._campiSelezionati == null)
                {
                    this._campiSelezionati = new ArrayList();
                }

                this._file = docsPaWS.ExportRicercaTrasm(oggettoTrasm, tipoRicerca, this._user, this._userRuolo, this._lstFiltriTrasm, this._tipologiaExport, this._titolo, UserManager.GetInfoUser(), this._campiSelezionati.ToArray());

                if (this._file != null)
                {
                    exportDatiSessionManager session = new exportDatiSessionManager();
                    session.SetSessionExportFile(this._file);
                }
            }
        }
Ejemplo n.º 17
0
        private void setDataToDoList()
        {
            this.getFiltriTrasm();
            DocsPaWR.InfoUtente infoUtente = UserManager.getInfoUtente();

            DocsPAWA.DocsPaWR.Registro[] reg = UserManager.getRuolo().registri;
            string registri = "0";

            if (reg.Length > 0)
            {
                foreach (DocsPAWA.DocsPaWR.Registro registro in reg)
                {
                    registri = registri + "," + registro.systemId;
                }
            }

            AmmUtils.WebServiceLink ws = new AmmUtils.WebServiceLink();
            this._file = ws.ExportToDoList(infoUtente, this._docOrFasc, this._lstFiltriTrasm, registri, this._tipologiaExport, this._titolo, this._campiSelezionati, this._objSystemId);
            ws         = null;

            if (this._file != null)
            {
                exportDatiSessionManager session = new exportDatiSessionManager();
                session.SetSessionExportFile(this._file);
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void PerformActionStampaRicevutaPdf()
        {
            DocsPaWR.DocsPaWebService ws = ProxyManager.getWS();



            DocsPaWR.FileDocumento content = ws.StampaRicevutaProtocolloPdf(UserManager.getInfoUtente(), this.IdDocument);

            if (content != null)
            {
                System.IO.MemoryStream memStream = new System.IO.MemoryStream(content.content);
                //Response.Clear();
                //Response.ContentType = "application/pdf";
                //Response.AddHeader("content-disposition", "inline;filename=Ricevuta.pdf");
                //Response.AddHeader("content-length", content.content.Length.ToString());
                //Response.BinaryWrite(content.content);
                //Response.Flush();
                //Response.End();

                Response.AppendHeader("content-disposition", "inline;filename=Ricevuta.pdf");
                Response.AppendHeader("Content-Length", memStream.Length.ToString());
                Response.ContentType = "application/pdf";
                Response.BinaryWrite(memStream.ToArray());
                Response.Flush();
                memStream.Close();
            }
        }
Ejemplo n.º 19
0
        protected void InitializePage()
        {
            MemoryStream ms           = null;
            StreamReader streamReader = null;

            try
            {
                DocsPaWR.FileRequest   fileReq = (DocsPaWR.FileRequest)DocumentManager.getSelectedRecord().documenti[0];
                DocsPaWR.FileDocumento fileDoc = DocumentManager.DocumentoGetFile(fileReq);

                string xmlString = GetFatturaFromBytes(fileDoc.name, fileDoc.content);

                XmlDocument xml = this.GenerateXMLDocumentFromString(xmlString);

                System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform();
                xslt.Load(System.IO.Path.Combine(Server.MapPath("~/"), "xml\\fatturapa_v1.2.xsl"));

                ms = new MemoryStream();

                System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(ms, new System.Text.UTF8Encoding());
                xslt.Transform(xml, null, writer);
                streamReader = new StreamReader(ms);

                DocsPaWR.FileDocumento pdfInvoice = ImportInvoiceManager.getInvoicePreviewPdf(ms.ToArray());

                if (pdfInvoice != null && pdfInvoice.content != null)
                {
                    pdfInvoice.name                = fileDoc.name + ".pdf";
                    pdfInvoice.fullName            = fileDoc.fullName + ".pdf";
                    pdfInvoice.estensioneFile      = "pdf";
                    this.UpPnlDocumentData.Visible = true;
                    FileManager.setSelectedFileReport(this, pdfInvoice, "../popup");
                    //this.frame.Attributes["src"] = "../Summaries/PDFViewer.aspx";
                    this.frame.Attributes["src"] = "InvoicePDFViewer.aspx";
                    this.UpPnlDocumentData.Update();
                }
                else
                {
                    string msg = "InvoicePreviewError";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + msg.Replace("'", @"\'") + "', 'error', '');} else {parent.ajaxDialogModal('" + msg.Replace("'", @"\'") + "', 'error', '');}", true);

                    this.UpPnlDocumentData.Visible = false;
                    this.UpPnlDocumentData.Update();
                }
            }
            catch (Exception)
            {
                string msg = "InvoicePreviewError";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + msg.Replace("'", @"\'") + "', 'error', '');} else {parent.ajaxDialogModal('" + msg.Replace("'", @"\'") + "', 'error', '');}", true);

                this.UpPnlDocumentData.Visible = false;
                this.UpPnlDocumentData.Update();
            }
            finally
            {
                ms.Dispose();
                streamReader.Dispose();
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Reperimento dell'estensione del file acquisito
        /// relativamente all'ultima versione del documento
        /// </summary>
        /// <returns></returns>
        protected string LastAcquiredDocumentExtension(SchedaDocumento currentScheda)
        {
            string retValue = string.Empty;

            if (currentScheda != null && currentScheda.documenti != null && currentScheda.documenti.Length > 0)
            {
                if (this.ViewState["LastAcquiredDocumentExtension"] == null || string.IsNullOrEmpty(this.ViewState["LastAcquiredDocumentExtension"].ToString()))
                {
                    if (CheckInOutServices.UserEnabled)
                    {
                        FileRequest lastDocument = new FileRequest();
                        // modifica per reperire le versioni antecedenti l'ultima
                        //if (DocumentManager.ListDocVersions != null)
                        //{
                        //    lastDocument = (from doc in DocumentManager.ListDocVersions where doc.version.Equals(DocumentManager.getSelectedNumberVersion()) select doc).FirstOrDefault();
                        //}
                        //else
                        //{
                        //    lastDocument = currentScheda.documenti[0];
                        //}

                        // provo con l'array già presente
                        lastDocument = (from doc in currentScheda.documenti where doc.version.Equals(DocumentManager.getSelectedNumberVersion()) select doc).FirstOrDefault();

                        // Reperimento ultimo file acquisito dal documento

                        //FileRequest lastDocument = currentScheda.documenti[0];

                        // Verifica se è stato acquisito un file
                        if (this.IsAcquired(lastDocument))
                        {
                            // Reperimento oggetto "FileDocumento" contenente
                            // il nome originale del file, indipendentemente
                            // dal documentale utilizzato correntemente
                            FileManager            fileManager  = new FileManager();
                            DocsPaWR.FileDocumento fileDocument = fileManager.getInfoFile(this.Page, lastDocument);

                            string defaultFileName = fileDocument.name;

                            // In caso di file firmato, viene reperita l'estensione originaria del file
                            while (defaultFileName.ToLower().EndsWith(".p7m"))
                            {
                                defaultFileName = defaultFileName.Substring(0, defaultFileName.Length - 4);
                            }

                            FileInfo fileInfo = new FileInfo(defaultFileName);
                            retValue = fileInfo.Extension.Replace(".", "");
                        }
                    }

                    this.ViewState.Add("LastAcquiredDocumentExtension", retValue);
                }
                else
                {
                    retValue = this.ViewState["LastAcquiredDocumentExtension"].ToString();
                }
            }
            return(retValue);
        }
Ejemplo n.º 21
0
        public void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                Response.Expires = -1;

                if (!IsPostBack && !this.AlreadyDownloaded)
                {
                    //    string id = Session.SessionID;
                    //    DocsPaWR.FileDocumento theDoc = FileManager.getInstance(id).getReport(this);

                    //    Response.ContentType = theDoc.contentType;
                    //    Response.ContentType = "application/octet-stream";
                    //    Response.AddHeader("content-disposition", "attachment;filename=" + theDoc.name);
                    //    Response.AddHeader("content-lenght", theDoc.content.Length.ToString());
                    //    Response.BinaryWrite(theDoc.content);



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

                    exportDatiSessionManager sessioneManager = new exportDatiSessionManager();
                    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());
                        if (this.IsApplet || this.IsSocket)
                        {
                            string base64String = System.Convert.ToBase64String(file.content, 0, file.content.Length);
                            Response.Write(base64String);
                        }
                        else
                        {
                            Response.BinaryWrite(file.content);
                            Response.Flush();
                            //Response.Close();
                            //Response.End();
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "parent.ajaxDialogModal('ErrorExportDati', 'warning', '');", true);
                    }



                    this.AlreadyDownloaded = true;
                }
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return;
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        ///
        /// </summary>
        private void SetDataDoc(String[] documentsSystemId)
        {
            this.GetFiltriDoc();

            Field[] visibleArray = null;

            if (this._campiSelezionati != null)
            {
                List <Field> visibleFieldsTemplate;
                visibleFieldsTemplate = new List <Field>();

                if (GridManager.SelectedGrid == null)
                {
                    GridManager.SelectedGrid = GridManager.GetStandardGridForUser(GridTypeEnumeration.Document, UserManager.GetInfoUser());
                }

                foreach (CampoSelezionato tempCamp in this._campiSelezionati)
                {
                    Field d = (Field)GridManager.SelectedGrid.Fields.Where(f => f.FieldId.Equals(tempCamp.fieldID) && f.CustomObjectId > 0).FirstOrDefault();
                    if (d != null)
                    {
                        visibleFieldsTemplate.Add(d);
                    }
                    else
                    {
                        if (!GridManager.IsRoleEnabledToUseGrids() && !tempCamp.campoStandard.Equals("1"))
                        {
                            d                = new Field();
                            d.FieldId        = tempCamp.fieldID;
                            d.CustomObjectId = Convert.ToInt32(tempCamp.campoStandard);
                            d.OriginalLabel  = tempCamp.nomeCampo;
                            d.Label          = tempCamp.nomeCampo;
                            d.Width          = 100;
                            visibleFieldsTemplate.Add(d);
                        }
                    }
                }

                if (visibleFieldsTemplate != null && visibleFieldsTemplate.Count > 0)
                {
                    visibleArray = visibleFieldsTemplate.ToArray();
                }
            }

            if (this._campiSelezionati == null)
            {
                this._campiSelezionati = new ArrayList();
            }

            this._file = docsPaWS.ExportDocCustom(this._userInfo, this._lstFiltri, this._tipologiaExport, this._titolo, this._context, this._campiSelezionati.ToArray(), documentsSystemId, GridManager.SelectedGrid, GridManager.IsRoleEnabledToUseGrids(), visibleArray);

            if (this._file != null)
            {
                exportDatiSessionManager session = new exportDatiSessionManager();
                session.SetSessionExportFile(this._file);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        ///
        ///</summary>
        ///<param name="selectedDocumentsId">Array con gli id dei documenti da esportare</param>
        private void setDataDocInFasc(String[] selectedDocumentsId)
        {
            this.getFascDocumenti();

            // Reperimento filtri di ricerca correntemente immessi
            DocsPaWR.FiltroRicerca[][] currentFilters = ricercaDoc.FiltriRicercaDocumenti.CurrentFilterSessionStorage.GetCurrentFilter();

            DocsPaWR.FiltroRicerca[][] orderFilters = ricercaDoc.FiltriRicercaDocumenti.CurrentFilterSessionOrderFilter.GetCurrentFilter();


            AmmUtils.WebServiceLink ws = new AmmUtils.WebServiceLink();

            Field[] visibleArray = null;

            if (this._campiSelezionati != null)
            {
                List <Field> visibleFieldsTemplate;
                visibleFieldsTemplate = new List <Field>();

                foreach (CampoSelezionato tempCamp in this._campiSelezionati)
                {
                    Field d = (Field)GridManager.SelectedGrid.Fields.Where(f => f.FieldId.Equals(tempCamp.fieldID) && f.CustomObjectId > 0).FirstOrDefault();
                    if (d != null)
                    {
                        visibleFieldsTemplate.Add(d);
                    }
                    else
                    {
                        if (!GridManager.IsRoleEnabledToUseGrids() && !tempCamp.campoStandard.Equals("1"))
                        {
                            d                = new Field();
                            d.FieldId        = tempCamp.fieldID;
                            d.CustomObjectId = Convert.ToInt32(tempCamp.campoStandard);
                            d.OriginalLabel  = tempCamp.nomeCampo;
                            d.Label          = tempCamp.nomeCampo;
                            d.Width          = 100;
                            visibleFieldsTemplate.Add(d);
                        }
                    }
                }

                if (visibleFieldsTemplate != null && visibleFieldsTemplate.Count > 0)
                {
                    visibleArray = visibleFieldsTemplate.ToArray();
                }
            }

            this._file = ws.ExportDocInFascCustom(this._userInfo, this._folder, this.codFasc, this._tipologiaExport, this._titolo, currentFilters, this._campiSelezionati, selectedDocumentsId, visibleArray, orderFilters);

            ws = null;

            if (this._file != null)
            {
                exportDatiSessionManager session = new exportDatiSessionManager();
                session.SetSessionExportFile(this._file);
            }
        }
Ejemplo n.º 24
0
 /// <summary>
 ///
 /// </summary>
 private void setLog()
 {
     AmmUtils.WebServiceLink ws = new AmmUtils.WebServiceLink();
     this._file = ws.ExportLog(this._codAmm, this._soggettoExport, this._tipologiaExport, this._titolo, this._user, this._data_a, this._data_da, this._oggetto, this._azione, this._esito, this._tabelle);
     ws         = null;
     if (this._file != null)
     {
         exportLogSessionManager session = new exportLogSessionManager();
         session.SetSessionExportFile(this._file);
     }
 }
Ejemplo n.º 25
0
        private void SetDataSearchAddressBook()
        {
            bool store = true;

            DocsPaWR.ParametriRicercaRubrica qco = (DocsPaWR.ParametriRicercaRubrica)HttpContext.Current.Session["AddressBook.corrFilter"];
            //this._file = docsPaWS.ExportSearchAddressBook(this._userInfo, store, qco);
            this._file = docsPaWS.ExportSearchAddressBookNew(this._userInfo, store, qco, this._titolo, this._tipologiaExport);
            if (this._file != null)
            {
                exportDatiSessionManager session = new exportDatiSessionManager();
                session.SetSessionExportFile(this._file);
            }
        }
Ejemplo n.º 26
0
 private void setDataDocInCest()
 {
     // Reperimento filtri di ricerca correntemente immessi
     DocsPaWR.FiltroRicerca[][] currentFilters = ricercaDoc.FiltriRicercaDocumenti.CurrentFilterSessionStorage.GetCurrentFilter();
     AmmUtils.WebServiceLink    ws             = new AmmUtils.WebServiceLink();
     this._file = ws.ExportDocInCest(this._userInfo, this._tipologiaExport, this._titolo, currentFilters, this._campiSelezionati);
     ws         = null;
     if (this._file != null)
     {
         exportDatiSessionManager session = new exportDatiSessionManager();
         session.SetSessionExportFile(this._file);
     }
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Reperimento contenuto del file
        /// </summary>
        /// <param name="versionId"></param>
        /// <returns></returns>
        public static byte[] GetFileContent()
        {
            DocsPaWR.FileDocumento fileDocumento = WsInstance.DocumentoGetFile(FileManager.getSelectedFile(), UserManager.getInfoUtente());

            if (fileDocumento != null)
            {
                return(fileDocumento.content);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 28
0
        public void ShowDocument()
        {
            Response.Expires = -1;
            DocsPaWR.FileDocumento immagineDocumento = this.GetDocumentoTrasmesso(true).ImmagineDocumento;

            if (immagineDocumento != null)
            {
                Response.ContentType = immagineDocumento.contentType;
                Response.AddHeader("content-disposition", "inline;filename=" + immagineDocumento.name);
                Response.AddHeader("content-lenght", immagineDocumento.content.Length.ToString());
                Response.BinaryWrite(immagineDocumento.content);
            }
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Imposta la sessione dell'export
 /// </summary>
 public static void SetSessionExportFile(DocsPaWR.FileDocumento file)
 {
     try
     {
         if (System.Web.HttpContext.Current.Session["EXPORT_FILE_SESSION"] == null)
         {
             System.Web.HttpContext.Current.Session.Add("EXPORT_FILE_SESSION", file);
         }
     }
     catch (System.Exception ex)
     {
         UIManager.AdministrationManager.DiagnosticError(ex);
     }
 }
Ejemplo n.º 30
0
        protected void CustomImageIndiceSistematico_Click(object sender, ImageClickEventArgs e)
        {
            DocsPaWR.FileDocumento filedoc = UIManager.ClassificationSchemeManager.getIndiceSistematico(UIManager.ClassificationSchemeManager.GetTitolarioInSession().ID);
            if (filedoc != null && filedoc.content.Length > 0)
            {
                Response.ContentType = filedoc.contentType;
                Response.AddHeader("content-disposition", "inline;filename=" + filedoc.fullName);
                Response.AddHeader("content-lenght", filedoc.content.Length.ToString());
                Response.BinaryWrite(filedoc.content);

                Response.Write("<html><body><script type=\"text/javascript\">OpenFile();</script></body></html>");
                Response.End();
            }
        }