Ejemplo n.º 1
0
        private async void BtnConfirmarColonia_Clicked(object sender, EventArgs e)
        {
            if (MypickerColonia.SelectedItem != null || MypickerColonia.SelectedIndex > 0)
            {
                VMDireccion c = DireccionesListaColonia.Find(t => t.COLONIA == MypickerColonia.SelectedItem.ToString());
                App.UidColoniaABuscar = c.ID.ToString();
                App.MVDireccion       = odireccion;
                App.MVDireccionDemo   = App.MVDireccion;
                App.MVDireccion.ListaDIRECCIONES[0].NOMBRECOLONIA = c.COLONIA;
                App.MVDireccion.ListaDIRECCIONES[0].COLONIA       = c.ID.ToString();
                Helpers.Settings.StrNombreColonia = c.COLONIA;
                Helpers.Settings.StrCOLONIA       = c.ID.ToString();
                Helpers.Settings.StrESTADO        = App.MVDireccion.ListaDIRECCIONES[0].ESTADO;

                App.MVProducto = new VMProducto();
                await Navigation.PopAsync();

                var objeto = new MasterMenuMenuItem {
                    Id = 3, Title = "", TargetType = typeof(HomePage)
                };
                var Page = (Page)Activator.CreateInstance(objeto.TargetType);
                App app  = Application.Current as App;
                App.Navegacion = Page.GetType().Name;
                MasterDetailPage md = (MasterDetailPage)app.MainPage;
                md.Detail = new NavigationPage(Page);
            }
            else
            {
                await DisplayAlert("Colonia no seleccionada", "Selecciona una colonia para continuar", "Aceptar");
            }
        }
Ejemplo n.º 2
0
        protected override void OnResume()
        {
            if (!string.IsNullOrEmpty(Navegacion))
            {
                MasterMenuMenuItem objeto = new MasterMenuMenuItem {
                    Id = 0, Title = "", TargetType = typeof(HomePage)
                };

                switch (Navegacion)
                {
                case "Login":
                    objeto = new MasterMenuMenuItem {
                        Id = 3, Title = "Inciar sesión", TargetType = typeof(Login)
                    };
                    break;

                case "UsuarioDirecciones":
                    objeto = new MasterMenuMenuItem {
                        Id = 3, Title = "Direcciones", TargetType = typeof(UsuarioDirecciones)
                    };
                    break;

                case "HomePage":
                    objeto = new MasterMenuMenuItem {
                        Id = 3, Title = "Busqueda", TargetType = typeof(HomePage)
                    };
                    break;

                case "Monedero":
                    objeto = new MasterMenuMenuItem {
                        Id = 3, Title = "Monedero", TargetType = typeof(Monedero)
                    };
                    break;

                case "HistorialPage":
                    objeto = new MasterMenuMenuItem {
                        Id = 3, Title = "Historial", TargetType = typeof(HistorialPage)
                    };
                    break;

                case "PerfilTelefonoPage":
                    objeto = new MasterMenuMenuItem {
                        Id = 3, Title = "Telefonos", TargetType = typeof(PerfilTelefonoPage)
                    };
                    break;

                case "PerfilGeneralPage":
                    objeto = new MasterMenuMenuItem {
                        Id = 3, Title = "Perfil", TargetType = typeof(PerfilGeneralPage)
                    };
                    break;
                }
                var Page            = (Page)Activator.CreateInstance(objeto.TargetType);
                App app             = Application.Current as App;
                MasterDetailPage md = (MasterDetailPage)app.MainPage;
                md.Detail = new NavigationPage(Page);
            }
        }
Ejemplo n.º 3
0
        private void btnAcceder_Clicked(object sender, EventArgs e)
        {
            var objeto = new MasterMenuMenuItem {
                Id = 3, Title = "Login", TargetType = typeof(Login)
            };
            var Page = (Page)Activator.CreateInstance(objeto.TargetType);
            App app  = Application.Current as App;

            App.Navegacion = Page.GetType().Name;
            MasterDetailPage md = (MasterDetailPage)app.MainPage;

            md.Detail = new NavigationPage(Page);
        }
Ejemplo n.º 4
0
        private async void BtnPagar_Clicked(object sender, EventArgs e)
        {
            if (App.Global1 == string.Empty)
            {
                await DisplayAlert("Inicio de sesion obligatorio", "Para continuar con el pedido inicia sesion o registrate", "Aceptar");

                var objeto = new MasterMenuMenuItem {
                    Id = 3, Title = "Login", TargetType = typeof(Login)
                };
                var Page = (Page)Activator.CreateInstance(objeto.TargetType);
                App app  = Application.Current as App;
                App.Navegacion = Page.GetType().Name;
                MasterDetailPage md = (MasterDetailPage)app.MainPage;
                md.Detail = new NavigationPage(Page);
            }
            else
            {
                await Navigation.PushAsync(new Pago(TotalPagar.ToString()));
            }
        }
Ejemplo n.º 5
0
        public async void Iniciar()
        {
            acloading.IsVisible = true;
            acloading.IsRunning = true;
            string obj = "";

            //lbCantidad.Text = "Cargando productos";

            if (string.IsNullOrEmpty(App.Global1))
            {
                App.MVDireccion.ListaDIRECCIONES = new List <VMDireccion>();
                App.MVDireccion.ListaDIRECCIONES.Add(new VMDireccion()
                {
                    ESTADO        = Helpers.Settings.StrESTADO,
                    COLONIA       = Helpers.Settings.StrCOLONIA,
                    NOMBRECOLONIA = Helpers.Settings.StrNombreColonia
                });
                App.UidEstadoABuscar = Helpers.Settings.StrESTADO;

                btnSeleccionarDireccion.Text = "ENTREGAR EN " + App.MVDireccion.ListaDIRECCIONES[0].NOMBRECOLONIA.ToUpper() + " >";

                btnAcceder.Text      = "Entrar";
                btnAcceder.IsEnabled = true;
            }
            else
            {
                if (App.MVDireccion.ListaDIRECCIONES.Count == 0)
                {
                    string strDirecciones = string.Empty;
                    App.MVDireccion = new VMDireccion();
                    using (HttpClient _client = new HttpClient())
                    {
                        var tex = "" + Helpers.Settings.sitio + "/api/Direccion/GetObtenerDireccionUsuario?UidUsuario=" + App.Global1;
                        strDirecciones = await _client.GetStringAsync(tex);

                        obj             = JsonConvert.DeserializeObject <ResponseHelper>(strDirecciones).Data.ToString();
                        App.MVDireccion = JsonConvert.DeserializeObject <VMDireccion>(obj);
                    }
                }
                btnAcceder.Text      = string.Empty;
                btnAcceder.IsEnabled = false;
            }

            if (App.MVDireccion != null)
            {
                acloading.IsVisible = true;
                acloading.IsRunning = true;

                #region Busqueda

                Guid UidEstado  = new Guid();
                Guid UidColonia = new Guid();

                CultureInfo ConfiguracionDiaEspanol = new CultureInfo("Es-Es");
                string      Dia = ConfiguracionDiaEspanol.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek);
                PanelRefrescar.IsVisible = false;
                if (App.MVDireccion.ListaDIRECCIONES.Count != 0)
                {
                    PanelProductos.IsVisible = true;
                    App.UidColoniaABuscar    = App.MVDireccion.ListaDIRECCIONES[0].COLONIA;
                    App.UidEstadoABuscar     = App.MVDireccion.ListaDIRECCIONES[0].ESTADO;

                    if (!string.IsNullOrEmpty(App.Global1))
                    {
                        App.DireccionABuscar = App.MVDireccion.ListaDIRECCIONES[0].ID.ToString();
                    }
                    if (!string.IsNullOrEmpty(App.UidColoniaABuscar) && !string.IsNullOrEmpty(App.UidEstadoABuscar))
                    {
                        UidEstado  = new Guid(App.UidEstadoABuscar);
                        UidColonia = new Guid(App.UidColoniaABuscar);
                        VMProducto oBusquedaproducto = new VMProducto();
                        App.ListaDeProductos = new List <VMProducto>();
                        if (App.DireccionABuscar != "" && !string.IsNullOrEmpty(App.Global1))
                        {
                            btnSeleccionarDireccion.Text = "ENTREGAR A " + App.MVUsuarios.StrUsuario + " EN " + App.MVDireccion.ListaDIRECCIONES.Find(x => x.ESTADO == App.UidEstadoABuscar).IDENTIFICADOR + " >";
                        }
                        ApiService ApiService = new ApiService("/api/Producto");
                        Dictionary <string, string> parameters = new Dictionary <string, string>();
                        parameters.Add("StrParametroBusqueda", "Giro");
                        parameters.Add("StrDia", Dia);
                        parameters.Add("UidEstado", UidEstado.ToString());
                        parameters.Add("UidColonia", UidColonia.ToString());
                        parameters.Add("UidBusquedaCategorias", App.giro);
                        //parameters.Add("StrNombreEmpresa", txtBusquedaActual.Text);
                        var result = await ApiService.GET <VMProducto>(action : "GetBuscarProductosCliente", responseType : ApiService.ResponseType.Object, arguments : parameters);

                        var oReponse = result as ResponseHelper;
                        if (result != null && oReponse.Status != false)
                        {
                            oBusquedaproducto = oReponse.Data as VMProducto;
                            if (oBusquedaproducto.ListaDeProductos != null && oBusquedaproducto.ListaDeProductos.Count > 0)
                            {
                                foreach (VMProducto item in oBusquedaproducto.ListaDeProductos)
                                {
                                    if (App.MVProducto.ListaDelCarrito.Exists(o => o.UID == item.UID))
                                    {
                                        item.IsSelected = true;
                                    }
                                    //parameters = new Dictionary<string, string>();
                                    //parameters.Add("StrParametroBusqueda", "Giro");
                                    //parameters.Add("StrDia", Dia);
                                    //parameters.Add("UidEstado", UidEstado.ToString());
                                    //parameters.Add("UidColonia", UidColonia.ToString());
                                    //parameters.Add("UidBusquedaCategorias", App.giro);
                                    //parameters.Add("UidProducto", item.UID.ToString());
                                    //result = await ApiService.GET<VMProducto>(action: "GetObtenerInformacionDeProductoDeLaSucursal", responseType: ApiService.ResponseType.Object, arguments: parameters);

                                    //oReponse = result as ResponseHelper;
                                    //if (result != null && oReponse.Status != false)
                                    //{
                                    //    var VProducto = oReponse.Data as VMProducto;
                                    //    if (VProducto.ListaDePreciosSucursales.Count > 0)
                                    //    {
                                    //        item.StrCosto = VProducto.ListaDePreciosSucursales[0].StrCosto;
                                    App.ListaDeProductos.Add(item);
                                    //    }
                                    //}
                                    //else
                                    //{
                                    //    var objeto = new MasterMenuMenuItem { Id = 1, Title = "Busqueda", TargetType = typeof(HomePage), UrlResource = "IconoHomeMenu" };
                                    //    var Page = (Page)Activator.CreateInstance(objeto.TargetType);
                                    //    App app = Application.Current as App;
                                    //    App.Navegacion = Page.GetType().Name;
                                    //    MasterDetailPage md = (MasterDetailPage)app.MainPage;
                                    //    md.Detail = new NavigationPage(Page);
                                    //}
                                }
                                PanelProductoNoEncontrados.IsVisible = false;
                                ListaDeProductosHome = App.ListaDeProductos;

                                MyListViewBusquedaProductosHome.ItemsSource = App.ListaDeProductos;
                                CantidadProductosMostrados = App.ListaDeProductos.Count;
                                //lbCantidad.Text = App.ListaDeProductos.Count + " Productos disponibles";
                            }
                            else
                            {
                                //lbCantidad.Text = "No hay productos disponibles";
                                PanelProductoNoEncontrados.IsVisible = true;
                            }
                        }
                        else
                        {
                            var objeto = new MasterMenuMenuItem {
                                Id = 1, Title = "Busqueda", TargetType = typeof(HomePage), UrlResource = "IconoHomeMenu"
                            };
                            var Page = (Page)Activator.CreateInstance(objeto.TargetType);
                            App app  = Application.Current as App;
                            App.Navegacion = Page.GetType().Name;
                            MasterDetailPage md = (MasterDetailPage)app.MainPage;
                            md.Detail = new NavigationPage(Page);
                        }
                    }
                    acloading.IsRunning = false;
                    acloading.IsVisible = false;
                }
                else
                {
                    acloading.IsRunning = false;
                    acloading.IsVisible = false;

                    PanelProductos.IsVisible = false;
                    if (!string.IsNullOrEmpty(App.Global1))
                    {
                        PanelDireccionesVacias.IsVisible = true;
                    }
                    else
                    {
                        PanelRefrescar.IsVisible = true;
                    }
                }
                #endregion
            }
        }