private void PovoaListaDePedidos() { string cpf = App.Current.Properties["Cpf_user"].ToString(); try { RastreioModel Resp = Service.Service.Rastreio(cpf); if (Resp != null) { List <Rastreio> Lista = new List <Rastreio>((IEnumerable <Rastreio>)Resp.Rastreio); for (int i = 0; i < Lista.Count; i++) { if (Lista[i].status == "Entregue") { Lista[i].IsVisible = true; } ListadePedidos.Add(Lista[i]); } } else { App.Current.MainPage.DisplayAlert("Atenção", "Carrinho vazio", "ok"); } } catch { App.Current.MainPage.DisplayAlert("Atenção", "ERRO", "ok"); } }
private void PovoarListaItens() { string cpf = App.Current.Properties["Cpf_user"].ToString(); RastreioModel Resp = new RastreioModel(); try { Resp = Service.Service.Rastreio(cpf); if (Resp != null) { List <Rastreio> Lista = new List <Rastreio>((IEnumerable <Rastreio>)Resp.Rastreio); for (int i = 0; i < Lista.Count; i++) { ListaDePedidos.Add(Lista[i]); } } else { App.Current.MainPage.DisplayAlert("Atenção", "Você não possui pedidos em aberto", "ok"); } } catch { App.Current.MainPage.DisplayAlert("Atenção", "ERRO", "ok"); } }
//RASTREIO DE PEDIDOS * public static RastreioModel Rastreio(string cpf) { string url = "https://ganhemais.site/api/RastrearPedidos.php?cpf={0}"; string NovoEnderecoURL = string.Format(url, cpf); WebClient wc = new WebClient(); string Conteudo = wc.DownloadString(NovoEnderecoURL); RastreioModel resp = JsonConvert.DeserializeObject <RastreioModel>(Conteudo); return(resp); }