public async Task GetPontos()
        {
            double pontos = 0;

            if (!App.LoggedApp)
            {
                nrPontos.Text = "0";
                pontos        = 0;
                nnrPontos     = 0;
            }
            else
            {
                Logic.Fidelidade fidelidade = new Logic.Fidelidade();
                pontos = await fidelidade.GetPontos(App.sdsEmail);

                nnrPontos     = pontos;
                nrPontos.Text = pontos.ToString();
            }
            if (pontos < 400)
            {
                lblMsgTroca.IsVisible = true;
                btTroca.IsEnabled     = false;
            }
            else
            {
                lblMsgTroca.IsVisible = false;
                btTroca.IsEnabled     = true;
            }
        }
Exemple #2
0
        private async void GetTrocas()
        {
            Logic.Fidelidade fidelidade = new Logic.Fidelidade();
            lstTrocas = await fidelidade.ListarPontos();

            ListViewTrocas.ItemsSource = lstTrocas;
        }
        private async void Button_Clicked(object sender, EventArgs e)
        {
            indiAcumulando.IsVisible = true;
            lblAcumulando.IsVisible  = true;

            btAcumular.IsEnabled = false;
            Logic.Fidelidade fidelidade = new Logic.Fidelidade();
            var retorno = await fidelidade.ValidarToken(nrToken.Text);

            if (retorno == "T")
            {
                await DisplayAlert("Parabéns", "Seu token foi acumulado com sucesso!", "OK");
            }
            if (retorno == "V")
            {
                await DisplayAlert("Expirado", "Seu token já expirou!", "Que Pena");
            }
            if (retorno == "U")
            {
                await DisplayAlert("Já utilizado", "Seu token já foi utilizado!", "Que Pena");
            }
            if (retorno == "F")
            {
                await DisplayAlert("Nada por aqui", "Seu token não foi encontrado!", "Que Pena");
            }

            nrToken.Text             = "";
            btAcumular.IsEnabled     = true;
            indiAcumulando.IsVisible = false;
            lblAcumulando.IsVisible  = false;
        }
Exemple #4
0
        private async void GetExpirar()
        {
            Logic.Fidelidade fidelidade = new Logic.Fidelidade();
            lstTrocasExpirar = await fidelidade.ListaPontosExpirando();

            ListViewExpirar.ItemsSource = lstTrocasExpirar;
            IsBusy = false;
        }
        private async void btnConfirma_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (Menu.MenuDetail.instance.nnrPontos < nnrPontos)
                {
                    await DisplayAlert("Que Pena", "Seu saldo é insuficiente para realizar essa troca!", "Acumule mais pontos!");
                }
                else
                {
                    indiTroca.IsVisible   = true;
                    btnConfirma.IsEnabled = false;
                    Logic.Fidelidade fidelidade = new Logic.Fidelidade();
                    bool             bboOk      = await fidelidade.SalvarTroca(lstProduto);

                    if (bboOk)
                    {
                        await DisplayAlert("Sucesso", "Troca realizada com sucesso! Vá até a loja para retirar os produtos!", "OK");
                    }
                    else
                    {
                        await DisplayAlert("Que pena", "Alguma coisa aconteceu de errado! Tente novamente!", "OK");

                        btnConfirma.IsEnabled = true;
                        indiTroca.IsVisible   = false;
                    }
                }
            }
            catch
            {
                await DisplayAlert("Que pena", "Alguma coisa aconteceu de errado! Tente novamente!", "OK");
            }
            finally
            {
                indiTroca.IsVisible   = false;
                btnConfirma.IsEnabled = true;
                await Navigation.PopAsync(true);
            }
        }