private void lstRecojo_ItemSelected(object sender, SelectedItemChangedEventArgs e) { try { if (lstRecojo.SelectedItem != null) { Recojo recojo = (Recojo)e.SelectedItem; if (recojo != null) { Navigation.PushAsync(new DetalleRecojo(Convert.ToDouble(recojo.LATITUD), Convert.ToDouble(recojo.LONGITUD), recojo.DESCRIPCION, recojo.HORARIO) { BindingContext = e.SelectedItem as Recojo } ); } } } catch (Exception) { throw; } }
void GuardarRecojo() { try { var db = new SQLiteConnection(App.FilePath); IEnumerable <Usuario> resultado = ConsultarUsuarioLogeado(db); if (resultado.Count() > 0) { List <Usuario> listll = (List <Usuario>)resultado; foreach (Usuario itemLoginLocal in listll) { var horario_seleccionado = SelectedDescripcionHorario; var t = Task.Run(async() => LstIdHorariodisponible = await HaugApi.Metodo.GetIdHorarioDisponible(horario_seleccionado.ToString())); t.Wait(); string var_token = Convert.ToString(Guid.NewGuid().ToString()); var DatosAdd = new Recojo { ID = 0, DESCRIPCION = Descripcion, ID_HORARIO = LstIdHorariodisponible[0].ID, HORARIO = horario_seleccionado.ToString(), TOKEN_RECOJO = var_token, ID_USUARIO = App.Id_Usuario, FECHA_TRANSACCION = DateTime.Now.Date, ID_ESTADO = 1, ENVIADO = 0, FECHA_ENVIADO = DateTime.Now.Date, LATITUD = Latitud, LONGITUD = Longitud }; using (SQLiteConnection conn = new SQLiteConnection(App.FilePath)) { conn.CreateTable <Recojo>(); int rpt = conn.Insert(DatosAdd); GuardarRecojoWebApi(rpt, Descripcion, LstIdHorariodisponible[0].ID, Direccion, var_token, Latitud, Longitud); App.Current.MainPage.DisplayAlert("Agregar", "Datos registrados correctamente.", "Aceptar"); Limpiar(); } } } } catch (Exception) { throw; } }