/// <summary>
 /// Evento click del uc_DeudorCuota (Pagar)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnPagar_Click(object sender, RoutedEventArgs e)
 {
     DataClasses1DataContext dc = new DataClasses1DataContext();
     Button boton = (Button)sender;
     id_cuota_asociado = Convert.ToInt32(boton.Tag);
     grdSecundaria.Visibility = Visibility.Collapsed;
     grdIndicarMonto.Visibility = Visibility.Visible;
     lblSimboloMoneda.Content = dc.SIGEEA_spObtenerMonedaCuota(id_cuota_asociado).First().Simbolo_Moneda;
 }
        private void btnPagarCuota_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MessageBox.Show("¿Realmente quiere realizar el pago?", "SIGEEA", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    ValidacionesMantenimiento validacion = new ValidacionesMantenimiento();
                    if (validacion.Validar(txbMonto.Text, Convert.ToInt32(txbMonto.Tag)) == true)
                    {
                        AsociadoMantenimiento asociado = new AsociadoMantenimiento();
                        DataClasses1DataContext dc = new DataClasses1DataContext();
                        double SaldoAnterior = dc.SIGEEA_Cuota_Asociados.First(c => c.PK_Id_Cuota_Asociado == id_cuota_asociado).Saldo_Cuota_Asociado;

                        if (SaldoAnterior - Convert.ToDouble(txbMonto.Text) >= 0)
                        {
                            if (asociado.RealizarPagoCuota(id_cuota_asociado, Convert.ToDouble(txbMonto.Text)) == true)
                            {
                                MessageBox.Show("Pago realizado con éxito", "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                                SIGEEA_spGenerarFacturaCuotaResult factura = asociado.GenerarFacturaCuota(id_cuota_asociado, Convert.ToDouble(txbMonto.Text), SaldoAnterior);
                                txbFactura.AppendText(factura.Nombre_Empresa);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.CedJuridica);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.Direccion_Empresa);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.Telefono);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.Correo);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.Fecha);
                                txbFactura.AppendText("  " + factura.Hora);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.NombreAsociado);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.CedPersona);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.CodigoAsociado);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.NombreCuota);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.Total);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText("Saldo anterior: " + dc.SIGEEA_spObtenerMonedaCuota(id_cuota_asociado).First().Simbolo_Moneda + SaldoAnterior.ToString());
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.Monto);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(factura.Saldo);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText(Environment.NewLine);
                                txbFactura.AppendText("¡Gracias por su preferencia!");
                                grdIndicarMonto.Visibility = Visibility.Collapsed;
                                grdFactura.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                throw new System.ArgumentException("Ha sido imposible realizar el pago.");
                            }
                        }
                        else
                        {
                            throw new System.ArgumentException("El saldo actual es menor que el monto digitado.");
                        }
                    }
                    else
                    {
                        BrushConverter bc = new BrushConverter();
                        txbMonto.Foreground = (Brush)bc.ConvertFrom("#FFFF0404");
                        throw new System.ArgumentException("El formato del monto es incorrecto");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }