public override bool Eliminar()
{
ConexionDb conexion = new ConexionDb();
bool retorno = false;
try
{
retorno = conexion.Ejecutar(String.Format("Delete from Presupuestos Where PresupuestoId = {0} --", this.PresupuestoId));
if (retorno)
{
conexion.Ejecutar(String.Format("Delete from PresupuestoDetalle Where PresupuestoId = {0} --", this.PresupuestoId));
}
}catch
{
retorno = false;
}
return retorno;
}
protected void EliminarButton_Click(object sender, EventArgs e) { Presupuesto presupuesto = new Presupuesto(); if (presupuesto.Buscar(Convert.ToInt32(PresupuestoTextBox.Text))) { if (presupuesto.Eliminar()) Utilitarios.ShowToastr(this, "Registro eliminado", "Exito", "success"); Limpiar(); } else { EliminarRequiredFieldValidator.IsValid = false; Limpiar(); } }