Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = -1;

            try
            {
                idIstanza        = Request.QueryString["idIstanza"];
                tipofirma        = Request.QueryString["tipofirma"];
                comcomponentType = Request.QueryString["applet"];

                if (string.IsNullOrEmpty(tipofirma))
                {
                    tipofirma = string.Empty;
                }
                if (tipofirma.Equals("cosign"))
                {
                    firmabool = true;
                }
                else
                {
                    firmabool = false;
                }

                byte[] ba = null;
                if (string.IsNullOrEmpty(comcomponentType))
                {
                    ba = Request.BinaryRead(Request.ContentLength);
                }
                else
                {
                    string b64Content = Request["contentFile"];
                    if (!string.IsNullOrEmpty(b64Content))
                    {
                        b64Content = b64Content.Replace(' ', '+');
                        b64Content = b64Content.Trim();

                        FileJSON file = JsonConvert.DeserializeObject <FileJSON>(b64Content);

                        ba = Convert.FromBase64String(file.content);
                    }
                }

                //Invia i dati al servizio
                wss = new ProxyManager().getProxy();
                string result = wss.uploadSignedXml(idIstanza, ba, (WSConservazioneLocale.InfoUtente)Session["infoutCons"], !string.IsNullOrEmpty(comcomponentType));
                Session["resultFirma"] = result;

                //wss.uploadSignedXml(idIstanza, ba, (WSConservazioneLocale.InfoUtente)Session["infoutCons"]);

                //se l'upload sul servizio avviene con successo restituisco il seguente alert di conferma!!!
                string confirmMsg = "Il documento firmato e' stato archiviato con successo!";
                confirmMsg = confirmMsg.Replace("'", "\\'");
                // Visualizzazione messaggio di errore
                this.RegisterClientScript("UploadSignDoc", "alert('" + confirmMsg + "');");
            }
            catch (Exception es)
            {
                Debugger.Write("Errore nell'upload del file firmato: " + es.Message);
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = -1;
            try
            {
                idIstanza        = Request.QueryString["idIstanza"];
                comcomponentType = Request.QueryString["applet"];

                wss = new ProxyManager().getProxy();

                byte[] fileToSign = wss.downloadSignedXml(idIstanza, ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]));

                if (fileToSign != null)
                {
                    if (string.IsNullOrEmpty(comcomponentType))
                    {
                        Response.ContentType = "application/xml";
                        Response.AddHeader("Content-Disposition", "inline");
                        Response.BinaryWrite(fileToSign);
                    }
                    else
                    {
                        string base64String = System.Convert.ToBase64String(fileToSign, 0, fileToSign.Length);
                        Response.Write(base64String);
                    }
                }
            }
            catch (Exception ex)
            {
                Debugger.Write("Errore nel download del file xml da firmare: " + ex.Message);
            }
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
 protected void Session_End(object sender, EventArgs e)
 {
     /*
      * GESTIONE DELLA SESSIONE:
      * -----------------------------------------------------------------------------
      * sia il tool di amministrazione sia Docspa si trovano sotto lo stesso progetto
      * quindi hanno in comune il presente Global.asax .
      *
      * Esiste una sessione denominata "AppWA" che all'accesso del tool di amm.ne
      * viene impostata a "ADMIN"; all'accesso di Docspa viene impostata a "DOCSPA".
      */
     try
     {
         UserManager.logoff(this.Session);
     }
     catch (Exception ex)
     {
         Debugger.Write("Errore nel log off: " + ex.Message);
     }
 }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Expires = -1;
            try
            {
                idIstanza = Request.QueryString["idIstanza"];
                wss       = new ProxyManager().getProxy();
                byte[] fileToSign = wss.downloadSignedXml(idIstanza, ((WSConservazioneLocale.InfoUtente)Session["infoutCons"]));

                //va aggiunta la chiamata al servizio con MTOM o in alternativa con DIME
                //System.IO.File fileFirmato = new System.IO.FileStream("timbro_orizzontale.JPG", System.IO.FileAccess.ReadWrite);

                if (fileToSign != null)
                {
                    Response.BinaryWrite(fileToSign);
                }
            }
            catch (Exception ex)
            {
                Debugger.Write("Errore nel download dal servizio del file xml da visualizzare per la firma: " + ex.Message);
            }
        }
Пример #6
0
        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);
            }
        }
Пример #7
0
        protected void btn_accedi_Click(object sender, ImageClickEventArgs e)
        {
            if (string.IsNullOrEmpty(this.hd_forceLogin.Value))
            {
                if (string.IsNullOrEmpty(this.hd_ddlRuolicaricato.Value))
                {
                    try
                    {
                        string message = string.Empty;

                        if (!loginAction(this.CreateUserLogin(this.txt_pass.Text, this.txt_userId.Text), out message))
                        {
                            this.lbl_error.Text    = message;
                            this.lbl_error.Visible = true;
                        }
                    }
                    catch (Exception exception)
                    {
                        System.Diagnostics.Debug.WriteLine(exception.ToString());

                        this.lbl_error.Text    = "Errore di connessione con il Server";
                        this.lbl_error.Visible = true;
                        //focus
                        string s = "<SCRIPT language='javascript'>document.getElementById('" + txt_userId.ID + "').focus() </SCRIPT>";
                        RegisterStartupScript("focus", s);

                        Debugger.Write("Errore nella login: "******"DbType"] = dbType;
                        this.LaunchApplication();
                    }
                    else
                    {
                        this.lbl_error.Text    = "Errore di comunicazione con il server";
                        this.lbl_error.Visible = true;
                    }
                }
            }
            else
            {
                if (isAuthorized)
                {
                    string dbType = ConservazioneManager.getDbType();
                    if (dbType != string.Empty)
                    {
                        Session["DbType"] = dbType;
                        this.LaunchApplication();
                    }
                    else
                    {
                        this.lbl_error.Text    = "Errore di comunicazione con il server";
                        this.lbl_error.Visible = true;
                    }
                }
                else
                {
                    this.lbl_error.Text    = "Utente non abilitato";
                    this.lbl_error.Visible = true;
                }
            }

            //
            // Adeguamento login Centro servizi dopo mev multi amministrazione
            if (this.hf_loginResult.Value.Equals("NO_AMMIN"))
            {
                //
                // Carico le amministrazioni buone per l'user id inserito.
                DocsPaWR.Amministrazione[] amministrazioni = null;
                string returnMsg = string.Empty;
                amministrazioni = UserManager.getListaAmministrazioniByUser(this, this.txt_userId.Text, true, out returnMsg);

                if (amministrazioni != null && amministrazioni.Length > 0)
                {
                    for (int i = 0; i < amministrazioni.Length; i++)
                    {
                        if (!ddl_Amministrazioni.Items.Contains(new ListItem(amministrazioni[i].descrizione, amministrazioni[i].systemId)))
                        {
                            this.ddl_Amministrazioni.Items.Add(new ListItem(amministrazioni[i].descrizione, amministrazioni[i].systemId));
                        }
                    }

                    //
                    // La lista delle amministrazioni viene resa visibile
                    this.pnl_ddlAmm.Visible          = true;
                    this.ddl_Amministrazioni.Visible = true;
                }
                else
                {
                    this.lbl_error.Text = "Nessuna amministrazione disponibile";
                }
            }
            //
            // End Adeguamento login Centro servizi dopo mev multi amministrazione
        }
Пример #8
0
        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);
            }
        }