Exemplo n.º 1
0
        public AllFacturas()
        {
            InitializeComponent();
            if (Memoria.UsuarioActual.US_ROL.Equals("Usuario"))
            {
                AdminView.IsEnabled = false;
                AdminView.IsVisible = false;

                int count = 1;
                foreach (var compra in CompraRepository.GetAllComprasByUserId(Memoria.UsuarioActual.UsuarioId))
                {
                    DinamicButton dinamicButton = new DinamicButton();
                    dinamicButton.DinamicValue = compra.COM_ID;
                    dinamicButton.Text         = "Ver";
                    dinamicButton.Clicked     += new EventHandler(dinamicButton.SeeFactura);
                    GridAllFacturas.Children.Add(new Label {
                        Text = compra.COM_FECHA_COMPRA.ToString(), TextColor = Color.White
                    }, 0, count);
                    GridAllFacturas.Children.Add(new Label {
                        Text = "$" + Math.Truncate(compra.COM_PRECIO_TOTAL).ToString(), TextColor = Color.White
                    }, 1, count);
                    GridAllFacturas.Children.Add(dinamicButton, 2, count);
                    count += 1;
                }
            }
            else
            {
                UserView.IsEnabled = false;
                UserView.IsVisible = false;
            }
        }
        private void Inicializadores()
        {
            if (ProductoRepository.GetProductoByID(7) == null)
            {
                ProductoRepository.InsertarPrueba();
                ProductoRepository.InsertarPrueba();
            }
            int count = 1;

            NombreUsuario.Text = Memoria.UsuarioActual.Nombre;
            if (Memoria.UsuarioActual.US_ROL.Equals("Usuario"))
            {
                NewProducto.IsVisible = false;
                NewAdmin.IsVisible    = false;

                foreach (var product in ProductoRepository.GetAllProductosDisponibles())
                {
                    DinamicButton dinamicButton = new DinamicButton();
                    dinamicButton.DinamicValue = product.PRO_ID;
                    dinamicButton.Text         = "Ver";
                    dinamicButton.Clicked     += new EventHandler(dinamicButton.SetMemoriaIdByProductID);
                    GridAllProducts.Children.Add(new Label {
                        Text = product.PRO_NOMBRE, TextColor = Color.White
                    }, 0, count);
                    GridAllProducts.Children.Add(new Label {
                        Text = product.PRO_DESCRIPCION, TextColor = Color.White
                    }, 1, count);
                    GridAllProducts.Children.Add(new Label {
                        Text = "$" + Math.Truncate(product.PRO_PRECIO).ToString(), TextColor = Color.White
                    }, 2, count);
                    GridAllProducts.Children.Add(dinamicButton, 3, count);
                    count += 1;
                }
            }
            if (Memoria.UsuarioActual.US_ROL.Equals("Administrador"))
            {
                Home.IsVisible = true;
                foreach (var product in ProductoRepository.GetAllProductos())
                {
                    DinamicButton dinamicButton = new DinamicButton();
                    dinamicButton.DinamicValue = product.PRO_ID;
                    dinamicButton.Text         = "Ver";
                    dinamicButton.Clicked     += new EventHandler(dinamicButton.ViewProductasAdmin);
                    GridAllProducts.Children.Add(new Label {
                        Text = product.PRO_NOMBRE, TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center
                    }, 0, count);
                    GridAllProducts.Children.Add(new Label {
                        Text = product.PRO_DESCRIPCION, TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center
                    }, 1, count);
                    GridAllProducts.Children.Add(new Label {
                        Text = "$" + Math.Truncate(product.PRO_PRECIO).ToString(), TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center
                    }, 2, count);
                    GridAllProducts.Children.Add(dinamicButton, 3, count);
                    count += 1;
                }
            }
        }
Exemplo n.º 3
0
        public Carrito()
        {
            InitializeComponent();
            int count = 1;

            foreach (var product in Memoria.listaCarrito)
            {
                //Boton para eliminar
                DinamicButton dinamicButton = new DinamicButton();
                dinamicButton.DinamicValue = product.PRO_ID;
                dinamicButton.Text         = "Eliminar";
                dinamicButton.Clicked     += new EventHandler(dinamicButton.BorrarCompraProducto);
                labelCantidad = new Label {
                    Text = product.COMP_CANTIDAD.ToString()
                };

                //Boton para ver producto y actualizar
                DinamicButton dinamicButtonVer = new DinamicButton();
                dinamicButtonVer.DinamicValue = product.PRO_ID;
                dinamicButtonVer.Text         = "Ver";
                dinamicButtonVer.Clicked     += new EventHandler(dinamicButtonVer.SetMemoriaIdByProductID);

                GridAllProducts.Children.Add(new Label {
                    Text = ProductoRepository.GetProductoByID(product.PRO_ID).PRO_NOMBRE, TextColor = Color.White
                }, 0, count);
                GridAllProducts.Children.Add(new Label {
                    Text = "$" + Math.Truncate(ProductoRepository.GetProductoByID(product.PRO_ID).PRO_PRECIO).ToString(), TextColor = Color.White
                }, 1, count);
                GridAllProducts.Children.Add(new Label {
                    Text = product.COMP_CANTIDAD.ToString(), TextColor = Color.White
                }, 2, count);
                GridAllProducts.Children.Add(dinamicButton, 3, count);
                GridAllProducts.Children.Add(dinamicButtonVer, 4, count);



                count += 1;
            }
        }
        public AllAbonosPendientes()
        {
            InitializeComponent();
            IEnumerable <Compra> compras = CompraRepository.GetAllComprasAbonosActivosByUserID(Memoria.UsuarioActual.UsuarioId);
            int count = 2;

            if (compras.Count() == 0)
            {
                lblInit.Text      = "No hay Facturas con abonos Activos";
                btnInit.IsEnabled = false;
                btnInit.IsVisible = false;
                lblInit.IsEnabled = true;
                lblInit.IsVisible = true;
            }
            else
            {
                lblInit.IsVisible = false;
                btnInit.IsVisible = true;
            }
            foreach (var compra in compras)
            {
                DinamicButton dinamicButton = new DinamicButton();
                dinamicButton.DinamicValue = compra.COM_ID;
                dinamicButton.Text         = "Ver";
                dinamicButton.Clicked     += new EventHandler(dinamicButton.SeeFactura);
                AllFacturasAbonoActivo.Children.Add(new Label {
                    Text = compra.COM_ID.ToString()
                }, 0, count);
                AllFacturasAbonoActivo.Children.Add(new Label {
                    Text = AbonoRepository.GetAbonoByCompraID(compra.COM_ID).ABO_RESTANTE.ToString()
                }, 1, count);
                AllFacturasAbonoActivo.Children.Add(new Label {
                    Text = "$" + Math.Truncate(compra.COM_PRECIO_TOTAL).ToString()
                }, 2, count);
                AllFacturasAbonoActivo.Children.Add(dinamicButton, 3, count);
                count += 1;
            }
        }