示例#1
0
        private bool ValidarGuardar()
        {
            bool paso = true;

            MyErrorProvider.Clear();

            if (DescripciontextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(DescripciontextBox, "El Campo no puede estar vacio.");
                DescripciontextBox.Focus();
                paso = false;
            }
            if (CostonumericUpDown.Value == 0)
            {
                MyErrorProvider.SetError(CostonumericUpDown, "El Campo no puede ser 0");
                CostonumericUpDown.Focus();
                paso = false;
            }
            if (ExistencianumericUpDown.Value == 0)
            {
                MyErrorProvider.SetError(ExistencianumericUpDown, "El Campo no puede ser 0");
                ExistencianumericUpDown.Focus();
                paso = false;
            }
            if (Repeticion(DescripciontextBox.Text))
            {
                MessageBox.Show("No se puede ingresar un producto ya creado");
                DescripciontextBox.Focus();
                paso = false;
            }

            return(paso);
        }
        public bool Validar()
        {
            bool paso = true;

            if (String.IsNullOrEmpty(DescripciontextBox.Text))
            {
                MessageBox.Show("La descripcion no puede estar vacia");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (CostonumericUpDown.Value == 0)
            {
                MessageBox.Show("El costo no puede estar vacio");
                CostonumericUpDown.Focus();
                paso = false;
            }
            return(paso);
        }
示例#3
0
        private bool Validar()
        {
            RepositorioBase <Productos> db = new RepositorioBase <Productos>();

            bool paso = true;

            errorProvider.Clear();

            if (DescripciontextBox.Text == string.Empty)
            {
                errorProvider.SetError(DescripciontextBox, "El campo Nombre no puede estar vacio");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (ProveedorcomboBox.Text == string.Empty)
            {
                errorProvider.SetError(ProveedorcomboBox, "El proveedor no puede estra vacio");
                ProveedorcomboBox.Focus();
                paso = false;
            }

            if (NoDuplicadoProducto(DescripciontextBox.Text, (int)ProductoIdnumericUpDown.Value) == true)
            {
                errorProvider.SetError(DescripciontextBox, "El producto ya existe");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (ProductoItbisnumericUpDown.Value < 0)
            {
                errorProvider.SetError(ProductoItbisnumericUpDown, "El rango debe ser de 0% a 18%");
                ProductoItbisnumericUpDown.Focus();
                paso = false;
            }

            if (ProductoItbisnumericUpDown.Value > 18)
            {
                errorProvider.SetError(ProductoItbisnumericUpDown, "El rango debe ser de 0% a 18%");
                ProductoItbisnumericUpDown.Focus();
                paso = false;
            }

            if (CostonumericUpDown.Value < 1)
            {
                errorProvider.SetError(CostonumericUpDown, "Seleccione un costo mayor");
                CostonumericUpDown.Focus();
                paso = false;
            }

            if (PrecionumericUpDown.Value < 1)
            {
                errorProvider.SetError(PrecionumericUpDown, "Seleccione un precio mayor");
                PrecionumericUpDown.Focus();
                paso = false;
            }
            if (PrecionumericUpDown.Value < CostonumericUpDown.Value)
            {
                errorProvider.SetError(PrecionumericUpDown, "El precio debe ser mayor o igual al costo");
                PrecionumericUpDown.Focus();
                paso = false;
            }
            return(paso);
        }