protected override void OnAppearing()
        {
            base.OnAppearing();
            try
            {
                tap = 0;
                Entidades.Respuesta Respuesta = new Entidades.Respuesta();
                Usuario = db.GetAllLevantado(Usuario.Cedula);
                if (Usuario.Codigo_Ubicacion == 0)
                {
                    Navigation.PopAsync(true);
                }

                if (buttonSelect == 3)
                {
                    btnDiferencias_Clicked(null, null);
                }
                if (buttonSelect == 2)
                {
                    btnContados_Clicked(null, null);
                }
                this.btnBusqueda.Text = "";
            }
            catch (Exception)
            {
                return;
            }
        }
Example #2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            try
            {
                if (!this.VienededeLogin)
                {
                    Entidades.Respuesta Respuesta = new Entidades.Respuesta();
                    Usuario = bd.GetAllLevantado(Usuario.Cedula);
                    if (Usuario.IsCerrado)
                    {
                        Usuario.Codigo_Ubicacion = 0;
                    }
                    CargarDatos();
                }
            }
            catch (Exception)
            {
                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                DisplayAlert("LIP", "Ocurrio Un error al Recuperar Datos Db Local", "Aceptar");
                return;
                //throw;
            }
        }
Example #3
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            try
            {
                tap = 0;
                Entidades.Respuesta Respuesta = new Entidades.Respuesta();
                Usuario = db.GetAllLevantado(Usuario.Cedula);
                if (Usuario.Codigo_Ubicacion == 0)
                {
                    Navigation.PopAsync(true);
                }

                if (Usuario.Conteo > 0)
                {
                    if (listDiferencias.Count > 0)
                    {
                        listDiferencias.Remove(p); //eliminamos de la lista de Conteo con dif.
                        if (buttonSelect != 1)
                        {
                            this.lvwProductos.ItemsSource = new List <Productos>();
                            this.lvwProductos.ItemsSource = listDiferencias;
                        }
                    }
                }
            }
            catch (Exception)
            {
                //throw;
            }
        }
Example #4
0
        private void Estantes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cargarCombo)
            {
                return;
            }
            Entidades.Auth      item      = new Entidades.Auth();
            Entidades.Respuesta Respuesta = new Entidades.Respuesta();
            var r = (Entidades.Lista) this.Estantes.SelectedItem;


            item = Usuario;
            item.Codigo_Ubicacion = r.Codigo_Ubicacion;

            Respuesta = Servicio.SeleccionarEstantes(item);
            if (Respuesta.Code == 1)
            {
                this.VienededeLogin = false;
                BuscarProductoPage f = new BuscarProductoPage();
                f.Usuario = item;
                f.Load();
                this.Navigation.PushAsync(f, true);
            }
            else
            {
                DisplayAlert("LIP", "Ocurrio al seleccionar el estante, Intentelo de nuevo", "Aceptar");
            }
        }
 private void ActEstantes_Clicked(object sender, EventArgs e)
 {
     Acr.UserDialogs.UserDialogs.Instance.ShowLoading("Cargando estantes");
     Device.BeginInvokeOnMainThread(() =>
     {
         Entidades.Respuesta Respuesta = new Entidades.Respuesta();
         Usuario = bd.GetAllLevantado(Usuario.Cedula);
         CargarDatos();
     });
 }
        private void Estantes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cargarCombo)
            {
                return;
            }
            Entidades.Auth      item      = new Entidades.Auth();
            Entidades.Respuesta Respuesta = new Entidades.Respuesta();
            var r = (Entidades.Lista) this.Estantes.SelectedItem;


            item = Usuario;
            item.NombreUbicacion  = r.Nombre;
            item.Codigo_Ubicacion = r.Codigo_Ubicacion;

            Respuesta = Servicio.SeleccionarEstantes(item);
            if (Respuesta.Code == 1)
            {
                this.VienededeLogin = false;
                BuscarProductoPage f = new BuscarProductoPage
                {
                    Usuario = item
                };
                f.Load();
                this.Navigation.PushAsync(f, true);
            }
            else
            {
                DisplayAlert("LIP", "Ocurrio un error al seleccionar el estante, Intentelo de nuevo", "Aceptar");
                Acr.UserDialogs.UserDialogs.Instance.ShowLoading("Cerrando Sesión!", Acr.UserDialogs.MaskType.None);
                Device.BeginInvokeOnMainThread(() =>
                {
                    var Cd = new Boolean();
                    Cd     = CargarDatos();
                });
            }
        }
