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); }
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(); } } } }
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(); } } } }
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(); } } } }