private bool Validar()
        {
            bool interruptor = true;

            if (string.IsNullOrEmpty(descripcionTextBox.Text))
            {
                DescripcionerrorProvider.SetError(descripcionTextBox, "Por favor llenar el campo vacio.");
                interruptor = false;
            }
            if (cantidadNumericUpDown.Value == 0)
            {
                CantidaderrorProvider.SetError(cantidadNumericUpDown, "Por favor llenar el campo vacio.");
                interruptor = false;
            }
            if (string.IsNullOrEmpty(CostotextBox.Text))
            {
                CostoerrorProvider.SetError(CostotextBox, "Por favor llenar el campo vacio.");
                interruptor = false;
            }
            if (string.IsNullOrEmpty(PreciotextBox.Text))
            {
                PrecioerrorProvider.SetError(PreciotextBox, "Por favor llenar el campo vacio.");
                interruptor = false;
            }

            return(interruptor);
        }
        private void Limpiar()
        {
            productoIdMaskedTextBox.Clear();
            descripcionTextBox.Clear();
            cantidadNumericUpDown.Value = 0;
            CostotextBox.Clear();
            PreciotextBox.Clear();
            fechaIngresoDateTimePicker.Value = DateTime.Today;

            DescripcionerrorProvider.Clear();
            PrecioerrorProvider.Clear();
            CostoerrorProvider.Clear();
            CantidaderrorProvider.Clear();
        }
Exemplo n.º 3
0
        private void Limpiar()
        {
            Detalle = new Entidades.FacturasProductos();
            Factura = new Entidades.Facturas();

            FacturaIdmaskedTextBox.Clear();
            ClienteIdmaskedTextBox.Clear();
            NombreClientetextBox.Clear();
            MontotextBox.Clear();
            FechadateTimePicker.Value = DateTime.Now;
            ProductoIdmaskedTextBox.Clear();
            DescripcionProductotextBox.Clear();
            ProductodataGridView.DataSource = null;
            CantidadnumericUpDown.Value     = 0;
            PreciotextBox.Clear();
            DevueltatextBox.Clear();
            RecibidomaskedTextBox.Clear();
            ComentariotextBox.Clear();
            NombreClienteerrorProvider.Clear();
            CantidaderrorProvider.Clear();
            ProductoerrorProvider.Clear();
            RecibidoerrorProvider.Clear();
            GriderrorProvider.Clear();
            ClienteIderrorProvider.Clear();
            FacturaIderrorProvider.Clear();
            DevueltaerrorProvider.Clear();
            FormaPagoComboBox.Text = null;

            ClienteIdmaskedTextBox.Enabled  = true;
            ProductoIdmaskedTextBox.Enabled = true;
            FechadateTimePicker.Enabled     = true;
            ComentariotextBox.Enabled       = true;
            FormaPagoComboBox.Enabled       = true;
            ProductodataGridView.Enabled    = true;
            RecibidomaskedTextBox.Enabled   = false;
            FacturaIdmaskedTextBox.Enabled  = true;
            CantidadnumericUpDown.Enabled   = false;
        }
Exemplo n.º 4
0
 private void CantidadnumericUpDown_ValueChanged(object sender, EventArgs e)
 {
     CantidaderrorProvider.Clear();
 }
Exemplo n.º 5
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();
        }
        private bool ValidarTextbox()
        {
            if (string.IsNullOrEmpty(NombreArticulotextBox.Text) &&
                string.IsNullOrEmpty(DespcripciontextBox.Text) &&
                string.IsNullOrEmpty(MarcaArticulotextBox.Text) &&
                string.IsNullOrEmpty(NombreProveedorcomboBox1.Text) &&
                string.IsNullOrEmpty(CategoriacomboBox.Text) &&
                string.IsNullOrEmpty(CantidadtextBox.Text) &&
                string.IsNullOrEmpty(PrecioCompratextBox.Text) &&
                string.IsNullOrEmpty(PrecioVentatextBox.Text)



                )
            {
                NombreArticuloerrorProvider.SetError(NombreArticulotextBox, "Favor Ingresar el  nombre del articulos");
                DescripcionerrorProvider.SetError(DespcripciontextBox, "Favor Ingresar la descripcion del articulo");
                MarcaerrorProvider.SetError(MarcaArticulotextBox, "Favor Ingresar la marca del articulo");
                NombreProveedorerrorProvider.SetError(NombreProveedorcomboBox1, "Favor elegir el proveedor a que  correponde el  articulo");
                CategoriaerrorProvider.SetError(CategoriacomboBox, "Favor elegir la categoria a que correponde el articulo");
                CantidaderrorProvider.SetError(CantidadtextBox, "Favor Ingresar la cantidad del articulo");
                PrecioCompraerrorProvider.SetError(PrecioCompratextBox, "Favor Ingresar el precio de compra del articulo");
                PrecioVentaerrorProvider.SetError(PrecioVentatextBox, "Favor Ingresar el precio de venta del articulo");
                MessageBox.Show("Favor llenar todos los campos obligatorios");
            }

            if (string.IsNullOrEmpty(NombreArticulotextBox.Text))
            {
                NombreArticuloerrorProvider.Clear();
                NombreArticuloerrorProvider.SetError(NombreArticulotextBox, "Favor Ingresar el  nombre del articulos");
                return(false);
            }

            if (string.IsNullOrEmpty(DespcripciontextBox.Text))
            {
                DescripcionerrorProvider.Clear();
                DescripcionerrorProvider.SetError(DespcripciontextBox, "Favor Ingresar la descripcion del articulo");
                return(false);
            }
            if (string.IsNullOrEmpty(MarcaArticulotextBox.Text))
            {
                MarcaerrorProvider.Clear();
                MarcaerrorProvider.SetError(MarcaArticulotextBox, "Favor Ingresar la marca del articulo");
                return(false);
            }
            if (string.IsNullOrEmpty(NombreProveedorcomboBox1.Text))
            {
                NombreProveedorerrorProvider.Clear();
                NombreProveedorerrorProvider.SetError(NombreProveedorcomboBox1, "Favor elegir el proveedor a que  correponde el  articulo");

                return(false);
            }

            if (string.IsNullOrEmpty(CategoriacomboBox.Text))
            {
                CategoriaerrorProvider.Clear();
                CategoriaerrorProvider.SetError(CategoriacomboBox, "Favor elegir la categoria a que correponde el articulo");
                return(false);
            }
            if (string.IsNullOrEmpty(CantidadtextBox.Text))
            {
                CantidaderrorProvider.Clear();
                CantidaderrorProvider.SetError(CantidadtextBox, "Favor Ingresar la cantidad del articulo");
                return(false);
            }

            if (string.IsNullOrEmpty(PrecioCompratextBox.Text))
            {
                PrecioCompraerrorProvider.Clear();
                PrecioCompraerrorProvider.SetError(PrecioCompratextBox, "Favor Ingresar el precio de compra del articulo");
                return(false);
            }
            if (string.IsNullOrEmpty(PrecioVentatextBox.Text))
            {
                PrecioVentaerrorProvider.Clear();
                PrecioVentaerrorProvider.SetError(PrecioVentatextBox, "Favor Ingresar el precio de venta del articulo");
                return(false);
            }



            return(true);
        }