コード例 #1
0
        private void btnGravar_Clicked(object sender, EventArgs e)
        {
            appp.saveAcessKey("IP", edtIp.Text);
            appp.saveAcessKey("PORTA", edtPorta.Text);
            if (pdv == null)
            {
                DisplayAlert("Alerta", "Informe o PDV padrão", "OK");
                ApiCamareiraFacil api_ = new ApiCamareiraFacil();
                listaSetores = api_.GetPDVs();
                if (listaSetores != null)
                {
                    pckSetor.ItemsSource = listaSetores;
                }
                else
                {
                    DisplayAlert("Alerta", "Lista de PDVs vazia. Verifique o caminho do servidor", "OK");
                }
                return;
            }
            appp.saveAcessKey("SETOR", pdv.Codigo);

            if (appp.getAcessKey("CONFIGURADO") == "")
            {
                appp.saveAcessKey("CONFIGURADO", "SIM");

                Page original = App.Current.MainPage.Navigation.NavigationStack.Last();
                App.Current.MainPage.Navigation.PopAsync().ConfigureAwait(false);
                App.Current.MainPage.Navigation.PushAsync(new Login());
                App.Current.MainPage.Navigation.RemovePage(original);
            }
            else
            {
                Navigation.PopAsync().ConfigureAwait(false);
            }
        }
コード例 #2
0
        private async void CarregarDados()
        {
            using (var objDialog = UserDialogs.Instance.Loading("Carregando..."))
            {
                await Task.Delay(2000);
            }

            ListaItens          = new ObservableCollection <ItemLancamento>();
            lstView.ItemsSource = ListaItens;

            try
            {
                ApiCamareiraFacil api = new ApiCamareiraFacil();
                produtos = api.GetItensPDV(app.getAcessKey("SETOR"));
                pckProdutos.ItemsSource = produtos;

                apartamentos = api.GetApartamentosOcupados().Where(w => w.Situacao.Equals("O")).ToList();
                pckApartamentos.ItemsSource = apartamentos;

                pontos = api.GetPDVs();
                pckPontoVenda.ItemsSource = pontos;
                for (int i = 0; i < pontos.Count; i++)
                {
                    if (pontos[i].Codigo == app.getAcessKey("SETOR"))
                    {
                        pckPontoVenda.SelectedIndex = i;
                    }
                }
            }
            catch (Exception E)
            {
                await DisplayAlert("Erro", "Erro: " + E.Message, "OK");
            }
        }
コード例 #3
0
        public Configuracao()
        {
            InitializeComponent();

            appp = new AppPreferences(Forms.Context);

            edtIp.Text    = (appp.getAcessKey("IP") != "" ? appp.getAcessKey("IP") : "");
            edtPorta.Text = (appp.getAcessKey("PORTA") != "" ? appp.getAcessKey("PORTA") : "");

            if (appp.getAcessKey("SETOR") != "" && appp.getAcessKey("CONFIGURADO") != "")
            {
                ApiCamareiraFacil api = new ApiCamareiraFacil();
                listaSetores         = api.GetPDVs();
                pckSetor.ItemsSource = listaSetores;
                for (int i = 0; i < listaSetores.Count; i++)
                {
                    if (listaSetores[i].Codigo == appp.getAcessKey("SETOR"))
                    {
                        pckSetor.SelectedIndex = i;
                    }
                }
            }
        }