/// <summary>
        /// Visualizzazione dell'esito della firma applicata ad uno o più documenti
        /// </summary>
        protected void ShowReport()
        {
            List <FirmaDigitaleResultStatus> res    = FirmaDigitaleResultManager.CurrentData;
            MassiveOperationReport           report = new MassiveOperationReport();

            foreach (FirmaDigitaleResultStatus temp in res)
            {
                MassiveOperationTarget target = MassiveOperationUtils.getItem(temp.IdDocument);
                MassiveOperationReport.MassiveOperationResultEnum result = MassiveOperationReport.MassiveOperationResultEnum.OK;
                if (!temp.Status)
                {
                    result = MassiveOperationReport.MassiveOperationResultEnum.KO;
                }
                report.AddReportRow(target.Codice, result, temp.StatusDescription);
            }

            if (!IsLF)
            {
                string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
                report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
                this.generateReport(report, "Firma digitale massiva");
            }
            else
            {
                HttpContext.Current.Session["massiveSignReport"] = report;
            }
            //PDZ 17/01/2017
            //Spostata da dentro if (!IsLF)
            FirmaDigitaleResultManager.ClearData();
        }
Exemple #2
0
        protected override bool btnConferma_Click(object sender, EventArgs e)
        {
            // System id dei documenti selezionati
            List <String> objectsId;

            // Report da mostrare
            MassiveOperationReport report = new MassiveOperationReport();

            // Se la request contiene objType e tale parametro è valorizzato come D,
            // i system id gestiti da MassiveOperationUtils sono id di documenti
            // altrimenti sono system id di fascicoli ed in tal caso bisogna eseguire l'inserimento
            // dei documenti contenuti nei fascicoli
            if (!String.IsNullOrEmpty(Request["objType"]) &&
                Request["objType"] == "D")
            {
                this.ExecuteInsertDocumentsInSA(
                    MassiveOperationUtils.GetSelectedItems(), report);
            }
            else
            {
                this.ExecuteInsertProjectsInSA(
                    MassiveOperationUtils.GetSelectedItems(), report);
            }

            // Introduzione della riga di summary
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
            this.generateReport(report, "Conservazione massiva");
            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Funzione per la validazione dei dati sul documento e l'avvio dell'inserimento
        /// nell'area di conservazione
        /// </summary>
        /// <param name="documentDetails">Dettagli del documento da inserire nell'area di conservazione</param>
        /// <param name="report">Report dello spostamento</param>
        private void CheckDataValidityAndInsertInSA(SchedaDocumento documentDetails, MassiveOperationReport report)
        {
            // Identificativo dell'istanza di certificazione
            String conservationAreaId;

            // Se il documento ha un file acquisito
            if (Convert.ToInt32(documentDetails.documenti[0].fileSize) > 0 && (string.IsNullOrEmpty(documentDetails.inConservazione) || !(documentDetails.inConservazione).Equals("1")))
            {
                // Inserimento del documento in area di conservazione
                this.InsertInSA(documentDetails, report);
            }

            else
            {
                string codice = MassiveOperationUtils.getItem(documentDetails.systemId).Codice;
                if (!string.IsNullOrEmpty(documentDetails.inConservazione) && (documentDetails.inConservazione).Equals("1"))
                {
                    report.AddReportRow(
                        codice,
                        MassiveOperationReport.MassiveOperationResultEnum.KO,
                        "Il documento risulta già inserito in una nuova istanza di conservazione, impossibile inserirlo nuovamente");
                }
                else
                {
                    report.AddReportRow(
                        codice,
                        MassiveOperationReport.MassiveOperationResultEnum.KO,
                        "Il documento principale non ha alcun file associato, impossibile inserirlo in area conservazione");
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Al click sul pulsante bisogna applicare il timestamp a tutti i documenti selezionati
        /// </summary>
        protected override bool btnConferma_Click(object sender, EventArgs e)
        {
            #region Dichiarazione variabili

            // Lista di system id degli elementi selezionati
            List <MassiveOperationTarget> selectedItem;

            // Il report da mostrare all'utente
            MassiveOperationReport report;

            #endregion

            // Inizializzazione del report
            report = new MassiveOperationReport();

            // Recupero della lista dei system id dei documenti selezionati
            selectedItem = MassiveOperationUtils.GetSelectedItems();

            // Esecuzione dell'applicazione del timestamp
            this.ApplyTimeStampToDocuments(selectedItem, report);

            // Introduzione della riga di summary
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);

            // Visualizzazione del report e termine della fase di attesa
            this.generateReport(report, "Timestamp massivo");
            return(true);
        }
Exemple #5
0
        /// <summary>
        /// Al click sul pulsante di conferma, viene avviata la procedura per lo spostamento massivo
        /// di documenti nell'Area di Lavoro
        /// </summary>
        protected override bool btnConferma_Click(object sender, EventArgs e)
        {
            // Il report da visualizzare
            MassiveOperationReport report;

            // Inizializzazione del report
            report = new MassiveOperationReport();

            // Selezione della procedura da seguire in base al
            // tipo di oggetto
            if (Request["objType"].Equals("D"))
            {
                this.MoveDocumentsInADL(MassiveOperationUtils.GetSelectedItems(), report);
            }
            else
            {
                this.MoveProjectsInADL(MassiveOperationUtils.GetSelectedItems(), report);
            }

            // Introduzione della riga di summary
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            if (Request["objType"].Equals("D"))
            {
                report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
            }
            else
            {
                report.AddSummaryRow("Fascicoli lavorati: {0} - Fascicoli non lavorati: {1}", pars);
            }

            this.generateReport(report, "Spostamento in ADL massivo");
            return(true);
        }
 /// <summary>
 /// Funzione per lo spostamento dei documenti nell'area di lavoro
 /// </summary>
 /// <param name="documentsInfo">L'elenco dei documenti da spostare</param>
 /// <param name="report">Report del''esecuzione</param>
 private void MoveDocumentsInWorkingArea(List <InfoDocumento> documentsInfo, MassiveOperationReport report)
 {
     // Per ogni documento...
     foreach (InfoDocumento docInfo in documentsInfo)
     {
         string id = MassiveOperationUtils.getItem(docInfo.idProfile).Codice;
         // ...spostamento del documento nell'area di lavoro
         try
         {
             if (DocumentManager.isDocInADL(docInfo.idProfile, this.Page) == 0 && DocumentManager.isDocInADLRole(docInfo.idProfile, this.Page) == 0)
             {
                 SchedaDocumento sd = DocumentManager.getDocumentDetails(this, docInfo.docNumber, docInfo.docNumber);
                 DocumentManager.addAreaLavoro(this, sd);
                 report.AddReportRow(
                     id,
                     MassiveOperationReport.MassiveOperationResultEnum.OK,
                     "Documento inserito correttamente nell'area di lavoro.");
             }
             else
             {
                 report.AddReportRow(
                     id,
                     MassiveOperationReport.MassiveOperationResultEnum.KO,
                     "Documento già inserito nell'area di lavoro.");
             }
         }
         catch (Exception e)
         {
             report.AddReportRow(
                 id,
                 MassiveOperationReport.MassiveOperationResultEnum.KO,
                 "Errore durante lo spostamento del documento nell'area di lavoro. Dettagli: " + e.Message);
         }
     }
 }
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true);

            // Il report da visualizzare
            MassiveOperationReport report;

            // Inizializzazione del report
            report = new MassiveOperationReport();

            // Selezione della procedura da seguire in base al
            // tipo di oggetto
            if (!this.IsFasc)
            {
                this.MoveDocumentsInADL(MassiveOperationUtils.GetSelectedItems(), report);
            }
            else
            {
                this.MoveProjectsInADL(MassiveOperationUtils.GetSelectedItems(), report);
            }

            // Introduzione della riga di summary
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            if (!this.IsFasc)
            {
                report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
            }
            else
            {
                report.AddSummaryRow("Fascicoli lavorati: {0} - Fascicoli non lavorati: {1}", pars);
            }

            this.generateReport(report, "Spostamento in ADL utente massivo");
        }
Exemple #8
0
        protected override bool btnConferma_Click(object sender, EventArgs e)
        {
            // Lista di system id degli elementi selezionati
            List <MassiveOperationTarget> selectedItem;

            // Recupero della lista dei system id dei documenti selezionati
            selectedItem = MassiveOperationUtils.GetSelectedItems();

            //tipo di rimozione
            string            selectedValue = this.rbl_versioni.SelectedItem.Value;
            RemoveVersionType type          = RemoveVersionType.ALL_BUT_THE_LAST;

            if ("opt_no_last_two".Equals(selectedValue))
            {
                type = RemoveVersionType.ALL_BUT_LAST_TWO;
            }
            MassiveOperationReport report = ProceedWithOperation(selectedItem, type);

            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);

            // Visualizzazione del report e termine della fase di attesa
            this.generateReport(report, "Rimozione versioni massiva");
            return(true);
        }
Exemple #9
0
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true);

            // Lista di system id degli elementi selezionati
            List <MassiveOperationTarget> selectedItem;

            // Errore verificatosi in fase di creazione della scheda
            String error = String.Empty;

            // La scheda documento creata
            SchedaDocumento document;

            // Recupero della lista dei system id dei documenti selezionati
            selectedItem = MassiveOperationUtils.GetSelectedItems();

            // Generazione della scheda
            MassiveOperationReport report = new MassiveOperationReport();
            //Se per uno dei documenti selezionati è attivo un processo di firma, blocco l'operazione di inoltro
            bool inLibroFirma = false;

            try
            {
                foreach (MassiveOperationTarget temp in selectedItem)
                {
                    if (LibroFirmaManager.IsDocOrAllInLibroFirma(temp.Id))
                    {
                        report.AddReportRow("-", MassiveOperationReport.MassiveOperationResultEnum.KO, "Il documento non è stato creato poichè per uno dei documenti selezionati, o suoi allegati, è attivo un processo di firma");
                        inLibroFirma = true;
                        break;
                    }
                }
                if (!inLibroFirma)
                {
                    document = this.GenerateDocumentScheda(selectedItem, out error);
                    if (document != null)
                    {
                        report.AddReportRow("-", MassiveOperationReport.MassiveOperationResultEnum.OK, "Il documento è stato creato correttamente");
                    }
                    else
                    {
                        report.AddReportRow("-", MassiveOperationReport.MassiveOperationResultEnum.KO, "Il documento non è stato creato");
                    }
                }
            }
            catch (Exception ex)
            {
                report.AddReportRow("-", MassiveOperationReport.MassiveOperationResultEnum.KO, "Errore nella creazione del documento");
            }
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
            this.generateReport(report, "Inoltra massivo");

            // set session to manage document.aspx
            HttpContext.Current.Session["IsForwarded"] = true;
        }
Exemple #10
0
        private MassiveOperationReport ProceedWithOperation(List <MassiveOperationTarget> selectedItem, RemoveVersionType type)
        {
            // Inizializzazione del report
            MassiveOperationReport report = new MassiveOperationReport();
            List <ImportResult>    res    = DocumentManager.RimuoviVersioniMassivo(selectedItem, type, this);

            foreach (ImportResult temp in res)
            {
                string codice = MassiveOperationUtils.getItem(temp.IdProfile).Codice;
                report.AddReportRow(codice, (temp.Outcome == OutcomeEnumeration.OK) ? MassiveOperationReport.MassiveOperationResultEnum.OK : MassiveOperationReport.MassiveOperationResultEnum.KO, temp.Message);
            }
            return(report);
        }
Exemple #11
0
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true);

            // creazione e inizializzazione report
            MassiveOperationReport report = new MassiveOperationReport();

            this.ExecuteVersamento(MassiveOperationUtils.GetSelectedItems(), report);

            // summary del report
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);

            //metodo generatereport da fare
            this.GenerateReport(report, "titolo");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Assegnazione dei tooltip dipendenti dal tipo di oggetti
            // contenuti nella griglia
            this.btnExport.ToolTip = String.Format(
                "Esporta i {0} selezionati",
                this.ObjType == ObjTypeEnum.D ? "documenti" : "fascicoli");

            this.btnWorkingArea.ToolTip = String.Format(
                "Salva i {0} selezionati nell'area di lavoro",
                this.ObjType == ObjTypeEnum.D ? "documenti" : "fascicoli");

            this.btnTransmit.ToolTip = String.Format(
                "Trasmetti i {0} selezionati",
                this.ObjType == ObjTypeEnum.D ? "documenti" : "fascicoli");

            // Visualizzazione dei controlli in base al tipo di ricerca in cui
            // è stata inserita la bottoniera
            this.ShowControls();

            // Se non ci sono documenti o fascicoli selezionati, il controllo non deve essere
            // visibile
            if (MassiveOperationUtils.IsCollectionInitialized())
            {
                this.Visible = true;
            }
            else
            {
                this.Visible = false;
            }



            //// Se nel livello superiore dello stack è presente la variabile GoToDetails
            //// significa che è stato fatto un inoltro massivo.
            //if (CallContextStack.CurrentContext.SessionState["GoToDetails"] != null)
            //{
            //    // Viene rimossa la variabile dalla sessione
            //    CallContextStack.CurrentContext.SessionState.Remove("GoToDetails");
            //    // Viene immerso il codice javascript per redirezionare il fram di destra alla
            //    // pagina di dettaglio del documento creato
            //    Page.ClientScript.RegisterStartupScript(
            //        this.GetType(),
            //        "Redirect",
            //        "top.frame
            //}
        }
Exemple #13
0
        protected override bool btnConferma_Click(object sender, EventArgs e)
        {
            DocsPaWR.InfoUtente            userInfo = UserManager.getInfoUtente();
            DocumentConsolidationHandler   dch      = new DocumentConsolidationHandler(null, userInfo);
            DocumentConsolidationStateEnum state    = DocumentConsolidationStateEnum.Step1;

            if (IsMetadati)
            {
                state = DocumentConsolidationStateEnum.Step2;
            }
            MassiveOperationReport report = dch.ConsolidateDocumentMassive(state, MassiveOperationUtils.GetSelectedItems());

            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
            this.generateReport(report, "Consolidamento documenti");
            return(true);
        }
        /// <summary>
        /// Visualizzazione dell'esito della firma applicata ad uno o più documenti
        /// </summary>
        protected void ShowReport()
        {
            List <FirmaResult> firmaResult = new List <FirmaResult>();

            List <FirmaDigitaleResultStatus> res    = FirmaDigitaleResultManager.CurrentData;
            MassiveOperationReport           report = new MassiveOperationReport();

            foreach (FirmaDigitaleResultStatus temp in res)
            {
                MassiveOperationTarget target = MassiveOperationUtils.getItem(temp.IdDocument);
                MassiveOperationReport.MassiveOperationResultEnum result = MassiveOperationReport.MassiveOperationResultEnum.OK;

                if (target == null)
                {
                    result = MassiveOperationReport.MassiveOperationResultEnum.KO;
                    report.AddReportRow(temp.IdDocument, result, temp.StatusDescription);
                }
                else
                {
                    if (!temp.Status)
                    {
                        result = MassiveOperationReport.MassiveOperationResultEnum.KO;
                    }
                    report.AddReportRow(target.Codice, result, temp.StatusDescription);
                }

                FirmaResult firmaTerminata = new FirmaResult();
                firmaTerminata.fileRequest = new FileRequest();
                //firmaTerminata.fileRequest.
            }

            if (!IsLF)
            {
                string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
                report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
                this.generateReport(report, "Firma digitale massiva");
                FirmaDigitaleResultManager.ClearData();
            }
            else
            {
                HttpContext.Current.Session["massiveSignReport"] = report;
                FirmaDigitaleResultManager.ClearData();
            }
        }
        protected List <MassiveOperationTarget> GetSelectedDocuments()
        {
            List <MassiveOperationTarget> selectedItems = MassiveOperationUtils.GetSelectedItems();

            if (selectedItems.Count == 0)
            {
                DocsPaWR.SchedaDocumento schedaDocumento = DocumentManager.getSelectedRecord();

                if (schedaDocumento != null)
                {
                    string codice = (schedaDocumento.protocollo != null) ? schedaDocumento.protocollo.numero : schedaDocumento.docNumber;
                    MassiveOperationTarget mot = new MassiveOperationTarget(schedaDocumento.systemId, codice);
                    mot.Checked = true;
                    selectedItems.Add(mot);
                }
            }

            return(selectedItems);
        }
        /// <summary>
        /// Funzione per l'inizializzazione della pagina
        /// </summary>
        private void Initialize()
        {
            // Assegnazione dei tooltip dipendenti dal tipo di oggetti
            // contenuti nella griglia
            this.btnExport.ToolTip = String.Format(
                "Esporta i {0} selezionati",
                this.ObjType == ObjTypeEnum.D ? "documenti" : "fascicoli");

            this.btnWorkingArea.ToolTip = String.Format(
                "Salva i {0} selezionati nell'area di lavoro",
                this.ObjType == ObjTypeEnum.D ? "documenti" : "fascicoli");

            this.btnTransmit.ToolTip = String.Format(
                "Trasmetti i {0} selezionati",
                this.ObjType == ObjTypeEnum.D ? "documenti" : "fascicoli");

            this.btnStorage.ToolTip = String.Format(
                "Sposta i {0} selezionati nell'area di conservazione.",
                this.ObjType == ObjTypeEnum.D ? "documenti" : "documenti contenuti nei fascicoli");


            // Visualizzazione dei controlli in base al tipo di ricerca in cui
            // è stata inserita la bottoniera
            this.ShowControls();

            // Se non ci sono documenti o fascicoli selezionati, il controllo non deve essere
            // visibile
            if (MassiveOperationUtils.IsCollectionInitialized())
            {
                this.Visible = true;
                this.chkSelectDeselectAll.Enabled = true;
            }
            else
            {
                // this.Visible = false;
                this.Visible = true;
                this.chkSelectDeselectAll.Enabled = false;
            }

            this.hd_pag_chiam.Value = this.PAGINA_CHIAMANTE;
            this.hd_pag_num.Value   = this.NUM_RESULT;
        }
Exemple #17
0
        /// <summary>
        /// Al click sul pulsante bisogna creare il documento per l'inoltro massivo
        /// </summary>
        protected override bool btnConferma_Click(object sender, EventArgs e)
        {
            #region Dichiarazione variabili

            // Lista di system id degli elementi selezionati
            List <MassiveOperationTarget> selectedItem;

            // Errore verificatosi in fase di creazione della scheda
            String error = String.Empty;

            // La scheda documento creata
            SchedaDocumento document;

            #endregion

            // Recupero della lista dei system id dei documenti selezionati
            selectedItem = MassiveOperationUtils.GetSelectedItems();

            // Generazione della scheda
            MassiveOperationReport report = new MassiveOperationReport();
            try
            {
                document = this.GenerateDocumentScheda(selectedItem, out error);
                if (document != null)
                {
                    report.AddReportRow("-", MassiveOperationReport.MassiveOperationResultEnum.OK, "Il documento è stato creato correttamente");
                }
                else
                {
                    report.AddReportRow("-", MassiveOperationReport.MassiveOperationResultEnum.KO, "Il documento non è stato creato");
                }
            }
            catch (Exception ex)
            {
                report.AddReportRow("-", MassiveOperationReport.MassiveOperationResultEnum.KO, "Errore nella creazione del documento");
            }
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
            this.generateReport(report, "Inoltra massivo");
            this.addJSOnChiudiButton("self.returnValue=true;self.close();");
            return(true);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected List <MassiveOperationTarget> GetSelectedDocuments()
        {
            List <MassiveOperationTarget> selectedItems = MassiveOperationUtils.GetSelectedItems();

            if (selectedItems.Count == 0)
            {
                DocsPaWR.SchedaDocumento schedaDocumento = NttDataWA.UIManager.DocumentManager.getSelectedRecord();

                if (schedaDocumento != null)
                {
                    FileRequest fileReq = new FileRequest();
                    if (UIManager.DocumentManager.getSelectedAttachId() != null)
                    {
                        fileReq = FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId());
                    }
                    else
                    {
                        fileReq = FileManager.GetFileRequest();
                    }
                    if (DocumentManager.getSelectedNumberVersion() != null && DocumentManager.ListDocVersions != null)
                    {
                        fileReq = (from v in DocumentManager.ListDocVersions where v.version.Equals(DocumentManager.getSelectedNumberVersion()) select v).FirstOrDefault();
                    }
                    string codice = string.Empty;
                    MassiveOperationTarget mot;
                    if (fileReq == null || fileReq.docNumber.Equals(schedaDocumento.docNumber))
                    {
                        codice = (schedaDocumento.protocollo != null) ? schedaDocumento.protocollo.numero : schedaDocumento.docNumber;
                        mot    = new MassiveOperationTarget(schedaDocumento.systemId, codice);
                    }
                    else
                    {
                        codice = fileReq.docNumber;
                        mot    = new MassiveOperationTarget(codice, codice);
                    }
                    mot.Checked = true;
                    selectedItems.Add(mot);
                }
            }

            return(selectedItems);
        }