Example #7
0
        private void IniciarSessionAsync()
        {
            try
            {
                var Servicios = new Services.LoginServices();
                Entidades.Respuesta Resultado;
                Entidades.Auth      usuario = new Entidades.Auth();


                Resultado = Servicios.LoginAsync(txtCedula.Text.ToUpper());


                if (Resultado.Code == 1) //Repuesta desde Servidor
                {
                    if (Resultado.Objeto != null)
                    {
                        usuario        = JsonConvert.DeserializeObject <Entidades.Auth>(Resultado.Objeto.ToString());
                        usuario.Conteo = usuario.Conteo - 1;
                        var f = new MainPage();
                        usuario.Cedula = this.txtCedula.Text;
                        f.Usuario      = usuario;

                        f.VienededeLogin = true;

                        f.Lista = Resultado.Lista;
                        f.CargarDatos();

                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                            await DisplayAlert("LIP", "Bienvenido :" + usuario.Nombre, "Aceptar");
                            await this.Navigation.PushAsync(f, true);
                        });
                    }
                    else
                    {
                        if (Resultado.Response == "Este Usuario tiene session activa")
                        {
                            var bd  = new DataAccess();
                            var usu = new Entidades.Auth();
                            usu = bd.GetAllLevantado(txtCedula.Text);


                            if (usuario != null)
                            {
                                var f = new MainPage();
                                f.bEnSession     = true;
                                f.Usuario        = usuario;
                                f.VienededeLogin = true;
                                f.CargarDatos();

                                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                                Device.BeginInvokeOnMainThread(async() =>
                                {
                                    await this.Navigation.PushAsync(f, true);
                                });
                            }
                            else
                            {
                                Session = false;
                                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                                Device.BeginInvokeOnMainThread(async() =>
                                {
                                    await DisplayAlert("LIP", "Este Usuario Tienen una session Abierta en un dispositivo, favor cerrar la sesión", "Ok");
                                    return;
                                });
                            }
                        }
                    }
                }
                if (Resultado.Code == 4)//Encontrado en BD
                {
                    var f = new MainPage();
                    f.bEnSession     = true;
                    f.Usuario        = (Entidades.Auth)Resultado.Objeto;
                    f.VienededeLogin = true;

                    f.CargarDatos();

                    Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await this.Navigation.PushAsync(f, true);
                    });
                }

                if (Resultado.Code == 3) //Error de Conexion BD
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await DisplayAlert("LIP", " Error de Conexion", "Aceptar");
                        return;
                    });
                    Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                }
                if (Resultado.Code == 0) //Error de Conexion Servidor
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await DisplayAlert("LIP", Resultado.Response != "" ? Resultado.Response : "Ocurrio un error de Conexion con el Servidor", "Aceptar");
                        Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                        return;
                    });
                }
                this.IsBusy = false;
            }

            catch (Exception)
            {
                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await DisplayAlert("LIP", "Ocurrio un Error", "Ok");
                    return;
                });

                // throw;
            }
        }
Example #8
0
        public void CargarDatos()
        {
            try
            {
                cargarCombo = true;
                Entidades.Auth      item      = new Entidades.Auth();
                Entidades.Respuesta Respuesta = new Entidades.Respuesta();
                BuscarProductoPage  f         = new BuscarProductoPage();

                var Conteo = string.Empty;
                Conteo    = Servicio.Conteo(Usuario);
                Respuesta = Servicio.TraerUbicaciones(Usuario);

                if (Respuesta.Code == 1)
                {
                    Lista = Respuesta.Lista;
                }


                if (Usuario.IsCerrado)
                {
                    Usuario.Codigo_Ubicacion = 0;
                }

                if ((int.Parse(Conteo)) - 1 != Usuario.Conteo)
                {
                    Lista                    = Respuesta.Lista;
                    Usuario.Conteo           = (int.Parse(Conteo)) - 1;
                    Usuario.Codigo_Ubicacion = 0;
                    bd.EjecutarQueryScalar(string.Format("UPDATE Auth SET  Conteo={0}, isCerrado= 0 ,Codigo_Ubicacion = {2} WHERE Codigo_Usuario ={1}", (int.Parse(Conteo) - 1), Usuario.Codigo_Usuario, Usuario.Codigo_Ubicacion));
                }


                l.Clear();


                foreach (object i in Lista)
                {
                    l.Add(JsonConvert.DeserializeObject <Entidades.Lista>(i.ToString()));
                }

                this.BindingContext       = l;
                this.Estantes.ItemsSource = l;


                this.lblBodega.Text   = Usuario.Bodega.ToString();
                this.lblSucursal.Text = Usuario.Sucursal.ToString();
                this.lblUsuario.Text  = Usuario.Nombre;


                if (this.Usuario.Codigo_Ubicacion != 0)
                {
                    this.EstanteActivo = true;
                }
                else
                {
                    this.EstanteActivo = false;
                }

                if (this.EstanteActivo)
                {
                    this.btnContar.Text      = "Seguir Contando ";
                    this.btnContar.IsVisible = true;
                    this.Estantes.IsVisible  = false;
                    this.lblEstante.Text     = Usuario.Codigo_Ubicacion.ToString();
                }
                else
                {
                    this.Estantes.IsVisible  = true;
                    this.btnContar.IsVisible = false;
                    this.btnContar.Text      = "Iniciar Conteo";
                    this.lblEstante.Text     = "Estante No Seleccionado";
                }
                cargarCombo = false;
                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
            }
            catch (Exception)
            {
                // throw;.
                cargarCombo = false;
                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await DisplayAlert("LIP", " Error de Conexion", "Aceptar");
                });

                return;
            }
        }