Esempio n. 1
0
        public void Save(string path, Leyenda legend)
        {
            try
            {
                PdfDocument document = new PdfDocument();
                PdfPage     page     = new PdfPage();
                page.Size        = _layout.Size;
                page.Orientation = _layout.Orientation;
                document.AddPage(page);
                XGraphics gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Replace);
                this.Render(gfx);

                PdfPage pageL = new PdfPage();
                pageL.Size        = PageSize.A4;
                pageL.Orientation = PageOrientation.Portrait;
                document.AddPage(pageL);
                gfx = XGraphics.FromPdfPage(pageL, XGraphicsPdfPageOptions.Replace);
                this.CreateLegend(gfx, legend);

                document.Save(path);
                gfx.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public void Draw(XGraphics gfx, Leyenda legend)
        {
            this.DrawLegendTitle(gfx);
            double y = this._top + this._legendTitleHeight;

            foreach (EntradaLeyenda le in legend.Items)
            {
                this.DrawLegendEntry(gfx, ref y, le);
            }
            if (legend.EntradaConsulta != null)
            {
                this.DrawLegendEntry(gfx, ref y, legend.EntradaConsulta);
            }
            if (legend.EntradaSeleccion != null)
            {
                this.DrawLegendEntry(gfx, ref y, legend.EntradaSeleccion);
            }
            if (legend.EntradaInformacion != null)
            {
                this.DrawLegendEntry(gfx, ref y, legend.EntradaInformacion);
            }

            if (this._frameVisible)
            {
                Frame f = new Frame();
                f.Left   = this._left;
                f.Top    = this._top;
                f.Width  = this._maxWidth;
                f.Height = (y + (this._symbolHeight / 2)) - this._top;
                f.Draw(gfx);
            }
        }
Esempio n. 3
0
        private void CreateLegend(XGraphics gfx, Leyenda legend)
        {
            PDFLegend pdfL = new PDFLegend();

            pdfL.Left                       = 1.5;
            pdfL.Top                        = 1.5;
            pdfL.MaxWidth                   = 18.0;
            pdfL.FrameVisible               = true;
            pdfL.LegendTitleHeight          = 1.0;
            pdfL.LegendTitle.FontFamilyName = "Tahoma";
            pdfL.LegendTitle.FontSize       = 16.0;
            pdfL.LegendTitle.FontColorName  = "Black";
            pdfL.LegendTitle.FontStyle      = XFontStyle.BoldItalic;
            pdfL.LegendTitle.Text           = "Leyenda";
            pdfL.EntryIndent                = 1.0;
            pdfL.SubEntryIndent             = 0.25;
            pdfL.SymbolWidth                = 1.0;
            pdfL.SymbolHeight               = 0.5;
            pdfL.FontFamilyName             = "Tahoma";
            pdfL.FontSize                   = 10.0;
            pdfL.FontColorName              = "Black";
            pdfL.FontStyle                  = XFontStyle.Bold;
            pdfL.TitleSpacing               = 0.2;
            pdfL.Draw(gfx, legend);
        }
Esempio n. 4
0
        public void PrintLegend(System.Drawing.Graphics g, Leyenda legend)
        {
            g.PageUnit = System.Drawing.GraphicsUnit.Point;
            XGraphics gfx = XGraphics.FromGraphics(g, XSize.FromSize(PageSizeConverter.ToSize(PageSize.A4)));

            this.CreateLegend(gfx, legend);
            gfx.Dispose();
        }
Esempio n. 5
0
        public bool eliminarLeyenda(Leyenda leyenda)
        {
            string textoComando       = "UPDATE LEYENDA SET eliminado = 1 WHERE leyendaID = @LEYENDAID";
            List <SqlParameter> lista = new List <SqlParameter>();

            lista.Add(new SqlParameter("@LEYENDAID", leyenda.Id));
            return(Convert.ToBoolean(sqlHelper.ejecutarNonQuery(textoComando, lista)));
        }
Esempio n. 6
0
        public bool modificarLeyenda(Leyenda leyenda)
        {
            string textoComando       = "UPDATE LEYENDA SET nombreControl = @NOMBRE, texto = @TEXTO where leyendaID = @LEYENDAID";
            List <SqlParameter> lista = new List <SqlParameter>();

            lista.Add(new SqlParameter("@NOMBRE", leyenda.NombreControl));
            lista.Add(new SqlParameter("@TEXTO", leyenda.Texto));
            lista.Add(new SqlParameter("@LEYENDAID", leyenda.Id));
            return(Convert.ToBoolean(sqlHelper.ejecutarNonQuery(textoComando, lista)));
        }
Esempio n. 7
0
        public bool crearLeyenda(Leyenda leyenda, Idioma idioma)
        {
            string textoComando       = "INSERT INTO LEYENDA (nombreControl, texto, idiomaID) values (@NOMBRE, @TEXTO, @IDIOMAID)";
            List <SqlParameter> lista = new List <SqlParameter>();

            lista.Add(new SqlParameter("@NOMBRE", leyenda.NombreControl));
            lista.Add(new SqlParameter("@TEXTO", leyenda.Texto));
            lista.Add(new SqlParameter("@IDIOMAID", idioma.Id));
            return(Convert.ToBoolean(sqlHelper.ejecutarNonQuery(textoComando, lista)));
        }
Esempio n. 8
0
        public static List <Leyenda> GetLeyenda(int DocEntry)
        {
            DataTable dt = Conexion.Ejecutar_dt(string.Format("EXEC [dbo].[Consulta_SFS_LEY] @DocEntry = '{0}'", DocEntry));

            List <Leyenda> leyendas = new List <Leyenda>();
            Leyenda        leyenda  = new Leyenda();

            leyenda.codLeyenda = dt.Rows[0].ItemArray[0].ToString();
            leyenda.desLeyenda = dt.Rows[0].ItemArray[1].ToString();

            leyendas.Add(leyenda);
            return(leyendas);
        }
Esempio n. 9
0
        /// <summary>
        /// conseguirLeyendaMenu se encarga de conseguir y actualizar los textos de los controles relativos a los Menu en base
        /// al idioma cargado en la Sesion.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public string conseguirLeyendaMenu(ToolStripMenuItem item)
        {
            Leyenda leyenda = Sesion.Instancia().IdiomaActual.Leyendas.Find(i => i.NombreControl == item.Name);

            if (leyenda != null)
            {
                return(leyenda.Texto);
            }
            else
            {
                return(item.Text);
            }
        }
Esempio n. 10
0
 /// <summary>
 /// modificarLeyenda se encarga de solicitar a la DAL la modificacion de una leyenda
 /// </summary>
 /// <param name="leyenda"></param>
 public void modificarLeyenda(Leyenda leyenda)
 {
     verificarPermiso("OP87");
     try
     {
         dalLeyenda.modificarLeyenda(leyenda);
         bllBitacora.crearNuevaBitacora("Modificacion de Leyenda", "Se modifico la leyenda para el control " + leyenda.NombreControl + " con ID " + leyenda.Id, Criticidad.Media);
     }
     catch (Exception ex)
     {
         bllBitacora.crearNuevaBitacora("Modificacion de leyenda", "Error en la modificacion de leyenda: " + ex.Message, Criticidad.Alta);
         throw ex;
     }
 }
Esempio n. 11
0
        /// <summary>
        /// conseguirLeyenda se encarga de retornar el texto de la leyenda traducida en base al idioma cargado actual en la Sesion.
        /// Si no se tiene una leyenda para ese control, se deja el atributo Text del control como se encuentra por default.
        /// </summary>
        /// <param name="control"></param>
        public void conseguirLeyenda(Control control)
        {
            Leyenda leyenda = Sesion.Instancia().IdiomaActual.Leyendas.Find(i => i.NombreControl == control.Name);

            if (leyenda != null)
            {
                control.Text = leyenda.Texto;
                if (control.HasChildren)
                {
                    foreach (Control controlHijo in control.Controls)
                    {
                        conseguirLeyenda(controlHijo);
                    }
                }
            }
        }
Esempio n. 12
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         Leyenda leyenda = new Leyenda();
         leyenda.NombreControl = GestionEtiqueta_textbox_nombre_control.Text;
         leyenda.Texto         = GestionEtiqueta_textbox_texto_leyenda.Text;
         bllLeyenda.crearLeyenda(leyenda, idiomaSeleccionado);
         recargarEtiquetas();
         Sesion.Instancia().IdiomaActual.Leyendas = bllLeyenda.conseguirLeyendasParaIdioma(Sesion.Instancia().IdiomaActual.Id);
         bllIdioma.Notify();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 13
0
        public List <Leyenda> conseguirLeyendasFaltantes(int idiomaId)
        {
            string textoComando       = "SELECT DISTINCT(nombreControl) FROM Leyenda where nombreControl not in(select nombreControl from Leyenda where IdiomaID = @ID and eliminado = 0) and eliminado = 0";
            List <SqlParameter> lista = new List <SqlParameter>();

            lista.Add(new SqlParameter("@ID", idiomaId));
            DataTable      leyendasDT    = sqlHelper.ejecutarDataAdapter(textoComando, lista).Tables[0];
            List <Leyenda> listaLeyendas = new List <Leyenda>();

            foreach (DataRow dr in leyendasDT.Rows)
            {
                Leyenda leyenda = new Leyenda();
                leyenda.NombreControl = Convert.ToString(dr["nombreControl"]);
                leyenda.Texto         = "";
                listaLeyendas.Add(leyenda);
            }
            return(listaLeyendas);
        }
Esempio n. 14
0
        public Leyenda conseguirLeyendaParaIdioma(string nombre, int idiomaId)
        {
            string textoComando       = "SELECT * from Leyenda where nombreControl = @NOMBRE and idiomaId = @IDIOMAID and eliminado = 0";
            List <SqlParameter> lista = new List <SqlParameter>();

            lista.Add(new SqlParameter("@NOMBRE", nombre));
            lista.Add(new SqlParameter("@IDIOMAID", idiomaId));
            Leyenda   leyendaADevolver = new Leyenda();
            DataTable dt = sqlHelper.ejecutarDataAdapter(textoComando, lista).Tables[0];

            if (dt.Rows.Count > 0)
            {
                leyendaADevolver.Id            = (int)dt.Rows[0]["leyendaID"];
                leyendaADevolver.NombreControl = (string)dt.Rows[0]["nombreControl"];
                leyendaADevolver.Texto         = (string)dt.Rows[0]["texto"];
            }
            return(leyendaADevolver);
        }
Esempio n. 15
0
        /// <summary>
        /// crearLeyenda se encarga de solicitar la creacion de una nueva leyenda para un idioma
        /// </summary>
        /// <param name="leyenda"></param>
        /// <param name="idioma"></param>
        public void crearLeyenda(Leyenda leyenda, Idioma idioma)
        {
            try
            {
                verificarPermiso("OP85");
                Leyenda leyendaConseguida = dalLeyenda.conseguirLeyendaParaIdioma(leyenda.NombreControl, idioma.Id);

                if (leyendaConseguida.NombreControl == null)
                {
                    dalLeyenda.crearLeyenda(leyenda, idioma);
                    bllBitacora.crearNuevaBitacora("Creacion de Leyenda", "Creacion de leyenda para el control " + leyenda.NombreControl + " con Idioma: " + idioma.NombreIdioma, Criticidad.Alta);
                }
                else
                {
                    throw new Exception(NuSmartMessage.formatearMensaje("GestionLeyenda_messagebox_leyenda_existente"));
                }
            }catch (Exception ex)
            {
                bllBitacora.crearNuevaBitacora("Creacion de Leyenda", "Error en la creacion de leyenda: " + ex.Message, Criticidad.Alta);
                throw ex;
            }
        }
Esempio n. 16
0
        public List <Leyenda> conseguirTodosParaIdioma(int idiomaId)
        {
            string consulta = "select * from leyenda where idiomaID = @IDIOMA and eliminado = 0 ORDER BY nombreControl asc";

            List <SqlParameter> lista = new List <SqlParameter>();

            lista.Add(new SqlParameter("@IDIOMA", idiomaId));

            DataTable leyendasDT = sqlHelper.ejecutarDataAdapter(consulta, lista).Tables[0];

            List <Leyenda> listaLeyendas = new List <Leyenda>();

            foreach (DataRow dr in leyendasDT.Rows)
            {
                Leyenda leyenda = new Leyenda();
                leyenda.Id            = (int)dr["leyendaId"];
                leyenda.NombreControl = Convert.ToString(dr["nombreControl"]);
                leyenda.Texto         = Convert.ToString(dr["texto"]);

                listaLeyendas.Add(leyenda);
            }

            return(listaLeyendas);
        }
Esempio n. 17
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     leyendaSeleccionada = (Leyenda)dataGridView1.CurrentRow.DataBoundItem;
     GestionEtiqueta_textbox_nombre_control.Text = leyendaSeleccionada.NombreControl;
     GestionEtiqueta_textbox_texto_leyenda.Text  = leyendaSeleccionada.Texto;
 }
