Exemple #1
0
        private bool validar()
        {
            bool paso = true;

            if (EstudiantetextBox.Text == string.Empty)
            {
                MyerrorProvider1.SetError(EstudiantetextBox, "Llenar espacio en blanco ");
                EstudiantetextBox.Focus();
                paso = false;
            }
            if (ValortextBox.Text == string.Empty)
            {
                MyerrorProvider1.SetError(ValortextBox, "Llenar espacio en blanco ");
                ValortextBox.Focus();
                paso = false;
            }
            if (LogradotextBox.Text == string.Empty)
            {
                MyerrorProvider1.SetError(LogradotextBox, "Llenar espacio en blanco ");
                LogradotextBox.Focus();
                paso = false;
            }
            if (ValortextBox.Text == string.Empty)
            {
                MyerrorProvider1.SetError(ValortextBox, "Llenar espacio en blanco ");
                ValortextBox.Focus();
                paso = false;
            }
            return(paso);
        }
        private void EliminarButton_Click(object sender, EventArgs e)
        {
            Repositorio <Productos> db = new Repositorio <Productos>();

            MyerrorProvider1.Clear();
            int id;

            int.TryParse(ProductoIdNumericUpDown.Text, out id);

            Limpiar();

            if (db.Eliminar(id))
            {
                MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MyerrorProvider1.SetError(ProductoIdNumericUpDown, "No se puede eliminar un Cliente que no existe");
            }
        }
        private bool Validar()
        {
            bool paso = true;

            MyerrorProvider1.Clear();

            if (DescripcionTextBox.Text == string.Empty)
            {
                MyerrorProvider1.SetError(DescuentoNumericUpDown, "El campo Descripcion no puede estar vacio");
                DescripcionTextBox.Focus();

                paso = false;
            }
            if (CostoNumericUpDown.Value == 0)
            {
                MyerrorProvider1.SetError(CostoNumericUpDown, "El campo Costo no puede estar vacio");
                CostoNumericUpDown.Focus();

                paso = false;
            }
            if (GananciaNumericUpDown.Value == 0)
            {
                MyerrorProvider1.SetError(GananciaNumericUpDown, "El campo Ganancia no puede estar vacio");
                GananciaNumericUpDown.Focus();
            }
            if (ExistenciaNumericUpDown.Value == 0)
            {
                MyerrorProvider1.SetError(ExistenciaNumericUpDown, "El campo Existencia no puede estar vacio");
                ExistenciaNumericUpDown.Focus();
            }
            if (ItbisNumericUpDown.Value == 0)
            {
                MyerrorProvider1.SetError(ItbisNumericUpDown, "El campo Itbis no puede estar vacio");
                ItbisNumericUpDown.Focus();
            }

            return(paso);
        }