private void AnteriorOrigen()
        {
            if (Ubicaciones == null)
            {
                App.Current.MainPage.DisplayAlert("Error", "Debes selecciona un origen base", "Aceptar");
                return;
            }

            UbicacionesModel = new UbicacionesDataBase();

            Posicion = Ubicaciones.posicion - 1;
            //var Sgte = OrigenPicket.Where(i => i.posicion == Posicion);
            OrigenPickSgte = new ObservableCollection <UbicacionesModel>(UbicacionesModel.GetMembers().Where(i => i.posicion == Posicion).OrderBy(i => i.nombre));
            if (OrigenPickSgte.Count == 0)
            {
                App.Current.MainPage.DisplayAlert("Error", "Este es el primer dato", "Aceptar");
                return;
            }

            IsVisibleOrigen     = true;
            IsVisibleOrigenPick = false;
            foreach (var item in OrigenPickSgte)
            {
                Ubicaciones.id       = item.id;
                ubicaciones.nombre   = item.nombre;
                ubicaciones.posicion = Posicion;
                Origen           = item.nombre;
                Posicion         = item.posicion;
                this.DestinoPick = new ObservableCollection <IntermediosModel>(IntermediosModel.GetOneMembers(item.id).OrderBy(i => i.destino));
            }
        }
Beispiel #2
0
        private async void LlenarUbicaciones(int id)
        {
            this.Ubicaciones     = new UbicacionesModel();
            this.UbicacionesData = new UbicacionesDataBase();

            var LoadUbicaciones = new UbicacionesModel
            {
                id = id
            };

            var url        = Application.Current.Resources["UrlAPI"].ToString();
            var prefix     = Application.Current.Resources["UrlPrefix"].ToString();
            var controller = Application.Current.Resources["UrlUbicaciones"].ToString();
            var response   = await this.apiService.Post <UbicacionesModel>(url, prefix, controller, LoadUbicaciones);

            if (!response.IsSuccess)
            {
                await App.Current.MainPage.DisplayAlert("Error", "Esta ruta no posee intermedios, comuniquese con el administrador", "Aceptar");

                return;
            }

            this.MyUbicaciones = (List <UbicacionesModel>)response.Result;

            if (MyUbicaciones != null)
            {
                UbicacionesData.DeleteTable();
            }

            int posicion = 0;

            foreach (var item in MyUbicaciones)
            {
                Ubicaciones.id       = item.id;
                Ubicaciones.nombre   = item.nombre;
                Ubicaciones.posicion = posicion + 1;
                UbicacionesData.AddMember(Ubicaciones);
                posicion = Ubicaciones.posicion;
            }
            posicion = 0;
        }
        public TicketsViewModel()
        {
            this.IsEnableAct         = true;
            this.IsEnableVal         = true;
            this.AlertaTicket        = false;
            this.IsVisible           = true;
            this.IsVisibleOrigen     = false;
            this.IsVisibleOrigenPick = true;
            this.IsVisibleAlert      = true;
            this.TickPer             = true;
            this.TickEnco            = false;
            this.NoPersonas          = 1;
            this.ValTicket           = val * NoPersonas;

            this.apiService       = new ApiService();
            this.IntermediosModel = new IntermediosDataBase();
            this.UbicacionesModel = new UbicacionesDataBase();
            this.LoadIntermedios();
            blueToothService    = DependencyService.Get <IBlueToothService>();
            this.OrigenPickSgte = null;
            this.Posicion       = 1;
            this.BindDeviceList();
        }