예제 #1
0
        private void botonBuscar_Click(object sender, RoutedEventArgs e)
        {
            this.gridMuestraViajes.Visibility = Visibility.Hidden;
            this.tablaViajes.Children.Clear();
            this.tablaViajes.RowDefinitions.Clear();
            if (this.comboOrigen.SelectedIndex > -1 && this.comboDestino.SelectedIndex > -1)
            {
                if (this.buscarFecha.Text != "")
                {
                    bool     existen = false;
                    Label    valor;
                    Button   ver;
                    string[] itemsTabla = new string[4];
                    string   salida     = "";
                    string   llegada    = "";
                    string   fecha      = this.buscarFecha.Text;

                    Ciudad origen  = CiudadFacade.buscarPorNombre(this.comboOrigen.SelectedItem.ToString());
                    Ciudad destino = CiudadFacade.buscarPorNombre(this.comboDestino.SelectedItem.ToString());

                    try
                    {
                        List <Viaje> viajes = ViajeFacade.buscarPorOrigenDestino(origen.nombre, destino.nombre);
                        if (viajes.Count > 0)
                        {
                            foreach (Viaje viaje in viajes)
                            {
                                foreach (ViajeDiario vd in viaje.viajesDiarios)
                                {
                                    if (vd.fecha == fecha && vd.trayecto.origen.id == origen.id && vd.trayecto.destino.id == destino.id)
                                    {
                                        existen = true;
                                        foreach (Horario horario in viaje.horarios)
                                        {
                                            if (horario.parada.ciudad.id == origen.id)
                                            {
                                                salida = origen.nombre + " - " + horario.salida;
                                            }
                                            if (horario.parada.ciudad.id == destino.id)
                                            {
                                                llegada = destino.nombre + " - " + horario.llegada;
                                            }
                                        }

                                        itemsTabla[0] = salida;
                                        itemsTabla[1] = llegada;
                                        itemsTabla[2] = vd.trayecto.precio.ToString();
                                        itemsTabla[3] = viaje.identificador;

                                        this.tablaViajes.RowDefinitions.Add(new RowDefinition());
                                        this.tablaViajes.RowDefinitions[this.tablaViajes.RowDefinitions.Count - 1].Height = new System.Windows.GridLength(30);
                                        for (int n = 0; n < itemsTabla.Length; n++)
                                        {
                                            valor                     = new Label();
                                            valor.Style               = Resources["ItemViaje"] as Style;
                                            valor.Content             = itemsTabla[n];
                                            valor.HorizontalAlignment = HorizontalAlignment.Center;
                                            valor.SetValue(Grid.ColumnProperty, n);
                                            valor.SetValue(Grid.RowProperty, this.tablaViajes.RowDefinitions.Count - 1);
                                            this.tablaViajes.Children.Add(valor);
                                        }
                                        BitmapImage btm = new BitmapImage(new Uri("/SmarTravel_Final;component/Images/continue.png", UriKind.Relative));
                                        Image       img = new Image();
                                        img.Source  = btm;
                                        img.Stretch = Stretch.Uniform;

                                        ver         = new Button();
                                        ver.Cursor  = Cursors.Hand;
                                        ver.Style   = Resources["BotonSinBorde"] as Style;
                                        ver.Content = img;
                                        ver.Click  += new RoutedEventHandler(verViaje_Click);
                                        ver.Tag     = viaje.id.ToString() + "/" + vd.id.ToString();
                                        ver.SetValue(Grid.ColumnProperty, 4);
                                        ver.SetValue(Grid.RowProperty, this.tablaViajes.RowDefinitions.Count - 1);
                                        this.tablaViajes.Children.Add(ver);
                                    }
                                }
                            }
                            if (existen == true)
                            {
                                this.gridMuestraViajes.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                validar alert = new validar();
                                alert.show("No existen viajes disponibles para esta fecha.");
                            }
                        }
                        else
                        {
                            validar alert = new validar();
                            alert.show("No existen viajes disponibles.");
                        }
                    }
                    catch (Exception ex)
                    {
                        validar alert = new validar();
                        alert.show("No se pudo obtener los viajes disponibles.");
                    }
                }
                else
                {
                    validar alert = new validar();
                    alert.show("Seleccione una fecha de busqueda.");
                }
            }
            else
            {
                validar alert = new validar();
                alert.show("Debe seleccionar origen y destino.");
            }
        }
        private void editar_Click(object sender, RoutedEventArgs e)
        {
            if (validarUpdate())
            {
                // UPDATE

                int contador = 0;
                foreach (UIElement ui in this.horarios.Children)
                {
                    int row = System.Windows.Controls.Grid.GetRow(ui);
                    int col = System.Windows.Controls.Grid.GetColumn(ui);

                    if ((row == 0) && (col == 0 || col == 1 || col == 2))
                    {
                        Label label = (Label)ui;
                    }
                    else
                    {
                        TextBox txt        = (TextBox)ui;
                        string  textoCelda = txt.Text;
                        if (row > 0 && col < 2)
                        {
                            if (contador == 0)
                            {
                                listHorariosLlegadaUpdate.Add(textoCelda);
                                contador = 1;
                            }
                            else
                            {
                                listHorariosSalidaUpdate.Add(textoCelda);
                                contador = 0;
                            }
                        }
                    }
                }


                MySqlConnection con;

                for (int i = 0; i < (paradas.Count); i++)
                {
                    con = conexionDB.ObtenerConexion();
                    Viaje ciudad = ViajeFacade.buscarPorId(this.id_viaje);

                    Parada paradaCiudad = ParadaFacade.buscarPorRecorridoCiudad(ciudad.recorrido, this.paradas[i]);

                    string       updateString  = "UPDATE HORARIOS SET LLEGADA=?llegada, SALIDA=?salida WHERE VIAJE=?viaje AND PARADA=?parada";
                    MySqlCommand updateCommand = new MySqlCommand(updateString, con);
                    updateCommand.Parameters.Add("?llegada", listHorariosLlegadaUpdate[i]);
                    updateCommand.Parameters.Add("?salida", listHorariosSalidaUpdate[i]);
                    updateCommand.Parameters.Add("?viaje", this.id_viaje);
                    updateCommand.Parameters.Add("?parada", paradaCiudad.id);

                    updateCommand.ExecuteNonQuery();
                    con.Close();
                }

                MySqlConnection con2 = conexionDB.ObtenerConexion();
                string          updateDatosViajes  = "UPDATE VIAJES_DIARIOS SET BUS=?bus, AUXILIAR=?auxiliar,CHOFER=?chofer WHERE VIAJE=?viaje";
                MySqlCommand    updateDatosCommand = new MySqlCommand(updateDatosViajes, con2);
                updateDatosCommand.Parameters.Add("?bus", comboBus.Text);
                updateDatosCommand.Parameters.Add("?auxiliar", obtenerRutPersonaByNombre(comboAuxiliar.Text, "AUXILIAR"));
                updateDatosCommand.Parameters.Add("?chofer", obtenerRutPersonaByNombre(comboChofer.Text, "CHOFER"));
                updateDatosCommand.Parameters.Add("?viaje", this.id_viaje);

                updateDatosCommand.ExecuteNonQuery();
                con2.Close();

                nuevoViajeDiario = new nuevoViaje();
                nuevoViajeDiario.Show();
                nuevoViajeDiario.saludo.Text     = "Gracias por actualizar nuestros registros";
                nuevoViajeDiario.textBlock1.Text = "Se ha actualizado correctamente el viaje en el sistema";
            }
        }
        private void button5_Click(object sender, RoutedEventArgs e)
        {
            if (validarEditViajeDiario())
            {
                listadoRecorridos.RowDefinitions.Clear();
                listadoRecorridos.ColumnDefinitions.Clear();
                this.listadoRecorridos.Visibility = Visibility.Visible;

                List <string> listHorarioSalida  = new List <string>();
                List <string> listHorarioLlegada = new List <string>();

                Ciudad       origen  = CiudadFacade.buscarPorNombre(this.cOrigenEditar.Text);
                Ciudad       destino = CiudadFacade.buscarPorNombre(this.cDestinoEditar.Text);
                List <Viaje> allViajesByOrigenDestino = ViajeFacade.buscarViajePorOrigenAndDestino(origen, destino);
                try
                {
                    if (allViajesByOrigenDestino.Count > -1)
                    {
                        // Obtener HORARIO DE SALIDA Y LLEGADA
                        for (int i = 0; i < allViajesByOrigenDestino.Count; i++)
                        {
                            MySqlConnection con = conexionDB.ObtenerConexion();
                            string          sql = "SELECT SALIDA FROM HORARIOS WHERE LLEGADA = '-' AND VIAJE =" + allViajesByOrigenDestino[i].id;
                            MySqlCommand    cmd = new MySqlCommand(sql, con);

                            MySqlDataReader dr = cmd.ExecuteReader();

                            while (dr.Read())
                            {
                                listHorarioSalida.Add(dr.GetString(0));
                            }
                            con.Close();

                            con.Open();
                            string sqlHoraLlegada = "SELECT LLEGADA FROM HORARIOS WHERE SALIDA = '-' AND VIAJE =" + allViajesByOrigenDestino[i].id;

                            MySqlCommand cmd2 = new MySqlCommand(sqlHoraLlegada, con);

                            MySqlDataReader dr2 = cmd2.ExecuteReader();

                            while (dr2.Read())
                            {
                                listHorarioLlegada.Add(dr2.GetString(0));
                            }
                            con.Close();
                        }


                        darFormatoListadoRecorridos();

                        // CREAR FILAS SEGUN RESULTADO
                        int largo = allViajesByOrigenDestino.Count;
                        this.listadoRecorridos.ColumnDefinitions[0].Width = new System.Windows.GridLength(180);
                        this.listadoRecorridos.ColumnDefinitions[1].Width = new System.Windows.GridLength(185);
                        this.listadoRecorridos.ColumnDefinitions[2].Width = new System.Windows.GridLength(120);
                        this.listadoRecorridos.ColumnDefinitions[3].Width = new System.Windows.GridLength(60);

                        for (int z = 0; z < largo; z++)
                        {
                            this.listadoRecorridos.RowDefinitions.Add(new RowDefinition());
                            this.listadoRecorridos.RowDefinitions[z].Height = new System.Windows.GridLength(40);
                        }
                        this.listadoRecorridos.RowDefinitions[0].Height = new System.Windows.GridLength(30);
                        this.listadoRecorridos.RowDefinitions[listadoRecorridos.RowDefinitions.Count - 1].Height = new System.Windows.GridLength(40);


                        int     contador = 0;
                        TextBox tHorarios;
                        for (int row = 1; row < this.listadoRecorridos.RowDefinitions.Count; row++)
                        {
                            for (int col = 0; col < this.listadoRecorridos.ColumnDefinitions.Count; col++)
                            {
                                if (col == 0)
                                {
                                    tHorarios       = new TextBox();
                                    tHorarios.Style = Resources["ItemTablaGuion"] as Style;
                                    tHorarios.Text  = origen.nombre + "- " + destino.nombre;
                                    tHorarios.SetValue(Grid.ColumnProperty, col);
                                    tHorarios.SetValue(Grid.RowProperty, row);
                                    tHorarios.IsReadOnly = true;
                                    this.listadoRecorridos.Children.Add(tHorarios);
                                }
                                if (col == 1)
                                {
                                    tHorarios       = new TextBox();
                                    tHorarios.Style = Resources["ItemTablaGuion"] as Style;
                                    tHorarios.Text  = allViajesByOrigenDestino[contador].identificador;
                                    tHorarios.SetValue(Grid.ColumnProperty, col);
                                    tHorarios.SetValue(Grid.RowProperty, row);
                                    tHorarios.IsReadOnly = true;
                                    this.listadoRecorridos.Children.Add(tHorarios);
                                }
                                if (col == 2)
                                {
                                    tHorarios       = new TextBox();
                                    tHorarios.Style = Resources["ItemTablaGuion"] as Style;

                                    tHorarios.Text = listHorarioSalida[contador] + " - " + listHorarioLlegada[contador];
                                    tHorarios.SetValue(Grid.ColumnProperty, col);
                                    tHorarios.SetValue(Grid.RowProperty, row);
                                    tHorarios.IsReadOnly = true;
                                    this.listadoRecorridos.Children.Add(tHorarios);
                                }
                                if (col == 3)
                                {
                                    BitmapImage btm = new BitmapImage(new Uri("/SmarTravel_Final;component/Images/busquedaIcon.png", UriKind.Relative));
                                    Image       img = new Image();
                                    img.Source  = btm;
                                    img.Stretch = Stretch.Fill;
                                    img.Width   = 30;
                                    img.Height  = 30;
                                    Button b = new Button();
                                    b.Click += new RoutedEventHandler(b_Click);

                                    //b.Content = "VER"
                                    b.Content = img;

                                    b.Tag = Convert.ToString(allViajesByOrigenDestino[contador].id);
                                    b.SetValue(Grid.ColumnProperty, col);
                                    b.SetValue(Grid.RowProperty, row);


                                    this.listadoRecorridos.Children.Add(b);
                                }
                            } // Fin columnas
                            contador++;
                        }     // FIn tabla
                    }

                    else
                    {
                        validar v = new validar();
                        v.show("No hay viajes diarios creados");
                    }
                } // Fin try
                catch (Exception ex)
                {
                    validar v = new validar();
                    v.show(ex.Message);
                }
            } // Fin validar datos
        }
        private void tabEditarViajeDiario_Selected(object sender, RoutedEventArgs e)
        {
            formatoTablaViaje();
            List <Viaje>  allViajes          = ViajeFacade.buscarAllViajes();
            List <string> listHorarioSalida  = new List <string>();
            List <string> listHorarioLlegada = new List <string>();
            int           largo = allViajes.Count;

            for (int z = 0; z < largo; z++)
            {
                this.ListadoViajes.RowDefinitions.Add(new RowDefinition());

                this.ListadoViajes.RowDefinitions[z].Height = new System.Windows.GridLength(40);
            }
            this.ListadoViajes.RowDefinitions[0].Height = new System.Windows.GridLength(25);
            this.ListadoViajes.RowDefinitions[ListadoViajes.RowDefinitions.Count - 1].Height = new System.Windows.GridLength(40);


            List <string> nombreIntermedios = new List <string>();

            foreach (Viaje viaje in allViajes)
            {
                List <Recorrido> listado = RecorridoFacade.OrigenDestinoByRecorrido(viaje.reco);
                foreach (Recorrido ciudad in listado)
                {
                    // TENGO LOS ORIGENES Y DESTINOS DE LOS VIAJES
                    nombreIntermedios.Add(ciudad.origen.nombre + " - " + ciudad.destino.nombre);
                }
            }

            if (allViajes.Count > -1)
            {
                // Obtener HORARIO DE SALIDA Y LLEGADA
                for (int i = 0; i < allViajes.Count; i++)
                {
                    MySqlConnection con = conexionDB.ObtenerConexion();
                    string          sql = "SELECT SALIDA FROM HORARIOS WHERE LLEGADA = '-' AND VIAJE =" + allViajes[i].id;
                    MySqlCommand    cmd = new MySqlCommand(sql, con);

                    MySqlDataReader dr = cmd.ExecuteReader();

                    while (dr.Read())
                    {
                        listHorarioSalida.Add(dr.GetString(0));
                    }

                    dr.Close();
                    con.Close();
                    con.Open();
                    string sqlHoraLlegada = "SELECT LLEGADA FROM HORARIOS WHERE SALIDA = '-' AND VIAJE =" + allViajes[i].id;

                    MySqlCommand cmd2 = new MySqlCommand(sqlHoraLlegada, con);

                    MySqlDataReader dr2 = cmd2.ExecuteReader();

                    while (dr2.Read())
                    {
                        listHorarioLlegada.Add(dr2.GetString(0));
                    }
                    con.Close();
                }


                TextBox celda;
                int     contador = 0;
                for (int row = 1; row < this.ListadoViajes.RowDefinitions.Count; row++)
                {
                    for (int col = 0; col < this.ListadoViajes.ColumnDefinitions.Count; col++)
                    {
                        if (col == 0)
                        {
                            celda       = new TextBox();
                            celda.Style = Resources["ItemTablaGuion"] as Style;
                            celda.Text  = nombreIntermedios[contador];
                            celda.SetValue(Grid.ColumnProperty, col);
                            celda.SetValue(Grid.RowProperty, row);
                            celda.IsReadOnly = true;
                            this.ListadoViajes.Children.Add(celda);
                        }
                        if (col == 1)
                        {
                            celda       = new TextBox();
                            celda.Style = Resources["ItemTablaGuion"] as Style;
                            celda.Text  = listHorarioSalida[contador] + " - " + listHorarioLlegada[contador];
                            celda.SetValue(Grid.ColumnProperty, col);
                            celda.SetValue(Grid.RowProperty, row);
                            celda.IsReadOnly = true;
                            this.ListadoViajes.Children.Add(celda);
                        }
                        if (col == 2)
                        {
                            celda       = new TextBox();
                            celda.Style = Resources["ItemTablaGuion"] as Style;
                            celda.Text  = allViajes[contador].identificador;
                            celda.SetValue(Grid.ColumnProperty, col);
                            celda.SetValue(Grid.RowProperty, row);
                            celda.IsReadOnly = true;
                            this.ListadoViajes.Children.Add(celda);
                        }
                        if (col == 3)
                        {
                            celda       = new TextBox();
                            celda.Style = Resources["ItemTablaGuion"] as Style;

                            celda.Text = allViajes[contador].fechaDesde;
                            celda.SetValue(Grid.ColumnProperty, col);
                            celda.SetValue(Grid.RowProperty, row);
                            celda.IsReadOnly = true;
                            this.ListadoViajes.Children.Add(celda);
                        }
                        if (col == 4)
                        {
                            celda       = new TextBox();
                            celda.Style = Resources["ItemTablaGuion"] as Style;

                            celda.Text = allViajes[contador].fechaHasta;
                            celda.SetValue(Grid.ColumnProperty, col);
                            celda.SetValue(Grid.RowProperty, row);
                            celda.IsReadOnly = true;
                            this.ListadoViajes.Children.Add(celda);
                        }
                        if (col == 5)
                        {
                            BitmapImage btm = new BitmapImage(new Uri("/SmarTravel_Final;component/Images/busquedaIcon.png", UriKind.Relative));
                            Image       img = new Image();
                            img.Source  = btm;
                            img.Stretch = Stretch.Fill;
                            img.Width   = 30;
                            img.Height  = 30;
                            Button buttonNewViaje = new Button();
                            buttonNewViaje.Click += new RoutedEventHandler(buttonNewViaje_Click);

                            //b.Content = "VER"
                            buttonNewViaje.Content = img;

                            buttonNewViaje.Tag = Convert.ToString(allViajes[contador].id);
                            buttonNewViaje.SetValue(Grid.ColumnProperty, col);
                            buttonNewViaje.SetValue(Grid.RowProperty, row);


                            this.ListadoViajes.Children.Add(buttonNewViaje);
                        }
                    }
                    contador++;
                }
            }
        } // Fin metodo
