public bool Validar()
        {
            bool paso = true;
            MyErrorProvider.Clear();

            if (string.IsNullOrWhiteSpace(ArticuloTextBox.Text))
            {
                MyErrorProvider.SetError(ArticuloTextBox, "Debe insertar almenos un articulo.");
                ArticuloTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CodigoMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(CodigoMaskedTextBox, "Debe asignarle un codigo.");
                CodigoMaskedTextBox.Focus();
                paso = false;
            }

            if (PrecioNumericUpDown.Value <= 0)
            {
                MyErrorProvider.SetError(PrecioNumericUpDown, "Debe asignarle un precio valido.");
                PrecioNumericUpDown.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(UnidadComboBox.Text))
            {
                MyErrorProvider.SetError(UnidadComboBox, "Debe agregarle una medida.");
                UnidadComboBox.Focus();
                paso = false;
            }

            return paso;
        }
Beispiel #2
0
 private void LimpiarProducto()
 {
     ProductoTextBox.Text        = string.Empty;
     CantidadNumericUpDown.Value = 0;
     UnidadComboBox.ResetText();
     PrecioUnitarioTextBox.Text = string.Empty;
     ImporteTextBox.Text        = string.Empty;
 }
 private void Limpiar()
 {
     MyErrorProvider.Clear();
     IDnumericUpDown.Value = 0;
     NombreTextBox.Text    = string.Empty;
     PrecioTextBox.Text    = string.Empty;
     CategoriaComboBox.ResetText();
     UnidadComboBox.ResetText();
     ImpuestoTextBox.Text   = string.Empty;
     ExistenciaTextBox.Text = string.Empty;
 }
        private bool Validar()
        {
            MyErrorProvider.Clear();
            bool paso = true;

            if (string.IsNullOrWhiteSpace(NombreTextBox.Text))
            {
                MyErrorProvider.SetError(NombreTextBox, "El campo nombre no puede estar vacio");
                NombreTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CategoriaComboBox.Text))
            {
                MyErrorProvider.SetError(CategoriaComboBox, "Debe de seleccionar una categoria");
                CategoriaComboBox.Focus();
                paso = false;
            }


            if (string.IsNullOrWhiteSpace(PrecioTextBox.Text))
            {
                MyErrorProvider.SetError(PrecioTextBox, "El campo precio no puede estar vacio");
                PrecioTextBox.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(ExistenciaTextBox.Text))
            {
                MyErrorProvider.SetError(ExistenciaTextBox, "El campo existencia no puede estar vacio");
                ExistenciaTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(UnidadComboBox.Text))
            {
                MyErrorProvider.SetError(UnidadComboBox, "Debe de seleccionar una categoria");
                UnidadComboBox.Focus();
                paso = false;
            }

            if (Convert.ToDouble(PrecioTextBox.Text) <= 0)
            {
                MyErrorProvider.SetError(PrecioTextBox, "El campo precio no puede ser mejor que 0");
                PrecioTextBox.Focus();
                paso = false;
            }

            return(paso);
        }