Example #1
0
 private void Abonar()
 {
     if (ValidarAlAbonar())
     {
         Pago pago = new Pago
         {
             Fecha     = DateTime.Now,
             IdCliente = Credito.IdCliente,
             IdCredito = Credito.IdCredito
         };
         if (cmbCuota.SelectedIndex == 1)
         {
             double cuota = Credito.Cuota;
             Credito.Abonar(cmbCuota.Text, 0, Convert.ToInt32(txtCuotapagar.Text.Trim()));
             pago.ValorPago = cuota * Convert.ToDouble(txtCuotapagar.Text.Trim());
             carteraService.ActualizarDineroRestante(pago.ValorPago);
         }
         else
         {
             Credito.Abonar(cmbCuota.Text, Convert.ToInt32(txtCuotapagar.Text.Trim()), 0);
             pago.ValorPago = Convert.ToDouble(txtCuotapagar.Text.Trim());
             carteraService.ActualizarDineroRestante(pago.ValorPago);
         }
         if (Credito.Saldo == 0)
         {
             clienteService.ActualizarEstado(Credito.IdCliente);
             carteraService.ActualizarCanttidadDeudoresMenos();
         }
         pagoService.RegistrarPago(pago);
         creditoService.ActualizarCredito(Credito);
         PintarLabel();
     }
 }