protected void ButtonEliminar_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(TextBoxID.Text)) { Utilidades.ShowToastr(this, "Llene campo Id ", "Consejo", "info"); Limpiar(); } else { int id = int.Parse(TextBoxID.Text); var bll = new BLL.DeudasclientesBLL(); var cliente = BLL.DeudasclientesBLL.Buscar(p => p.IdDeudas == id); if (BLL.DeudasclientesBLL.Eliminar(cliente)) { Utilidades.ShowToastr(this, "Deuda Eliminada con exito", "CORRECTO", "success"); Limpiar(); } else { Utilidades.ShowToastr(this, "No se puedo eliminar la deuda", "ERROR", "error"); } } }
protected void ButtonGuardar_Click(object sender, EventArgs e) { int id = 0; decimal deudatotal = 0; var guardar = new Entidades.Deudasclientes(); deudatotal = Convert.ToDecimal(TextMonto.Text); guardar.Cliente = TextBoxNombre.Text; // guardar.Deuda = deudatotal; guardar.IdDeudas = (Utilidades.TOINT(TextBoxID.Text)); if (deudatotal < Convert.ToDecimal(TextBoxDevuelta.Text) || deudatotal == 0) { int idd = int.Parse(TextBoxID.Text); var bll = new BLL.DeudasclientesBLL(); var cliente = BLL.DeudasclientesBLL.Buscar(p => p.IdDeudas == idd); BLL.DeudasclientesBLL.Eliminar(cliente); Utilidades.ShowToastr(this, "Abono es mayor que deuda se elimina automaticamente", "ATENCION", "info"); } else { if (id != guardar.IdDeudas) { BLL.DeudasclientesBLL.Mofidicar(guardar); Utilidades.ShowToastr(this, "Modifico la deuda", "ATENCION", "info"); } } }