Example #1
0
        private void BtnCrearCuota_Click(object sender, EventArgs e)
        {
            Creditos = creditoservice.ConsultarCreditosCliente(cliente.Cedula);
            Credito credito = new Credito();

            foreach (var item in Creditos)
            {
                if (item.NumeroCredito.Equals(int.Parse(TxtCodigoCredito.Text)))
                {
                    credito = item;
                }
            }
            Cuota cuota = new Cuota();

            cuota.NumeroCuota = int.Parse(TxtNumero.Text);
            cuota.FechaCuota  = DtpFecha.Value;
            cuota.ValorCuota  = decimal.Parse(TxtCuota.Text);
            cuota.AgregarCredito(credito);
            cuota.AgregarCliente(cliente);
            if (cuota.NumeroCuota > credito.NumeroCuotas)
            {
                MessageBox.Show("Usted ya ha pagado todas las cuotas.");
            }
            else
            {
                MessageBox.Show(cuotaservice.CrearCuota(cuota));
            }


            DtgCreditos.DataSource = null;
            DtgCreditos.DataSource = creditoservice.ConsultarCreditosCliente(cliente.Cedula);

            TxtNumero.Text        = "";
            TxtCuota.Text         = "";
            TxtCodigoCredito.Text = "";
            DtpFecha.Value        = DateTime.Now;
        }