Exemple #19
0
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true);

            // Il report da visualizzare
            MassiveOperationReport report;

            // Inizializzazione del report
            report = new MassiveOperationReport();

            // Esecuzione dell'applicazione del timestamp
            this.ApplyTimeStampToDocuments(MassiveOperationUtils.GetSelectedItems(), report);

            // Introduzione della riga di summary
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);

            // Generazione del report da esportare
            this.generateReport(report, "Timestamp massivo");
        }
Exemple #20
0
        protected void BtnConfirm_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true);

            DocumentConsolidationHandler   dch   = new DocumentConsolidationHandler(null, UserManager.GetInfoUser());
            DocumentConsolidationStateEnum state = DocumentConsolidationStateEnum.Step1;
            string title = "Consolidamento documenti";

            if (this.IsMetadati)
            {
                state = DocumentConsolidationStateEnum.Step2;
                title = "Consolidamento documenti e metadati";
            }

            MassiveOperationReport report = dch.ConsolidateDocumentMassive(state, MassiveOperationUtils.GetSelectedItems());

            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
            this.generateReport(report, title);
        }
        /// <summary>
        /// Funzione utilizzata per verificare se c'è almeno un elemento selezionato
        /// e se è possibile procedere con l'avvio della funzione massiva richiesta
        /// </summary>
        /// <param name="dialogName">Il nome da assegnare alla funestra da aprire</param>
        /// <param name="function">Lo script da registrare in caso di successo delle verifica</param>
        private void UpdateSavedCheckingStatusAndCheckAtLeastOneSelected(
            string dialogName,
            string function)
        {
            // Lo script da immergere
            string script = "alert('Selezionare almeno un risultato!');";

            // Aggiornamento dello stato di checking salvato
            this.UpdateSavedCheckingStatus();

            // Se ci sono elementi selezionati, viene immerso il codice per l'apertura della finestra
            // altrimenti viene immerso il codice per mostrare un avviso
            if (MassiveOperationUtils.GetSelectedItems().Count > 0)
            {
                script = function;
            }

            this.Page.ClientScript.RegisterStartupScript(
                this.GetType(),
                dialogName,
                script,
                true);
        }
Exemple #22
0
        /// <summary>
        /// Funzione per l'inizializzazione della pagina
        /// </summary>
        private void Initialize()
        {
            // La lista dei system id dei documenti selezionati
            List <MassiveOperationTarget> documentsIdProfile;

            // Lista delle informazioni di base sui documenti da convertire
            List <BaseInfoDoc> documents;

            // Recupero dei system id dei documenti da convertire
            documentsIdProfile = MassiveOperationUtils.GetSelectedItems();

            // Inizializzazione della lista delle informazioni sui documenti da convertire
            documents = new List <BaseInfoDoc>();

            // Per ogni id profile, vengono recuperate le informazioni di base sul
            // documento
            foreach (MassiveOperationTarget temp in documentsIdProfile)
            {
                // ...recupero del contenuto delle informazioni di base sul documento
                try
                {
                    documents.Add(DocumentManager.GetBaseInfoForDocument(
                                      temp.Id,
                                      String.Empty,
                                      String.Empty).Where(e => e.IdProfile.Equals(temp.Id)).FirstOrDefault());
                }
                catch (Exception e)
                {
                    throw new Exception(String.Format(
                                            "Errore durante il reperimento delle informazioni sul documento {0}", temp.Codice));
                }
            }

            // Salvataggio delle informazioni sui documenti
            this.DocumentsInfo = documents;
        }
Exemple #23
0
        private void Export()
        {
            string oggetto   = this.hd_export.Value;
            string tipologia = string.Empty;
            string titolo    = this.txt_titolo.Text;

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

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

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

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

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

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

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


                if (file == null || file.content == null || file.content.Length == 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "noRisultatiRicerca", "alert('Nessun documento trovato.');", true);
                    ClientScript.RegisterStartupScript(this.GetType(), "openFile", "OpenFile('" + tipologia + "');", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "openFile", "OpenFile('" + tipologia + "');", true);
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "errore", "alert('Errore di sistema: " + ex.Message.Replace("'", "\\'") + "');", true);
            }
        }
Exemple #24
0
        /// <summary>
        /// Funzione per la conversione dei documenti in PDF
        /// </summary>
        /// <param name="documentsInfo">La lista con le informazioni sui documenti da convertire</param>
        /// <returns>Il report dell'elaborazione</returns>
        public MassiveOperationReport ConvertInPdf(List <BaseInfoDoc> documentsInfo)
        {
            DocsPaWebService ws = new DocsPaWebService();

            ws.Timeout = System.Threading.Timeout.Infinite;
            // Il report da restituire
            MassiveOperationReport report;

            // Il risultato della messa in conversione di un documento
            MassiveOperationReport.MassiveOperationResultEnum tempResult;

            // Il messaggio da inserire nel report
            string message;

            // Informazioni sull'utente che ha lanciato la procedura
            InfoUtente userInfo;

            // Il file associato al documento
            byte[] content = null;

            // Inizializzazione del report
            report = new MassiveOperationReport();

            // Recupero delle informazioni sull'utente
            userInfo = UserManager.getInfoUtente(this);
            foreach (BaseInfoDoc doc in documentsInfo)
            {
                // Inizializzazione del messaggio
                string codice = MassiveOperationUtils.getItem(doc.IdProfile).Codice;
                message = "Documento inserito correttamente nella coda di conversione PDF.";

                //Recupero i diritti sul documento
                string ar = ws.getAccessRightDocBySystemID(doc.IdProfile, UserManager.getInfoUtente(this));

                // Verifica delle informazioni sul documento
                tempResult = this.ValidateDocumentInformation(doc, out message);

                if (ar.Equals("20"))
                {
                    message    = "Il documento è in attesa di accettazione, quindi non può essere convertito";
                    tempResult = MassiveOperationReport.MassiveOperationResultEnum.KO;
                }

                //Verifico che il documento non sia consolidato
                FirmaDigitale.FirmaDigitaleMng mng             = new FirmaDigitale.FirmaDigitaleMng();
                DocsPaWR.SchedaDocumento       schedaDocumento = mng.GetSchedaDocumento(doc.DocNumber);

                if (schedaDocumento != null)
                {
                    if (schedaDocumento.ConsolidationState != null &&
                        schedaDocumento.ConsolidationState.State > DocsPaWR.DocumentConsolidationStateEnum.None)
                    {
                        // Il documento risulta consolidato, non può essere firmato digitalmente
                        message    = "Il documento risulta consolidato";
                        tempResult = MassiveOperationReport.MassiveOperationResultEnum.KO;
                    }
                }

                // Se il risultato di validazione delle informazioni è OK, si pruò procedere
                if (tempResult == MassiveOperationReport.MassiveOperationResultEnum.OK)
                {
                    try
                    {
                        // Recupero delle informazioni sul file da convertire
                        content = FileManager.getInstance(Session.SessionID).GetFile(
                            this,
                            doc.VersionId,
                            doc.VersionNumber.ToString(),
                            doc.DocNumber,
                            doc.Path,
                            doc.FileName,
                            false).content;
                    }
                    catch (Exception e)
                    {
                        message    = "Errore durante il reperimento del file associato al documento.";
                        tempResult = MassiveOperationReport.MassiveOperationResultEnum.KO;
                    }
                }

                // Se si può procedere si mette in coda il file da convertire
                if (tempResult == MassiveOperationReport.MassiveOperationResultEnum.OK)
                {
                    try
                    {
                        // Avvio della conversione
                        FileManager.EnqueueServerPdfConversionAM(
                            this,
                            userInfo,
                            content,
                            doc.FileName,
                            new SchedaDocumento()
                        {
                            systemId  = doc.IdProfile,
                            docNumber = doc.DocNumber
                        });
                    }
                    catch (Exception e)
                    {
                        tempResult = MassiveOperationReport.MassiveOperationResultEnum.KO;
                        message    = "Errore durante l'inserimento del documento nella coda di conversione.";
                    }
                }
                // Inserimento di una nuova riga nel report
                report.AddReportRow(
                    codice,
                    tempResult,
                    message);
            }

            // Restituzione del report
            return(report);
        }
