コード例 #1
0
        /// </summary>
        /// <remarks>
        /// Qualora sia attivata la gestione degli allegati profilati, la scheda documento sarà relativa
        /// all'allegato correntemente selezionato da tab allegati
        /// </remarks>
        public static void RefreshCheckOutStatus()
        {
            DocsPaWR.SchedaDocumento schedaDocumento = null;
            DocsPaWR.FileRequest     fileRequest     = FileManager.getSelectedFile();
            if (fileRequest != null)
            {
                if (fileRequest.GetType() == typeof(DocsPaWR.Allegato))
                {
                    // Tab "allegati" correntemente selezionato,
                    // reperimento dello stato checkout dell'allegato selezionato.
                    // Solo se attiva la profilazione allegati.
                    if (fileRequest != null && fileRequest.GetType() == typeof(DocsPaWR.Allegato))
                    {
                        schedaDocumento = DocumentManager.getDocumentDetails(null, fileRequest.docNumber, fileRequest.docNumber);
                    }
                }
                else
                {
                    schedaDocumento = DocumentManager.getSelectedRecord();
                }

                if (schedaDocumento != null)
                {
                    //Inizializzazione del contesto di checkout del documento
                    CheckInOut.CheckOutContext.Current = new CheckInOut.CheckOutContext(schedaDocumento);
                }
                else
                {
                    CheckInOut.CheckOutContext.Current = null;
                }
            }
        }
コード例 #2
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);
        }
コード例 #3
0
        /// <summary>
        /// Reperimento dell'url dell'immagine per la versione
        /// </summary>
        /// <param name="fileRequest"></param>
        /// <returns></returns>
        protected string GetVersionImage(DocsPaWR.FileRequest fileRequest)
        {
            bool isAcquired = this.IsAcquired(fileRequest);

            if (fileRequest.GetType() == typeof(DocsPaWR.Allegato))
            {
                if (DocumentManager.AllegatoIsPEC(fileRequest.versionId).Equals("1"))
                {
                    return("../images/allegato_pec.jpg");
                }
                else if (DocumentManager.AllegatoIsIS(fileRequest.versionId).Equals("1"))
                {
                    return("~/images/ico_allegato_PI3.jpg");
                }
                else if (DocumentManager.AllegatoIsEsterno(fileRequest.versionId).Equals("1"))
                {
                    return("~/images/allegato_esterno.jpg");
                }
                else
                {
                    if (isAcquired)
                    {
                        return("../images/ico_allegato_enable.gif");
                    }
                    else
                    {
                        return("../images/ico_allegato_disabled.gif");
                    }
                }
            }
            else
            {
                return("../images/ico_doc_enable.gif");
            }
        }
コード例 #4
0
        /// <summary>
        /// Verifica se il formato del file è ammesso per la firma digitale
        /// </summary>
        /// <param name="fileRequest"></param>
        /// <returns></returns>
        protected bool IsFormatSupportedForSign(DocsPaWR.FileRequest fileRequest)
        {
            bool retValue = false;

            if (!DocsPAWA.FormatiDocumento.Configurations.SupportedFileTypesEnabled)
            {
                retValue = true;
            }
            else
            {
                string extension = System.IO.Path.GetExtension(fileRequest.fileName);

                if (!string.IsNullOrEmpty(extension))
                {
                    // Rimozione del primo carattere dell'estensione (punto)
                    extension = extension.Substring(1);

                    DocsPaWR.SupportedFileType[] fileTypes = ProxyManager.getWS().GetSupportedFileTypes(Convert.ToInt32(UserManager.getInfoUtente().idAmministrazione));

                    retValue = fileTypes.Count(e => e.FileExtension.ToLower() == extension.ToLower() &&
                                               e.FileTypeUsed && e.FileTypeSignature) > 0;
                }
            }

            return(retValue);
        }
コード例 #5
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;
        }