예제 #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Viaje       viaje       = ViajeFacade.buscarPorId(this.idViaje);
            ViajeDiario viajeDiario = new ViajeDiario();

            foreach (ViajeDiario vd in viaje.viajesDiarios)
            {
                if (vd.id == idDiario)
                {
                    viajeDiario = vd;
                }
            }
            foreach (Horario h in viaje.horarios)
            {
                if (h.parada.ciudad.nombre == viajeDiario.trayecto.origen.nombre)
                {
                    this.textoSalida.Text = h.salida;
                }
                if (h.parada.ciudad.nombre == viajeDiario.trayecto.destino.nombre)
                {
                    this.textoLlegada.Text = h.llegada;
                }
            }

            if (viajeDiario.id > -1)
            {
                int precio = viajeDiario.trayecto.precio;
                this.textoFecha.Text   = viajeDiario.fecha;
                this.textoOrigen.Text  = viajeDiario.trayecto.origen.nombre;
                this.textoDestino.Text = viajeDiario.trayecto.destino.nombre;
                this.textoTarifa.Text  = precio.ToString();
                this.textoTotal.Text   = precio.ToString();

                Button asiento;
                for (int i = 1; i <= viajeDiario.asientosDisponibles; i = i + 4)
                {
                    this.gridAsientos.RowDefinitions.Add(new RowDefinition());
                    this.gridAsientos.RowDefinitions[this.gridAsientos.RowDefinitions.Count - 1].Height = new System.Windows.GridLength(35);
                    for (int n = 0; n < 5; n++)
                    {
                        //ASIENTOS LADO CHOFER
                        if (n < 2)
                        {
                            string numero = (n + i).ToString();
                            if (Convert.ToInt32(numero) > viajeDiario.asientosDisponibles)
                            {
                                break;
                            }
                            asiento         = new Button();
                            asiento.Cursor  = Cursors.Hand;
                            asiento.Style   = Resources["BotonAzul"] as Style;
                            asiento.Content = numero;
                            asiento.Width   = 34;
                            asiento.Height  = 34;
                            asiento.Click  += new RoutedEventHandler(selecciona_Asiento);
                            asiento.Tag     = numero;
                            asiento.SetValue(Grid.ColumnProperty, n);
                            asiento.SetValue(Grid.RowProperty, this.gridAsientos.RowDefinitions.Count - 1);
                            this.gridAsientos.Children.Add(asiento);
                        }
                        else
                        {
                            //ASIENTOS OTRO LADO
                            if (n > 2)
                            {
                                string numero = (n - 1 + i).ToString();
                                if (Convert.ToInt32(numero) > viajeDiario.asientosDisponibles)
                                {
                                    break;
                                }
                                asiento         = new Button();
                                asiento.Cursor  = Cursors.Hand;
                                asiento.Style   = Resources["BotonAzul"] as Style;
                                asiento.Content = numero;
                                asiento.Width   = 34;
                                asiento.Height  = 34;
                                asiento.Click  += new RoutedEventHandler(selecciona_Asiento);
                                asiento.Tag     = numero;
                                asiento.SetValue(Grid.ColumnProperty, n);
                                asiento.SetValue(Grid.RowProperty, this.gridAsientos.RowDefinitions.Count - 1);
                                this.gridAsientos.Children.Add(asiento);
                            }
                        }
                    }
                }
            }
        }
        public paradasViaje(int idViaje, string origen, string destino)
        {
            InitializeComponent();
            Viaje viaje = ViajeFacade.buscarPorId(idViaje);

            if (viaje != null)
            {
                Label    valor;
                string[] itemsTabla = new string[3];
                bool     intermedio = false;
                foreach (Horario h in viaje.horarios)
                {
                    if (intermedio == false)
                    {
                        if (h.parada.ciudad.nombre == origen)
                        {
                            intermedio    = true;
                            itemsTabla[0] = h.parada.ciudad.nombre;
                            itemsTabla[1] = h.llegada;
                            itemsTabla[2] = h.salida;

                            this.tablaParadas.RowDefinitions.Add(new RowDefinition());
                            this.tablaParadas.RowDefinitions[this.tablaParadas.RowDefinitions.Count - 1].Height = new System.Windows.GridLength(30);
                            for (int n = 0; n < itemsTabla.Length; n++)
                            {
                                valor                     = new Label();
                                valor.Style               = Resources["ItemViaje"] as Style;
                                valor.Content             = itemsTabla[n];
                                valor.HorizontalAlignment = HorizontalAlignment.Center;
                                valor.SetValue(Grid.ColumnProperty, n);
                                valor.SetValue(Grid.RowProperty, this.tablaParadas.RowDefinitions.Count - 1);
                                this.tablaParadas.Children.Add(valor);
                            }
                        }
                    }
                    else
                    {
                        if (h.parada.ciudad.nombre == destino)
                        {
                            itemsTabla[0] = h.parada.ciudad.nombre;
                            itemsTabla[1] = h.llegada;
                            itemsTabla[2] = h.salida;

                            this.tablaParadas.RowDefinitions.Add(new RowDefinition());
                            this.tablaParadas.RowDefinitions[this.tablaParadas.RowDefinitions.Count - 1].Height = new System.Windows.GridLength(30);
                            for (int n = 0; n < itemsTabla.Length; n++)
                            {
                                valor                     = new Label();
                                valor.Style               = Resources["ItemViaje"] as Style;
                                valor.Content             = itemsTabla[n];
                                valor.HorizontalAlignment = HorizontalAlignment.Center;
                                valor.SetValue(Grid.ColumnProperty, n);
                                valor.SetValue(Grid.RowProperty, this.tablaParadas.RowDefinitions.Count - 1);
                                this.tablaParadas.Children.Add(valor);
                            }
                            break;
                        }
                        else
                        {
                            itemsTabla[0] = h.parada.ciudad.nombre;
                            itemsTabla[1] = h.llegada;
                            itemsTabla[2] = h.salida;

                            this.tablaParadas.RowDefinitions.Add(new RowDefinition());
                            this.tablaParadas.RowDefinitions[this.tablaParadas.RowDefinitions.Count - 1].Height = new System.Windows.GridLength(30);
                            for (int n = 0; n < itemsTabla.Length; n++)
                            {
                                valor                     = new Label();
                                valor.Style               = Resources["ItemViaje"] as Style;
                                valor.Content             = itemsTabla[n];
                                valor.HorizontalAlignment = HorizontalAlignment.Center;
                                valor.SetValue(Grid.ColumnProperty, n);
                                valor.SetValue(Grid.RowProperty, this.tablaParadas.RowDefinitions.Count - 1);
                                this.tablaParadas.Children.Add(valor);
                            }
                        }
                    }
                }
            }
        }