private void BindGrid() { SisPackController.AdministrarGrillas.Configurar(this.dtgResponsables, "ResponsableID", this.CantidadOpciones); try { IResponsable responsable = ResponsableFactory.GetResponsable(); DsResponsables ds = responsable.GetResponsablesDataSet(); string docNro = this.txtDocumentoNro.Text; string apeNom = this.txtApellidoNombre.Text; string filtro = null; if (docNro != "") { filtro = "NroDocumento = '" + docNro + "' AND (Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%')"; } else { filtro = "Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%'"; } DsResponsables.DatosRow[] drLista = (DsResponsables.DatosRow[])ds.Datos.Select(filtro, "Apellido, Nombre DESC"); this.dtgResponsables.DataSource = drLista; this.dtgResponsables.DataBind(); } catch (Exception ex) { throw ex; //this.txtErrorMsg.Text = "Error al consultar datos de responsables: " + ex.Message; } }
private void Buscar() { int total = 0; try { IResponsable responsable = ResponsableFactory.GetResponsable(); DsResponsables ds = responsable.GetResponsablesDataSet(); //ESTA que sigue string filtroEspecial = "docNro LIKE '" + this.documentoNro + "%' AND ApeNom LIKE '" + this.apellidoNombre + "%'"; if (this.documentoNro != "") { filtro = "NroDocumento = '" + this.documentoNro + "' AND (Apellido LIKE '" + this.apellidoNombre + "%' OR Nombre LIKE '" + this.apellidoNombre + "%')"; } else { filtro = "Apellido LIKE '" + this.apellidoNombre + "%' OR Nombre LIKE '" + this.apellidoNombre + "%'"; } DsResponsables.DatosRow[] drLista = (DsResponsables.DatosRow[])ds.Datos.Select(filtro); total = drLista.Length; if (total > 0) { if (total == 1) { DsResponsables.DatosRow dr = drLista[0]; this.txtResponsableID.Text = dr.ResponsableID.ToString(); this.txtDocumentoNro.Text = dr.NroDocumento.ToString(); this.txtApellidoNombre.Text = dr.Apellido + " " + dr.Nombre; this.txtErrorMsg.Text = ""; this.txtOpen.Text = ""; } else { this.txtDocumentoNro.Text = this.documentoNro; this.txtApellidoNombre.Text = this.apellidoNombre; this.txtOpen.Text = "S"; } } else { this.txtResponsableID.Text = ""; this.txtErrorMsg.Text = "No se encontraron datos."; this.txtOpen.Text = ""; } } catch (Exception ex) { this.txtErrorMsg.Text = "Error al consultar datos de responsables: " + ex.Message; } }