コード例 #6
0
        protected void HsmrbP7M_Change(object sender, EventArgs e)
        {
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true);

            DocsPaWR.FileRequest fileReq = null;

            fileReq = FileManager.getSelectedFile();

            bool isPdf = (FileManager.getEstensioneIntoSignedFile(this.Page, fileReq.fileName).ToUpper() == "PDF");

            if (!this.chkConverti.Enabled && !isPdf)
            {
                if (Utils.IsEnabledSupportedFileTypes())
                {
                    this.FileTypes = Utils.GetSupportedFileTypes(Int32.Parse(UserManager.getInfoUtente().idAmministrazione));

                    bool retVal = true;

                    int count = this.FileTypes.Count(f => f.FileExtension.ToLowerInvariant() == FileManager.getEstensioneIntoSignedFile(this.Page, fileReq.fileName).ToLowerInvariant() &&
                                                     f.FileTypeUsed && f.FileTypeSignature);
                    retVal = (count > 0);

                    this.chkConverti.Checked = !retVal;
                }
            }

            // Update Panel
            this.upTipoFirma.Update();
            this.upChConverti.Update();
            this.uprbFirmaCoF.Update();
        }
コード例 #7
0
        //meccanismo di caching per evitare di fare la getFile tutte le volte, con conseguente controllo del certificato
        private FileDocumento DocumentoGetFileCached(DocsPaWR.FileRequest fileRequest)
        {
            FileDocumento retval = null;

            if (HttpContext.Current.Session["FileRequest_Cached"] == null)
            {
                HttpContext.Current.Session["FileDocumento_Cached"] = null;
            }

            if (HttpContext.Current.Session["FileDocumento_Cached"] == null)
            {
                retval = DocumentManager.DocumentoGetFile(fileRequest);
                HttpContext.Current.Session["FileRequest_Cached"]   = fileRequest;
                HttpContext.Current.Session["FileDocumento_Cached"] = retval;
            }
            else
            {
                if (HttpContext.Current.Session["FileRequest_Cached"] != fileRequest)
                {
                    //filerequest è cambiato
                    retval = DocumentManager.DocumentoGetFile(fileRequest);
                    HttpContext.Current.Session["FileRequest_Cached"]   = fileRequest;
                    HttpContext.Current.Session["FileDocumento_Cached"] = retval;
                }
                else
                {
                    retval = (FileDocumento)HttpContext.Current.Session["FileDocumento_Cached"];
                }
            }
            return(retval);
        }
コード例 #8
0
        /// <summary>
        /// Verifica se il file è stato acquisito per la versione
        /// </summary>
        /// <param name="fileRequest"></param>
        /// <returns></returns>
        protected bool IsAcquired(DocsPaWR.FileRequest fileRequest)
        {
            int fileSize;

            Int32.TryParse(fileRequest.fileSize, out fileSize);
            return(fileSize > 0);
        }
コード例 #9
0
ファイル: CheckInOutServices.cs プロジェクト: sebbalex/PITre
        /// <summary>
        /// Reperimento delle informazioni di stato checkout del documento
        /// </summary>
        /// <returns></returns>
        public static CheckOutStatus GetCheckOutDocumentStatus()
        {
            DocsPaWR.SchedaDocumento schedaDocumento = null;

            if (IsEnabledProfilazioneAllegati && IsSelectedTabAllegati())
            {
                // Tab "allegati" correntemente selezionato,
                // reperimento dello stato checkout dell'allegato selezionato
                DocsPaWR.FileRequest fileRequest = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
                                                   UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
                                                   UIManager.FileManager.GetFileRequest();

                if (fileRequest != null && fileRequest.GetType() == typeof(DocsPaWR.Allegato))
                {
                    schedaDocumento = System.Web.HttpContext.Current.Session["schedaAllegatoSelezionato"] as DocsPaWR.SchedaDocumento;
                }
            }
            else
            {
                // Qualsiasi altro tab differente dal tab "allegati",
                // reperimento dello stato checkout del documento principale
                schedaDocumento = CheckInOutServices.CurrentSchedaDocumento;
            }

            if (schedaDocumento != null)
            {
                return(schedaDocumento.checkOutStatus);
            }
            else
            {
                return(null);
            }
        }
