Example #1
0
 private void btnViajesAnuales_Click(object sender, EventArgs e)
 {
     try
     {
         ServicioTURU Sewb = new ServicioTURU();
         this.Carga = Sewb.ViajesXML();
         XElement XML    = XElement.Parse(Carga);
         var      Filtro = (from viaje in XML.Elements("Viaje")
                            group viaje by new
         {
             anio = Convert.ToDateTime(viaje.Element("FechaPartida").Value).Year,
             comp = viaje.Element("Compañia").Value
         } into tabla
                            select new
         {
             Compañia = tabla.Key.comp,
             Año = tabla.Key.anio,
             Viajes = tabla.Count()
         });
         gvViajes.DataSource = Filtro.ToList();
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Example #2
0
 private void CargoDatos()
 {
     try
     {
         ServicioTURU Sewb = new ServicioTURU();
         this.Carga = Sewb.ViajesXML();
         XElement XML   = XElement.Parse(Carga);
         var      datos = (from viaje in XML.Elements("Viaje")
                           select new
         {
             NumeroViaje = viaje.Element("Numero").Value,
             CiudadDestino = viaje.Element("CiudadDestino").Value,
             PaisDestino = viaje.Element("PaisDestino").Value,
             Compañia = viaje.Element("Compañia").Value,
             FechaPartida = viaje.Element("FechaPartida").Value
         });
         gvViajes.DataSource = datos.ToList();
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Example #3
0
 private void btnFiltroPais_Click(object sender, EventArgs e)
 {
     try
     {
         ServicioTURU Sewb = new ServicioTURU();
         this.Carga = Sewb.ViajesXML();
         XElement XML    = XElement.Parse(Carga);
         var      Filtro = (from viaje in XML.Elements("Viaje")
                            where (string)viaje.Element("PaisDestino") == cbPais.Text.Trim()
                            select new
         {
             NumeroViaje = viaje.Element("Numero").Value,
             CiudadDestino = viaje.Element("CiudadDestino").Value,
             PaisDestino = viaje.Element("PaisDestino").Value,
             Compañia = viaje.Element("Compañia").Value,
             FechaPartida = viaje.Element("FechaPartida").Value
         });
         gvViajes.DataSource = Filtro.ToList();
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }