public void U_CargaDatos() { var xpalabra1 = string.Empty; var xpalabra2 = string.Empty; var xpalabra3 = string.Empty; if (txtNombre.Enabled) { xpalabra1 = VariablesPublicas.Palabras(txtNombre.Text.Trim(), 1); xpalabra2 = VariablesPublicas.Palabras(txtNombre.Text.Trim(), 2); xpalabra3 = VariablesPublicas.Palabras(txtNombre.Text.Trim(), 3); } var BL = new ubigeoBL(); var BE = new tb_ubigeo(); BE.nombrelike1 = xpalabra1; BE.nombrelike2 = xpalabra2; BE.nombrelike3 = xpalabra3; tabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; btnRefrescar.Enabled = true; var sorted = default(SortOrder); var xnomcolumna = string.Empty; if ((Examinar.SortedColumn != null)) { xnomcolumna = Examinar.Columns[Examinar.SortedColumn.Index].Name; sorted = Examinar.SortOrder; } Examinar.AutoGenerateColumns = false; Examinar.DataSource = tabla; Examinar.AllowUserToResizeRows = false; if (xnomcolumna.Trim().Length > 0) { if (sorted == SortOrder.Ascending) { Examinar.Sort(Examinar.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Ascending); } else { Examinar.Sort(Examinar.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Descending); } } else { Examinar.Sort(Examinar.Columns["ubige"], System.ComponentModel.ListSortDirection.Ascending); } if (Examinar.Rows.Count > 0) { Examinar.CurrentCell = Examinar.Rows[0].Cells["depar"]; Examinar.Focus(); Examinar.BeginEdit(true); } }
internal void ValidaUbigeo() { Int16 lc_cont; var zhallado = false; var VMNROITEM = gridAnexos.Rows[gridAnexos.CurrentRow.Index].Cells["direcnume"].Value.ToString(); var xcodartic = ".."; if (!(gridAnexos.Rows[gridAnexos.CurrentRow.Index].Cells["ubige"].Value == DBNull.Value)) { xcodartic = gridAnexos.Rows[gridAnexos.CurrentRow.Index].Cells["ubige"].Value.ToString(); } if ( xcodartic.Trim().Length == 0 ) { zhallado = true; } else { var BL = new ubigeoBL(); var BE = new tb_ubigeo(); BE.ubige = xcodartic; tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; for (lc_cont = 0; lc_cont < TablaAnexos.Rows.Count; lc_cont++) { if (TablaAnexos.Rows[lc_cont]["direcnume"].ToString() == VMNROITEM ) { if ( tmptabla.Rows.Count > 0 ) { TablaAnexos.Rows[lc_cont]["ubige"] = tmptabla.Rows[0]["ubige"]; txtUbigeoanexos.Text = tmptabla.Rows[0]["depar"] + " - " + tmptabla.Rows[0]["provi"] + " - " + tmptabla.Rows[0]["distr"]; zhallado = true; break; } } } } if ( ! zhallado ) { gridAnexos.Rows[gridAnexos.CurrentRow.Index].Cells["ubige"].Value = j_CodUbigeo; } gridAnexos.Refresh(); }