コード例 #10
0
        /// <summary>
        /// Reperimento dell'estensione completa del file nel caso in cui sia P7M
        /// </summary>
        /// <returns></returns>
        protected string GetP7mFileExtensions()
        {
            string extensions = string.Empty;

            DocsPaWR.FileRequest fileInfo = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
                                            UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
                                            UIManager.FileManager.GetFileRequest();
            //DocsPaWR.FileDocumento fileInfo = SaveFileServices.GetFileInfo();

            string fileName = fileInfo.fileName;

            if (Path.GetExtension(fileName).ToUpperInvariant() == ".P7M")
            {
                while (!string.IsNullOrEmpty(Path.GetExtension(fileName)))
                {
                    string ext = Path.GetExtension(fileName);

                    if (!string.IsNullOrEmpty(ext))
                    {
                        extensions = ext + extensions;
                    }

                    fileName = Path.GetFileNameWithoutExtension(fileName);
                }
            }

            return(extensions);
        }
コード例 #11
0
        /// <summary>
        /// Reperimento del tooltip della versione
        /// </summary>
        /// <param name="fileRequest"></param>
        /// <returns></returns>
        protected string GetLabelTooltip(DocsPaWR.FileRequest fileRequest)
        {
            string tooltip = string.Empty;

            if (fileRequest.GetType() == typeof(DocsPaWR.Allegato))
            {
                tooltip = fileRequest.descrizione;
            }
            else
            {
                tooltip = this.CurrentSchedaDocumento.oggetto.descrizione;
            }

            if (tooltip != null)
            {
                if (tooltip.Length > 128)
                {
                    return(tooltip.Substring(0, 125) + "...");
                }
                else
                {
                    return(tooltip.ToString());
                }
            }
            else
            {
                return(string.Empty);
            }
        }
コード例 #12
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);
        }
コード例 #13
0
ファイル: SaveFileServices.cs プロジェクト: sebbalex/PITre
        /// <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);
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// Reperimento delle informazioni di stato checkout del documento
        /// </summary>
        /// <returns></returns>
        public static CheckOutStatus GetCheckOutDocumentStatus()
        {
            DocsPaWR.SchedaDocumento schedaDocumento = null;

            if (IsEnabledProfilazioneAllegati && IsSelectedTabAllegati())
            {
                // Tab "allegati" correntemente selezionato,
                // reperimento dello stato checkout dell'allegato selezionato
                DocsPaWR.FileRequest fileRequest = FileManager.getSelectedFile();

                if (fileRequest != null && fileRequest.GetType() == typeof(DocsPaWR.Allegato))
                {
                    SiteNavigation.CallContext context = SiteNavigation.CallContextStack.CurrentContext;

                    schedaDocumento = context.ContextState["schedaAllegatoSelezionato"] as DocsPaWR.SchedaDocumento;
                }
            }
            else
            {
                // Qualsiasi altro tab differente dal tab "allegati",
                // reperimento dello stato checkout del documento principale
                schedaDocumento = CheckInOutServices.CurrentSchedaDocumento;
            }

            if (schedaDocumento != null)
            {
                return(schedaDocumento.checkOutStatus);
            }
            else
            {
                return(null);
            }
        }
コード例 #15
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();
            }
        }
コード例 #16
0
ファイル: SaveFileServices.cs プロジェクト: sebbalex/PITre
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static DocsPaWR.FileDocumento GetFileInfo()
        {
            DocsPaWR.FileRequest fileInfo = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
                                            UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
                                            UIManager.FileManager.GetFileRequest();

            return(WsInstance.DocumentoGetInfoFile(fileInfo, UIManager.UserManager.GetInfoUser()));
        }
コード例 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = -1;

            try
            {
                idDocumento     = Request.QueryString["idDocumento"];
                tipofirma       = Request.QueryString["tipofirma"];
                this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]);

                if (string.IsNullOrEmpty(tipofirma))
                {
                    tipofirma = string.Empty;
                }
                if (tipofirma.Equals("cosign"))
                {
                    firmabool = true;
                }
                else
                {
                    firmabool = false;
                }

                byte[] ba = Request.BinaryRead(Request.ContentLength);
                DocsPaWR.DocsPaWebService WS = new ProxyManager().getProxyDocsPa();

                DocsPaWR.FileDocumento fd = new ConservazioneWA.DocsPaWR.FileDocumento();

                ASCIIEncoding ae            = new ASCIIEncoding();
                string        base64content = ae.GetString(ba);

                DocsPaWR.InfoUtente infoutWS = WS.getInfoUtente(infoUtente.idPeople, infoUtente.idGruppo);

                if (!IsPostBack)
                {
                    DocsPaWR.FileRequest fr = WS.GetVersionsMainDocument(infoutWS, idDocumento)[0];
                    //il file è in formato pdf
                    //fr.fileName += ".pdf";

                    fr.dataInserimento = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");

                    bool retValue = WS.AppendDocumentoFirmato(base64content, firmabool, ref fr, infoutWS);

                    if (!retValue)
                    {
                        Debugger.Write("Errore nel Page_Load (docs = NULL)");
                        throw new Exception();
                    }
                }

                string confirmMsg = "Firma avvenuta con successo.";
                this.RegisterClientScript("SignStampaCons", "alert('" + confirmMsg + "');");
            }
            catch (Exception ex)
            {
                Debugger.Write("Errore nella firma della stampa del registro di conservazione: " + ex.Message);
            }
        }
