Exemplo n.º 1
0
        private bool validarExistencias()
        {
            bool existe = false;

            List <string> campos = new List <string>();

            campos.Add("nombre");
            List <string> valores = new List <string>();

            valores.Add(txtGasto.Text);

            gasto = new conexiones_BD.clases.tipos_gastos(campos, valores);

            if (modificar)
            {
                if (gasto.validarCamposcondicorORActu(true, 1) > 1)
                {
                    existe = true;
                }
            }
            else
            {
                if (gasto.validarCamposcondicorOR(true) > 0)
                {
                    existe = true;
                }
            }

            return(existe);
        }
Exemplo n.º 2
0
 private void eliminar()
 {
     if (idtipo_gas != null)
     {
         if (MessageBox.Show("¿Desea eliminar este registro?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
         {
             gasto = new conexiones_BD.clases.tipos_gastos(idtipo_gas);
             if (gasto.eliminar(true, false) > 0)
             {
                 habilitar(false);
                 vaciarDatos();
                 cargarTablas();
             }
         }
     }
 }
Exemplo n.º 3
0
 private void modifica()
 {
     if (!validar())
     {
         if (!validarExistencias())
         {
             gasto = new conexiones_BD.clases.tipos_gastos(idtipo_gas, txtGasto.Text, txtDescripcion.Text);
             if (gasto.modificar(true, false) > 0)
             {
                 habilitar(false);
                 vaciarDatos();
                 cargarTablas();
             }
         }
     }
 }
Exemplo n.º 4
0
 private void guardar()
 {
     if (!validar())
     {
         if (!validarExistencias())
         {
             gasto = new conexiones_BD.clases.tipos_gastos(txtGasto.Text, txtDescripcion.Text);
             if (gasto.guardar(true, false) > 0)
             {
                 vaciarDatos();
                 cargarTablas();
                 txtGasto.Focus();
             }
         }
     }
 }