Exemple #1
0
        private void Buscar_Click(object sender, RoutedEventArgs e)
        {
            Limpiar_Click(sender, e);
            calcular.IsEnabled = true;
            string cedu;

            cedu = "000000000" + cedulaCliente.Text;
            cedu = nacionalidad.Text + cedu.Substring(cedu.Length - 8);

            try
            {
                if (casoEmpleado.IsChecked == true)
                {
                    calcular.IsEnabled       = false;
                    oficioRiesgoso.IsEnabled = false;
                    casoEspecial.IsEnabled   = false;
                    casoReferido.IsEnabled   = false;
                    ingresosOtros.IsEnabled  = false;
                    cargasOtras.IsEnabled    = false;


                    #region visibilidad_no

                    textCargo.Visibility          = Visibility.Visible;
                    textNombre.Visibility         = Visibility.Visible;
                    textNroTdc.Visibility         = Visibility.Visible;
                    textTdcLimAct.Visibility      = Visibility.Visible;
                    textTdcLimAsig.Visibility     = Visibility.Visible;
                    listaCargo.Visibility         = Visibility.Visible;
                    listaNombre.Visibility        = Visibility.Visible;
                    listaTdcEmp.Visibility        = Visibility.Visible;
                    listaTdcLimite.Visibility     = Visibility.Visible;
                    listaTdcLimiteAsig.Visibility = Visibility.Visible;

                    text1.Visibility  = Visibility.Collapsed;
                    text2.Visibility  = Visibility.Collapsed;
                    text3.Visibility  = Visibility.Collapsed;
                    text4.Visibility  = Visibility.Collapsed;
                    text5.Visibility  = Visibility.Collapsed;
                    text6.Visibility  = Visibility.Collapsed;
                    text7.Visibility  = Visibility.Collapsed;
                    text8.Visibility  = Visibility.Collapsed;
                    text9.Visibility  = Visibility.Collapsed;
                    text10.Visibility = Visibility.Collapsed;
                    text11.Visibility = Visibility.Collapsed;
                    text12.Visibility = Visibility.Collapsed;
                    text13.Visibility = Visibility.Collapsed;
                    text14.Visibility = Visibility.Collapsed;
                    text15.Visibility = Visibility.Collapsed;
                    text16.Visibility = Visibility.Collapsed;
                    text17.Visibility = Visibility.Collapsed;
                    text18.Visibility = Visibility.Collapsed;
                    text19.Visibility = Visibility.Collapsed;
                    text20.Visibility = Visibility.Collapsed;
                    text21.Visibility = Visibility.Collapsed;
                    text22.Visibility = Visibility.Collapsed;
                    text23.Visibility = Visibility.Collapsed;
                    text24.Visibility = Visibility.Collapsed;
                    text25.Visibility = Visibility.Collapsed;

                    listaProducto.Visibility       = Visibility.Collapsed;
                    listaNroCredito.Visibility     = Visibility.Collapsed;
                    listaHistorico.Visibility      = Visibility.Collapsed;
                    listaMontoLiquidado.Visibility = Visibility.Collapsed;
                    listaFechaLiquidado.Visibility = Visibility.Collapsed;
                    listaFechaAumento.Visibility   = Visibility.Collapsed;
                    listaMora.Visibility           = Visibility.Collapsed;

                    listaMes_1.Visibility         = Visibility.Collapsed;
                    listaMes_2.Visibility         = Visibility.Collapsed;
                    listaMes_3.Visibility         = Visibility.Collapsed;
                    listaSalario.Visibility       = Visibility.Collapsed;
                    listaNombreEmpresa.Visibility = Visibility.Collapsed;
                    listaRifEmpresa.Visibility    = Visibility.Collapsed;

                    listaMes_1_saldo.Visibility = Visibility.Collapsed;
                    listaMes_2_saldo.Visibility = Visibility.Collapsed;
                    listaMes_3_saldo.Visibility = Visibility.Collapsed;
                    listaSaldoPro.Visibility    = Visibility.Collapsed;
                    clienteNombre.Visibility    = Visibility.Collapsed;

                    cargasBdv.Visibility   = Visibility.Collapsed;
                    cargasOtras.Visibility = Visibility.Collapsed;

                    ingresosOtros.Visibility = Visibility.Collapsed;
                    calcular.Visibility      = Visibility.Collapsed;

                    riesgoConsolidado.Visibility = Visibility.Collapsed;

                    listaTarjetas.Visibility       = Visibility.Collapsed;
                    listaLimite.Visibility         = Visibility.Collapsed;
                    listaLimiteOtorgado.Visibility = Visibility.Collapsed;
                    aprobadoreferido.Visibility    = Visibility.Collapsed;

                    #endregion

                    empleado = SqliteDataAccess.CargaCedulaEmp(cedu);
                    clientes = SqliteDataAccess.CargaCedula(cedu);

                    listaCargo.Items.Add(empleado[0].CARGO.ToString());
                    listaNombre.Items.Add(empleado[0].NOMBRE.ToString());


                    for (int i = 0; i < clientes.Count; i++) // SE AGREGA LISTADO DE NRO DE TARJETAS DEL EMPLEADO
                    {
                        if (clientes[i].PRODUCTO.ToString() == "TDC")
                        {
                            listaTdcEmp.Items.Add(clientes[i].NUMERO_CREDITO.ToString());
                        }
                    }

                    for (int i = 0; i < clientes.Count; i++) // SE AGREGA LISTADO DE LIMITE DE TARJETAS DEL EMPLEADO
                    {
                        if (clientes[i].PRODUCTO.ToString() == "TDC")
                        {
                            listaTdcLimite.Items.Add("Bs. " + clientes[i].MONTO_LIQUIDADO.ToString("N2"));
                        }
                    }

                    for (int i = 0; i < 2; i++) // SE AGREGA LISTADO DE LIMITE !!!ASIGNADO DE TARJETAS DEL EMPLEADO SEGUN NIVEL
                    {
                        listaTdcLimiteAsig.Items.Add("Bs. " + empleado[0].LIMITE_TDC.ToString("N2"));
                    }


                    acr = SqliteDataAccess.CargaCedulaFull(cedu);

                    if (acr[0].CONSOLIDADO == 1)
                    {
                        CALIFICA.Text       = "NO CUMPLE POLITICAS";
                        CALIFICA.Background = Brushes.Red;
                    }
                    else
                    {
                        CALIFICA.Text       = "CALIFICA";
                        CALIFICA.Background = Brushes.Green;
                    }

                    return;
                }
                else
                {
                    clientes = SqliteDataAccess.CargaCedula(cedu);

                    if (clientes.Count > 0)
                    {
                        for (int i = 0; i < clientes.Count; i++)
                        {
                            listaProducto.Items.Add(clientes[i].PRODUCTO.ToString());
                            listaNroCredito.Items.Add(clientes[i].NUMERO_CREDITO.ToString());
                            listaHistorico.Items.Add(clientes[i].HISTORICO.ToString());
                            listaMontoLiquidado.Items.Add(clientes[i].MONTO_LIQUIDADO.ToString("N2"));
                            listaFechaLiquidado.Items.Add(clientes[i].FECHA_LIQUIDACION.ToString());
                            listaFechaAumento.Items.Add(clientes[i].FECHA_ULT_AUMENTO.ToString());
                            listaMora.Items.Add(clientes[i].MORA.ToString());

                            if (clientes[i].PRODUCTO.ToString() == "TDC")
                            {
                                listaTarjetas.Items.Add(clientes[i].NUMERO_CREDITO.ToString());
                                listaLimite.Items.Add(clientes[i].MONTO_LIQUIDADO.ToString("N2"));
                            }
                        }

                        for (int i = 0; i < clientes.Count; i++) // SE AGREGA LOS PROCTOS SOCIALES AL FINAL DE LA LISTA
                        {
                            if (clientes[i].PRODUCTO.ToString() == "TDC_SOCIAL")
                            {
                                listaTarjetas.Items.Add(clientes[i].NUMERO_CREDITO.ToString());
                                listaLimite.Items.Add(clientes[i].MONTO_LIQUIDADO.ToString("N2"));
                            }
                        }
                    }
                }
            }

            catch (Exception)
            {
                MessageBox.Show("NO POSEE OPERACIONES ACTIVAS BDV");
            }

            try
            {
                acr = SqliteDataAccess.CargaCedulaFull(cedu);

                if (acr[0].CONSOLIDADO == 1)
                {
                    CALIFICA.Text       = "NO CUMPLE POLITICAS";
                    CALIFICA.Background = Brushes.Red;
                }
                else
                {
                    CALIFICA.Text       = "CALIFICA";
                    CALIFICA.Background = Brushes.Green;
                }

                if (acr.Count > 0)
                {
                    for (int i = 0; i < acr.Count; i++)
                    {
                        listaMes_1.Items.Add(acr[i].MES_1.ToString("N2"));
                        listaMes_2.Items.Add(acr[i].MES_2.ToString("N2"));
                        listaMes_3.Items.Add(acr[i].MES_3.ToString("N2"));
                        listaSalario.Items.Add(acr[i].SALARIO.ToString("N2"));
                        listaNombreEmpresa.Items.Add(acr[i].NOMBRE_EMPRESA.ToString());
                        listaRifEmpresa.Items.Add(acr[i].RIF_EMPRESA.ToString());
                    }

                    cargasBdv.Text = "Bs. " + acr[0].CARGA_BDV.ToString("N2");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("NO POSEE EXPERIENCIA BDV");
                CALIFICA.Text       = "CALIFICA";
                CALIFICA.Background = Brushes.Green;
            }

            try
            {
                saldo = SqliteDataAccess.SaldosTdcs(cedu);

                if (saldo.Count > 0)
                {
                    listaMes_1_saldo.Items.Add(saldo[0].MES_1.ToString("N2"));
                    listaMes_2_saldo.Items.Add(saldo[0].MES_2.ToString("N2"));
                    listaMes_3_saldo.Items.Add(saldo[0].MES_3.ToString("N2"));
                    listaSaldoPro.Items.Add(saldo[0].SALDO_PROMEDIO.ToString("N2"));
                }

                clienteNombre.Text = saldo[0].NOMBRE.ToString();
            }
            catch (Exception)
            {
            }
        }