private async void search_Cliente_click(object sender, EventArgs e)
        {
            TSCustomerApp.Ruc            = this.txtCodigo.Text;
            TSCustomerApp.CdCliente      = this.txtCodigo.Text;
            TSCustomerApp.afiliacionTarj = "";

            CustomerEstado resultado = CustomerEstado.ErrorSistema;
            await Task.Run(() =>
            {
                contexto.IsSearch           = true;
                TSCustomerApp.ClientSearch += TSSalesApp_ClientSearch;
                resultado = TSCustomerApp.ObtenerClienteByRuc().Result;
            });

            if (resultado != CustomerEstado.EsperandoRespuesta)
            {
                switch (resultado)
                {
                case CustomerEstado.ErrorInternet:
                    await DisplayAlert("Aviso", "Su dispositivo no cuenta con internet en estos momentos.", "Aceptar");

                    contexto.IsSearch = false;
                    break;

                case CustomerEstado.ErrorSistema:
                    await DisplayAlert("Aviso", "Hubo un problema de comunicación con el servidor, por favor intente después.", "Aceptar");

                    contexto.IsSearch = false;
                    break;
                }
            }
        }
        protected async void ClienteAlls(string placa)
        {
            await Task.Delay(1000);

            if (placa.Equals(contexto.Nombre) == false)
            {
                return;
            }
            CustomerEstado resultado = CustomerEstado.ErrorSistema;
            await Task.Run(() =>
            {
                resultado = TSCustomerApp.LoadClientByPlaca((placa ?? "").Trim()).Result;
            });

            if (resultado != CustomerEstado.EsperandoRespuesta)
            {
                switch (resultado)
                {
                case CustomerEstado.ErrorInternet:
                    await DisplayAlert("Aviso", "Su dispositivo no cuenta con internet en estos momentos.", "Aceptar");

                    break;

                case CustomerEstado.ErrorSistema:
                    await DisplayAlert("Aviso", "Hubo un problema de comunicación con el servidor, por favor intente después.", "Aceptar");

                    break;
                }
            }
        }
        private async void LoadClientAlls()
        {
            CustomerEstado resultado = CustomerEstado.ErrorSistema;
            await Task.Run(() =>
            {
                TSCustomerApp.ClienteAlls += _ClienteAlls;
                resultado = TSCustomerApp.LoadClientesAll().Result;
            });

            if (resultado != CustomerEstado.EsperandoRespuesta)
            {
                switch (resultado)
                {
                case CustomerEstado.ErrorInternet:
                    await DisplayAlert("Aviso", "Su dispositivo no cuenta con internet en estos momentos.", "Aceptar");

                    break;

                case CustomerEstado.ErrorSistema:
                    await DisplayAlert("Aviso", "Hubo un problema de comunicación con el servidor, por favor intente después.", "Aceptar");

                    break;
                }
            }
        }
        private async void search_tarjeta_click(object sender, EventArgs e)
        {
            ContextBinding.IsSearch      = true;
            TSCustomerApp.Ruc            = this.txtCodigo.Text;
            TSCustomerApp.CdCliente      = this.txtCodigo.Text;
            TSCustomerApp.afiliacionTarj = this.txtTarjetaAfiliacion.Text;
            TSCustomerApp.prefijo        = "";
            TSCustomerApp.IsArticulo     = false;
            if (String.IsNullOrEmpty(TSCustomerApp.afiliacionTarj))
            {
                busyindicator.IsVisible = false;
                ContextBinding.IsSearch = false;
                await DisplayAlert("Aviso", "Ingrese el numero de tarjeta.", "Aceptar");

                return;
            }

            CustomerEstado resultado = CustomerEstado.ErrorSistema;

            busyindicator.IsVisible = true;
            await Task.Run(() =>
            {
                TSCustomerApp.ClientSearch += TSSalesApp_ClientSearch;
                resultado = TSCustomerApp.ObtenerClienteByTarjeta().Result;
            });

            if (resultado != CustomerEstado.EsperandoRespuesta)
            {
                busyindicator.IsVisible = false;
                ContextBinding.IsSearch = false;
                switch (resultado)
                {
                case CustomerEstado.ErrorInternet:
                    await DisplayAlert("Aviso", "Su dispositivo no cuenta con internet en estos momentos.", "Aceptar");

                    break;

                case CustomerEstado.ErrorSistema:
                    await DisplayAlert("Aviso", "Hubo un problema de comunicación con el servidor, por favor intente después.", "Aceptar");

                    break;
                }
            }
        }
