Пример #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");
            }
        }
Пример #3
0
        private void Add_button_Click(object sender, EventArgs e)
        {
            // List<DetallesPresupuestos> detalle = new List<DetallesPresupuestos>();

            if (DetallePresupuestodataGridView.DataSource != null)
            {
                this.Detalle = (List <DetallesPresupuestos>)DetallePresupuestodataGridView.DataSource;
            }

            this.Detalle.Add(
                new DetallesPresupuestos(
                    id: 0,
                    presupuestoid: (int)PresupuestoId_numericUpDown.Value,
                    Cuentaid: TipoCuentacomboBox.SelectedIndex,
                    valor: Convert.ToDouble(Valor_numericUpDown.Value)
                    ));
            SuperErrorProvider1.Clear();
            CargarGrid();
            ////DetallePresupuestodataGridView.DataSource = null;
            // DetallePresupuestodataGridView.DataSource = Detalle;
            //  LlenarTotal();
        }