コード例 #18
0
        //END NEW

        /// <summary>
        /// Reperimento dell'estensione completa del file nel caso in cui sia P7M
        /// </summary>
        /// <returns></returns>
        protected string GetP7mFileExtensions()
        {
            string extensions = string.Empty;

            NttDataWA.DocsPaWR.SchedaDocumento schedaDocumento = UIManager.DocumentManager.getSelectedRecord();

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

            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 = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
                                            UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
                                            UIManager.FileManager.GetFileRequest(selectedVersionId);

            //DocsPaWR.FileDocumento fileInfo = SaveFileServices.GetFileInfo();
            FileDocumento doc = FileManager.getInstance(schedaDocumento.systemId).getInfoFile(this.Page, fileInfo);


            //string fileName = fileInfo.fileName;
            //string fileName = doc.nomeOriginale != null ? doc.nomeOriginale : string.Empty;

            //INC000001126833 APSS: problema con riproponi su documenti tipizzati con modelli
            string fileName = string.Empty;

            if (doc != null)
            {
                fileName = doc.nomeOriginale;
                if (string.IsNullOrEmpty(fileName))
                {
                    fileName = doc.name;
                }
            }
            if (Path.GetExtension(fileName).ToUpperInvariant() == ".P7M")
            {
                while (!string.IsNullOrEmpty(Path.GetExtension(fileName)))
                {
                    string ext = Path.GetExtension(fileName);

                    if (!string.IsNullOrEmpty(ext))
                    {
                        extensions = ext + extensions;
                    }

                    fileName = Path.GetFileNameWithoutExtension(fileName);
                }
            }

            return(extensions);
        }
コード例 #19
0
        /// <summary>
        /// Reperimento tipologie di modelli di documento disponibili
        /// </summary>
        /// <returns></returns>
        private string[] GetDocumentModelTypes()
        {
            string[] retValue          = null;
            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 = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
                                            UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
                                            UIManager.FileManager.GetFileRequest(selectedVersionId);

            string fileName = fileInfo.fileName;

            string currExtList = GetCurrentFileExtensionList(fileInfo);

            // Verifica se il file è già stato acquisito
            bool isFileAcquired = (!string.IsNullOrEmpty(fileName));

            if (isFileAcquired)
            {
                // Se il file è già stato acquisito, viene proposta
                // l'estensione del file fornito in querystring
                if (string.IsNullOrEmpty(currExtList))
                {
                    string extension = (fileInfo.fileName.Split('.').Length > 1) ? (fileInfo.fileName.Split('.'))[fileInfo.fileName.Split('.').Length - 1] : string.Empty;
                    retValue = new string[1] {
                        extension
                    };
                }
                else
                {
                    retValue = currExtList.Split('|');
                }
            }
            else
            {
                if (Request["fileType"] != null && Request["fileType"] != string.Empty)
                {
                    // Vengono forniti i modelli eventualmente forniti in querystring
                    retValue = Request["fileType"].Split('|');
                }
                else
                {
                    // Vengono forniti i modelli disponibili nel sistema
                    DocsPaWR.DocsPaWebService ws = new NttDataWA.DocsPaWR.DocsPaWebService();
                    int idAdmin = Convert.ToInt32(UIManager.UserManager.GetInfoUser().idAmministrazione);
                    retValue = ws.GetCheckOutDocumentModelTypes(idAdmin);
                }
            }

            return(retValue);
        }
