예제 #1
0
 public Envios_ViewModel()
 {
     bdapi = new Repository_Api();
     get   = new Get_ID();
     getSucursal();
     add_envio = new Command(guardar_envio);
 }
 public Ver_Pedido_Adm_ViewModel()
 {
     Db_api = new Repository_Api();
     get_ID = new Get_ID();
     get_ordenes();
     add_pedido = new Command(go_order);
     pull       = new Command(pull_get_ordenes);
 }
예제 #3
0
 public Ver_Envios_ViewModel()
 {
     add_envio = new Command(go_envio);
     Db_api    = new Repository_Api();
     get_ID    = new Get_ID();
     get_ordenes();
     add_envio = new Command(go_envio);
     pull      = new Command(pull_get_ordenes);
 }
예제 #4
0
 public Pedidos_ViewModel()
 {
     bdapi         = new Repository_Api();
     get           = new Get_ID();
     fecha_entrega = DateTime.Now;
     add_order     = new Command(guardar_orden);
     test          = new Command(test1);
     getSucursal();
 }
예제 #5
0
        public async void ver_nCorte()
        {
            Get_ID     ids      = new Get_ID();
            int        g        = 0;
            int        id_corte = ids.get_corte();
            Get_NCorte n        = new Get_NCorte();

            g = await n.get_ncorte();

            await App.Current.MainPage.DisplayAlert("Advertencia", "Numero De Turno Actual: " + g.ToString(), "ok");

            await App.Current.MainPage.DisplayAlert("Advertencia", "ID del Corte Actual: " + id_corte.ToString(), "ok");
        }
예제 #6
0
        // Login
        public async void Login()
        {
            Get_ID ids = new Get_ID();

            int activo = ids.get_usuario();

            if (activo == 0)
            {
                // Buscar Usuarios En la API
                var usuarios = await bdapi.getUsuarios(new UsuariosModel { username = usuario, password = pass });

                datos = new ObservableCollection <UsuariosModel>(usuarios);
                if (datos.Count == 0)
                {
                    await App.Current.MainPage.DisplayAlert("Usuario", "Incorrecto", "OK");
                }
                // Guardar Usuario Localmente
                else
                {
                    UsuariosModel data = new UsuariosModel();
                    //await App.Current.MainPage.DisplayAlert("Usuario", "correcto", "OK");
                    foreach (UsuariosModel user in datos)
                    {
                        data.id_usuario = user.id_usuario;
                        data.rol        = user.rol;
                        data.username   = user.username;
                        data.password   = user.password;
                        data.nombre     = user.nombre;
                        data.apellido   = user.apellido;
                    }
                    bdlocal.CreateUser(data);
                    //nombre = ver_usuario();

                    // Registrar Corte
                    if (data.rol == 2)
                    {
                        Iniciar_Corte();
                    }
                    await App.Current.MainPage.Navigation.PushAsync(new View.MainPage());
                }
            }
            else
            {
                await App.Current.MainPage.DisplayAlert("ADVERTENCIA", "YA EXISTE UN USUARIO lOGEADO", "OK");
            }
        }
예제 #7
0
        // Obtener Usuario Registrado

        // Cerrar Corte
        public async void cerrar_corte()
        {
            Get_ID ids = new Get_ID();
            await bdapi.Finalizar_Corte(new CorteModel { estado = 0, id_corte = ids.get_corte() });

            UsuariosModel data    = new UsuariosModel();
            var           usuario = bdlocal.GetUsuario();

            datos = new ObservableCollection <UsuariosModel>(usuario);
            foreach (UsuariosModel user in datos)
            {
                data.id_usuario = user.id_usuario;
                data.rol        = user.rol;
                data.username   = user.username;
                data.password   = user.password;
                data.nombre     = user.nombre;
                data.apellido   = user.apellido;
            }
            bdlocal.DeleteUser(data);
            //await App.Current.MainPage.DisplayAlert("ADVERTENCIA","SE HA CERRADO EL CORTE", "CONTINUAR");
            App.Current.MainPage = new NavigationPage(new View.Login_Page());
        }
예제 #8
0
        // Ingresar Corte Al Sistema
        public async void Iniciar_Corte()
        {
            CorteModel datos   = new CorteModel();
            Get_ID     ids     = new Get_ID();
            Get_NCorte num     = new Get_NCorte();
            int        n_corte = await num.get_ncorte();

            int    id_usuario  = ids.get_usuario();
            int    id_sucursal = ids.get_sucursal();
            string nombre      = ids.get_nombreusuario();
            //await App.Current.MainPage.DisplayAlert("Corte","ID Usuario: " + id_usuario.ToString()+ "\n"+ "ID Sucursal: " + id_sucursal.ToString() + "\n" + "Nombre: " + nombre , "OK");
            var corte_save = await bdapi.Iniciar_Corte(new CorteModel {
                usuario          = id_usuario,
                sucursal         = id_sucursal,
                efectivo_final   = 0.00,
                efectivo_inicial = 0.00,
                // Estado 1 Para indicar que se inicio
                estado = 1,
                turno  = n_corte + 1
            });

            corte = new ObservableCollection <CorteModel>(corte_save);
            foreach (CorteModel info in corte)
            {
                datos.id_corte         = info.id_corte;
                datos.fecha_hora       = info.fecha_hora;
                datos.efectivo_final   = info.efectivo_final;
                datos.efectivo_inicial = info.efectivo_inicial;
                datos.estado           = info.estado;
                datos.sucursal         = info.sucursal;
                datos.usuario          = info.usuario;
                datos.turno            = info.turno;
            }
            bdlocal.CreateCorte(datos);
            //int num_corte = await num.get_ncorte();
            //await App.Current.MainPage.DisplayAlert("Corte","Numero De Turno: " + num_corte, "OK");
        }