public void AgregarAbono() { if (int.Parse(txtMontoAbono.Text) <= int.Parse(txtDeuda.Text)) { DateTime fechaAbono = DateTime.Now.Date; int montoAbono = int.Parse(txtMontoAbono.Text); Boleta boleta = new Boleta(); boleta = boleta.ObtenerBoleta(_numeroBoleta); DateTime fechaLimite = boleta.FechaCreacion.AddMonths(1); Abono abono = new Abono(boleta, montoAbono, fechaAbono, fechaLimite); if (abono.AgregarAbono()) { int idAbono = abono.ObtenerIdMaximoAbono(); CargarGrillaAbonoPorBoleta(boleta.Numero); MessageBox.Show("Abono N°" + idAbono + " agregado."); _numeroBoleta = 0; } } else { MessageBox.Show("Monto del abono no puede ser mayor a lo adeudado."); } _numeroBoleta = 0; }
public void ObtenerDatos(Abono ab) { int id = Convert.ToInt32(Session["UsuarioCoId"]); ab.ClienteId = Convert.ToInt32(tbxCliente.Text); ab.PrestamoId = Convert.ToInt32(tbxPrestamo.Text); ab.UsuarioCoId = id; foreach (GridViewRow row in gridAbono.Rows) { ab.AgregarAbono(Convert.ToSingle(row.Cells[0].Text), row.Cells[1].Text); } }
public void AgregarAbono() { if (!string.IsNullOrEmpty(txtDeuda.Text) && txtDeuda.Text != "--") { if (!string.IsNullOrEmpty(txtMontoAbono.Text) && int.Parse(txtMontoAbono.Text) > 0) { if (int.Parse(txtMontoAbono.Text) <= int.Parse(txtDeuda.Text)) { DateTime fechaAbono = DateTime.Now.Date; int montoAbono = int.Parse(txtMontoAbono.Text); Boleta boleta = new Boleta(); boleta = boleta.ObtenerBoleta(_numeroBoleta); DateTime fechaLimite = boleta.FechaCreacion.AddMonths(1); Abono abono = new Abono(boleta, montoAbono, fechaAbono, fechaLimite); if (abono.AgregarAbono()) { int idAbono = abono.ObtenerIdMaximoAbono(); CargarGrillaAbonoPorBoleta(boleta.Numero); MessageBox.Show("Abono N°" + idAbono + " agregado."); EvaluarDeudaParaEstadoFiador(boleta.Numero); _numeroBoleta = 0; } } else { MessageBox.Show("Monto del abono no puede ser mayor a lo adeudado."); } } else { MessageBox.Show("No hay ningun monto ingresado para agregar"); } } else { MessageBox.Show("Debe seleccionar una boleta para pagar primero"); } }