Exemplo n.º 1
0
        //FUNCION PARA LLENAR EL GRID
        private void llenarGrid(string[] t_st_datos)
        {
            try
            {
                string t_st_query = "";
                if (t_st_datos[0] == "1")
                {
                    t_st_query = "select PAG.id_pago, NUM.serie as Serie, NUM.numero_pago as Numero, PER.apellidos as Cliente, PAG.fecha_pago as Fecha_Pago, LOC.nombre_localidad, PAG.comentarios as Comentarios from cv403_pagos PAG inner join  cv403_numeros_pagos NUM  on PAG.id_pago = NUM.id_pago inner join tp_personas PER on PER.id_persona = PAG.id_persona inner join tp_vw_localidades LOC on LOC.id_localidad = PAG.id_localidad order by NUM.numero_pago desc";
                }

                else
                {
                    t_st_query = "select PAG.id_pago, NUM.serie as Serie, NUM.numero_pago as Numero, PER.apellidos as Cliente, PAG.fecha_pago as Fecha_Pago, LOC.nombre_localidad, PAG.comentarios as Comentarios from cv403_pagos PAG inner join  cv403_numeros_pagos NUM  on PAG.id_pago = NUM.id_pago inner join tp_personas PER on PER.id_persona = PAG.id_persona inner join tp_vw_localidades LOC on LOC.id_localidad = PAG.id_localidad order by NUM.numero_pago desc where NUM.numero_pago LIKE '%' + '" + t_st_datos[1] + "' and PER.apellidos LIKE '%' + '" + t_st_datos[1] + "'+ '%'";
                }

                x = conexion.GFun_Lo_Rellenar_Grid(t_st_query, "cv403_pagos");
                if (x == false)
                {
                    MessageBox.Show("Error en la consulta");
                }
                else
                {
                    dgvRecibo.DataSource = conexion.ds.Tables["cv403_pagos"];
                    dgvRecibo.Refresh();

                    dgvRecibo.Rows[0].Selected = true;
                    dgvRecibo.CurrentCell      = dgvRecibo.Rows[0].Cells[1];
                }
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }
        //FUNCION PARA LLENAR EL GRID
        private void llenarGrid(string[] t_st_datos)
        {
            try
            {
                string t_st_query = "";
                if (t_st_datos[0] == "1")
                {
                    t_st_query = "select id_persona,identificacion as Identificacion,apellidos as Apellidos," +
                                 "nombres as Nombres,'' as Cliente from tp_personas";
                }

                else
                {
                    t_st_query = "select id_persona,identificacion as Identificacion,apellidos as Apellidos," +
                                 "nombres as Nombres,'' as Cliente from tp_personas where identificacion LIKE '%' + '" + t_st_datos[1] + "' " +
                                 " OR apellidos like '%' + '" + t_st_datos[1] + "' OR nombres like '%' + '" + t_st_datos[1] + "' + '%'";
                }

                x = conexion.GFun_Lo_Rellenar_Grid(t_st_query, "tp_personas");
                if (x == false)
                {
                    MessageBox.Show("Error en la consulta");
                }
                else
                {
                    dgvPersona.DataSource = conexion.ds.Tables["tp_personas"];
                    dgvPersona.Refresh();

                    //NICOLE
                    dgvPersona.Rows[0].Selected = true;
                    dgvPersona.CurrentCell      = dgvPersona.Rows[0].Cells[1];

                    int iConta2 = 0;
                    foreach (DataGridViewRow row2 in dgvPersona.Rows)
                    {
                        sApellido = row2.Cells["Apellidos"].Value.ToString();
                        sNombre   = row2.Cells["Nombres"].Value.ToString();
                        sCliente  = sApellido + " " + sNombre;
                        dgvPersona.Rows[iConta2].Cells[4].Value = sCliente;

                        iConta2++;
                    }
                }
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }