Пример #1
0
        public bool Validar()
        {
            if (string.IsNullOrEmpty(DescripcionrichTextBox.Text))
            {
                errorProvider1.SetError(DescripcionrichTextBox, "llena el campo de descripcion");
                return(false);
            }
            if (string.IsNullOrEmpty(CantidadnumericUpDown.ToString()))
            {
                errorProvider1.SetError(CantidadnumericUpDown, "llena el campo de cantidad");
                return(false);
            }
            if (string.IsNullOrEmpty(GrupoIdnumericUpDown.ToString()))
            {
                errorProvider1.SetError(GrupoIdnumericUpDown, "llenar el campo de grupos");
                return(false);
            }
            if (string.IsNullOrEmpty(gruposnumericUpDown.ToString()))
            {
                errorProvider1.SetError(gruposnumericUpDown, "llenar el campo de grupos");
                return(false);
            }

            return(true);
        }
Пример #2
0
        private void BuscarProducto()
        {
            if (!string.IsNullOrEmpty(ProductoIdmaskedTextBox.Text))
            {
                int id = Utilidades.TOINT(ProductoIdmaskedTextBox.Text);

                Detalle.Producto = BLL.ProductosBLL.Buscar(p => p.ProductoId == id);

                if (Detalle.Producto != null)
                {
                    DescripcionProductotextBox.Text = Detalle.Producto.Descripcion;
                    PreciotextBox.Text            = Detalle.Producto.Precio.ToString();
                    CantidadnumericUpDown.Enabled = true;
                    CantidadnumericUpDown.Focus();
                }
                else
                {
                    ProductoIdmaskedTextBox.Clear();
                    ProductoerrorProvider.SetError(ProductoIdmaskedTextBox, "No existe un producto con ese id.");
                    DescripcionProductotextBox.Clear();
                    PreciotextBox.Clear();
                    CantidadnumericUpDown.Enabled = false;
                    ProductoIdmaskedTextBox.Focus();
                }
            }
            else
            {
                DescripcionProductotextBox.Clear();
                ProductoerrorProvider.SetError(ProductoIdmaskedTextBox, "Digite el id de un producto.");
                ProductoIdmaskedTextBox.Focus();
            }
        }
        private bool ValidarCamposDetalle()
        {
            bool paso = true;

            if (string.IsNullOrWhiteSpace(CategoriacomboBox.Text))
            {
                MyerrorProvider.SetError(CategoriacomboBox, "El campo Categoria no puede estar vacio");
                CategoriacomboBox.Focus();
                paso = false;
            }

            if (CantidadnumericUpDown.Value == 0)
            {
                MyerrorProvider.SetError(CantidadnumericUpDown, "El campo Cantidad no puede ser cero");
                CantidadnumericUpDown.Focus();
                paso = false;
            }

            if (PrecionumericUpDown.Value == 0)
            {
                MyerrorProvider.SetError(PrecionumericUpDown, "El campo Precio no puede ser cero");
                PrecionumericUpDown.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(ImportetextBox.Text))
            {
                MyerrorProvider.SetError(ImportetextBox, "El campo Importe no puede ser cero");
                ImportetextBox.Focus();
                paso = false;
            }

            return(paso);
        }
Пример #4
0
 public Capitulo6Ejercicio1()
 {
     InitializeComponent();
     CantidadnumericUpDown.Hide();
     CalificacionnumericUpDown.Hide();
     IntroducirCalbutton.Hide();
     Siguientebutton.Hide();
 }
Пример #5
0
        private void IntroducirCalbutton_Click(object sender, EventArgs e)
        {
            cantidadEstudiantes = Convert.ToInt32(CantidadnumericUpDown.Value);
            CantidadnumericUpDown.Hide();
            IntroducirCalbutton.Hide();

            CalificacionnumericUpDown.Show();
            Siguientebutton.Show();
        }
Пример #6
0
 private void Aceptarbutton_Click(object sender, EventArgs e)
 {
     cantidaCusos = Convert.ToInt32(CantidadAulasnumericUpDown.Value);
     calificacion = new float[cantidaCusos][];
     CantidadAulasnumericUpDown.Hide();
     Aceptarbutton.Hide();
     CantidadnumericUpDown.Show();
     IntroducirCalbutton.Show();
 }
Пример #7
0
        private void textBox5_KeyPress(object sender, KeyPressEventArgs e)
        {
            int id = Utilidades.TOINT(ProductoIdtextBox.Text);

            if (e.KeyChar == (char)Keys.Enter)
            {
                detalle.Producto = BLL.Productos.Buscar(p => p.ProductoId == id);

                if (detalle.Producto != null)
                {
                    NombreProductotextBox.Text = detalle.Producto.Descripcion;
                    PrecioProductotextBox.Text = detalle.Producto.Precio.ToString();
                    CantidadnumericUpDown.Focus();
                }
            }
        }
