private void Filtrar() { var sorted = default(SortOrder); var xnomcolumna = string.Empty; if ((dgProveedor.SortedColumn != null)) { xnomcolumna = dgProveedor.Columns[dgProveedor.SortedColumn.Index].Name; sorted = dgProveedor.SortOrder; } var xpalabra1 = string.Empty; var xpalabra2 = string.Empty; var xpalabra3 = string.Empty; if (txtdescripcion.Enabled) { xpalabra1 = VariablesPublicas.Palabras(txtdescripcion.Text, 1); xpalabra2 = VariablesPublicas.Palabras(txtdescripcion.Text, 2); xpalabra3 = VariablesPublicas.Palabras(txtdescripcion.Text, 3); } dgProveedor.DataSource = null; dgProveedor.AutoGenerateColumns = false; var BL = new tb_plla_pdt_tabla10BL(); var BE = new tb_plla_pdt_tabla10(); BE.nomlike1 = xpalabra1; BE.nomlike2 = xpalabra2; BE.nomlike3 = xpalabra3; BE.norden = 1; BE.ver_blanco = 0; dgProveedor.DataSource = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; if (xnomcolumna.Trim().Length > 0) { if (sorted == SortOrder.Ascending) { dgProveedor.Sort(dgProveedor.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Ascending); } else { dgProveedor.Sort(dgProveedor.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Descending); } } else { dgProveedor.Sort(dgProveedor.Columns["ocupaid"], System.ComponentModel.ListSortDirection.Ascending); } VariablesPublicas.PintaEncabezados(dgProveedor); }
private void txtcodrtps_LostFocus(object sender, System.EventArgs e) { if (!(j_Cargo == txtcodrtps.Text) & u_n_opsel > 0) { if (txtcodrtps.Text.Trim().Length == 0) { txtdrtps.Text = ""; txtcodrtps.Text = ""; } else { string xnomlike1 = VariablesPublicas.Palabras(txtdrtps.Text, 1); string xnomlike2 = VariablesPublicas.Palabras(txtdrtps.Text, 2); string xnomlike3 = VariablesPublicas.Palabras(txtdrtps.Text, 3); tb_plla_pdt_tabla10BL BL = new tb_plla_pdt_tabla10BL(); tb_plla_pdt_tabla10 BE = new tb_plla_pdt_tabla10(); BE.ocupaid = txtcodrtps.Text.Trim(); //BE.nomlike1 = xnomlike1; //BE.nomlike2 = xnomlike2; //BE.nomlike3 = xnomlike3; BE.norden = 1; BE.ver_blanco = 0; tmptabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length == 0) { if (tmptabla.Rows.Count == 0) { AyudaccostoRPTS(""); } else { if (tmptabla.Rows.Count > 0) { txtcodrtps.Text = tmptabla.Rows[0]["ocupaid"].ToString().Trim(); txtdrtps.Text = tmptabla.Rows[0]["ocupaname"].ToString(); } else { AyudaccostoRPTS(txtcodrtps.Text); } } } } } }