protected void btn_verifica_unificata_Click(object sender, EventArgs e) { bool errore = false; int number; int totDocs; Int32.TryParse(hd_totDocs.Value, out totDocs); Int32.TryParse(tb_num_file.Text, out number); int percent = 0; string descrizione, esito; WSConservazioneLocale.Esito Cha_Esito; if (!rbtn_file_da_aprire.Checked && !rbtn_numero_file.Checked && !rbtn_percent_file.Checked) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_selezione", "alert('Selezionare un opzione!');", true); errore = true; } else { if (rbtn_numero_file.Checked && string.IsNullOrEmpty(tb_num_file.Text)) { errore = true; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_insNum", "alert('Inserire il numero di file da verificare!');", true); } else if (rbtn_numero_file.Checked && !Int32.TryParse(tb_num_file.Text, out number)) { errore = true; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_insNum2", "alert('Inserire un valore numerico.');", true); } else if (rbtn_numero_file.Checked && (number > totDocs || number < 3)) { errore = true; if (totDocs > 2) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_insNum3", "alert('Il valore inserito non è valido. Inserire un valore compreso tra 3 e " + totDocs + "');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_inNum4", "alert('Il valore inserito non è valido. Numero di documenti non sufficiente per la selezione casuale.');", true); } } else if (rbtn_percent_file.Checked && (string.IsNullOrEmpty(tb_percent_file.Text) || !Int32.TryParse(tb_percent_file.Text, out number))) { errore = true; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_percent1", "alert('Inserire una percentuale valida.');", true); } else if (rbtn_percent_file.Checked && (number > 100 || number < 1)) { errore = true; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_percent2", "alert('Inserire una percentuale valida.');", true); } else if (rbtn_file_da_aprire.Checked) { errore = true; foreach (GridViewRow grv in GridView1.Rows) { if (((CheckBox)grv.FindControl("chk_doc")).Checked) { errore = false; } } if (errore) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_selezione", "alert('Selezionare quali file verificare!');", true); } } } if (!errore) { bool integritaVerificata = true; WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); Dictionary <String, String> documentiMemorizzati = ConservazioneWA.Utils.ConservazioneManager.getFilesFromUniSincro(infoUtente, IdIstanza, false); //WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(IdIstanza, infoUtente); WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazioneLite(IdIstanza, infoUtente); int totDocs2 = items.Length; string files = ""; string[] presi = null; if (rbtn_numero_file.Checked || rbtn_percent_file.Checked) { if (rbtn_numero_file.Checked) { number = Int32.Parse(tb_num_file.Text); percent = (int)Math.Ceiling((double)((double)(100 * number) / totDocs)); } else { percent = Int32.Parse(tb_percent_file.Text); double op = (totDocs * 100 / percent); number = (int)Math.Ceiling((double)((double)(totDocs * percent) / 100)); } Random rdm = new Random(); presi = new string[number]; int i = 0; while (i < number) { int j = rdm.Next(totDocs); if (!presi.Contains(items[j].DocNumber)) { files += items[j].DocNumber + ","; presi[i] = items[j].DocNumber; i++; } } } if (rbtn_file_da_aprire.Checked) { number = 0; foreach (GridViewRow gvr in GridView1.Rows) { if (((CheckBox)gvr.FindControl("chk_doc")).Checked) { files += gvr.Cells[0].Text + ","; number++; } } presi = files.Split(','); percent = (int)Math.Ceiling((double)((double)(100 * number) / totDocs)); } string unisincroitem = "", path = "", hash = ""; string[] uniSincroItems = null; string hashValue = null; int validi = 0, invalidi = 0; foreach (string docnum in presi) { if (!string.IsNullOrEmpty(docnum)) { unisincroitem = documentiMemorizzati[docnum]; uniSincroItems = unisincroitem.Split('§'); path = uniSincroItems[2]; hash = uniSincroItems[3]; hashValue = ConservazioneWA.Utils.ConservazioneManager.getFileHashFromStore(infoUtente, IdIstanza, path, false); string segnaturaOrId = ConservazioneWA.Utils.ConservazioneManager.getSegnatura_ID_Doc(docnum); if (hash.ToLower() != hashValue.ToLower()) { integritaVerificata = false; invalidi++; // Modifica scrittura Registro di Conservazione per la scrittura di Verifica Unificata documento WSConservazioneLocale.RegistroCons regCons = new WSConservazioneLocale.RegistroCons(); regCons.idAmm = infoUtente.idAmministrazione; regCons.idIstanza = hd_idIstanza.Value; regCons.idOggetto = docnum; regCons.tipoOggetto = "D"; regCons.tipoAzione = ""; regCons.userId = infoUtente.userId; regCons.codAzione = "INTEGRITA_STORAGE_"; regCons.descAzione = "Verifica fallita integrità documento " + segnaturaOrId + " per istanza id: " + hd_idIstanza.Value; regCons.esito = "0"; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons, infoUtente); } else { // Modifica scrittura Registro di Conservazione per la scrittura di Verifica Unificata documento WSConservazioneLocale.RegistroCons regCons = new WSConservazioneLocale.RegistroCons(); regCons.idAmm = infoUtente.idAmministrazione; regCons.idIstanza = hd_idIstanza.Value; regCons.idOggetto = docnum; regCons.tipoOggetto = "D"; regCons.tipoAzione = ""; regCons.userId = infoUtente.userId; regCons.codAzione = "INTEGRITA_STORAGE"; regCons.descAzione = "Verifica corretta integrità documento " + segnaturaOrId + " per istanza id: " + hd_idIstanza.Value; regCons.esito = "1"; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons, infoUtente); validi++; } } } if (!integritaVerificata) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_fallimento", "alert('Verifica Integrità fallita.');", true); //ConservazioneWA.Utils.ConservazioneManager.esitoLeggibilita(hd_idCons.Value, false); Utils.ConservazioneManager.RegistraEsitoVerificaSupportoRegistrato( (WSConservazioneLocale.InfoUtente)Session["infoutCons"], this.IdIstanza, this.IdSupporto, integritaVerificata, percent.ToString(), this.txtDataProssimaVerifica.Text, this.txtNoteDiVerifica.Text, "U"); descrizione = "Esecuzione della verifica di integrità dei documenti dell’istanza " + hd_idIstanza.Value + " nel repository del sistema"; esito = "0"; Cha_Esito = WSConservazioneLocale.Esito.KO; } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_successo", "alert('Verifica Integrità eseguita con successo.');", true); // MEV CS 1.5 // mancava la registrazione in caso di verifica con esito positivo Utils.ConservazioneManager.RegistraEsitoVerificaSupportoRegistrato( (WSConservazioneLocale.InfoUtente)Session["infoutCons"], this.IdIstanza, this.IdSupporto, integritaVerificata, percent.ToString(), this.txtDataProssimaVerifica.Text, "Verifica unificata (Integrità): " + this.txtNoteDiVerifica.Text, "U"); // end MEV CS 1.5 //ConservazioneWA.Utils.ConservazioneManager.esitoLeggibilita(hd_idCons.Value, true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',1,'" + IdSupporto + "','" + txtNoteDiVerifica.Text + "','" + txtDataProssimaVerifica.Text + "');", true); descrizione = "Esecuzione della verifica di integrità dei documenti dell’istanza " + hd_idIstanza.Value + " nel repository del sistema"; esito = "1"; Cha_Esito = WSConservazioneLocale.Esito.OK; } // Memorizzazione esito verifica solamente per le verifiche sull'intero supporto, non sul singolo documento //Utils.ConservazioneManager.RegistraEsitoVerificaSupportoRegistrato( // (WSConservazioneLocale.InfoUtente)Session["infoutCons"], // this.IdIstanza, // this.IdSupporto, // integritaVerificata, // percent.ToString(), // this.txtDataProssimaVerifica.Text, // this.txtNoteDiVerifica.Text); this.ClientScript.RegisterStartupScript(this.GetType(), "close", "window.returnValue=true; window.close();", true); ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroControlli(IdIstanza, "", infoUtente, "Verifica Integrità storage", integritaVerificata, number, validi, invalidi); // Modifica scrittura Registro di Conservazione per la scrittura di Verifica Integrità unificata supporto intero WSConservazioneLocale.RegistroCons regCons2 = new WSConservazioneLocale.RegistroCons(); regCons2.idAmm = infoUtente.idAmministrazione; regCons2.idIstanza = hd_idIstanza.Value; regCons2.tipoOggetto = "I"; regCons2.tipoAzione = ""; regCons2.userId = infoUtente.userId; regCons2.codAzione = "INTEGRITA_STORAGE"; regCons2.descAzione = descrizione; regCons2.esito = esito; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons2, infoUtente); // Inserisce nel DPA_LOG la Verifica Integrità Unificata dell'istanza ConservazioneWA.Utils.ConservazioneManager.inserimentoInDpaLog(infoUtente, "INTEGRITA_STORAGE", IdIstanza, descrizione, Cha_Esito); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grdSupporti_ItemCommand(object sender, DataGridCommandEventArgs e) { this.grdSupporti.SelectedIndex = e.Item.ItemIndex; if (e.CommandName == "DOWNLOAD") { // Modifica per la scrittura dell'evento Download su Registro Conservazione e sul Log WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); string idConservazione = this.NormalizeFilterCriteria(Request.QueryString["idConservazione"]); bool redirectflag = false; try { Response.Redirect(e.CommandArgument.ToString(), redirectflag); // MEV CS 1.5 - Alert Conservazione // il download è avvenuto correttamente - verifico se l'alert è attivo if (Utils.ConservazioneManager.IsAlertConservazioneAttivo(infoUtente.idAmministrazione, "DOWNLOAD")) { //task asincrono di incremento contatore ed eventuale invio alert Utils.ConservazioneManager.InvioAlertAsync(infoUtente, "DOWNLOAD", string.Empty, string.Empty); } // end MEV CS 1.5 WSConservazioneLocale.RegistroCons regCons = new WSConservazioneLocale.RegistroCons(); regCons.idAmm = infoUtente.idAmministrazione; regCons.idIstanza = idConservazione; regCons.tipoOggetto = "I"; regCons.tipoAzione = ""; regCons.userId = infoUtente.userId; regCons.codAzione = "DOWNLOAD_ISTANZA"; regCons.descAzione = "Download Istanza " + idConservazione; regCons.esito = "1"; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons, infoUtente); // Inserisce nel DPA_LOG la Verifica Integrià dell'istanza ConservazioneWA.Utils.ConservazioneManager.inserimentoInDpaLog(infoUtente, "DOWNLOAD_ISTANZA", idConservazione, "Download Istanza " + idConservazione, WSConservazioneLocale.Esito.OK); } catch { WSConservazioneLocale.RegistroCons regCons = new WSConservazioneLocale.RegistroCons(); regCons.idAmm = infoUtente.idAmministrazione; regCons.idIstanza = idConservazione; regCons.tipoOggetto = "I"; regCons.tipoAzione = ""; regCons.userId = infoUtente.userId; regCons.codAzione = "DOWNLOAD_ISTANZA"; regCons.descAzione = "Download Istanza " + idConservazione; regCons.esito = "0"; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons, infoUtente); // Inserisce nel DPA_LOG la Verifica Integrià dell'istanza ConservazioneWA.Utils.ConservazioneManager.inserimentoInDpaLog(infoUtente, "DOWNLOAD_ISTANZA", idConservazione, "Download Istanza " + idConservazione, WSConservazioneLocale.Esito.KO); } //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "download", "", true); } else if (e.CommandName == "BROWSE") { // Modifica per la scrittura dell'evento Browse su Registro Conservazione e sul Log WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); string idConservazione = this.NormalizeFilterCriteria(Request.QueryString["idConservazione"]); try { // Azione di browse dell'istanza di conservazione ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "openWindow", "window.open('" + e.CommandArgument + "');", true); //Response.Redirect(e.CommandArgument.ToString()); // MEV CS 1.5 - Alert Conservazione // l'operazione è avvenuta correttamente - verifico se l'alert è attivo if (Utils.ConservazioneManager.IsAlertConservazioneAttivo(infoUtente.idAmministrazione, "SFOGLIA")) { // task asincrono di incremento contatore ed eventuale invio alert Utils.ConservazioneManager.InvioAlertAsync(infoUtente, "SFOGLIA", string.Empty, string.Empty); } // end MEV CS 1.5 WSConservazioneLocale.RegistroCons regCons = new WSConservazioneLocale.RegistroCons(); regCons.idAmm = infoUtente.idAmministrazione; regCons.idIstanza = idConservazione; regCons.tipoOggetto = "I"; regCons.tipoAzione = ""; regCons.userId = infoUtente.userId; regCons.codAzione = "SFOGLIA_ISTANZA"; regCons.descAzione = "Visualizzazione contenuti istanza " + idConservazione; regCons.esito = "1"; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons, infoUtente); // Inserisce nel DPA_LOG la Verifica Integrià dell'istanza ConservazioneWA.Utils.ConservazioneManager.inserimentoInDpaLog(infoUtente, "SFOGLIA_ISTANZA", idConservazione, "Visualizzazione contenuti istanza ", WSConservazioneLocale.Esito.OK); } catch { WSConservazioneLocale.RegistroCons regCons = new WSConservazioneLocale.RegistroCons(); regCons.idAmm = infoUtente.idAmministrazione; regCons.idIstanza = idConservazione; regCons.tipoOggetto = "I"; regCons.tipoAzione = ""; regCons.userId = infoUtente.userId; regCons.codAzione = "SFOGLIA_ISTANZA"; regCons.descAzione = "Visualizzazione contenuti istanza " + idConservazione; regCons.esito = "0"; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons, infoUtente); // Inserisce nel DPA_LOG la Verifica Integrià dell'istanza ConservazioneWA.Utils.ConservazioneManager.inserimentoInDpaLog(infoUtente, "SFOGLIA_ISTANZA", idConservazione, "Visualizzazione contenuti istanza ", WSConservazioneLocale.Esito.KO); } } else if (e.CommandName == "REGISTRA_SUPPORTO") { // Azione successiva alla registrazione del supporto rimovibile this.FetchSupporti(); } else if (e.CommandName == "VERIFICA_SUPPORTO") { // Azione successiva alla verifica del supporto //string esitoVerifica = this.hd_verifica.Value; this.FetchSupporti(); Label lblIdIstanza = (Label)e.Item.FindControl("lblIdIstanza"); Label lblIdSupporto = (Label)e.Item.FindControl("lblIdSupporto"); this.FetchStoriaVerifiche(lblIdIstanza.Text, lblIdSupporto.Text); } else if (e.CommandName == "STORIA_VERIFICHE_SUPPORTO") { Label lblIdIstanza = (Label)e.Item.FindControl("lblIdIstanza"); Label lblIdSupporto = (Label)e.Item.FindControl("lblIdSupporto"); this.FetchStoriaVerifiche(lblIdIstanza.Text, lblIdSupporto.Text); } else if (e.CommandName == "GO_TO_ISTANZA") { Label lblIdIstanza = (Label)e.Item.FindControl("lblIdIstanza"); //istanze += "<li><a href=\"RicercaIstanze.aspx?id=" + singoleIstanze[i] + "\" title=\"Istanza numero " + singoleIstanze[i] + "\">" + singoleIstanze[i] + "</a></li>"; this.Response.Redirect(string.Format("~/RicercaIstanze.aspx?id={0}", lblIdIstanza.Text)); } else if (e.CommandName == "VERIFICA_INTEGRITA_STORAGE") { this.FetchSupporti(); } else if (e.CommandName == "VERIFICA_LEGGIBILITA") { this.FetchSupporti(); } else if (e.CommandName == "VERIFICHE_IL") { this.FetchSupporti(); } // Modifica Rigenerazione Istanza Danneggiata a.sigalot else if (e.CommandName == "RIGENERAZIONE_ISTANZA") { string idConservazione = this.NormalizeFilterCriteria(Request.QueryString["idConservazione"]); WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); Label lblIdSupporto = (Label)e.Item.FindControl("lblIdSupporto"); if (string.IsNullOrEmpty(idConservazione)) { Label lblIdIstanza = (Label)e.Item.FindControl("lblIdIstanza"); idConservazione = lblIdIstanza.Text; } //ricerca x vedere se già ci sono istanze rigenerate DA FARE bool isIstanzaRig = ConservazioneManager.isIstanzaRigenerata(idConservazione, infoUtente); if (isIstanzaRig) { // Istanza già rigenerata this.hd_supporto_da_rigenerare.Value = lblIdSupporto.Text; this.hd_ID_istanza_da_rigenerare.Value = idConservazione; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "notifyRigeneraIstanza", "notifyRigeneraIstanza('" + idConservazione + "','" + lblIdSupporto.Text + "');", true); } else { string message = ConservazioneManager.rigeneraIstanza(idConservazione, lblIdSupporto.Text, infoUtente); //if (string.IsNullOrEmpty(message)) // Response.Write("<script>alert('Operazione avvenuta con successo')</script>"); //else // Response.Write("<script>alert('" + message + "')</script>"); if (string.IsNullOrEmpty(message)) { //Response.Write("<script>alert('Operazione avvenuta con successo')</script>"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_successo", "alert('Operazione avvenuta con successo.');", true); } else { //Response.Write("<script>alert('"+message+"')</script>"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_rigenerazione_fallita", "alert('Si è verificato un errore.');", true); } } } this.upDettaglio.Update(); }
protected void btn_avanti_Click(object sender, EventArgs e) { string descrizione, esito, segnaturaOrId; //DocsPaDB.Query_DocsPAWS.Conservazione cons = new DocsPaDB.Query_DocsPAWS.Conservazione(); segnaturaOrId = ConservazioneWA.Utils.ConservazioneManager.getSegnatura_ID_Doc(hd_docnumber.Value); if (RadioButtonList1.SelectedItem == null) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_selezione", "alert('Indicare se il file è leggibile o meno.');", true); } else { if (RadioButtonList1.Items[1].Selected) { risultatoLeggibilita.Value = "fallito"; //ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroControlli(hd_idCons.Value,docnumber,infoUtente,"Verifica Leggibilità",RadioButtonList1.Items[1].Selected,0,0,0); esito = "0"; descrizione = "Esecuzione della verifica di leggibilità del documento" + segnaturaOrId + "dell'istanza " + hd_idCons.Value; } else { descrizione = "Esecuzione della verifica di leggibilità del documento " + segnaturaOrId + "dell'istanza " + hd_idCons.Value;; esito = "1"; } // Modifica Registro di Conservazione Leggibilità e Log WSConservazioneLocale.InfoUtente infoUtente2 = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); WSConservazioneLocale.RegistroCons regCons2 = new WSConservazioneLocale.RegistroCons(); regCons2.idAmm = infoUtente2.idAmministrazione; regCons2.idIstanza = hd_idCons.Value; regCons2.idOggetto = hd_docnumber.Value; regCons2.tipoOggetto = "D"; regCons2.tipoAzione = ""; regCons2.userId = infoUtente2.userId; regCons2.codAzione = "LEGGIBILITA"; regCons2.descAzione = descrizione; regCons2.esito = esito; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons2, infoUtente2); WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroControlli(hd_idCons.Value, segnaturaOrId, infoUtente, "Verifica Leggibilità", RadioButtonList1.Items[0].Selected, 0, 0, 0); string frameSrc = ""; //Page_Load(this, e); if (!String.IsNullOrEmpty(hd_indice_docs.Value) && hd_num_docs.Value != "0") { Dictionary <String, String> documentiMemorizzati = ConservazioneWA.Utils.ConservazioneManager.getFilesFromUniSincro(infoUtente, hd_idCons.Value, Boolean.Parse(hd_localstore.Value)); if (Int32.TryParse(hd_indice_docs.Value, out numero)) { //WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(hd_idCons.Value, infoUtente); string file = hd_files.Value; string[] files = file.Split(','); // Modifica Lembo 09-09-2013: Per le prestazioni, prendo tutto dall'unisincro. //WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(hd_idCons.Value, infoUtente); string uniSincroItem = documentiMemorizzati[files[numero - 1]]; string[] uniSincroItems = uniSincroItem.Split('§'); string fileType = String.Format(".{0}", uniSincroItems[2].ToString().Split('.')[uniSincroItems[2].ToString().Split('.').Length - 1]); //if (item.DocNumber == files[numero - 1]) //{ frameSrc = "docVisualizza.aspx?idC=" + hd_idCons.Value + "&file=" + uniSincroItem + "&ext=" + fileType + "&locale=" + hd_localstore.Value; hd_docnumber.Value = files[numero - 1]; //} //} //foreach (WSConservazioneLocale.ItemsConservazione item in items) //{ // string uniSincroItem = documentiMemorizzati[item.DocNumber]; // if (item.DocNumber == files[numero - 1]) // { // frameSrc = "docVisualizza.aspx?idC=" + hd_idCons.Value + "&file=" + uniSincroItem + "&ext=" + item.tipoFile + "&locale=" + hd_localstore.Value; // hd_docnumber.Value = item.DocNumber; // } //} //frameSrc = "docVisualizza.aspx?idC=" + hd_idCons.Value + "&file=" + items[numero - 1].DocNumber /*+ items[numero - 1].tipoFile*/; int numdocs = Int32.Parse(hd_num_docs.Value); if (numero < numdocs) { numero++; hd_indice_docs.Value = numero.ToString(); } else { btn_avanti.Visible = false; btn_chiudi.Visible = true; } } } this.iframeDoc.Attributes["src"] = frameSrc; RadioButtonList1.SelectedIndex = -1; } }
/// <summary> /// Metodo utilizzato per la verifica su di un singolo file. Viene richiamato se nella chiamata della pagina viene specificato /// un idDocumento. L'idDocumento considerato in realtà è il docnumber nel database. /// </summary> private void verificaSingoloFile() { string descrizione, esito, segnaturaOrId; WSConservazioneLocale.Esito Cha_Esito; WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); segnaturaOrId = ConservazioneWA.Utils.ConservazioneManager.getSegnatura_ID_Doc(IdDocumento); Dictionary <String, String> documentiMemorizzati = ConservazioneWA.Utils.ConservazioneManager.getFilesFromUniSincro(infoUtente, IdIstanza, false); WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(IdIstanza, infoUtente); //Codice per ottenere il primo supporto remoto di un'istanza. //In questo caso abbiamo il path del supporto nelle chiavi di configurazione e quindi il supporto è sempre lo stesso. // //string filtro = " A.ID_CONSERVAZIONE= '"+IdIstanza+"' AND ( A.ID_TIPO_SUPPORTO = 1 ) and a.ID_CONSERVAZIONE = c.SYSTEM_ID and c.id_amm = "+infoUtente.idAmministrazione+" ORDER BY A.ID_CONSERVAZIONE DESC, A.COPIA ASC"; //WSConservazioneLocale.InfoSupporto[] supporti = ConservazioneWA.Utils.ConservazioneManager.getInfoSupporto(filtro, infoUtente); //string idSupporto2 = supporti[0].SystemID; int percent = (int)Math.Ceiling((double)((double)(100 / items.Length))); string unisincroitem = documentiMemorizzati[IdDocumento]; string[] uniSincroItems = unisincroitem.Split('§'); string path = uniSincroItems[2]; string hash = uniSincroItems[3]; string hashValue = ConservazioneWA.Utils.ConservazioneManager.getFileHashFromStore(infoUtente, IdIstanza, path, false); bool integritaVerificata = true; int invalidi = 0, validi = 0; if (hash.ToLower() != hashValue.ToLower()) { integritaVerificata = false; invalidi++; } else { validi++; } if (!integritaVerificata) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_fallimento", "alert('Verifica Integrità fallita. File danneggiato');", true); //ConservazioneWA.Utils.ConservazioneManager.esitoLeggibilita(hd_idCons.Value, false); descrizione = " Verifica Fallita Integrità Documento " + segnaturaOrId + " in istanza " + IdIstanza; esito = "0"; Cha_Esito = WSConservazioneLocale.Esito.KO; } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_successo", "alert('Verifica Integrità sul file eseguita con successo.');", true); //ConservazioneWA.Utils.ConservazioneManager.esitoLeggibilita(hd_idCons.Value, true); descrizione = " Verifica effettuata con successo integrità documento " + segnaturaOrId + " in istanza " + IdIstanza; esito = "1"; Cha_Esito = WSConservazioneLocale.Esito.OK; } Utils.ConservazioneManager.RegistraEsitoVerificaSupportoRegistrato( (WSConservazioneLocale.InfoUtente)Session["infoutCons"], this.IdIstanza, FetchIdSupporto(), integritaVerificata, percent.ToString(), FetchDataProssimaVerifica(), "Verifica Integrità su singolo file", "I"); this.ClientScript.RegisterStartupScript(this.GetType(), "close", "window.returnValue=true; window.close();", true); ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroControlli(IdIstanza, IdDocumento, infoUtente, "Verifica Integrità singolo file", integritaVerificata, 1, validi, invalidi); // Modifica scrittura Registro di Conservazione per la scrittura di Verifica Integrità sul singolo documento WSConservazioneLocale.RegistroCons regCons2 = new WSConservazioneLocale.RegistroCons(); regCons2.idAmm = infoUtente.idAmministrazione; regCons2.idOggetto = IdDocumento; regCons2.idIstanza = IdIstanza; regCons2.tipoOggetto = "I"; regCons2.tipoAzione = ""; regCons2.userId = infoUtente.userId; regCons2.codAzione = "INTEGRITA_STORAGE"; regCons2.descAzione = descrizione; regCons2.esito = esito; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons2, infoUtente); // Inserisce nel DPA_LOG la Verifica dell'istanza //ConservazioneWA.Utils.ConservazioneManager.inserimentoInDpaLog(infoUtente, "INTEGRITA_STORAGE", IdIstanza, descrizione, Cha_Esito); }
protected void btn_chiudi_Click(object sender, EventArgs e) { string segnaturaOrId; DocsPaDB.Query_DocsPAWS.Conservazione cons = new DocsPaDB.Query_DocsPAWS.Conservazione(); segnaturaOrId = ConservazioneWA.Utils.ConservazioneManager.getSegnatura_ID_Doc(hd_docnumber.Value); if (RadioButtonList1.SelectedItem == null) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_selezione", "alert('Indicare se il file è leggibile o meno.');", true); } else { WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); if (RadioButtonList1.Items[1].Selected) { risultatoLeggibilita.Value = "fallito"; // Modifica per inserimento Registro di conservazione caso successo di Leggibilità del documento WSConservazioneLocale.RegistroCons regConsOk = new WSConservazioneLocale.RegistroCons(); regConsOk.idAmm = infoUtente.idAmministrazione; regConsOk.idIstanza = hd_idCons.Value; regConsOk.idOggetto = hd_docnumber.Value; regConsOk.tipoOggetto = "D"; regConsOk.tipoAzione = ""; regConsOk.userId = infoUtente.userId; regConsOk.codAzione = "LEGGIBILITA"; regConsOk.descAzione = "Esecuzione della verifica di leggibilità del documento " + segnaturaOrId + " dell'istanza id: " + hd_idCons.Value; regConsOk.esito = "1"; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regConsOk, infoUtente); } else { // Modifica per inserimento Registro di conservazione caso fallito di Leggibilità del documento WSConservazioneLocale.RegistroCons regCons = new WSConservazioneLocale.RegistroCons(); regCons.idAmm = infoUtente.idAmministrazione; regCons.idIstanza = hd_idCons.Value; regCons.idOggetto = hd_docnumber.Value; regCons.tipoOggetto = "D"; regCons.tipoAzione = ""; regCons.userId = infoUtente.userId; regCons.codAzione = "LEGGIBILITA"; regCons.descAzione = "Esecuzione della verifica di leggibilità del documento " + segnaturaOrId + " dell'istanza id: " + hd_idCons.Value; regCons.esito = "1"; ConservazioneWA.Utils.ConservazioneManager.inserimentoInRegistroCons(regCons, infoUtente); } bool leggibilitaVerificata = (risultatoLeggibilita.Value != "fallito"); if (risultatoLeggibilita.Value == "fallito") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_fallimento", "alert('Sono presenti documenti non leggibili.');", true); ConservazioneWA.Utils.ConservazioneManager.esitoLeggibilita(infoUtente, hd_idCons.Value, false); } else { if (hd_localstore.Value.ToString().ToLower() == "true") { this.iframeDoc.Attributes["src"] = "about:blank"; if (ConservazioneWA.Utils.ConservazioneManager.esitoLeggibilita(infoUtente, hd_idCons.Value, true)) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_successo", "alert('Verifica di leggibilità effettuata con successo.');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_caricamento_fallito", "alert('Caricamento nello storage remoto fallito.');", true); } } //Modifica: bisogna notificare la verifica leggibilità effettuata prima del caricamento su storage remoto. //dato che locale è true solo nella verifica antecedente il caricamento, lo usiamo per richiamare la popup //if (hd_localstore.Value.ToString().ToLower()=="true") //{ // Session["timer_chiusura"] = "no"; // ScriptManager.RegisterStartupScript(this.Page,this.GetType(),"show_chiusura_istanza","showChiusuraIstanza('"+hd_idCons.Value+"');",true); //} else { if (ConservazioneWA.Utils.ConservazioneManager.esitoLeggibilita(infoUtente, hd_idCons.Value, true)) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_successo", "alert('Verifica di leggibilità effettuata con successo.');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_fallito", "alert('Errore in database.');", true); } } } // MEV CS 1.5 // notifiche scadenza verifiche leggibilità // nella tabella DPA_SUPPORTO devo tenere separate le info sulle // verifiche di leggibilità da quelle di integrità if (TipoVerifica != "Verifica per chiusura") { if (!string.IsNullOrEmpty(this.IdSupporto)) { //Utils.ConservazioneManager.RegistraEsitoVerificaSupportoRegistrato( // (WSConservazioneLocale.InfoUtente)Session["infoutCons"], // hd_idCons.Value, // this.IdSupporto, // leggibilitaVerificata, // hd_percent.Value, // this.DataProssimaVerifica, // this.TipoVerifica + this.NoteVerifica, // this.codiceVerifica); Utils.ConservazioneManager.RegistraEsitoVerificaLeggibilitaSupportoRegistrato( (WSConservazioneLocale.InfoUtente)Session["infoutCons"], hd_idCons.Value, this.IdSupporto, leggibilitaVerificata, hd_percent.Value, this.DataProssimaVerifica, this.TipoVerifica + this.NoteVerifica, this.codiceVerifica); } else { //Utils.ConservazioneManager.RegistraEsitoVerificaSupportoRegistrato( // (WSConservazioneLocale.InfoUtente)Session["infoutCons"], // hd_idCons.Value, // FetchIdSupporto(), // leggibilitaVerificata, // hd_percent.Value, // FetchDataProssimaVerifica(), // this.TipoVerifica + "verifica di un file singolo", // this.codiceVerifica); Utils.ConservazioneManager.RegistraEsitoVerificaLeggibilitaSupportoRegistrato( (WSConservazioneLocale.InfoUtente)Session["infoutCons"], hd_idCons.Value, FetchIdSupporto(), leggibilitaVerificata, hd_percent.Value, FetchDataProssimaVerifica(), this.TipoVerifica + "verifica di un file singolo", this.codiceVerifica); } } else { if (!string.IsNullOrEmpty(this.IdSupporto)) { //Utils.ConservazioneManager.RegistraEsitoVerificaSupportoRegistrato( // (WSConservazioneLocale.InfoUtente)Session["infoutCons"], // hd_idCons.Value, // this.IdSupporto, // leggibilitaVerificata, // hd_percent.Value, // this.DataProssimaVerifica, // "Verifica Leggibilità per chiusura", // this.codiceVerifica); Utils.ConservazioneManager.RegistraEsitoVerificaLeggibilitaSupportoRegistrato( (WSConservazioneLocale.InfoUtente)Session["infoutCons"], hd_idCons.Value, this.IdSupporto, leggibilitaVerificata, hd_percent.Value, this.DataProssimaVerifica, "Verifica Leggibilità per chiusura", this.codiceVerifica); } else { //Utils.ConservazioneManager.RegistraEsitoVerificaSupportoRegistrato( // (WSConservazioneLocale.InfoUtente)Session["infoutCons"], // hd_idCons.Value, // FetchIdSupporto(), // leggibilitaVerificata, // hd_percent.Value, // FetchDataProssimaVerifica(), // "Verifica Leggibilità per chiusura", // this.codiceVerifica); Utils.ConservazioneManager.RegistraEsitoVerificaLeggibilitaSupportoRegistrato( (WSConservazioneLocale.InfoUtente)Session["infoutCons"], hd_idCons.Value, FetchIdSupporto(), leggibilitaVerificata, hd_percent.Value, FetchDataProssimaVerifica(), "Verifica Leggibilità per chiusura", this.codiceVerifica); } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_selezione", "window.close();", true); //Response.Write("<script>window.close();</script>"); } }