Esempio n. 18
0
    public bool fillData()
    {
        Debug.Log("Fill Config");
        jsonString = File.ReadAllText(Application.dataPath + "/Resources/Json/DatosMunicipios.Json");
        if (jsonString == null)
        {
            return(false);
        }
        //itemData = JsonMapper.ToObject (jsonString);
        TodosMunicipios = new List <UnMunicipio> ();
        var N    = JSON.Parse(jsonString);
        int cont = 0;

        for (int i = 0; i < N.Count; i++)
        {
            um = new UnMunicipio();
            //scenes = new List<Escena> ();
            um.codigo = N [i] ["codigo"];
            um.nombre = N [i] ["nombre"];
            //Personas
            um.bibliotecas    = N [i] ["bibliotecas"];
            um.bibliobuses    = N [i] ["bibliobuses"];
            um.teleasistencia = N [i] ["teleasistencia"];
            um.hestia         = N [i] ["hestia"];
            um.governobert    = N [i] ["governobert"];
            um.xaloc          = N [i] ["xaloc"];
            um.km2            = N [i] ["km2"];
            //um.km22=N [i] ["KM22"];
            //Sostenibilidad
            um.CambioClimatico  = N [i] ["CambioClimatico"];
            um.Sostenibilidad   = N [i] ["Sostenibilidad"];
            um.EconomiaCircular = N [i] ["EconomiaCircular"];
            //um.emissions=N [i] ["emissions"];
            um.CalderesBiomassa    = N [i] ["CalderesBiomassa"];
            um.FotovoltaiquesAuto  = N [i] ["FotovoltaiquesAuto"];
            um.FotovoltaiquesVenta = N [i] ["FotovoltaiquesVenta"];
            um.AnalisisParticulas  = N [i] ["AnalisisParticulas"];
            um.AguaFuentes         = N [i] ["AguaFuentes"];
            um.MedidaSonido        = N [i] ["MedidaSonido"];
            um.SoporteTecnico      = N [i] ["SoporteTecnico"];
            um.AparatosPrestados   = N [i] ["AparatosPrestados"];
            um.Turismo             = N [i] ["Turismo"];
            //Tecnologia
            um.AsesoramientoJuridico = N [i] ["AsesoramientoJuridico"];
            um.GestionInformacion    = N [i] ["GestionInformacion"];
            um.GestionFormacion      = N [i] ["GestionFormacion"];
            um.HERMES = N [i] ["HERMES"];
            um.GestionContabilidad = N [i] ["GestionContabilidad"];
            um.GestionPadron       = N [i] ["GestionPadron"];
            um.GestionWebs         = N [i] ["GestionWebs"];
            um.Muniapps            = N [i] ["Muniapps"];
            um.PlataformaUrbana1   = N [i] ["PlataformaUrbana1"];
            um.PlataformaUrbana2   = N [i] ["PlataformaUrbana2"];
            um.Hibrid = N[i]["Hibrid"];
            um.SITMUN = N [i] ["SITMUN"];
            um.InfraestructurasInformacion = N [i] ["InfraestructurasInformacion"];
            //Posicion
            um.posX = N [i] ["posX"];
            um.posY = N [i] ["posY"];
            um.posZ = N [i] ["posZ"];

            TodosMunicipios.Add(um);

            //Debug.Log ("Nombre: "+um.nombre);
            //Debug.Log ("x: "+um.posX+" y: "+um.posY+" z: "+um.posZ);
            //if (um.bibliobuses != 0) {
            //Debug.Log ("Hay biblio: " + um.bibliotecas);
            cont++;
            GameObject Marker = Instantiate(marcador, new Vector3(um.posX, um.posY, um.posZ), Quaternion.identity);
            //GameObject Marker=Instantiate (marcador, new Vector3 (um.posX, um.posY, um.posZ), Quaternion.identity);
            Vector3 v = new Vector3(um.posX, um.posY, um.posZ);
            //v.y = -27;
            //Marker.transform.position= v;
            //GameObject Marker=Instantiate (marcador, new Vector3 (um.posX, um.posY, um.posZ), Quaternion.identity);
            //GameObject Marker=Instantiate (marcador, new Vector3 (um.posX, 70, um.posZ), Quaternion.identity);

            MarkerBehaviour MB = Marker.GetComponentInChildren <MarkerBehaviour> ();

            MB.codigo = um.codigo;
            MB.setYpos(um.posY);
            TapaBehaviour TB = Marker.GetComponentInChildren <TapaBehaviour> ();
            TB.codigo = um.codigo;
            //MB.pos = new Vector3 (um.posX,um.posY,um.posZ);
            //MB.yPos = um.posY;
            //Marker.transform.position= new Vector3 (um.posX,um.posY,um.posZ);
            Marker.transform.position = new Vector3(um.posX, um.posY - 27, um.posZ);
            //}
        }

        //LEYENDAS
        Debug.Log("Fill Config leyendas");
        jsonString = File.ReadAllText(Application.dataPath + "/Resources/Json/json_maqueta_es_en_ca.Json");
        if (jsonString == null)
        {
            Debug.Log("Error json");
            return(false);
        }
        TodasLeyendas = new List <Leyenda> ();
        var J     = JSON.Parse(jsonString);
        int conta = 0;

        Debug.Log("Temas:" + J.Count);
        for (int i = 0; i < J.Count; i++)
        {
            Debug.Log("Temas:" + i);

            Debug.Log("Contenidos tema:" + J[i]["contenidos"].Count);
            for (int j = 0; j < J[i]["contenidos"].Count; j++)
            {
                Debug.Log(" Subcontenidos:" + J [i] ["contenidos"] [j] ["Subcontenidos"].Count);
                if (J [i] ["contenidos"] [j] ["Subcontenidos"].Count > 0)
                {
                    ly = new Leyenda();
                    Debug.Log(" Rellena subcontenido");
                    for (int k = 0; k < J[i]["contenidos"][j]["Subcontenidos"].Count; k++)
                    {
                        ly.codigo      = J [i] ["contenidos"] [j] ["Subcontenidos"] [k] ["id"];
                        ly.codigoPadre = J [i] ["contenidos"] [j] ["id"];
                        ly.leyenda_esp = J [i] ["contenidos"] [j] ["Subcontenidos"] [k] ["idiomas"][0]["leyenda"];
                        ly.leyenda_ing = J [i] ["contenidos"] [j] ["Subcontenidos"] [k] ["idiomas"][1]["leyenda"];
                        ly.leyenda_cat = J [i] ["contenidos"] [j] ["Subcontenidos"] [k] ["idiomas"][2]["leyenda"];
                        Debug.Log("Codigo:" + ly.codigo + " leyenda" + ly.leyenda_esp);
                        TodasLeyendas.Add(ly);
                    }
                }
                else
                {
                    ly = new Leyenda();
                    Debug.Log(" Rellena contenido");
                    ly.codigo      = J [i] ["contenidos"] [j] ["id"];
                    ly.codigoPadre = J [i] ["contenidos"] [j] ["id"];
                    ly.leyenda_esp = J [i] ["contenidos"] [j] ["idiomas"] [0] ["leyenda"];
                    ly.leyenda_ing = J [i] ["contenidos"] [j] ["idiomas"] [1] ["leyenda"];
                    ly.leyenda_cat = J [i] ["contenidos"] [j] ["idiomas"] [2] ["leyenda"];
                    Debug.Log("Codigo:" + ly.codigo + " leyenda" + ly.leyenda_esp);
                    TodasLeyendas.Add(ly);
                }
            }
            Debug.Log("End for");
        }
        //FIN LEYENDAS


        Debug.Log("Datos recuperados. ");
        Debug.Log("Pintados: " + cont);
        //Instantiate(marcador,new Vector3(TodosMunicipios[0].posX,TodosMunicipios[0].posY,TodosMunicipios[0].posZ),Quaternion.identity);
        AnimationTrigger atScript = AnimStarters.GetComponent <AnimationTrigger>();

        //atScript.isGrowing = true;
        return(true);
    }
