public override bool Insertar()
{
ConexionDb con = new ConexionDb();
bool retorno = false;
try
{
retorno = con.Ejecutar(string.Format("insert into Cuentas (UsuarioId, Descripcion, Balance, Porciento) values ({0},'{1}',{2},{3})", this.UsuarioId, this.Descripcion, this.Balance, this.Porciento));
}
catch (Exception)
{
retorno = false;
}
return retorno;
}
public override bool Editar()
protected void GuardarButton_Click(object sender, EventArgs e) { Cuentas cuenta = new Cuentas(); if (CuentaIdTextBox.Text.Length <= 0) { LLenarDatos(cuenta); if (cuenta.Insertar()) { HttpContext.Current.Response.Write("<SCRIPT>alert('Guardado Correctamente')</SCRIPT>"); Limpiar(); } else { HttpContext.Current.Response.Write("<SCRIPT>alert('Error al Guardar')</SCRIPT>"); } } else { cuenta.CuentaId = ConvertirId(); LLenarDatos(cuenta); if (cuenta.Editar()) { HttpContext.Current.Response.Write("<SCRIPT>alert('Editado Correctamente')</SCRIPT>"); Limpiar(); } else { HttpContext.Current.Response.Write("<SCRIPT>alert('Error al editar')</SCRIPT>"); } } }