Exemple #25
0
        /// <summary>
        /// Funzione per l'inserimento di un documento nell'area di conservazione
        /// </summary>
        /// <param name="documentDetails">Dettagli del documento da inserire</param>
        /// <param name="report">Report di inserimento</param>
        private void InsertInSA_WithConstraint(SchedaDocumento documentDetails,
                                               MassiveOperationReport report,
                                               ref int indexOfCurrentDoc,
                                               ref int currentDimOfDocs,
                                               int DimMaxInIstanza,
                                               int numMaxDocInIstanza,
                                               int percentualeTolleranza
                                               )
        {
            StringBuilder message = new StringBuilder();
            String        conservationAreaId;
            string        id = MassiveOperationUtils.getItem(documentDetails.systemId).Codice;

            // Se si sta creando la prima istanza di conservazione...
            if (DocumentManager.isPrimaConservazione(
                    UserManager.GetInfoUser().idPeople,
                    UserManager.GetInfoUser().idGruppo) == 1)
            {
                message.Append("Si sta creando la prima istanza di conservazione. ");
            }

            // Recupero dell'eventiale fascicolo selezionato
            Fascicolo selectedProject = ProjectManager.getProjectInSession();

            // Controllo Rispetto dei Vincoli dell'istanza
            #region Vincoli Istanza di Conservazione
            // Variabili di controllo per violazione dei vincoli sulle istanze
            bool numDocIstanzaViolato      = false;
            bool dimIstanzaViolato         = false;
            int  TotalSelectedDocumentSize = 0;

            TotalSelectedDocumentSize = DocumentManager.GetTotalDocumentSize(documentDetails);
            // Dimensione documenti raggiunta
            currentDimOfDocs = TotalSelectedDocumentSize + currentDimOfDocs;
            // Numero di documenti raggiunti
            indexOfCurrentDoc = indexOfCurrentDoc + 1;

            numDocIstanzaViolato = DocumentManager.isVincoloNumeroDocumentiIstanzaViolato(indexOfCurrentDoc, numMaxDocInIstanza);
            dimIstanzaViolato    = DocumentManager.isVincoloDimensioneIstanzaViolato(currentDimOfDocs, DimMaxInIstanza, percentualeTolleranza);

            double DimensioneMassimaConsentitaPerIstanza = 0;
            DimensioneMassimaConsentitaPerIstanza = DimMaxInIstanza - ((DimMaxInIstanza * percentualeTolleranza) / 100);

            int DimMaxConsentita = 0;
            DimMaxConsentita = Convert.ToInt32(DimensioneMassimaConsentitaPerIstanza);

            if (numDocIstanzaViolato || dimIstanzaViolato)
            {
                // Azzero le due variabili
                currentDimOfDocs  = 0;
                indexOfCurrentDoc = 0;
            }
            #endregion

            // Inserimento del documento nella conservazione e recupero dell'id dell'istanza
            if (selectedProject != null)
            {
                // Da ricerca documenti in fascicolo
                conservationAreaId = DocumentManager.addAreaConservazioneAM_WithConstraint(
                    this.Page,
                    documentDetails.systemId,
                    selectedProject.systemID,
                    documentDetails.docNumber,
                    UserManager.GetInfoUser(),
                    "F",
                    numDocIstanzaViolato,
                    dimIstanzaViolato,
                    DimMaxConsentita,
                    numMaxDocInIstanza,
                    TotalSelectedDocumentSize
                    );
            }
            else
            {
                conservationAreaId = DocumentManager.addAreaConservazioneAM_WithConstraint(
                    this.Page,
                    documentDetails.systemId,
                    "",
                    documentDetails.docNumber,
                    UserManager.GetInfoUser(),
                    "D",
                    numDocIstanzaViolato,
                    dimIstanzaViolato,
                    DimMaxConsentita,
                    numMaxDocInIstanza,
                    TotalSelectedDocumentSize
                    );
            }

            try
            {
                if (conservationAreaId.ToString() != "-1")
                {
                    int size_xml = DocumentManager.getItemSize(
                        documentDetails,
                        conservationAreaId);

                    int doc_size = Convert.ToInt32(documentDetails.documenti[0].fileSize);

                    int    numeroAllegati = documentDetails.allegati.Length;
                    string fileName       = documentDetails.documenti[0].fileName;
                    string tipoFile       = Path.GetExtension(fileName);
                    int    size_allegati  = 0;
                    for (int i = 0; i < documentDetails.allegati.Length; i++)
                    {
                        size_allegati = size_allegati + Convert.ToInt32(documentDetails.allegati[i].fileSize);
                    }
                    int total_size = size_allegati + doc_size + size_xml;

                    DocumentManager.insertSizeInItemCons(conservationAreaId, total_size);

                    DocumentManager.updateItemsConservazione(
                        tipoFile,
                        Convert.ToString(numeroAllegati),
                        conservationAreaId);
                }
            }
            catch (Exception e)
            {
                report.AddReportRow(
                    id,
                    MassiveOperationReport.MassiveOperationResultEnum.KO,
                    "Si è verificato un errore durante l'inserimento del documento nell'area di conservazione");
            }

            #region old code
            //report.AddReportRow(
            //    id,
            //    MassiveOperationReport.MassiveOperationResultEnum.OK,
            //    "Documento inserito correttamente in area di conservazione.");
            #endregion

            #region MEV CS 1.5 - F03_01
            if (!string.IsNullOrEmpty(conservationAreaId.ToString()))
            {
                report.AddReportRow(
                    documentDetails.systemId,
                    MassiveOperationReport.MassiveOperationResultEnum.OK,
                    "Documento inserito correttamente in area di conservazione.");
            }
            else
            {
                report.AddReportRow(
                    documentDetails.systemId,
                    MassiveOperationReport.MassiveOperationResultEnum.KO,
                    "Documento non inserito in area di conservazione per violazione vincoli dimensione istanza.");
            }
            #endregion
        }
        private void InitializePage()
        {
            if (CommandType != "close")
            {
                this.FirmaAnnidata = false;
                this.Continue      = false;
                this.popolaCampiMemento();
                if (UIManager.UserManager.IsAuthorizedFunctions("TO_GET_OTP"))
                {
                    this.BtnRequestOTP.Visible = true;
                }

                //MEV LIBRO FIRMA
                //if (!string.IsNullOrEmpty(Utils.InitConfigurationKeys.GetValue("0", DBKeys.FE_LIBRO_FIRMA.ToString())) && Utils.InitConfigurationKeys.GetValue("0", DBKeys.FE_LIBRO_FIRMA.ToString()).Equals("1"))
                //{
                //    this.HsmRadioCoSign.Visible = false;
                //}
                //ABBATANGELI - Nuova gestione firma/cofirma
                //if (string.IsNullOrEmpty(Utils.InitConfigurationKeys.GetValue("0", DBKeys.LOCK_COFIRMA.ToString())) || Utils.InitConfigurationKeys.GetValue("0", DBKeys.LOCK_COFIRMA.ToString()).Equals("0"))

                //Valore della Chiave FE_SET_TIPO_FIRMA
                //  0: Annidata
                //  1: Parallela
                //  2: Annidata non modificabile
                //  3: Parallela non modificabile
                string setTipoFirma = string.IsNullOrEmpty(Utils.InitConfigurationKeys.GetValue("0", DBKeys.FE_SET_TIPO_FIRMA.ToString())) ? "0" : Utils.InitConfigurationKeys.GetValue("0", DBKeys.FE_SET_TIPO_FIRMA.ToString());
                if (setTipoFirma.Equals("0") || setTipoFirma.Equals("2"))
                {
                    this.HsmRadioSign.Checked   = true;
                    this.HsmRadioCoSign.Enabled = true;
                    this.HsmRadioSign.Enabled   = true;
                }
                else
                {
                    //forzaCofirma = true;
                    this.HsmRadioCoSign.Checked = true;
                    this.HsmRadioCoSign.Enabled = false;
                    this.HsmRadioSign.Enabled   = false;
                }
                bool enableChangeRadio = setTipoFirma.Equals("0") || setTipoFirma.Equals("1");
                this.HsmRadioCoSign.Enabled = enableChangeRadio;
                this.HsmRadioSign.Enabled   = enableChangeRadio;
                if (IsLF)
                {
                    //se la popup è aperta dal libro firma, posso firmare cades e pades.
                    //Qual'ora presenti entrambi firmo prima CADES e poi PADES. Conclusa CADES, la maschera non viene chiusa, ma verrà chiesto
                    //un nuovo OTP per procedere con firma PADES. Al termine di quest'ultima, se ci sono stati errori verrà mostrato
                    //il report altrimenti verrà chiusa la popup.
                    this.HsmLitP7M.Enabled   = false;
                    this.HsmLitPades.Enabled = false;
                    List <MassiveOperationTarget> selectedItemSystemIdList = MassiveOperationUtils.GetSelectedItems();
                    if (selectedItemSystemIdList != null && selectedItemSystemIdList.Count > 0)
                    {
                        List <string> idDocumentList = (from temp in selectedItemSystemIdList select temp.Id).ToList <string>();
                        bool          toSignCades    = (from id in idDocumentList where id.Contains("C") select id).FirstOrDefault() != null;
                        if (toSignCades)
                        {
                            this.HsmLitP7M.Checked   = true;
                            this.HsmLitPades.Checked = false;
                        }
                        else
                        {
                            this.HsmLitP7M.Checked   = false;
                            this.HsmLitPades.Checked = true;
                        }
                    }
                }
                this.TxtHsmPin.Focus();
            }
        }
        private bool PutHSMSign()
        {
            bool   retVal   = false;
            string errorMsg = string.Empty;

            if (!string.IsNullOrEmpty(this.TxtHsmAlias.Text) && !string.IsNullOrEmpty(this.TxtHsmDomain.Text) && !string.IsNullOrEmpty(this.TxtHsmPin.Text) && !string.IsNullOrEmpty(this.TxtHsmLitOtp.Text) && (this.HsmLitPades.Checked || this.HsmLitP7M.Checked))
            {
                string alias   = this.TxtHsmAlias.Text;
                string dominio = this.TxtHsmDomain.Text;
                string pin     = this.TxtHsmPin.Text;
                string otp     = this.TxtHsmLitOtp.Text;

                try
                {
                    DigitalSignature.RemoteDigitalSignManager         dsm = new DigitalSignature.RemoteDigitalSignManager();
                    DigitalSignature.RemoteDigitalSignManager.Memento m   = new DigitalSignature.RemoteDigitalSignManager.Memento {
                        Alias = alias, Dominio = dominio
                    };
                    //Intanto salvo il memento
                    dsm.HSM_SetMementoForUser(m);
                }
                catch (System.Exception ex)
                {
                    return(true);
                }

                MassiveOperationReport.MassiveOperationResultEnum result;
                string codice = string.Empty;

                // Il dettaglio dell'elaborazione per un documento
                string details;

                MassiveOperationReport report = new MassiveOperationReport();
                if ((IsLF || Continue) && HttpContext.Current.Session["massiveSignReport"] != null)
                {
                    report = HttpContext.Current.Session["massiveSignReport"] as MassiveOperationReport;
                }

                //Lista dei fileReequest da passare in input al servizio di firma massiva
                List <FileRequest> fileRequestList = new List <FileRequest>();
                //List<FileRequest> listFileReqLF = new List<FileRequest>();
                this.FileTypes = UIManager.FileManager.GetSupportedFileTypes(Int32.Parse(UIManager.UserManager.GetInfoUser().idAmministrazione));
                this.IsEnabledSupportedFileTypes = UIManager.FileManager.IsEnabledSupportedFileTypes();

                string objType = Request.QueryString["objType"];
                if (objType.Equals("D"))
                {
                    this.SchedaDocumentList = this.LoadSchedaDocumentsList(
                        MassiveOperationUtils.GetSelectedItems());
                }

                // Invio della trasmissione per ogni documento da inviare
                foreach (SchedaDocumento schedaDoc in this.SchedaDocumentList)
                {
                    result  = MassiveOperationReport.MassiveOperationResultEnum.OK;
                    details = String.Empty;

                    // Verifica della possibilità di firmare il documento
                    result = this.CanSignDocument(schedaDoc, out details);

                    if (result != MassiveOperationReport.MassiveOperationResultEnum.KO)
                    {
                        fileRequestList.Add(schedaDoc.documenti[0]);
                    }

                    // Aggiunta di una riga al report
                    if (result == MassiveOperationReport.MassiveOperationResultEnum.KO)
                    {
                        codice = MassiveOperationUtils.getItem(schedaDoc.docNumber).Codice;
                        report.AddReportRow(
                            codice,
                            result,
                            details);
                    }
                }
                //PER TUTTI I DOCUMENTI CHE HANNO SUPERATO I CONTROLLI VADO AD APPLICARE LA FIRMA
                if (fileRequestList.Count > 0)
                {
                    DigitalSignature.RemoteDigitalSignManager dsm = new DigitalSignature.RemoteDigitalSignManager();

                    bool cofirma = this.HsmRadioCoSign.Checked; //prendere dalla checkbox cofirma

                    //ABBATANGELI - Hanno cambiato idea nuovamente e non è sempre cosign ma prende il valore dal checkbox cofirma
                    ////ABBATANGELI - PITre richiede sempre la cofirma per hsm
                    ////cofirma = true;


                    bool timestamp = this.HsmCheckMarkTemporal.Checked; //prendere dalla checkbox timestamp
                    DigitalSignature.RemoteDigitalSignManager.tipoFirma tipoFirma = new DigitalSignature.RemoteDigitalSignManager.tipoFirma();
                    if (this.HsmLitPades.Checked)
                    {
                        tipoFirma = DigitalSignature.RemoteDigitalSignManager.tipoFirma.PADES;
                    }
                    else
                    {
                        tipoFirma = DigitalSignature.RemoteDigitalSignManager.tipoFirma.CADES;
                        cofirma   = this.HsmRadioCoSign.Checked && !FirmaAnnidata;
                    }
                    List <FirmaResult> firmaResult = null;
                    try
                    {
                        firmaResult = dsm.HSM_SignMultiSign(fileRequestList.ToArray(), cofirma, timestamp, tipoFirma, alias, dominio, otp, pin).ToList <FirmaResult>();

                        /*Commento perchè la distinzione tra documenti che devo firmare cades e quelli da firmare pades per il libro firma, la faccio prima, quando vado a selezionare SchedaDocumentList
                         * if (!IsLF)
                         * {
                         *  firmaResult = dsm.HSM_SignMultiSign(fileRequestList.ToArray(), cofirma, timestamp, tipoFirma, alias, dominio, otp, pin).ToList<FirmaResult>();
                         * }
                         * else
                         * {
                         *  List<MassiveOperationTarget> selectedItemSystemIdList = MassiveOperationUtils.GetSelectedItems();
                         *  string typeSign = tipoFirma.Equals(DigitalSignature.RemoteDigitalSignManager.tipoFirma.CADES) ? "C" : "P";
                         *  List<string> idDocumentList = (from temp in selectedItemSystemIdList where temp.Id.Contains(typeSign) select temp.Id.Replace(typeSign, "")).ToList<string>();
                         *  listFileReqLF = (from f in fileRequestList where idDocumentList.Contains(f.docNumber) select f).ToList();
                         *  if (listFileReqLF != null && listFileReqLF.Count > 0)
                         *  {
                         *      firmaResult = dsm.HSM_SignMultiSign(listFileReqLF.ToArray(), cofirma, timestamp, tipoFirma, alias, dominio, otp, pin).ToList<FirmaResult>();
                         *  }
                         * }
                         */
                        if (firmaResult != null && ((firmaResult.Count > 1) || (firmaResult.Count == 1 && firmaResult[0].fileRequest != null)))
                        {
                            foreach (FirmaResult r in firmaResult)
                            {
                                string[] splitMsg = r.errore.Split(':');
                                if (splitMsg[0].Equals("true"))
                                {
                                    result  = MassiveOperationReport.MassiveOperationResultEnum.OK;
                                    details = "Firma HSM del documento avvenuta con successo";
                                    codice  = MassiveOperationUtils.getItem(r.fileRequest.docNumber).Codice;
                                    report.AddReportRow(
                                        codice,
                                        result,
                                        details);
                                }
                                else
                                {
                                    if (r.esito == null || string.IsNullOrEmpty(r.esito.Codice))
                                    {
                                        errorMsg = String.Format(
                                            "Si sono verificati degli errori durante la firma del documento. Dettagli: {0}",
                                            splitMsg[1]);
                                    }
                                    else
                                    {
                                        errorMsg = Utils.Languages.GetMessageFromCode(r.esito.Codice, UserManager.GetLanguageData());
                                    }

                                    result  = MassiveOperationReport.MassiveOperationResultEnum.KO;
                                    codice  = MassiveOperationUtils.getItem(r.fileRequest.docNumber).Codice;
                                    details = errorMsg;
                                    report.AddReportRow(
                                        codice,
                                        result,
                                        details);
                                }
                            }
                        }
                        else
                        {
                            //List<FileRequest> list = IsLF ? listFileReqLF : fileRequestList;
                            string error = "Si sono verificati degli errori durante la firma del documento";
                            if (firmaResult != null && firmaResult.Count > 0)
                            {
                                error += ": " + firmaResult[0].errore;
                            }
                            if (firmaResult[0].esito != null && !string.IsNullOrEmpty(firmaResult[0].esito.Codice))
                            {
                                error = Utils.Languages.GetMessageFromCode(firmaResult[0].esito.Codice, UserManager.GetUserLanguage());
                            }
                            foreach (FileRequest fr in fileRequestList)
                            {
                                result  = MassiveOperationReport.MassiveOperationResultEnum.KO;
                                codice  = MassiveOperationUtils.getItem(fr.docNumber).Codice;
                                details = error;
                                report.AddReportRow(
                                    codice,
                                    result,
                                    details);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //List<FileRequest> list = IsLF ? listFileReqLF : fileRequestList;
                        foreach (FileRequest fr in fileRequestList)
                        {
                            result  = MassiveOperationReport.MassiveOperationResultEnum.KO;
                            codice  = MassiveOperationUtils.getItem(fr.docNumber).Codice;
                            details = "Si sono verificati degli errori durante la firma HSM del documento.";
                            report.AddReportRow(
                                codice,
                                result,
                                details);
                        }
                    }
                }
                if (Continue)
                {
                    HttpContext.Current.Session["massiveSignReport"] = report;

                    //Se ho firmato CADES e ci sono documenti da firmare PADES non chiudo la maschera ma visualizzo un worning che
                    //informa l'utente di inserire un nuovo otp per procedere con la firma
                    this.TxtHsmLitOtp.Text      = string.Empty;
                    this.HsmLitP7M.Enabled      = false;
                    this.HsmLitPades.Enabled    = false;
                    this.HsmRadioCoSign.Enabled = false;
                    this.UpOTP.Update();
                    this.UpPnlSign.Update();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('WarningRequestNewOTPFirmaAnnidata', 'warning');} else {parent.ajaxDialogModal('WarningRequestNewOTPFirmaAnnidata', 'warning');}", true);
                    return(false);
                }

                if (!IsLF)
                {
                    // Introduzione della riga di summary
                    string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
                    report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
                    this.generateReport(report, "Firma HSM massiva");
                }
                else
                {
                    HttpContext.Current.Session["massiveSignReport"] = report;

                    //Se ho firmato CADES e ci sono documenti da firmare PADES non chiudo la maschera ma visualizzo un worning che
                    //informa l'utente di inserire un nuovo otp per procedere con la firma
                    List <MassiveOperationTarget> selectedItemSystemIdList = MassiveOperationUtils.GetSelectedItems();
                    bool toSignPades = (from s in selectedItemSystemIdList where s.Id.Contains("P") select s).FirstOrDefault() != null;
                    if (this.HsmLitP7M.Checked && toSignPades)
                    {
                        this.HsmLitP7M.Checked   = false;
                        this.HsmLitPades.Checked = true;
                        this.TxtHsmLitOtp.Text   = string.Empty;
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('WarningRequestNewOTP', 'warning');} else {parent.ajaxDialogModal('WarningRequestNewOTP', 'warning');}", true);
                        this.UpPnlSign.Update();
                        this.UpOTP.Update();
                        return(false);
                    }
                }

                retVal = true;
            }
            else
            {
                retVal = false;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('WarningHsmSign', 'warning');} else {parent.ajaxDialogModal('WarningHsmSign', 'warning');}", true);
            }

            return(retVal);
        }
Exemple #28
0
        /// <summary>
        /// Funzione per l'inserimento di un documento nell'area di conservazione
        /// </summary>
        /// <param name="documentDetails">Dettagli del documento da inserire</param>
        /// <param name="report">Report di inserimento</param>
        private void InsertInSA(SchedaDocumento documentDetails, MassiveOperationReport report)
        {
            StringBuilder message = new StringBuilder();
            String        conservationAreaId;
            string        id = MassiveOperationUtils.getItem(documentDetails.systemId).Codice;

            // Se si sta creando la prima istanza di conservazione...
            if (DocumentManager.isPrimaConservazione(
                    this,
                    UserManager.getInfoUtente(Page).idPeople,
                    UserManager.getInfoUtente(Page).idGruppo) == 1)
            {
                message.Append("Si sta creando la prima istanza di conservazione. ");
            }

            // Recupero dell'eventiale fascicolo selezionato
            Fascicolo selectedProject = FascicoliManager.getFascicoloSelezionato();

            // Inserimento del documento nella conservazione e recupero dell'id dell'istanza
            if (selectedProject != null)
            {
                // Da ricerca documenti in fascicolo
                conservationAreaId = DocumentManager.addAreaConservazioneAM(
                    this.Page,
                    documentDetails.systemId,
                    selectedProject.systemID,
                    documentDetails.docNumber,
                    UserManager.getInfoUtente(Page),
                    "F");
            }
            else
            {
                conservationAreaId = DocumentManager.addAreaConservazioneAM(
                    this.Page,
                    documentDetails.systemId,
                    "",
                    documentDetails.docNumber,
                    UserManager.getInfoUtente(Page),
                    "D");
            }

            try
            {
                int size_xml = DocumentManager.getItemSize(
                    this.Page,
                    documentDetails,
                    conservationAreaId);

                int doc_size = Convert.ToInt32(documentDetails.documenti[0].fileSize);

                int    numeroAllegati = documentDetails.allegati.Length;
                string fileName       = documentDetails.documenti[0].fileName;
                string tipoFile       = Path.GetExtension(fileName);
                int    size_allegati  = 0;
                for (int i = 0; i < documentDetails.allegati.Length; i++)
                {
                    size_allegati = size_allegati + Convert.ToInt32(documentDetails.allegati[i].fileSize);
                }
                int total_size = size_allegati + doc_size + size_xml;

                DocumentManager.insertSizeInItemCons(Page, conservationAreaId, total_size);

                DocumentManager.updateItemsConservazione(
                    this.Page,
                    tipoFile,
                    Convert.ToString(numeroAllegati),
                    conservationAreaId);
            }
            catch (Exception e)
            {
                report.AddReportRow(
                    id,
                    MassiveOperationReport.MassiveOperationResultEnum.KO,
                    "Si è verificato un errore durante l'inserimento del documento nell'area di conservazione");
            }

            report.AddReportRow(
                id,
                MassiveOperationReport.MassiveOperationResultEnum.OK,
                "Documento inserito correttamente in area di conservazione.");
        }
