Exemple #1
0
        private async void botonComprar_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            MessageDialog mensajeError1 = new MessageDialog("Debe iniciar sesión para realizar compras.", "Inicie Sesión");
            MessageDialog mensajeError2 = new MessageDialog("Ya posee este producto en su carrito de compras.");
            MessageDialog mensajeError3 = new MessageDialog("Disculpe, no tenemos este producto en existencia actualmente.");

            if (BufferUsuario.isConectado())
            {
                if (producto.Cantidad == 0)
                {
                    mensajeError3.ShowAsync();
                    return;
                }

                bool chequear = await servicioAei.checkearProductoCarritoAsync(BufferUsuario.Usuario, producto);

                if (chequear)
                {
                    mensajeError2.ShowAsync();
                    return;
                }
                Popup        popup      = new Popup();
                DetallePopup direcPopup = new DetallePopup(popup, producto);
                popup.Child  = direcPopup;
                popup.IsOpen = true;
            }
            else
            {
                mensajeError1.ShowAsync();
            }
        }
        private void buttonComprar_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            ServicioAEIClient servicioAei = new ServicioAEIClient();

            if (producto.Cantidad == 0)
            {
                MessageBox.Show("Este articulo esta agotado, buscaremos en otra tienda");
                return;
            }

            servicioAei.checkearProductoCarritoAsync(BufferUsuario.Usuario, producto);
            servicioAei.checkearProductoCarritoCompleted += (s, a) =>
            {
                bool chequear = a.Result;
                if (chequear)
                {
                    MessageBox.Show("Ya posee este producto en el carrito");
                    return;
                }

                ConfirmacionPage.producto = producto;
                NavigationService.Navigate(new Uri("/ConfirmacionPage.xaml", UriKind.Relative));
            };
        }
        private void buttonComprar_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            ServicioAEIClient servicioAei = new ServicioAEIClient();

            if (producto.Cantidad == 0)
            {
                MessageBox.Show("Este articulo esta agotado, buscaremos en otra tienda");
                return;
            }

            servicioAei.checkearProductoCarritoAsync(BufferUsuario.Usuario, producto);
            servicioAei.checkearProductoCarritoCompleted += (s, a) =>
            {
                bool chequear = a.Result;
                if (chequear)
                {
                    MessageBox.Show("Ya posee este producto en el carrito");
                    return;
                }

                ConfirmacionPage.producto = producto;
                NavigationService.Navigate(new Uri("/ConfirmacionPage.xaml", UriKind.Relative));
            };
        }