Esempio n. 1
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         ServicioTURU Sweb = new ServicioTURU();
         Sweb.EliminarViaje(Vinter);
         lblError.Text = "Viaje eliminado correctamente";
         LimpiarForm();
     }
     catch (System.Web.Services.Protocols.SoapException ex)
     {
         if (ex.Detail.InnerText.Length > 100)
         {
             lblError.Text = ex.Detail.InnerText.Substring(0, 100);
         }
         else
         {
             lblError.Text = ex.Detail.InnerText;
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Esempio n. 2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                ServicioTURU Sweb = new ServicioTURU();

                Sweb.EliminarTerminal(term);
                lblMensaje.Text = "Terminal eliminada correctamente";
                LimpiarCampos();
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                if (ex.Detail.InnerText.Length > 100)
                {
                    lblMensaje.Text = ex.Detail.InnerText.Substring(0, 100);
                }
                else
                {
                    lblMensaje.Text = ex.Detail.InnerText;
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text = ex.Message;
            }
        }
Esempio n. 3
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;
     }
 }
Esempio n. 4
0
 private void txtNombre_Validating(object sender, CancelEventArgs e)
 {
     try
     {
         lblError.Text = "";
         ServicioTURU Sweb = new ServicioTURU();
         _Comp = Sweb.BuscarCompania(txtNombre.Text);
         if (_Comp == null)
         {
             HabilitarAgregar();
         }
         else
         {
             HabilitarBajaModificar();
             txtDireccion.Text = _Comp._Direccion;
             txtTelefono.Text  = _Comp._Telefono;
         }
     }
     catch (System.Web.Services.Protocols.SoapException ex)
     {
         if (ex.Detail.InnerText.Length > 100)
         {
             lblError.Text = ex.Detail.InnerText.Substring(0, 100);
         }
         else
         {
             lblError.Text = ex.Detail.InnerText;
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Esempio n. 5
0
 private void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         if (ControlVacio())
         {
             throw new Exception("Debe completar todos los campos");
         }
         ServicioTURU Sweb = new ServicioTURU();
         _Comp._Nombre    = txtNombre.Text;
         _Comp._Direccion = txtDireccion.Text;
         _Comp._Telefono  = txtTelefono.Text;
         Sweb.ModificarCompania(_Comp);
         lblError.Text = "Compañia modificada correctamente";
         LimpiarForm();
     }
     catch (System.Web.Services.Protocols.SoapException ex)
     {
         if (ex.Detail.InnerText.Length > 100)
         {
             lblError.Text = ex.Detail.InnerText.Substring(0, 100);
         }
         else
         {
             lblError.Text = ex.Detail.InnerText;
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Esempio n. 6
0
 private void VerificarIngreso(object sender, EventArgs e)
 {
     try
     {
         ServicioTURU Sweb = new ServicioTURU();
         Empleado     emp  = Sweb.Logueo(ctrlLogin.usuario, ctrlLogin.pass);
         if (emp == null)
         {
             throw new Exception("Usuario o contraseña invalidos");
         }
         else
         {
             this.Hide();
             Form f = new FrmInicio(emp);
             f.Show();
         }
     }
     catch (System.Web.Services.Protocols.SoapException ex)
     {
         if (ex.Detail.InnerText.Length > 40)
         {
             lblError.Text = ex.Detail.InnerText.Substring(0, 40);
         }
         else
         {
             lblError.Text = ex.Detail.InnerText;
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Esempio n. 7
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                if (ControlVacio())
                {
                    throw new Exception("Debe completar todos los campos");
                }
                ServicioTURU Sweb = new ServicioTURU();
                if (cbCompanias.Text != Vinter._Com._Nombre)
                {
                    Vinter._Com = Sweb.BuscarCompania(cbCompanias.SelectedItem.ToString());
                }
                if (cbTerminales.Text != Vinter._Ter._Codigo)
                {
                    Vinter._Ter = Sweb.BuscarTerminal(cbTerminales.SelectedItem.ToString());
                }

                DateTime fechaPartida = Convert.ToDateTime(dtFechaPartida.Value.ToShortDateString() + " " + txtHoraPartida.Text);
                DateTime fechaArribo  = Convert.ToDateTime(dtFechaArribo.Value.ToShortDateString() + " " + txtHoraArribo.Text);

                Vinter._NumViaje         = Convert.ToInt32(txtNumero.Text);
                Vinter._Documentacion    = txtDocumentacion.Text;
                Vinter._Emp              = _Emp;
                Vinter._CantidadAsientos = Convert.ToInt32(txtAsientos.Text);
                Vinter._FechaArribo      = fechaArribo;
                Vinter._FechaPartida     = fechaPartida;

                Vinter._ServicioBordo = chkServicioaBordo.Checked;
                Sweb.ModificarViaje(Vinter);
                lblError.Text = "Viaje modificado correctamente";
                LimpiarForm();
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                if (ex.Detail.InnerText.Length > 100)
                {
                    lblError.Text = ex.Detail.InnerText.Substring(0, 100);
                }
                else
                {
                    lblError.Text = ex.Detail.InnerText;
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
Esempio n. 8
0
 private void txtNumero_Validating(object sender, CancelEventArgs e)
 {
     try
     {
         lblError.Text = "";
         ServicioTURU Sweb = new ServicioTURU();
         Viaje = Sweb.BuscarViaje(Convert.ToInt32(txtNumero.Text));
         if (Viaje is ViajesNacionales)
         {
             throw new Exception("Ese numero corresponde a un Viaje Nacional.");
         }
         Vinter = (ViajesInternacionales)Viaje;
         if (Vinter == null)
         {
             HabilitarAgregar();
         }
         else
         {
             HabilitarBajaModificar();
             txtAsientos.Text          = Vinter._CantidadAsientos.ToString();
             txtDocumentacion.Text     = Vinter._Documentacion;
             txtHoraArribo.Text        = Vinter._FechaArribo.ToShortTimeString();
             txtHoraPartida.Text       = Vinter._FechaPartida.ToShortTimeString();
             dtFechaArribo.Text        = Vinter._FechaArribo.ToShortDateString();
             dtFechaPartida.Text       = Vinter._FechaPartida.ToShortDateString();
             cbTerminales.Text         = Vinter._Ter._Codigo;
             cbCompanias.Text          = Vinter._Com._Nombre;
             chkServicioaBordo.Checked = Vinter._ServicioBordo;
         }
     }
     catch (System.Web.Services.Protocols.SoapException ex)
     {
         if (ex.Detail.InnerText.Length > 100)
         {
             lblError.Text = ex.Detail.InnerText.Substring(0, 100);
         }
         else
         {
             lblError.Text = ex.Detail.InnerText;
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Esempio n. 9
0
        private void btnAgregar_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (ControlVacio())
                {
                    throw new Exception("Todos los campos deben contener datos");
                }
                Terminal t = new Terminal();
                t._Codigo = txtCodigo.Text;
                t._Pais   = cmbPais.Text;
                t._Ciudad = txtCiudad.Text;
                string[] listaT = new string[lstFacilidad.Items.Count];
                for (int i = 0; i < lstFacilidad.Items.Count; i++)
                {
                    listaT[i] = (lstFacilidad.Items[i].ToString());
                }
                t._Facilidades = listaT;

                ServicioTURU Sweb = new ServicioTURU();
                Sweb.AgregarTerminal(t);
                lblMensaje.Text = "Terminal agregada correctamente";
                LimpiarCampos();
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                if (ex.Detail.InnerText.Length > 100)
                {
                    lblMensaje.Text = ex.Detail.InnerText.Substring(0, 100);
                }
                else
                {
                    lblMensaje.Text = ex.Detail.InnerText;
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text = ex.Message;
            }
        }
Esempio n. 10
0
 private void txtCodigo_Validating(object sender, CancelEventArgs e)
 {
     try
     {
         lblMensaje.Text = "";
         ServicioTURU Sweb = new ServicioTURU();
         term = Sweb.BuscarTerminal(txtCodigo.Text);
         if (term == null)
         {
             CamposAgregar();
         }
         else
         {
             CamposBajaModi();
             txtCiudad.Text = term._Ciudad;
             cmbPais.Text   = term._Pais;
             for (int i = 0; i < (term._Facilidades.Length); i++)
             {
                 lstFacilidad.Items.Add(term._Facilidades[i]);
             }
         }
     }
     catch (System.Web.Services.Protocols.SoapException ex)
     {
         if (ex.Detail.InnerText.Length > 100)
         {
             lblMensaje.Text = ex.Detail.InnerText.Substring(0, 100);
         }
         else
         {
             lblMensaje.Text = ex.Detail.InnerText;
         }
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }
Esempio n. 11
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;
     }
 }
Esempio n. 12
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;
     }
 }