Esempio n. 19
0
        public void Update(IdiomaSubject idioma)
        {
            if (idioma.Idioma != null)
            {
                foreach (TextBox txtBox in SingletonIdioma.FindWindowChildren <TextBox>(this))
                {
                    if (txtBox.Tag != null)
                    {
                        Leyenda leyenda = idioma.Idioma.Leyendas.Find(
                            delegate(Leyenda leye) { return(leye.Etiqueta.Equals((string)txtBox.Tag)); }
                            );

                        if (leyenda != null)
                        {
                            HintAssist.SetHint(txtBox, leyenda.Traduccion.TextoTraducido);
                        }
                        txtBox.Text = txtBox.Text;
                    }
                }

                foreach (TextBlock textBlock in SingletonIdioma.FindWindowChildren <TextBlock>(this))
                {
                    if (textBlock.Tag != null)
                    {
                        Leyenda leyenda = idioma.Idioma.Leyendas.Find(
                            delegate(Leyenda leye) { return(leye.Etiqueta.Equals((string)textBlock.Tag)); }
                            );

                        if (leyenda != null)
                        {
                            textBlock.Text = leyenda.Traduccion.TextoTraducido;
                        }
                    }
                }

                foreach (ComboBox comboBox in SingletonIdioma.FindWindowChildren <ComboBox>(this))
                {
                    if (comboBox.Tag != null)
                    {
                        Leyenda leyenda = idioma.Idioma.Leyendas.Find(
                            delegate(Leyenda leye) { return(leye.Etiqueta.Equals((string)comboBox.Tag)); }
                            );

                        if (leyenda != null)
                        {
                            HintAssist.SetHint(comboBox, leyenda.Traduccion.TextoTraducido);
                        }
                    }
                }

                foreach (PasswordBox passwordBox in SingletonIdioma.FindWindowChildren <PasswordBox>(this))
                {
                    if (passwordBox.Tag != null)
                    {
                        Leyenda leyenda = idioma.Idioma.Leyendas.Find(
                            delegate(Leyenda leye) { return(leye.Etiqueta.Equals((string)passwordBox.Tag)); }
                            );

                        if (leyenda != null)
                        {
                            HintAssist.SetHint(passwordBox, leyenda.Traduccion.TextoTraducido);
                        }
                    }
                }

                foreach (Button button in SingletonIdioma.FindWindowChildren <Button>(this))
                {
                    if (button.Tag != null)
                    {
                        Leyenda leyenda = idioma.Idioma.Leyendas.Find(
                            delegate(Leyenda leye) { return(leye.Etiqueta.Equals((string)button.Tag)); }
                            );

                        if (leyenda != null)
                        {
                            button.Content = leyenda.Traduccion.TextoTraducido;
                        }
                    }
                }
            }
        }