Пример #5
0
        private async void search_Cliente_click(object sender, EventArgs e)
        {
            string prefijo = (string)cmboPrefij.SelectedValue;

            if (String.IsNullOrEmpty(prefijo))
            {
                await DisplayAlert("Aviso", "Debe seleccionar el tipo de prefijo", "Aceptar"); return;
            }
            contexto.IsSearch       = true;
            TSCustomerApp.CdCliente = prefijo + this.txtTarjetaCliente.Text;
            TSCustomerApp.ClientOuput.nroTarjeta = this.txtTarjetaCliente.Text;

            CustomerEstado resultado = CustomerEstado.ErrorSistema;
            await Task.Run(() =>
            {
                TSCustomerApp.ClienteByCodigo += TSSalesApp_ClientSearch;
                resultado = TSCustomerApp.ObtenerClienteByCodigo().Result;
            });

            if (resultado != CustomerEstado.EsperandoRespuesta)
            {
                switch (resultado)
                {
                case CustomerEstado.ErrorInternet:
                    contexto.IsSearch = false;
                    await DisplayAlert("Aviso", "Su dispositivo no cuenta con internet en estos momentos.", "Aceptar");

                    break;

                case CustomerEstado.ErrorSistema:
                    contexto.IsSearch = false;
                    await DisplayAlert("Aviso", "Hubo un problema de comunicación con el servidor, por favor intente después.", "Aceptar");

                    break;
                }
            }
        }
        public async void OnSearch(object sender, EventArgs e)
        {
            if (this.cmboPrefij.SelectedValue == null)
            {
                await DisplayAlert("Aviso", "Seleccione el prefijo antes de realizar la búsqueda", "Aceptar");

                return;
            }
            if (this.cmboTipoOperacion.SelectedValue == null)
            {
                await DisplayAlert("Aviso", "Seleccione el tipo de operación antes de realizar la búsqueda", "Aceptar");

                return;
            }
            if (Contexto.Codigo.Length <= this.cmboPrefij.SelectedValue.ToString().Length)
            {
                await DisplayAlert("Aviso", "Seleccione el prefijo correcto y ingrese el código completo de la tarjeta antes de realizar la búsqueda", "Aceptar");

                return;
            }
            if (Contexto.Codigo.Substring(0, this.cmboPrefij.SelectedValue.ToString().Length).Equals(this.cmboPrefij.SelectedValue.ToString()) == false)
            {
                await DisplayAlert("Aviso", "Seleccione el prefijo correcto antes de realizar la búsqueda", "Aceptar");

                return;
            }
            Contexto.IsVisiblePanelEdicion = false;
            Contexto.IsSearch            = true;
            Contexto.IsBusy              = true;
            Contexto.TituloBusqueda      = "Cargando ...";
            TSCustomerApp.Ruc            = "";
            TSCustomerApp.CdCliente      = "";
            TSCustomerApp.afiliacionTarj = Contexto.Codigo;
            TSCustomerApp.prefijo        = this.cmboPrefij.SelectedValue.ToString();
            TSCustomerApp.IsArticulo     = true;

            if (String.IsNullOrEmpty(TSCustomerApp.afiliacionTarj))
            {
                await DisplayAlert("Aviso", "Ingrese el numero de tarjeta.", "Aceptar");

                Contexto.IsSearch = false;
                return;
            }

            CustomerEstado resultado = CustomerEstado.ErrorSistema;
            await Task.Run(() =>
            {
                TSCustomerApp.ClientSearch += TSSalesApp_ClientSearch;
                resultado = TSCustomerApp.ObtenerClienteByTarjeta().Result;
            });

            if (resultado != CustomerEstado.EsperandoRespuesta)
            {
                switch (resultado)
                {
                case CustomerEstado.ErrorInternet:
                    await DisplayAlert("Aviso", "Su dispositivo no cuenta con internet en estos momentos.", "Aceptar");

                    break;

                case CustomerEstado.ErrorSistema:
                    await DisplayAlert("Aviso", "Hubo un problema de comunicación con el servidor, por favor intente después.", "Aceptar");

                    break;
                }
                Contexto.IsSearch = false;
            }
        }