Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Nel query string deve essere presente l'id del documento da cancellare
            if (!String.IsNullOrEmpty(Request["idDocument"]))
            {
                this.ProcessDelete(Request["idDocument"]);
            }
            else
            {
                // Viene cancellato il documento salvato nel contesto di checkout
                this.ProcessDeleteFromCheckOutContext();
            }

            // Redirezionamento alla pagina di UndoCheckout in modo da aggiornare lo stato del documento
            string checkinOutFolderPath = "/CheckInOut/";

            NttDataWA.DocsPaWR.DocsPaWebService ws      = new NttDataWA.DocsPaWR.DocsPaWebService();
            DocsPaWR.SmartClientConfigurations  smcConf = ws.GetSmartClientConfigurationsPerUser(UserManager.GetInfoUser());
            string componentsType = smcConf.ComponentsType;

            if (componentsType == "3")
            {
                checkinOutFolderPath = "/CheckInOutApplet/";
            }

            Response.Redirect(Utils.utils.getHttpFullPath() + checkinOutFolderPath + "UndoCheckOutPage.aspx");
        }
Exemplo n.º 2
0
        public bool HSM_SetMementoForUser(Memento memento)
        {
            if (memento == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(memento.Alias))
            {
                return(false);
            }

            if (String.IsNullOrEmpty(memento.Dominio))
            {
                return(false);
            }

            DocsPaWR.InfoUtente infoUt             = NttDataWA.UIManager.UserManager.GetInfoUser();
            NttDataWA.DocsPaWR.DocsPaWebService ws = ProxyManager.GetWS();
            try
            {
                return(ws.HSM_SetMementoForUser(infoUt, memento.Dominio, memento.Alias));
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Download del file richiesto
        /// </summary>
        protected virtual void DownloadFile()
        {
            DocsPaWR.DocsPaWebService ws = new NttDataWA.DocsPaWR.DocsPaWebService();

            ModelRequest modelReq = new DocsPaWR.ModelRequest();

            modelReq.documentId = Request.QueryString["documentId"];
            modelReq.modelType  = Request.QueryString["modelType"];
            modelReq.userInfo   = new InfoUtente(); // UserManager.GetInfoUser();
            //modelReq.userInfo.extApplications = null;

            modelReq.userInfo.userId            = UserManager.GetInfoUser().userId;
            modelReq.userInfo.dst               = UserManager.GetInfoUser().dst;
            modelReq.userInfo.idAmministrazione = UserManager.GetInfoUser().idAmministrazione;
            modelReq.userInfo.idCorrGlobali     = UserManager.GetInfoUser().idCorrGlobali;
            modelReq.userInfo.idGruppo          = UserManager.GetInfoUser().idGruppo;
            modelReq.userInfo.idPeople          = UserManager.GetInfoUser().idPeople;
            modelReq.userInfo.urlWA             = UserManager.GetInfoUser().urlWA;

            modelReq.userInfo.urlWA = UserManager.GetInfoUser().urlWA;

            if (!string.IsNullOrEmpty(WebServiceUrl))
            {
                ws.Url = WebServiceUrl;
            }

            string modelres = ws.GetDocumentModelAsXml(modelReq);


            Response.Write(modelres);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Reperimento tipologie di modelli di documento disponibili
        /// </summary>
        /// <returns></returns>
        private string[] GetDocumentModelTypes()
        {
            string[] retValue = null;

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

            if (UIManager.DocumentManager.getSelectedAttachId() != null)
            {
                fileInfo = UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId());
            }
            else
            {
                fileInfo = (from doc in CheckInOutServices.CurrentSchedaDocumento.documenti where doc.version.Equals(DocumentManager.getSelectedNumberVersion()) select doc).FirstOrDefault();
            }

            string fileName = string.Empty;

            if (fileInfo != null)
            {
                fileName = fileInfo.fileName;
            }

            // 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

                string extension = (fileInfo.fileName.Split('.').Length > 1) ? (fileInfo.fileName.Split('.'))[fileInfo.fileName.Split('.').Length - 1] : string.Empty;
                retValue = new string[1] {
                    extension
                };
            }
            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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Reperimento scheda del documento da firmare digitalmente
 /// </summary>
 /// <param name="idDocumento"></param>
 /// <returns></returns>
 public DocsPaWR.SchedaDocumento GetSchedaDocumento(string idDocumento)
 {
     if (string.IsNullOrEmpty(idDocumento))
     {
         return(NttDataWA.UIManager.DocumentManager.getSelectedRecord());
     }
     else
     {
         NttDataWA.DocsPaWR.DocsPaWebService ws = ProxyManager.GetWS();
         return(ws.DocumentoGetDettaglioDocumentoNoDataVista(NttDataWA.UIManager.UserManager.GetInfoUser(), idDocumento, idDocumento));
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Reperimento del documento firmato
        /// </summary>
        /// <param name="page"></param>
        /// <param name="fileRequest"></param>
        /// <returns></returns>
        public NttDataWA.DocsPaWR.FileDocumento GetSignedDocument(System.Web.UI.Page page, DocsPaWR.FileRequest fileRequest)
        {
            NttDataWA.DocsPaWR.DocsPaWebService ws = ProxyManager.GetWS();

            NttDataWA.DocsPaWR.FileDocumento retValue = ws.DocumentoGetFileFirmato(fileRequest, NttDataWA.UIManager.UserManager.GetInfoUser());

            if (retValue == 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(retValue);
        }
Exemplo n.º 8
0
 public string HSM_RequestCertificateJson(String AliasCertificato, String DominioCertificato)
 {
     NttDataWA.DocsPaWR.DocsPaWebService ws = ProxyManager.GetWS();
     try
     {
         return(ws.HSM_RequestCertificateJson(AliasCertificato, DominioCertificato));
     }
     catch (Exception e)
     {
         // loggiamo un errore ?!?!?!?
         return(null);
     }
 }
Exemplo n.º 9
0
 public DocsPaWR.FirmaResult[] HSM_SignMultiSignSession(NttDataWA.DocsPaWR.FileRequest[] fileRequestList, string MultiSignToken, String AliasCertificato, String DominioCertificato, String OtpFirma, String PinCertificato, bool cofirma)
 {
     DocsPaWR.InfoUtente infoUt             = NttDataWA.UIManager.UserManager.GetInfoUser();
     NttDataWA.DocsPaWR.DocsPaWebService ws = ProxyManager.GetWS();
     try
     {
         return(ws.HSM_SignMultiSignSession(infoUt, fileRequestList, MultiSignToken, AliasCertificato, DominioCertificato, OtpFirma, PinCertificato, cofirma));
     }
     catch (Exception e)
     {
         // loggiamo un errore ?!?!?!?
         return(null);
     }
 }
Exemplo n.º 10
0
 public string HSM_OpenMultiSignSession(NttDataWA.DocsPaWR.FileRequest[] fileRequestList, bool cofirma, bool timestamp, tipoFirma TipoFirma)
 {
     DocsPaWR.InfoUtente infoUt             = NttDataWA.UIManager.UserManager.GetInfoUser();
     NttDataWA.DocsPaWR.DocsPaWebService ws = ProxyManager.GetWS();
     try
     {
         string tipoFirmaSTR = TipoFirma.ToString();
         return(ws.HSM_OpenMultiSignSession(infoUt, fileRequestList, cofirma, timestamp, tipoFirmaSTR));
     }
     catch (Exception e)
     {
         // loggiamo un errore ?!?!?!?
         return(null);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// CheckIn del documento corrente MTEXT
        /// </summary>
        private void CheckInMTextDocument(String file)
        {
            // Salvataggio del docNumber del documento in CheckOut
            CheckOutStatus ckSt = CheckOutAppletContext.Current.Status;

            if (UIManager.DocumentManager.getSelectedAttachId() != null)
            {
                ckSt = UIManager.DocumentManager.GetCheckOutDocumentStatus(UIManager.DocumentManager.GetSelectedAttachment().docNumber);
            }

            String docNumber = ckSt.DocumentNumber;

            // Estrai porzione del path di interesse per M/TEXT
            file = file.Substring(8);

            // Accedi a MTEXT per prelevare il PDF
            MTextModelProvider mtext = models.ModelProviderFactory <MTextModelProvider> .GetInstance();

            // Preleva contenuto PDF
            Byte[] content = mtext.ExportDocument(file, "application/pdf");

            // Fai sembrare il file M/TEXT un file FDF
            ckSt.DocumentLocation = "mtext.pdf";

            // Effettua il checkin del documento
            NttDataWA.DocsPaWR.ValidationResultInfo result = CheckInOutServices.CheckInDocument(content);

            // Salva l'FQN del file M/TEXT
            NttDataWA.DocsPaWR.DocsPaWebService ws = new NttDataWA.DocsPaWR.DocsPaWebService();
            ws.SetMTextFullQualifiedName(new NttDataWA.DocsPaWR.MTextDocumentInfo()
            {
                DocumentDocNumber = docNumber,
                FullQualifiedName = file
            });

            if (!result.Value)
            {
                // Scrittura dei messaggi di errore nel checkin
                Response.Write(this.GetErrorMessage(result));
            }
        }
Exemplo n.º 12
0
        public Memento HSM_GetMementoForUser()
        {
            DocsPaWR.InfoUtente infoUt             = NttDataWA.UIManager.UserManager.GetInfoUser();
            NttDataWA.DocsPaWR.DocsPaWebService ws = ProxyManager.GetWS();
            try
            {
                Memento  retval = new Memento();
                string[] resp   = ws.HSM_GetMementoForUser(infoUt);

                if (resp.Length == 2)
                {
                    retval.Dominio = resp[0];
                    retval.Alias   = resp[1];
                }
                return(retval);
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return(null);
            }
        }
Exemplo n.º 13
0
        public bool HSM_RequestOTP(String AliasCertificato, String DominioCertificato)
        {
            if (string.IsNullOrEmpty(AliasCertificato))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(DominioCertificato))
            {
                return(false);
            }

            NttDataWA.DocsPaWR.DocsPaWebService ws = new NttDataWA.DocsPaWR.DocsPaWebService();
            try
            {
                return(ws.HSM_RequestOTP(AliasCertificato, DominioCertificato));
            }
            catch (System.Exception ex)
            {
                //UIManager.AdministrationManager.DiagnosticError(ex);
                return(false);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Aggiornamento abilitazione / disabilitazione funzioni di checkin - checkout
        /// </summary>
        private void RefreshButtons()
        {
            this.DisableAllButtons();

            DocsPaWR.SchedaDocumento currentScheda = this.CurrentSchedaDocumento;

            if (currentScheda != null)
            {
                FileRequest selectedFile = UIManager.FileManager.getSelectedFile();

                // Verifica stato consolidamento del documento (solo se non consolidato, si può fare checkout)
                if (currentScheda.ConsolidationState == null ||
                    (currentScheda.ConsolidationState != null && currentScheda.ConsolidationState.State == DocsPaWR.DocumentConsolidationStateEnum.None))
                {
                    if (!string.IsNullOrEmpty(currentScheda.systemId) && (currentScheda.tipoProto != "R" && currentScheda.tipoProto != "C"))
                    {
                        // NB: Nei casi in cui l'utente non è abilitato per l'utilizzo della funzione di checkin / checkout,
                        // le uniche funzionalità non disponibili saranno quelle relative al checkin e all'undocheckout.
                        // In ogni caso potrà vedere lo stato del documento e chi l'ha posto in checkout.

                        // Verifica se il documento non è né cestinato né annullato
                        if (!this.IsDocumentoInCestino && !this.IsDocumentoAnnullato)
                        {
                            CheckOutStatus status = CheckInOutServices.GetCheckOutDocumentStatus();

                            if (status != null)
                            {
                                // Il documento risulta bloccato, reperimento del proprietario del blocco
                                string ownerUser       = status.UserName.ToUpper();
                                bool   isOwnerCheckOut = (ownerUser == UIManager.UserManager.GetInfoUser().userId.ToUpper());

                                if (this.UserEnabled && isOwnerCheckOut && (currentScheda.checkOutStatus == null || currentScheda.checkOutStatus.InConversionePdf))
                                {
                                    // Documento bloccato dall'utente corrente: funzioni di rilascio abilitate
                                    this.btnCheckIn.Enabled            = true;
                                    this.btnOpenCheckedOutFile.Enabled = true;
                                    this.btnUndoCheckOut.Enabled       = true;

                                    if (UIManager.UserManager.isFiltroAooEnabled())
                                    {
                                        //DocsPaWR.Registro[] userRegistri = UIManager.UserManager.getListaRegistri(this.Page);
                                        DocsPaWR.Registro[] userRegistri = RoleManager.GetRoleInSession().registri;
                                        this.btnCheckIn.Enabled            = UIManager.UserManager.verifyRegNoAOO(currentScheda, userRegistri);
                                        this.btnOpenCheckedOutFile.Enabled = UIManager.UserManager.verifyRegNoAOO(currentScheda, userRegistri);
                                        this.btnUndoCheckOut.Enabled       = UIManager.UserManager.verifyRegNoAOO(currentScheda, userRegistri);
                                    }
                                }
                                string language = UIManager.UserManager.GetUserLanguage();

                                this.btnShowCheckOutStatus.Enabled = true;
                                this.btnShowCheckOutStatus.Visible = true;
                                this.btnShowCheckOutStatus.ToolTip = Utils.Languages.GetLabelFromCode("DocumentImgLockTooltip", language) + ownerUser;

                                //Verifico che il documento è bloccato per una richiesta di conversione pdf lato server
                                //In caso affermativo disabilito l'apertura del file ed il rilascia sen
                                if (status.InConversionePdf)
                                {
                                    this.btnOpenCheckedOutFile.Enabled = false;
                                    this.btnCheckIn.Enabled            = false;

                                    // Se il documento è in stato di conversione pdf,
                                    // il pulsante di annullamento è abilitato solo se l'owner
                                    // del blocco è l'utente stesso
                                    //this.btnUndoCheckOut.Enabled = isOwnerCheckOut;
                                    this.btnUndoCheckOut.Enabled = false;
                                }
                            }
                            else
                            {
                                //modifica
                                NttDataWA.DocsPaWR.DocsPaWebService ws = new NttDataWA.DocsPaWR.DocsPaWebService();

                                //string idAmm = UIManager.UserManager.GetInfoUser().idAmministrazione;
                                ////NttDataWA.DocsPaWR.CacheConfig info = ws.getConfigurazioneCache(idAmm);
                                //if (ws.isActiveCache(idAmm))
                                //{
                                //    //bool inCache = ws.inCache(currentScheda.docNumber, currentScheda.documenti[currentScheda.documenti.Length - 1].versionId, idAmm);

                                //    //if (inCache)
                                //    //{
                                //    //    string pathComponents = ws.recuperaPathComponents(currentScheda.docNumber, currentScheda.documenti[currentScheda.documenti.Length - 1].versionId);
                                //    //    if (string.IsNullOrEmpty(pathComponents))
                                //    //        this.btnCheckOut.Enabled = false;
                                //    //    else
                                //            this.btnCheckOut.Enabled = true;
                                //    //}
                                //}
                                //else
                                //fine mofidica
                                if (Session["docInRisposta"] == null && Session["docInRisposta2"] == null)
                                {
                                    if (!this.IsEnabledProfilazioneAllegati &&
                                        this.IsSelectedTabAllegati && selectedFile.GetType() == typeof(DocsPaWR.Allegato))
                                    {
                                        // La funzione di checkout esplicita da tab allegati è disabilitata se la profilazione allegati è disabilitata
                                        this.btnCheckOut.Enabled = false;
                                    }
                                    else
                                    {
                                        this.btnCheckOut.Enabled = this.UserEnabled;

                                        if (UIManager.UserManager.isFiltroAooEnabled())
                                        {
                                            if (btnCheckOut.Enabled)
                                            {
                                                //DocsPaWR.Registro[] userRegistri = UIManager.UserManager.getListaRegistri(this.Page);
                                                DocsPaWR.Registro[] userRegistri = RoleManager.GetRoleInSession().registri;
                                                btnCheckOut.Enabled = UIManager.UserManager.verifyRegNoAOO(currentScheda, userRegistri);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    this.btnCheckOut.Enabled = false;
                                    if (Session["docInRisposta"] != null)
                                    {
                                        Session.Remove("docInRisposta");
                                    }
                                    else
                                    if (Session["docInRisposta2"] != null)
                                    {
                                        Session.Remove("docInRisposta2");
                                    }
                                }
                            }
                        }
                    }
                }

                // Abilitazione / disabilitazione pulsante salva file,
                // che viene comunque abilitato (se file presente)
                // indipendentemente dalle regole di abilitazione del checkin / checkout

                int size;
                if (selectedFile != null && Int32.TryParse(selectedFile.fileSize, out size))
                {
                    this.btnSave.Enabled = (size > 0);
                    this.Refresh(currentScheda.systemId, selectedFile.docNumber);
                }

                if (DocumentManager.getSelectedRecord() != null && !string.IsNullOrEmpty(DocumentManager.getSelectedRecord().systemId))
                {
                    if (CheckInOutServices.IsCheckedOutDocument(DocumentManager.getSelectedRecord().systemId, DocumentManager.getSelectedRecord().docNumber, UIManager.UserManager.GetInfoUser(), true) || (selectedFile != null && selectedFile.inLibroFirma))
                    {
                        this.btnCheckOut.Enabled = false;
                    }
                }
            }
        }