Пример #1
0
 public exportDatiManager(
     string oggettoExport,
     string tipologiaExport,
     string titolo,
     DocsPaWR.InfoUtente userInfo,
     DocsPaWR.Ruolo userRuolo,
     DocsPaWR.FullTextSearchContext context,
     string docOrFasc,
     String[] objSystemId)
 {
     this._oggettoExport   = oggettoExport;               // doc o fasc o trasm.....
     this._tipologiaExport = tipologiaExport;             // PDF o XLS
     this._titolo          = titolo;
     this._userInfo        = userInfo;
     this._userRuolo       = userRuolo;
     this._context         = context;
     this._docOrFasc       = docOrFasc;
     this._objSystemId     = objSystemId;
 }
Пример #2
0
        public exportDatiManager(
            string oggettoExport,
            string tipologiaExport,
            string titolo,
            DocsPaWR.InfoUtente userInfo,
            DocsPaWR.Ruolo userRuolo,
            DocsPaWR.FullTextSearchContext context,
            string docOrFasc,
            ArrayList campiSelezionati,
            String[] objSystemId)
        {
            this._oggettoExport    = oggettoExport;   // doc o fasc o trasm.....
            this._tipologiaExport  = tipologiaExport; // PDF o XLS
            this._titolo           = titolo;
            this._userInfo         = userInfo;
            this._userRuolo        = userRuolo;
            this._context          = context;
            this._docOrFasc        = docOrFasc;
            this._campiSelezionati = campiSelezionati;

            // Impostazione della lista dei system id degli oggetti selezionati
            this._objSystemId = objSystemId;
        }
Пример #3
0
        private void Export()
        {
            string oggetto   = this.hd_export.Value;
            string tipologia = string.Empty;
            string titolo    = this.txt_titolo.Text;

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

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

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

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

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

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

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


                if (file == null || file.content == null || file.content.Length == 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "noRisultatiRicerca", "alert('Nessun documento trovato.');", true);
                    ClientScript.RegisterStartupScript(this.GetType(), "openFile", "OpenFile('" + tipologia + "');", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "openFile", "OpenFile('" + tipologia + "');", true);
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "errore", "alert('Errore di sistema: " + ex.Message.Replace("'", "\\'") + "');", true);
            }
        }