コード例 #20
0
        /// <summary>
        /// Reperimento della descrizione della versione
        /// </summary>
        /// <param name="fileRequest"></param>
        /// <returns></returns>
        protected string GetNomeOriginale(DocsPaWR.FileRequest fileRequest)
        {
            FileManager fileMan = new FileManager();
            string      retval  = fileMan.getInfoFile(Page, fileRequest).nomeOriginale;

            if (retval == null)
            {
                retval = "";
            }
            return(retval);
        }
コード例 #21
0
        /// <summary>
        /// Azione di visualizzazione del documento tramite l'applicazione proprietaria
        /// </summary>
        /// <param name="versionId"></param>
        protected virtual void PerformActionShowPrintableVersion(string versionId)
        {
            this.HideDocumentOnFrame();

            DocsPaWR.FileRequest fileRequest = this.GetFileRequest(versionId);

            this.Session["VisualizzatoreUnificato.SelectedFileRequest"] = fileRequest;

            // Visualizzazione del documento nel frame
            this.ShowDocumentOnFrame(true, true);
        }
コード例 #22
0
        /// <summary>
        /// Reperimento filerequest a partire dal versionid
        /// </summary>
        /// <param name="versionId"></param>
        /// <returns></returns>
        private DocsPaWR.FileRequest GetFileRequest(string versionId)
        {
            DocsPaWR.FileRequest fileRequest = this.CurrentSchedaDocumento.documenti.Where(e => e.versionId == versionId).FirstOrDefault();

            if (fileRequest == null)
            {
                // Ricerca la versione negli allegati al documento
                fileRequest = this.CurrentSchedaDocumento.allegati.Where(e => e.versionId == versionId).FirstOrDefault();
            }

            return(fileRequest);
        }
コード例 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = -1;
            httpFullPath     = utils.getHttpFullPath();

            if (!this.IsPostBack)
            {
                this.FetchFileTypes();

                this.schedaDocumento = UIManager.DocumentManager.getSelectedRecord();

                if (this.schedaDocumento.documentoPrincipale != null)
                {
                    rblListSavingOption.Items.RemoveAt(1);
                }



                if (UIManager.DocumentManager.getSelectedAttachId() == null && this.schedaDocumento != null && this.schedaDocumento.protocollo != null && !string.IsNullOrEmpty(this.schedaDocumento.protocollo.segnatura))
                {
                    file_name = UIManager.UserManager.normalizeStringPropertyValue(this.schedaDocumento.protocollo.segnatura);
                }
                else
                {
                    if (this.schedaDocumento != null && this.schedaDocumento.docNumber != null && !string.IsNullOrEmpty(this.schedaDocumento.docNumber))
                    {
                        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 fileReq = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
                                                       UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
                                                       UIManager.FileManager.GetFileRequest(selectedVersionId);

                        FileDocumento doc = FileManager.getInstance(this.schedaDocumento.systemId).getInfoFile(this.Page, fileReq);
                        if (doc != null && !string.IsNullOrEmpty(doc.nomeOriginale))
                        {
                            file_name = cleanFileName(doc.nomeOriginale);
                        }
                        else
                        {
                            file_name = this.schedaDocumento.docNumber;
                        }
                        //file_name = (UIManager.DocumentManager.getSelectedAttachId() != null ? UIManager.DocumentManager.getSelectedAttachId() : this.schedaDocumento.docNumber);
                    }
                }

                this.initForm();
            }
        }
コード例 #24
0
        //END NEW

        /// <summary>
        /// Reperimento dell'estensione completa del file nel caso in cui sia P7M
        /// </summary>
        /// <returns></returns>
        protected string GetP7mFileExtensions()
        {
            string extensions = string.Empty;


            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 = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
                                            UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
                                            UIManager.FileManager.GetFileRequest(selectedVersionId);

            /*
             * DocsPaWR.FileRequest fileInfo = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
             *      UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
             *          UIManager.FileManager.GetFileRequest();
             * */
            //DocsPaWR.FileDocumento fileInfo = SaveFileServices.GetFileInfo();

            FileDocumento doc = FileManager.getInstance(this.schedaDocumento.systemId).getInfoFile(this.Page, fileInfo);

            //string fileName = fileInfo.fileName;
            //string fileName = doc.nomeOriginale;
            string fileName = doc.nomeOriginale;

            if (string.IsNullOrEmpty(fileName))
            {
                fileName = doc.name;
            }

            if (Path.GetExtension(fileName).ToUpperInvariant() == ".P7M")
            {
                while (!string.IsNullOrEmpty(Path.GetExtension(fileName)))
                {
                    string ext = Path.GetExtension(fileName);

                    if (!string.IsNullOrEmpty(ext))
                    {
                        extensions = ext + extensions;
                    }

                    fileName = Path.GetFileNameWithoutExtension(fileName);
                }
            }

            return(extensions);
        }
