Ejemplo n.º 1
0
 private void _editText_TextChanged(object sender, Android.Text.TextChangedEventArgs e)
 {
     try
     {
         if (_editText.Length() > 0)
         {
             _miArrayAdapter.Clear();
             _DataSet     = new Mensajero();
             _Aeropuertos = _DataSet.filtrarAeropuertos(_editText.Text.Trim());
             foreach (Aeropuerto item in _Aeropuertos)
             {
                 _miArrayAdapter.Add("" + item.oCiudad.nombreCiudad + "(" + item.IATA_aeropuertoID + ")");
             }
             return;
         }
         else if (_lvAeropuertos.Count > 0)
         {
             _miArrayAdapter.Clear();
         }
     }
     catch (Exception)
     {
     }
 }
        private void ButtonBuscar_Click(object sender, EventArgs e)
        {
            //Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
            //AlertDialog alert = dialog.Create();
            //alert.SetTitle("Error");
            //alert.SetMessage("Algo salió mal");
            //alert.SetIcon(Resource.Drawable.alert);
            //alert.SetButton("OK", (c, ev) =>
            //{
            //    // Ok button click task
            //});
            //alert.SetButton2("CANCEL", (c, ev) => { });
            //alert.Show();

            _dataSet = new Mensajero();



            if (_irDesde.Text.Length > 0 && _viajarA.Text.Length > 0)
            {
                if (_dataSet.vuelosDisponibles(fechaDeVuelo, FechaDeVueloRetorno, _irDesde.Text.Substring(_irDesde.Length() - 4, 3), _viajarA.Text.Substring(_viajarA.Length() - 4, 3)) != null)
                {
                    vuelos = _dataSet.vuelosDisponibles(fechaDeVuelo, FechaDeVueloRetorno, _irDesde.Text.Substring(_irDesde.Length() - 4, 3), _viajarA.Text.Substring(_viajarA.Length() - 4, 3));

                    if (vuelos.Count < 1)
                    {
                        Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                        AlertDialog alert = dialog.Create();
                        alert.SetTitle("Disculpe la molestia");
                        alert.SetMessage("No hay vuelos disponibles");
                        alert.SetButton("OK", (c, ev) =>
                        {
                            // Ok button click task
                        });
                        alert.Show();
                        return;
                    }

                    Intent _intent = new Intent(this, typeof(VueloDisponibleActivity));
                    _intent.PutExtra("Vuelo", JsonConvert.SerializeObject(vuelos));
                    StartActivity(_intent);
                }
                else
                {
                    Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                    AlertDialog alert = dialog.Create();
                    alert.SetTitle("Error");
                    alert.SetMessage("Algo salió mal");
                    alert.SetButton("OK", (c, ev) =>
                    {
                        // Ok button click task
                    });
                    alert.Show();
                }
            }
            else
            {
                Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                AlertDialog alert = dialog.Create();
                alert.SetTitle("Error");
                alert.SetMessage("LLenar correctamente los campos Origen y Destino de Viaje");
                alert.SetButton("OK", (c, ev) =>
                {
                    // Ok button click task
                });
                alert.Show();
            }
        }