Exemple #29
0
        /// <summary>
        /// Event Handler per il click del pulsante conferma
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override bool btnConferma_Click(object sender, EventArgs e)
        {
            // Il report da mostrare all'utente
            MassiveOperationReport report;

            // Lista di system id degli elementi selezionati
            List <MassiveOperationTarget> selectedItem;

            // Il fascicolo selezionato per la fascicolazione rapida
            Fascicolo project;

            // Valore utilizzato per indicare che è possibile procedere con la fascicolazione
            bool canProceed = true;

            // Inizializzazione del report
            report = new MassiveOperationReport();

            // Il messaggio di errore
            StringBuilder errorMessage = new StringBuilder("Impossibile eseguire la fascicolazione:");

            // Recupero della lista dei system id dei documenti selezionati
            selectedItem = MassiveOperationUtils.GetSelectedItems();

            // Recupero del fascicolo selezionato per la fascicolazione rapida
            project = FascicoliManager.getFascicoloSelezionatoFascRapida(this);


            // Se il fascicolo non è valorizzato non si può procedere
            if (project == null)
            {
                canProceed = false;
                errorMessage.AppendLine(" Selezionare un fascicolo in cui fascicolare.");
            }

            // Se non sono stati selezionati documenti, non si può procedere con la fascicolazione
            if (selectedItem == null ||
                selectedItem.Count == 0)
            {
                canProceed = false;
                errorMessage.AppendLine("- Selezionare almeno un documento da fascicolare.");
            }

            // Se non è possibile continuare, viene salvata una nuova riga per il report
            // e ne viene impostato l'esito negativo
            if (!canProceed)
            {
                report.AddReportRow(
                    "N.A.",
                    MassiveOperationReport.MassiveOperationResultEnum.KO,
                    errorMessage.ToString());
            }
            else
            {
                // Altrimenti si procede con la fascicolazione
                this.ProceedWithOperation(selectedItem, project, report);
            }
            string[] pars = new string[] { "" + report.Worked, "" + report.NotWorked };
            report.AddSummaryRow("Documenti lavorati: {0} - Documenti non lavorati: {1}", pars);
            this.generateReport(report, "Fascicolazione massiva");
            return(true);
        }