/// <summary> /// /// </summary> protected void Fetch() { WSConservazioneLocale.InfoUtente infoUtente = (WSConservazioneLocale.InfoUtente)Session["infoutCons"]; //GM 31-7-2013 //filtro su esito string esito = this.ddl_esito.SelectedItem.Value; if (esito == "-1") { esito = string.Empty; } //filtro su azione string azione = this.ddl_azione.SelectedItem.Value; if (azione == "0") { azione = string.Empty; } this.grdLogApplicativi.DataSource = Utils.ConservazioneManager.GetLogs( infoUtente, this.txtIdIstanza.Text, this.txtDataLogFrom.Text, this.txtDataLogTo.Text, this.txtUtente.Text, azione, esito); this.grdLogApplicativi.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); if (!IsPostBack) { amm = ConservazioneWA.Utils.ConservazioneManager.GetInfoAmmCorrente(this.infoUtente.idAmministrazione); this.lbl_amm.Text = this.amm.Codice + " - " + this.amm.Descrizione; this.btnFind.Attributes.Add("onmouseover", "this.className='cbtnHover';"); this.btnFind.Attributes.Add("onmouseout", "this.className='cbtn';"); } else { //per reload pagina dopo che un'istanza è stata firmata //ricarico l'elenco in modo da rimuoverla dall'elenco delle non firmate if (this.reloadData.Value == "1") { this.reloadData.Value = "0"; List <WSConservazioneLocale.FiltroRicerca> filters = this.creaFiltro(); //this.dg_StampeCons.CurrentPageIndex = 0; LoadData(filters); } } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); this.idEsibizione = Request.QueryString["idEsibizione"]; this.idCert = Request.QueryString["idCertificazione"]; this.daFirmare = (Request.QueryString["firma"].ToString() == "y"); this.hd_iddocumento.Value = idCert; this.hd_idesibizione.Value = idEsibizione; if (daFirmare) { this.btnApplicaFirma.Attributes.Add("onmouseover", "this.className='cbtnHover';"); this.btnApplicaFirma.Attributes.Add("onmouseout", "this.className='cbtn';"); this.btnApplicaFirma.Attributes.Add("onClick", "ApplySign('" + this.GetQueryStringTipoFirma() + "');"); this.btnAnnulla.Text = "Annulla"; ClientScript.RegisterStartupScript(this.GetType(), "fetchListaCert", "FetchListaCertificati();", true); } else { this.btnApplicaFirma.Visible = false; this.rowCertificati1.Visible = false; this.rowCertificati2.Visible = false; this.lblListaCertificati.Visible = false; this.btnAnnulla.Text = "Chiudi"; this.iFrameSignedDoc.Attributes.Add("height", "520px"); } this.btnAnnulla.Attributes.Add("onmouseover", "this.className='cbtnHover';"); this.btnAnnulla.Attributes.Add("onmouseout", "this.className='cbtn';"); this.btnAnnulla.Attributes.Add("onClick", "CloseWindow('annulla');"); }
protected void GestioneGrafica() { this.btnFind.Attributes.Add("onmouseover", "this.className='cbtnHover';"); this.btnFind.Attributes.Add("onmouseout", "this.className='cbtn';"); WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); amm = Utils.ConservazioneManager.GetInfoAmmCorrente(infoUtente.idAmministrazione); this.lbl_amm.Text = this.amm.Codice + " - " + this.amm.Descrizione; }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; try { idDocumento = Request.QueryString["idDocumento"]; tipofirma = Request.QueryString["tipofirma"]; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); if (string.IsNullOrEmpty(tipofirma)) { tipofirma = string.Empty; } if (tipofirma.Equals("cosign")) { firmabool = true; } else { firmabool = false; } byte[] ba = Request.BinaryRead(Request.ContentLength); DocsPaWR.DocsPaWebService WS = new ProxyManager().getProxyDocsPa(); DocsPaWR.FileDocumento fd = new ConservazioneWA.DocsPaWR.FileDocumento(); ASCIIEncoding ae = new ASCIIEncoding(); string base64content = ae.GetString(ba); DocsPaWR.InfoUtente infoutWS = WS.getInfoUtente(infoUtente.idPeople, infoUtente.idGruppo); if (!IsPostBack) { DocsPaWR.FileRequest fr = WS.GetVersionsMainDocument(infoutWS, idDocumento)[0]; //il file è in formato pdf //fr.fileName += ".pdf"; fr.dataInserimento = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); bool retValue = WS.AppendDocumentoFirmato(base64content, firmabool, ref fr, infoutWS); if (!retValue) { Debugger.Write("Errore nel Page_Load (docs = NULL)"); throw new Exception(); } } string confirmMsg = "Firma avvenuta con successo."; this.RegisterClientScript("SignStampaCons", "alert('" + confirmMsg + "');"); } catch (Exception ex) { Debugger.Write("Errore nella firma della stampa del registro di conservazione: " + ex.Message); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); if (!this.IsPostBack) { this.Fetch(); GestioneGrafica(); } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); amm = Utils.ConservazioneManager.GetInfoAmmCorrente(this.infoUtente.idAmministrazione); InizializzaPagina(); //menuTop.ProfiloUtente = CalcolaProfiloUtente(); //menuTop.ProfiloUtente = ConservazioneManager.CalcolaProfiloUtente(this.infoUtente.idPeople, this.infoUtente.idAmministrazione); menuTop.ProfiloUtente = "CONSERVAZIONE"; }
protected void Page_Load(object sender, EventArgs e) { this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); if (!IsPostBack) { this.txt_Codice.CssClass = CSS_CODICE; this.txt_Descrizione.CssClass = CSS_DESCRIZIONE; } }
protected void BtnSign_Click(object sender, EventArgs e) { bool cofirma = false; bool timestamp = false; bool convert = false; DigitalSignature.RemoteDigitalSignManager dsm = null; DigitalSignature.RemoteDigitalSignManager.tipoFirma tipoFirma = DigitalSignature.RemoteDigitalSignManager.tipoFirma.CADES; DigitalSignature.RemoteDigitalSignManager.Memento mem = null; String alias, dominio, pin, otp; byte[] fileToSign = null; if (!string.IsNullOrEmpty(this.TxtHsmAlias.Text) && !string.IsNullOrEmpty(this.TxtHsmDomain.Text) && !string.IsNullOrEmpty(this.TxtHsmPin.Text) && !string.IsNullOrEmpty(this.TxtHsmLitOtp.Text)) { alias = this.TxtHsmAlias.Text; dominio = this.TxtHsmDomain.Text; pin = this.TxtHsmPin.Text; otp = this.TxtHsmLitOtp.Text; dsm = new DigitalSignature.RemoteDigitalSignManager(); tipoFirma = new DigitalSignature.RemoteDigitalSignManager.tipoFirma(); mem = new DigitalSignature.RemoteDigitalSignManager.Memento { Alias = alias, Dominio = dominio }; try { // D.O. 16/11/2016 le seguenti proprità non sono inizializzate in Page_Load (IsPostBack = true) // this.wss = new ProxyManager().getProxy(); this.idIstanza = Request.QueryString["idIstanza"]; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); this.infoUtenteWR = GetInfoUtenteWR(infoUtente); dsm.HSM_SetMementoForUser(mem, this.infoUtenteWR); // fileToSign = wss.downloadSignedXml(idIstanza, this.infoUtente); dsm.HSM_SignContent(idIstanza, fileToSign, cofirma, timestamp, tipoFirma, alias, dominio, otp, pin, convert, this.infoUtenteWR); } catch (System.Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + ex.Message + "', 'warning');} else {parent.ajaxDialogModal('" + ex.Message + "', 'warning');}", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "alert('Inserire tutti i campi obbligatori.';", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Response.Expires = -1; btn_verifica.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btn_verifica.Attributes.Add("onmouseout", "this.className='cbtn';"); btn_chiudi.Attributes.Add("onmouseover", "this.className='cbtnHover';"); btn_chiudi.Attributes.Add("onmouseout", "this.className='cbtn';"); idConservazione = this.Request.QueryString["idConservazione"]; this.hd_idIstanza.Value = idConservazione; WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(idConservazione, infoUtente); int i = 0; DataTable tabella1 = new DataTable(); tabella1.Columns.Add(new DataColumn("docnumber")); tabella1.Columns.Add(new DataColumn("desc")); tabella1.Columns.Add(new DataColumn("tipo")); string[] riga1 = new string[3]; foreach (WSConservazioneLocale.ItemsConservazione item in items) { riga1[0] = item.DocNumber; riga1[1] = item.desc_oggetto; riga1[2] = item.tipoFile; tabella1.Rows.Add(riga1); sel_file_da_aprire.Items.Add(item.DocNumber /* + item.tipoFile*/); //sel_numero_file.Items.Add((i+1).ToString()); i++; } hd_totDocs.Value = (i).ToString(); if (i < 3) { rbtn_numero_file.Enabled = false; lbl_numero_file.Enabled = false; tb_num_file.Enabled = false; } else { tb_num_file.Text = "3"; } tb_percent_file.Text = "100"; GridView1.DataSource = tabella1; GridView1.DataBind(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { this.Response.Expires = -1; string idDocumento = this.Request.QueryString["idDocumento"]; int indiceAllegato; Int32.TryParse(this.Request.QueryString["indiceAllegato"], out indiceAllegato); //GM per scaricare stampe firmate del registro di conservazione bool downloadAsAttachment; bool.TryParse(Request.QueryString["downloadAsAttachment"], out downloadAsAttachment); WSConservazioneLocale.InfoUtente infoUtente = (WSConservazioneLocale.InfoUtente)Session["infoutCons"]; WSConservazioneLocale.FileDocumento fileDocumento = null; //GM 22-7-2013 //gestione diversa se devo visualizzare o scaricare il documento if (!downloadAsAttachment) { fileDocumento = ConservazioneWA.Utils.ConservazioneManager.GetFileDocumentoNotifica(infoUtente, idDocumento, indiceAllegato); } else { fileDocumento = ConservazioneWA.Utils.ConservazioneManager.GetFileDocumentoFirmato(infoUtente, idDocumento, indiceAllegato); } if (fileDocumento != null) { if (!downloadAsAttachment) { this.Response.ContentType = "application/pdf"; this.Response.AddHeader("Content-Disposition", "inline"); this.Response.BinaryWrite(fileDocumento.content); } else { Response.Buffer = true; Response.Clear(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fileDocumento.name); Response.BinaryWrite(fileDocumento.content); Response.Flush(); Response.End(); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); amm = Utils.ConservazioneManager.GetInfoAmmCorrente(this.infoUtente.idAmministrazione); // Recupero user che si è loggato DocsPaWR.Utente user = (DocsPaWR.Utente)Session["userData"]; InizializzaPagina(user); //menuTop.ProfiloUtente = CalcolaProfiloUtente(); //menuTop.ProfiloUtente = ConservazioneManager.CalcolaProfiloUtente(this.infoUtente.idPeople, this.infoUtente.idAmministrazione); menuTop.ProfiloUtente = "ESIBIZIONE"; }
protected void caricamento() { WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); if (ConservazioneWA.Utils.ConservazioneManager.esitoLeggibilita(infoUtente, IdIstanza, true)) { hd_stato.Value = "ok"; } else { hd_stato.Value = "ko"; } //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ricarica", "<script>window.reload();</script>",true); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ricarica", "<script>document.getElementById('form1').submit();</script>", true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); this.infoUtenteWR = GetInfoUtenteWR(infoUtente);// ((DocsPaWR.InfoUtente)Session["infoutCons"]); this.idIstanza = Request.QueryString["idIstanza"]; this.wss = new ProxyManager().getProxy(); this.InitializeLanguage(); this.InitializePage(); } }
protected void Page_Load(object sender, EventArgs e) { this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); Response.Expires = -1; if (!IsPostBack) { string listaIstanze = this.Request.QueryString["listaIstanze"]; // Id oggetto chiamante string idObject = this.Request.QueryString["idObject"]; FetchData(listaIstanze); } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); if (!IsPostBack) { GestioneGrafica(); GetTypeDocument(); CaricaComboTitolari(); this.RecordCount = 0; this.SelectedPage = 1; this.SearchFilters = null; this.Result = null; this.TemplateProf = null; } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); if (!IsPostBack) { this.btnApplicaFirma.Attributes.Add("onmouseover", "this.className='cbtnHover';"); this.btnApplicaFirma.Attributes.Add("onmouseout", "this.className='cbtn';"); this.btnAnnulla.Attributes.Add("onmouseover", "this.className='cbtnHover';"); this.btnAnnulla.Attributes.Add("onmouseout", "this.className='cbtn';"); this.btnSalvaDoc.Attributes.Add("onmouseover", "this.className='cbtnHover';"); this.btnSalvaDoc.Attributes.Add("onmouseout", "this.className='cbtn';"); } this.idDocumento = Request.QueryString["idDocumento"]; bool isFirmato = Convert.ToBoolean(Request.QueryString["firmato"]); this.hd_iddocumento.Value = idDocumento; if (!isFirmato) { ClientScript.RegisterStartupScript(this.GetType(), "fetchlistacert", "FetchListaCertificati();", true); this.btnApplicaFirma.Attributes.Add("onClick", "ApplySign('" + this.GetQueryStringTipoFirma() + "');"); } else { //impedisco la visualizzazione della lista certificati this.rowListaCertificati.Visible = false; this.lblListaCertificati.Visible = false; this.lstListaCertificati.Visible = false; //ingrandisco il frame con il visualizzatore iFrameSignedDoc.Attributes.Add("height", "540px"); //modifico i pulsanti this.btnApplicaFirma.Visible = false; this.btnSalvaDoc.Visible = true; this.btnAnnulla.Text = "Chiudi"; } this.btnAnnulla.Attributes.Add("onClick", "CloseWindow('annulla');"); this.btnSalvaDoc.Attributes.Add("onClick", "DialogDownload();"); }
protected void Page_Load(object sender, EventArgs e) { string locale = this.Request.QueryString["locale"]; bool localStore = false; if (String.IsNullOrEmpty(locale)) { locale = "false"; } Boolean.TryParse(locale, out localStore); WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); string file = this.Request.QueryString["file"]; string idConservazione = this.Request.QueryString["idC"]; string filetype = this.Request.QueryString["ext"]; string[] uniSincroItems = file.Split('§'); string path = uniSincroItems[2]; string formato = uniSincroItems[0]; Response.Clear(); byte[] bincontent = null; if (formato.Contains("pkcs7-mime")) { WSConservazioneLocale.FileDocumento fd = ConservazioneWA.Utils.ConservazioneManager.sbustaFileFirmato(idConservazione, path, localStore); Response.AddHeader("content-disposition", "inline;filename=" + fd.name); Response.ContentType = !string.IsNullOrEmpty(fd.contentType) ? fd.contentType : "application/octet-stream"; bincontent = fd.content; Response.AddHeader("content-length", bincontent.Length.ToString()); Response.BinaryWrite(bincontent); } else { Response.ContentType = formato; Response.AddHeader("content-disposition", "inline;filename=" + uniSincroItems[1] + filetype); bincontent = ConservazioneWA.Utils.ConservazioneManager.getFileFromStore(infoUtente, idConservazione, path, localStore); Response.AddHeader("content-length", bincontent.Length.ToString()); Response.BinaryWrite(bincontent); Response.Flush(); } //Response.Flush(); Response.End(); }
public static bool logOff(WSConservazioneLocale.InfoUtente infoUtente, Page page) { string userId = infoUtente.userId; string idAmm = infoUtente.idAmministrazione; string dst = infoUtente.dst; bool result = true; try { result = wss.Logoff(userId, idAmm, page.Session.SessionID, dst); } catch (Exception e) { result = false; Debugger.Write("Errore nel log-off: " + e.Message); } return(result); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; this.infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); //GM 29-8-2013 //se è presente in sessione la variabile valoreContent va rimossa //per evitare problemi nell'estrazione dei report excel if (Session["valoreContent"] != null) { Session.Remove("valoreContent"); } if (!this.IsPostBack) { GestioneGrafica(); PopolaDdlAzioni(); } }
private DocsPaWR.InfoUtente GetInfoUtenteWR(WSConservazioneLocale.InfoUtente infoUt) { DocsPaWR.InfoUtente newInfoUt = new InfoUtente(); newInfoUt.codWorkingApplication = infoUt.codWorkingApplication; //newInfoUt.delegato = infoUt.delegato; newInfoUt.diSistema = infoUt.diSistema; newInfoUt.dst = infoUt.dst; newInfoUt.extApplications = infoUt.extApplications; newInfoUt.idAmministrazione = infoUt.idAmministrazione; newInfoUt.idCorrGlobali = infoUt.idCorrGlobali; newInfoUt.idGruppo = infoUt.idGruppo; newInfoUt.idPeople = infoUt.idPeople; newInfoUt.matricola = infoUt.matricola; newInfoUt.sede = infoUt.sede; newInfoUt.urlWA = infoUt.urlWA; newInfoUt.userId = infoUt.userId; return(newInfoUt); }
private void caricaAllegati(string idIstanza, string idDocPrincipale) { //valore cablato bool localStore = true; // // Get isLocalStore localStore = ConservazioneWA.Utils.ConservazioneManager.isLocalStore(); WSConservazioneLocale.InfoUtente infoUt = (WSConservazioneLocale.InfoUtente)Session["infoutCons"]; //recupero la lista degli allegati dal file di chiusura Dictionary <string, string> lista = Utils.ConservazioneManager.getFilesFromUniSincro(infoUt, idIstanza, localStore); int i = 1; foreach (KeyValuePair <string, string> all in lista) { //se è un allegato contiene nel path l'iddoc del doc principale, e il suo id è diverso da quello del doc principale if (!(all.Key == idDocPrincipale) && ((all.Value.Split('§')[2]).Contains(idDocPrincipale))) { string idAllegato = all.Value.Split('§')[1]; ImageButton btn = new ImageButton(); btn.ID = "btn_all" + i; btn.ImageUrl = "../Img/ico_allegato.gif"; btn.Attributes.Add("onClick", string.Format("CaricaDoc('{0}');", idAllegato)); btn.ToolTip = "Allegato " + i; this.div_allegati.Controls.Add(btn); this.div_allegati.Controls.Add(new LiteralControl("<br />")); //this.cell_btn.Controls.Add(btn); //this.cell_btn.Controls.Add(new LiteralControl("<br />")); i = i + 1; } } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; WSConservazioneLocale.InfoUtente infoUt = (WSConservazioneLocale.InfoUtente)Session["infoutCons"]; // Per adesso Provo lacale bool localStore = true; // // Get isLocalStore localStore = ConservazioneWA.Utils.ConservazioneManager.isLocalStore(); try { // Parametri necessari, idIstanza di conservazione, pathFile // Parametri passati in input dal chiamante idIstanza = Request.QueryString["idIstanza"]; idDocumento = Request.QueryString["idDoc"]; type = Request.QueryString["type"]; wss = new ProxyManager().getProxy(); // Visualizzazione xml per documento if (type == "D") { // // Recupero il file di chiusura, in cui sono contenute tutte le informazioni Dictionary <String, String> documentiMemorizzati = null; documentiMemorizzati = ConservazioneWA.Utils.ConservazioneManager.getFilesFromUniSincro(infoUt, idIstanza, localStore); string info = documentiMemorizzati[idDocumento]; if (string.IsNullOrEmpty(info)) { // } else { // Prendo il file dallo storage //string formato = info.Split('§')[0]; string formato = "text/plain"; string idDocument = info.Split('§')[1]; string path = info.Split('§')[2]; //string hashSupporto = info.Split('§')[3]; pathFile = path + ".xml"; byte[] contentFile = wss.getFileFromStore(infoUt, idIstanza, pathFile, localStore); if (contentFile != null) { Response.ContentType = formato; Response.AddHeader("Content-Disposition", "inline"); Response.BinaryWrite(contentFile); } } } // Visualizzazione xml per fascicolo if (type == "F") { // Get Info istanze conservazione WSConservazioneLocale.ItemsConservazione[] itemsCons = ConservazioneManager.getItemsConservazione(idIstanza, infoUt); string formato = "text/plain"; string idFascicolo = idDocumento; string CodiceFascicolo = string.Empty; if (itemsCons.Length > 0) { CodiceFascicolo = itemsCons.FirstOrDefault(x => x.ID_Project.ToString() == idFascicolo).CodFasc.ToString(); } string path = "\\Fascicoli" + "\\" + CodiceFascicolo + "\\" + idFascicolo; //string hashSupporto = info.Split('§')[3]; pathFile = path + ".xml"; byte[] contentFile = wss.getFileFromStore(infoUt, idIstanza, pathFile, localStore); if (contentFile != null) { Response.ContentType = formato; Response.AddHeader("Content-Disposition", "inline"); Response.BinaryWrite(contentFile); } } } catch (Exception ex) { Debugger.Write("Errore nel download del file: " + ex.Message); } }
protected void btn_verifica_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); 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) { // MEV CS 1.5 // alert su esecuzione anticipata verifica leggibilità // verifico se l'alert è attivo string idAmministrazione = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]).idAmministrazione; if (Utils.ConservazioneManager.IsAlertConservazioneAttivo(idAmministrazione, "LEGGIBILITA_ANTICIPATA")) { bool checkVerificaAnticipata = Utils.ConservazioneManager.IsVerificaLeggibilitaAnticipata(this.hd_idIstanza.Value, IdSupporto, idAmministrazione); if (checkVerificaAnticipata) { //invio alert Utils.ConservazioneManager.InvioAlertAsync((WSConservazioneLocale.InfoUtente)Session["infoutCons"], "LEGGIBILITA_ANTICIPATA", this.hd_idIstanza.Value, IdSupporto); } } // fine MEV CS 1.5 if (rbtn_numero_file.Checked) { string files = ""; WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); //WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(this.hd_idIstanza.Value, infoUtente); WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazioneLite(IdIstanza, infoUtente); number = Int32.Parse(tb_num_file.Text); Random rdm = new Random(); string[] 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++; } } // MEV CS 1.5 //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',0,'" + IdSupporto + "','" + txtNoteDiVerifica.Text + "','" + txtDataProssimaVerifica.Text + "');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',0,'" + IdSupporto + "','" + txtNoteDiVerifica.Text + "','" + txtDataProssimaVerificaLegg.Text + "');", true); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','no'," + sel_numero_file.Items[sel_numero_file.SelectedIndex].Text + ");", true); } if (rbtn_percent_file.Checked) { string files = ""; WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); //WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(this.hd_idIstanza.Value, infoUtente); WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazioneLite(IdIstanza, infoUtente); int 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(); string[] 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++; } } // MEV CS 1.5 // verifico se è attivo l'alert sulla percentuale massima di documenti verificabili if (Utils.ConservazioneManager.IsAlertConservazioneAttivo(infoUtente.idAmministrazione, "LEGGIBILITA_PERC")) { // parametro soglia percentuale int sogliaDoc = Int32.Parse(Utils.ConservazioneManager.GetParametriAlertConservazione(infoUtente.idAmministrazione, "LEGGIBILITA_PERC")); //se la percentuale scelta è maggiore della soglia invio l'alert if (percent >= sogliaDoc) { //alert Utils.ConservazioneManager.InvioAlertAsync(infoUtente, "LEGGIBILITA_PERC", this.hd_idIstanza.Value, IdSupporto); } } //MEV CS 1.5 //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',0,'" + IdSupporto + "','" + txtNoteDiVerifica.Text + "','" + txtDataProssimaVerifica.Text + "');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',0,'" + IdSupporto + "','" + txtNoteDiVerifica.Text + "','" + txtDataProssimaVerificaLegg.Text + "');", true); } if (rbtn_file_da_aprire.Checked) { string files = ""; foreach (GridViewRow gvr in GridView1.Rows) { if (((CheckBox)gvr.FindControl("chk_doc")).Checked) { files += gvr.Cells[0].Text + ","; } } //MEV CS 1.5 //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',0,'"+IdSupporto+"','"+txtNoteDiVerifica.Text+"','"+txtDataProssimaVerifica.Text+"');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',0,'" + IdSupporto + "','" + txtNoteDiVerifica.Text + "','" + txtDataProssimaVerificaLegg.Text + "');", true); } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "chiusura", "window.close();", true); } }
protected void btn_verifica_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); 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) { if (rbtn_numero_file.Checked) { string files = ""; WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(this.hd_idIstanza.Value, infoUtente); number = Int32.Parse(tb_num_file.Text); Random rdm = new Random(); string[] 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++; } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',2);", true); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','no'," + sel_numero_file.Items[sel_numero_file.SelectedIndex].Text + ");", true); } if (rbtn_percent_file.Checked) { string files = ""; WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); WSConservazioneLocale.ItemsConservazione[] items = ConservazioneWA.Utils.ConservazioneManager.getItemsConservazione(this.hd_idIstanza.Value, infoUtente); int 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(); string[] 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++; } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',2);", true); } if (rbtn_file_da_aprire.Checked) { string files = ""; foreach (GridViewRow gvr in GridView1.Rows) { if (((CheckBox)gvr.FindControl("chk_doc")).Checked) { files += gvr.Cells[0].Text + ","; } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "verificaLeggibilita", "showVerificaLeggibilita('" + this.hd_idIstanza.Value + "','" + files + "',2);", true); } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "chiusura", "window.close();", true); } }
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); } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; WSConservazioneLocale.InfoUtente infoUt = (WSConservazioneLocale.InfoUtente)Session["infoutCons"]; // Per adesso Provo lacale bool localStore = true; // // Get isLocalStore localStore = ConservazioneWA.Utils.ConservazioneManager.isLocalStore(); try { // Parametri necessari, idIstanza di conservazione, pathFile // Parametri passati in input dal chiamante idIstanza = Request.QueryString["idIstanza"]; idDocumento = Request.QueryString["idDoc"]; wss = new ProxyManager().getProxy(); // // Recupero il file di chiusura, in cui sono contenute tutte le informazioni Dictionary <String, String> documentiMemorizzati = null; documentiMemorizzati = ConservazioneWA.Utils.ConservazioneManager.getFilesFromUniSincro(infoUt, idIstanza, localStore); string info = documentiMemorizzati[idDocumento]; if (string.IsNullOrEmpty(info)) { // Non è stato possibile recuperare il file di chiusura // prendo file da locale // // Recupero le info sul file //WSConservazioneLocale.FileDocumento fileDocumento = null; fileDocumento = ConservazioneWA.Utils.ConservazioneManager.GetFileDocumentoNotifica(infoUt, idDocumento, 0); if (fileDocumento != null) { pathFile = fileDocumento.path; ContentType = fileDocumento.contentType; Response.ContentType = ContentType; Response.AddHeader("Content-Disposition", "inline"); Response.BinaryWrite(fileDocumento.content); } } else { // Prendo il file dallo storage string formato = info.Split('§')[0]; string idDocument = info.Split('§')[1]; string path = info.Split('§')[2]; string hashSupporto = info.Split('§')[3]; pathFile = path; byte[] contentFile = wss.getFileFromStore(infoUt, idIstanza, pathFile, localStore); if (contentFile != null) { Response.ContentType = formato; Response.AddHeader("Content-Disposition", "inline"); Response.BinaryWrite(contentFile); } } } catch (Exception ex) { Debugger.Write("Errore nel download del file: " + ex.Message); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { this._infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); this._tipiSupporto = ConservazioneManager.GetTipiSupporto(); this._statiSupporto = ConservazioneManager.GetStatiSupporto(); if (!Page.IsPostBack) { this.PrepareFilters(); string idConservazione = this.NormalizeFilterCriteria(Request.QueryString["idConservazione"]); if (!string.IsNullOrEmpty(idConservazione)) { this.FetchSupporti(); this.txtFilterIdIstanza.Text = idConservazione; } else { string id = this.NormalizeFilterCriteria(Request.QueryString["id"]); if (!string.IsNullOrEmpty(id)) { this.FetchSupporti(); this.txtFilterIdSupporto.Text = id; } } this.GestioneGrafica(); } //se l'istanza viene messa in lavorazione if (this.hd_istanza_da_rigenerare != null && this.hd_istanza_da_rigenerare.Value != String.Empty && this.hd_istanza_da_rigenerare.Value != "undefined") { WSConservazioneLocale.InfoUtente infoUtente = ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]); string idSupporto = this.hd_supporto_da_rigenerare.Value; string idIstanza = this.hd_ID_istanza_da_rigenerare.Value; string message = ""; try { if (!string.IsNullOrEmpty(idSupporto) && !string.IsNullOrEmpty(idIstanza)) { message = ConservazioneManager.rigeneraIstanza(idIstanza, idSupporto, infoUtente); this.hd_istanza_da_rigenerare.Value = null; this.hd_supporto_da_rigenerare.Value = null; this.hd_ID_istanza_da_rigenerare.Value = null; 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); } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alt_rigenerazione_fallita", "alert('Si è verificato un errore.');", true); } } catch { this.hd_istanza_da_rigenerare.Value = null; this.hd_supporto_da_rigenerare.Value = null; this.hd_ID_istanza_da_rigenerare.Value = null; } } }
private void LaunchApplication() { if (this.user != null) { if (this.user.ruoli != null && this.user.ruoli.Length > 0) { this.ruolo = (DocsPaWR.Ruolo) this.user.ruoli[0]; } else { DocsPaWR.Ruolo ruoloFinto = new DocsPaWR.Ruolo(); ruoloFinto.idAmministrazione = this.user.idAmministrazione; ruoloFinto.idGruppo = "-1"; ruoloFinto.systemId = "-1"; this.ruolo = ruoloFinto; } } // // Old Code - MEV CS 1.4 - Esibizione //creaInfoUtente(this.user); //ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); // End OldCode // New Code - MEV cs 1.4 - esibizione WSConservazioneLocale.InfoUtente infoUt = creaInfoUtente(this.user); if (infoUt != null) { if (!string.IsNullOrEmpty(infoUt.idAmministrazione) && !string.IsNullOrEmpty(infoUt.idPeople) ) { // Lancio applicazione esibizione/conservazione if (string.IsNullOrEmpty(ProfiloUtente)) { ProfiloUtente = ConservazioneManager.CalcolaProfiloUtente(infoUt.idPeople, infoUt.idAmministrazione); } // Se provengo da PGU il Profilo è quello di conservazione if (Session["PGU"] != null && Session["PGU"].Equals("PGU")) { ProfiloUtente = "CONSERVAZIONE"; } if (!string.IsNullOrEmpty(ProfiloUtente)) { switch (ProfiloUtente.ToUpper()) { case "ESIBIZIONE": Session["GestioneEsibizione"] = "ESIBIZIONE"; //per la pagina di gestione esibizione ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('Esibizione/HomePageEsibizione.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); break; case "CONSERVAZIONE": Session["GestioneEsibizione"] = "CONSERVAZIONE"; //per la pagina di gestione esibizione ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); break; case "CONSERVAZIONE_ESIBIZIONE": // Valore in sessione, che se popolato in pageLoad gestisce la combo per l'accesso al giusto modulo // Rendo visibile il Panel della scelta del profilo CONSERVAZIONE / ESIBIZIONE { this.pnl_profili.Visible = true; this.ddl_profili.Visible = true; this.lbl_error.Text = "Selezionare un profilo di accesso"; this.lbl_error.Visible = true; // La combo profili è visibile this.hf_profiloUtente.Value = ProfiloUtente; if (Session["ProfiloUtente"] != null && Session["ProfiloUtente"].Equals("ESIBIZIONE")) { // Pulisco la sessione this.hf_profiloUtente.Value = Session["ProfiloUtente"].ToString(); Session["ProfiloUtente"] = ""; this.lbl_error.Text = string.Empty; this.lbl_error.Visible = false; Session["GestioneEsibizione"] = "ESIBIZIONE"; //per la pagina di gestione esibizione ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('Esibizione/HomePageEsibizione.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); } if (Session["ProfiloUtente"] != null && Session["ProfiloUtente"].Equals("CONSERVAZIONE")) { this.hf_profiloUtente.Value = Session["ProfiloUtente"].ToString(); Session["ProfiloUtente"] = ""; this.lbl_error.Text = string.Empty; this.lbl_error.Visible = false; Session["GestioneEsibizione"] = "CONSERVAZIONE"; //per la pagina di gestione esibizione ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); } break; } default: ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); break; } } //if(!string.IsNullOrEmpty(ProfiloUtente) && ProfiloUtente.ToUpper().Equals("ESIBIZIONE")) // ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('../Esibizione/HomePageEsibizione.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); //else // ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); } else { // Lancio applicazione Conservazione ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); } } else { // Default, Conservazione ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); } // // End Mev cs 1.4 - esibizione // Response.Write("<script>var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}</script>"); //ClientScript.RegisterStartupScript(this.GetType(), "openApplicazione", "var w=window.open('HomePageNew.aspx','HomePage','scrollbars=yes,location=0,resizable=yes');w.moveTo(0,0);w.resizeTo(screen.availWidth,screen.availHeight);if(w!=self){window.opener=null;self.close();}", true); }
/// <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(); }