예제 #1
0
        private bool GuardarValidar()
        {
            bool paso = true;

            SuperErrorProvider1.Clear();
            if (Valor_numericUpDown.Value == 0)
            {
                SuperErrorProvider1.SetError(Valor_numericUpDown, "el campo esta vacio");
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(TipoCuentacomboBox.SelectedIndex.ToString()))
            {
                SuperErrorProvider1.SetError(TipoCuentacomboBox, "debe elegir uno");
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(DescripciontextBox.Text))
            {
                SuperErrorProvider1.SetError(DescripciontextBox, " debe llenar el campo");
                paso = false;
            }
            if (this.Detalle.Count == 0)
            {
                SuperErrorProvider1.SetError(DetallePresupuestodataGridView, "debe agregar algun presupuesto");
                paso = false;
            }
            return(paso);
        }
예제 #2
0
        private void EliminarButton_Click(object sender, EventArgs e)
        {
            SuperErrorProvider1.Clear();
            int id;

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

            if (!ExisteEnBaseDeDatos())
            {
                SuperErrorProvider1.SetError(PresupuestoId_numericUpDown, "no se pudo eliminar una persona que no existen");
                return;
            }
            if (repositorio.Eliminar(id))
            {
                Limpiar();
                MessageBox.Show("Eliminado");
            }
        }