コード例 #25
0
        /// <summary>
        /// Selezione elemento correntemente in sessione nel datagrid
        /// </summary>
        /// <param name="version"></param>
        protected void ShowVersion(DocsPaWR.FileRequest version)
        {
            foreach (DataGridItem item in this.grdButtons.Items)
            {
                if (Server.HtmlDecode(item.Cells[0].Text).Trim() == version.versionId.Trim())
                {
                    this.SelectGridItem(item, true);

                    this.PerformActionShowVersion(version.versionId);

                    break;
                }
            }
        }
コード例 #26
0
        /// <summary>
        /// Azione di visualizzazione del documento nel frame
        /// </summary>
        /// <param name="versionId"></param>
        protected virtual void PerformActionShowVersion(string versionId)
        {
            DocsPaWR.FileRequest fileRequest = this.GetFileRequest(versionId);

            bool downloadAsAttatchment = false;

            downloadAsAttatchment |= Path.GetExtension(fileRequest.fileName).ToLower().Equals(".eml");

            this.Session["VisualizzatoreUnificato.SelectedFileRequest"] = fileRequest;

            // Visualizzazione del documento nel frame
            // this.ShowDocumentOnFrame(false);
            this.ShowDocumentOnFrame(downloadAsAttatchment, false);
        }
コード例 #27
0
ファイル: CheckInOutServices.cs プロジェクト: sebbalex/PITre
        /// <summary>

        /// <summary>
        /// Aggiornamento dello statto di checkout della scheda documento correntemente visualizzata

        /// </summary>
        /// <remarks>
        /// Qualora sia attivata la gestione degli allegati profilati, la scheda documento sarà relativa
        /// all'allegato correntemente selezionato da tab allegati
        /// </remarks>
        public static void RefreshCheckOutStatus()
        {
            NttDataWA.DocsPaWR.SchedaDocumento schedaDocumento = null;

            //if (IsEnabledProfilazioneAllegati && IsSelectedTabAllegati())
            if (IsSelectedTabAllegati())
            {
                // Tab "allegati" correntemente selezionato,
                // reperimento dello stato checkout dell'allegato selezionato.
                // Solo se attiva la profilazione allegati.
                DocsPaWR.FileRequest fileRequest = (UIManager.DocumentManager.getSelectedAttachId() != null) ?
                                                   UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) :
                                                   UIManager.FileManager.GetFileRequest();

                if (fileRequest != null && fileRequest.GetType() == typeof(DocsPaWR.Allegato))
                {
                    schedaDocumento = System.Web.HttpContext.Current.Session["schedaAllegatoSelezionato"] as DocsPaWR.SchedaDocumento;

                    if (schedaDocumento != null)
                    {
                        schedaDocumento = _webServices.DocumentoGetDettaglioDocumento(GetInfoUtente(), schedaDocumento.systemId, schedaDocumento.docNumber);

                        System.Web.HttpContext.Current.Session["schedaAllegatoSelezionato"] = schedaDocumento;
                    }
                }
            }
            else
            {
                schedaDocumento = UIManager.DocumentManager.getSelectedRecord();

                if (schedaDocumento != null)
                {
                    // Reperimento scheda documento per l'allegato
                    schedaDocumento = _webServices.DocumentoGetDettaglioDocumento(GetInfoUtente(), schedaDocumento.systemId, schedaDocumento.docNumber);

                    UIManager.DocumentManager.setSelectedRecord(schedaDocumento);
                }
            }

            if (schedaDocumento != null)
            {
                //Inizializzazione del contesto di checkout del documento
                NttDataWA.CheckInOut.CheckOutContext.Current = new NttDataWA.CheckInOut.CheckOutContext(schedaDocumento);
            }
            else
            {
                NttDataWA.CheckInOut.CheckOutContext.Current = null;
            }
        }
