Esempio n. 1
0
        /// <summary>
        /// Rendering del documento checkedout
        /// </summary>
        private void RenderCheckedOutDocument()
        {
            byte[] content = null;

            if (CheckOutPage.SessionContent == null)
            {
                // Se il download del file non è stato fatto
                // contestualmente al CheckOut, viene reperito
                // il content del file dal server
                content = CheckInOutServices.GetCheckedOutFileDocument();
            }
            else
            {
                // Se il file è già stato scaricato contestualmente al checkout,
                // viene reperito il content del file dalla sessione
                content = CheckOutPage.SessionContent;

                CheckOutPage.SessionContent = null;
            }

            if (content != null)
            {
                Response.BinaryWrite(content);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Checkout di un documento e download del contenuto del file
        /// </summary>
        /// <param name="idDocument"></param>
        /// <param name="documentNumber"></param>
        /// <param name="machineName"></param>
        /// <param name="documentLocation">Percorso di estrazione del file</param>
        /// <param name="downloadFile">Se true, viene effettuato il download del file contestualmente al checkout</param>
        private void CheckOutDocument(string idDocument, string documentNumber, string documentLocation, string machineName, bool downloadFile)
        {
            CheckOutStatus checkOutStatus;

            ValidationResultInfo result = null;

            if (downloadFile)
            {
                byte[] content;

                result = CheckInOutServices.CheckOutDocumentWithFile(documentLocation, machineName, out checkOutStatus, out content);

                if (result.Value)
                {
                    SessionContent = content;
                }
            }
            else
            {
                result = CheckInOutServices.CheckOutDocument(documentLocation, machineName, out checkOutStatus);
            }

            if (!result.Value)
            {
                // Scrittura dei messaggi di errore nel checkout
                Response.Write(this.GetErrorMessage(result));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// CheckIn del documento corrente MTEXT
        /// </summary>
        private void CheckInMTextDocument(String file)
        {
            // Salvataggio del docNumber del documento in CheckOut
            String docNumber = CheckOutContext.Current.Status.DocumentNumber;

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

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

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

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

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

            // Salva l'FQN del file M/TEXT
            DocsPaWebService ws = new DocsPaWebService();

            ws.SetMTextFullQualifiedName(new MTextDocumentInfo()
            {
                DocumentDocNumber = docNumber,
                FullQualifiedName = file
            });

            if (!result.Value)
            {
                // Scrittura dei messaggi di errore nel checkin
                Response.Write(this.GetErrorMessage(result));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Caricamento dati relativamente allo stato del documento bloccato
        /// </summary>
        private void Fetch()
        {
            CheckOutStatus status = CheckInOutServices.GetCheckOutDocumentStatus();

            if (status != null)
            {
                this.DrawTable(status);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Annullamento del blocco sul documento
        /// </summary>
        private void UndoCheckOutDocument()
        {
            ValidationResultInfo retValue = CheckInOutServices.UndoCheckOutDocument();

            if (!retValue.Value)
            {
                // Scrittura dei messaggi di errore nel checkout
                Response.Write(this.GetErrorMessage(retValue));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// CheckIn del documento corrente
        /// </summary>
        private void CheckInDocument()
        {
            byte[] content = Request.BinaryRead(Request.ContentLength);

            ValidationResultInfo result = CheckInOutServices.CheckInDocument(content);

            if (!result.Value)
            {
                // Scrittura dei messaggi di errore nel checkin
                Response.Write(this.GetErrorMessage(result));
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Inizializzazione pannello checkinout
        /// </summary>
        /// <param name="idDocument"></param>
        /// <param name="documentNumber"></param>
        public void Initialize(string idDocument, string documentNumber)
        {
            if (!this.IsPostBack)
            {
                // Impostazione parametri relativi al documento corrente
                this.IDDocument     = idDocument;
                this.DocumentNumber = documentNumber;

                // Registrazione eventi javascript
                this.RegisterClientScriptEvents();

                // Verifica se l'utente è abilitato all'utilizzo della funzione
                if (this.UserEnabled)
                {
                    // Inizializzazione del contesto di checkout per il documento corrente
                    CheckInOutServices.InitializeContext();
                }
            }
        }
Esempio n. 8
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 = 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 == UserManager.getInfoUtente().userId.ToUpper());

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

                                    if (DocsPAWA.UserManager.isFiltroAooEnabled(this.Page))
                                    {
                                        DocsPaWR.Registro[] userRegistri = DocsPAWA.UserManager.getListaRegistri(this.Page);
                                        this.btnCheckIn.Enabled            = UserManager.verifyRegNoAOO(currentScheda, userRegistri);
                                        this.btnOpenCheckedOutFile.Enabled = UserManager.verifyRegNoAOO(currentScheda, userRegistri);
                                        this.btnUndoCheckOut.Enabled       = UserManager.verifyRegNoAOO(currentScheda, userRegistri);
                                    }
                                }

                                this.btnShowCheckOutStatus.Enabled = true;
                                this.btnShowCheckOutStatus.Visible = true;
                                this.btnShowCheckOutStatus.ToolTip = "Il documento risulta bloccato dall'utente " + 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;
                                }
                            }
                            else
                            {
                                //modifica
                                DocsPAWA.DocsPaWR.DocsPaWebService ws = new DocsPAWA.DocsPaWR.DocsPaWebService();

                                string idAmm = UserManager.getInfoUtente().idAmministrazione;
                                //DocsPAWA.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;
                                        }

                                        if (IsTimeStampedFile)
                                        {
                                            this.btnCheckOut.Enabled = false;
                                        }
                                    }
                                }
                                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 (IsTimeStampedFile)
                                        {
                                            this.btnCheckOut.Enabled = false;
                                        }

                                        if (DocsPAWA.UserManager.isFiltroAooEnabled(this.Page))
                                        {
                                            if (btnCheckOut.Enabled)
                                            {
                                                DocsPaWR.Registro[] userRegistri = DocsPAWA.UserManager.getListaRegistri(this.Page);
                                                btnCheckOut.Enabled = 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);
                }
            }
        }