public void U_CargaDatos() { string xpalabra1 = ""; string xpalabra2 = ""; string xpalabra3 = ""; if (txtFilter.Enabled) { xpalabra1 = VariablesPublicas.Palabras(txtFilter.Text.Trim(), 1); xpalabra2 = VariablesPublicas.Palabras(txtFilter.Text.Trim(), 2); xpalabra3 = VariablesPublicas.Palabras(txtFilter.Text.Trim(), 3); } //tabla = ocapa.UBIGEO_CONSULTA("", "", "", xpalabra1, xpalabra2, xpalabra3); try { paisBL BL = new paisBL(); tb_pais BE = new tb_pais(); switch (cboFiltro.SelectedItem.ToString()) { case "Pais": BE.paisname = txtFilter.Text.Trim().ToUpper(); break; case "Código": BE.paisid = txtFilter.Text.Trim().ToUpper(); break; default: BE.paisid = txtFilter.Text.Trim().ToUpper(); break; } tabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } btnBuscar.Enabled = true; SortOrder sorted = default(SortOrder); string xnomcolumna = ""; if ((gridExaminar.SortedColumn != null)) { xnomcolumna = gridExaminar.Columns[gridExaminar.SortedColumn.Index].Name; sorted = gridExaminar.SortOrder; } gridExaminar.AutoGenerateColumns = false; gridExaminar.DataSource = tabla; gridExaminar.AllowUserToResizeRows = false; if (xnomcolumna.Trim().Length > 0) { if (sorted == SortOrder.Ascending) { gridExaminar.Sort(gridExaminar.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Ascending); } else { gridExaminar.Sort(gridExaminar.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Descending); } } else { gridExaminar.Sort(gridExaminar.Columns["paisid"], System.ComponentModel.ListSortDirection.Ascending); } if (gridExaminar.Rows.Count > 0) { gridExaminar.CurrentCell = gridExaminar.Rows[0].Cells["paisname"]; gridExaminar.Focus(); gridExaminar.BeginEdit(true); } }
private void ValidaPais() { if (txtpaisid.Text.Trim().Length > 0) { var BL = new paisBL(); var BE = new tb_pais(); BE.paisid = txtpaisid.Text; var tmptablaPais = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmptablaPais.Rows.Count == 0) { txtpaisid.Text = j_String; } else { txtpaisid.Text = tmptablaPais.Rows[0]["paisid"].ToString(); txtpaisname.Text = tmptablaPais.Rows[0]["paisname"].ToString(); } } else { txtpaisid.Text = j_String; } }