コード例 #28
0
        /// <summary>
        /// Visualizzazione del documento
        /// </summary>
        private void ShowFileDocument(DocsPAWA.DocsPaWR.SchedaDocumento schedaDocumento, string versionId, bool isAllegato)
        {
            DocsPaWR.FileRequest fileRequest = this.GetFileRequest(schedaDocumento, versionId, isAllegato);

            DocsPaWR.FileDocumento fileDocument = this.GetFileDocument(fileRequest);

            if (fileDocument != null)
            {
                this.RenderDocumentContent(fileDocument);
            }
            else
            {
                // Documento non trovato
            }
        }
コード例 #29
0
        /// <summary>
        /// Reperimento dell' HASH sha256 del documento da firmare
        /// </summary>
        /// <param name="page"></param>
        /// <param name="fileRequest"></param>
        /// <returns></returns>
        public string GetSignedDocumentHash(System.Web.UI.Page page, DocsPaWR.FileRequest fileRequest, bool pades)
        {
            DocsPAWA.DocsPaWR.DocsPaWebService ws = DocsPAWA.ProxyManager.getWS();

            DocsPAWA.DocsPaWR.MassSignature msReq = new DocsPaWR.MassSignature {
                fileRequest = fileRequest, signPades = pades
            };
            DocsPAWA.DocsPaWR.MassSignature ms = ws.getSha256(msReq, DocsPAWA.UserManager.getInfoUtente());

            if (ms == null)
            {
                throw new ApplicationException("Attenzione! il file non è visualizzabile.<br><br>Verificare:<br>&bull;&nbsp;l'esistenza del file in:<br>" + fileRequest.docServerLoc + fileRequest.path + fileRequest.fileName + "<br><br>&bull;&nbsp;la stringa di Impronta sulla base dati.");
            }

            return(ms.base64Sha256);
        }
コード例 #30
0
        /// <summary>
        /// Aggiornamento dello statto di checkout della scheda documento correntemente visualizzata

        /// </summary>
        /// <remarks>
        /// Qualora sia attivata la gestione degli allegati profilati, la scheda documento sarà relativa
        /// all'allegato correntemente selezionato da tab allegati
        /// </remarks>
        public static void RefreshCheckOutStatus()
        {
            SAAdminTool.DocsPaWR.SchedaDocumento schedaDocumento = null;

            //if (IsEnabledProfilazioneAllegati && IsSelectedTabAllegati())
            if (IsSelectedTabAllegati())
            {
                // Tab "allegati" correntemente selezionato,
                // reperimento dello stato checkout dell'allegato selezionato.
                // Solo se attiva la profilazione allegati.
                DocsPaWR.FileRequest fileRequest = FileManager.getSelectedFile();

                if (fileRequest != null && fileRequest.GetType() == typeof(DocsPaWR.Allegato))
                {
                    SiteNavigation.CallContext context = SiteNavigation.CallContextStack.CurrentContext;

                    schedaDocumento = context.ContextState["schedaAllegatoSelezionato"] as DocsPaWR.SchedaDocumento;

                    if (schedaDocumento != null)
                    {
                        schedaDocumento = _webServices.DocumentoGetDettaglioDocumento(GetInfoUtente(), schedaDocumento.systemId, schedaDocumento.docNumber);

                        context.ContextState["schedaAllegatoSelezionato"] = schedaDocumento;
                    }
                }
            }
            else
            {
                schedaDocumento = DocumentManager.getDocumentoSelezionato();

                // Reperimento scheda documento per l'allegato
                schedaDocumento = _webServices.DocumentoGetDettaglioDocumento(GetInfoUtente(), schedaDocumento.systemId, schedaDocumento.docNumber);

                DocumentManager.setDocumentoSelezionato(schedaDocumento);
            }

            if (schedaDocumento != null)
            {
                //Inizializzazione del contesto di checkout del documento
                SAAdminTool.CheckInOut.CheckOutContext.Current = new SAAdminTool.CheckInOut.CheckOutContext(schedaDocumento);
            }
            else
            {
                SAAdminTool.CheckInOut.CheckOutContext.Current = null;
            }
        }