Ejemplo n.º 1
0
        public bool ValidarE()
        {
            bool paso = true;

            if (string.IsNullOrWhiteSpace(MontoETextBox.Text))
            {
                MyErrorProvider.SetError(MontoETextBox, "Debe agregar un monto");
                MontoETextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(ComprobanteETextBox.Text))
            {
                MyErrorProvider.SetError(ComprobanteETextBox, "Debe agregar un comprobante");
                ComprobanteETextBox.Focus();
                paso = false;
            }

            return(paso);
        }
Ejemplo n.º 2
0
        private void GuardarEbutton_Click(object sender, EventArgs e)
        {
            bool         paso         = false;
            EgresoFondos egresoFondos = new EgresoFondos();
            RepositorioBase <EgresoFondos> repositorio = new RepositorioBase <EgresoFondos>();

            if (!ValidarE())
            {
                return;
            }

            egresoFondos = LlenarClaseEgreso();
            //paso = repositorio.Guardar(egresoFondos);



            if (egresoFondos.Monto > Convert.ToSingle(SaldoActualLabel.Text))
            {
                MyErrorProvider.SetError(MontoETextBox, "El monto del egreso supera el saldo disponible");
                MontoETextBox.Focus();
            }
            else
            {
                paso = repositorio.Guardar(egresoFondos);
            }

            if (paso)
            {
                SaldoActualLabel.Text = Convert.ToString(egresoFondos.SaldoActual);
                Limpiar();
                MessageBox.Show("Guardado");
            }
            else
            {
                MessageBox.Show("No fue posible guardar");
            }
        }