Пример #8
0
        private void AgregarProducto()
        {
            if (!string.IsNullOrEmpty(DescripcionProductotextBox.Text))
            {
                if (CantidadnumericUpDown.Value != 0)
                {
                    if (Detalle.Producto.Cantidad >= CantidadnumericUpDown.Value)
                    {
                        bool productoAgregado = false;
                        foreach (var producto in Factura.Relacion)
                        {
                            if (Detalle.Producto.ProductoId == producto.ProductoId)
                            {
                                productoAgregado = true;
                                break;
                            }
                        }
                        if (!productoAgregado)
                        {
                            Factura.Relacion.Add(new Entidades.FacturasProductos(Factura.FacturaId, Detalle.Producto.ProductoId, Detalle.Producto.Descripcion, Detalle.Producto.Precio, CantidadnumericUpDown.Value));
                            LlenarDataGrid(Factura);

                            CantidadnumericUpDown.Enabled = false;
                            CalculoMonto();
                            ProductoIdmaskedTextBox.Clear();
                        }
                        else
                        {
                            MessageBox.Show("Este producto ya esta agregado en la factura.");
                            DescripcionProductotextBox.Clear();
                            PreciotextBox.Clear();
                            CantidadnumericUpDown.Text    = "0";
                            CantidadnumericUpDown.Enabled = false;
                            ProductoIdmaskedTextBox.Focus();
                        }
                    }
                    else
                    {
                        if (Detalle.Producto.Cantidad <= 0)
                        {
                            MessageBox.Show("No queda producto de ese tipo");
                            ProductoIdmaskedTextBox.Clear();
                            DescripcionProductotextBox.Clear();
                            CantidadnumericUpDown.Text = "0";

                            ProductoIdmaskedTextBox.Focus();
                        }
                        else
                        {
                            MessageBox.Show("La cantidad excede la existencia, se cuenta con (" + Detalle.Producto.Cantidad + ") " + Detalle.Producto.Descripcion + ".");
                            CantidadnumericUpDown.Focus();
                        }
                    }
                }
                else
                {
                    CantidaderrorProvider.SetError(CantidadnumericUpDown, "Digite una cantidad diferente de (0).");
                    CantidadnumericUpDown.Focus();
                }
            }
            else
            {
                ProductoerrorProvider.SetError(ProductoIdmaskedTextBox, "Busque un producto para poder agregar.");
            }

            ClienteIdmaskedTextBox.Clear();
        }
Пример #9
0
        private void AgragraAlGrid_Click(object sender, EventArgs e)
        {
            RepositorioBase <Productos> db = new RepositorioBase <Productos>();
            Productos producto;

            if (ProductocomboBox.Text == "")
            {
                return;
            }
            producto = db.Buscar((int)ProductocomboBox.SelectedValue);

            if (ProductocomboBox.Text == "")
            {
                errorProvider.SetError(ProductocomboBox, "Debe elegir un Producto");
                ProductocomboBox.Focus();
                return;
            }


            if (PrecionumericUpDown.Value < Convert.ToDecimal(producto.Costo))
            {
                errorProvider.SetError(PrecionumericUpDown, "El precio de venta debe ser mayor al precio del costo");
                PrecionumericUpDown.Focus();
                return;
            }

            if (producto.Existencia - Convert.ToDouble(CantidadnumericUpDown.Value) < 0)
            {
                errorProvider.SetError(CantidadnumericUpDown, "El almacen del producto no es suficiente ");
                CantidadnumericUpDown.Focus();
                return;
            }
            if (ExisteEnGrid() == false)
            {
                errorProvider.SetError(ProductocomboBox, "El Producto ya existe en el Grid");
                ProductocomboBox.Focus();
                return;
            }
            if (CantidadnumericUpDown.Value < 1)
            {
                errorProvider.SetError(CantidadnumericUpDown, "Debe elegir una cantidad ");
                CantidadnumericUpDown.Focus();
                return;
            }


            double import = Convert.ToDouble(PrecionumericUpDown.Value * CantidadnumericUpDown.Value);


            if (detalleDataGridView.DataSource != null)
            {
                this.Detalle = (List <VentasDetalle>)detalleDataGridView.DataSource;
            }

            this.Detalle.Add(new VentasDetalle()
            {
                VentaId    = Convert.ToInt32(VentaIdnumericUpDown.Value),
                ProductoId = Convert.ToInt32(ProductocomboBox.SelectedValue),
                Cantidad   = Convert.ToDouble(CantidadnumericUpDown.Value),
                Precio     = Convert.ToDouble(PrecionumericUpDown.Value),
                Importe    = import,
                Itbis      = (producto.ProductoItbis * import) / 100
            });

            LimpiaProducto();
            CargarGrid();
            CalcularItbis();
            CalcularSubtotal();
            CalcularTotal();
        }