private void llenar_Tipocompra() { try { tb_co_tipocomprasBL BL = new tb_co_tipocomprasBL(); tb_co_tipocompras BE = new tb_co_tipocompras(); switch (cboCriterioBusqueda.SelectedItem.ToString()) { case "Código": BE.tipoid = txtCadenaBuscar.Text.Trim().ToUpper(); break; case "Descripción": BE.tiponame = txtCadenaBuscar.Text.Trim().ToUpper(); break; default: BE.tipoid = txtCadenaBuscar.Text.Trim().ToUpper(); break; } Sw_LOad = false; if (GridExaminar.RowCount > 0) { GridExaminar.Focus(); GridExaminar.BeginEdit(true); } GridExaminar.AutoGenerateColumns = false; GridExaminar.DataSource = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private BindingSource NewMethodDoc() { tb_co_tipocomprasBL BL = new tb_co_tipocomprasBL(); tb_co_tipocompras BE = new tb_co_tipocompras(); DataTable tcompra = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; DataRowCollection rows = tcompra.Rows; object[] cell; Dictionary<string, string> dic = new Dictionary<string, string>(); BindingSource binding = new BindingSource(); foreach (DataRow item in rows) { cell = item.ItemArray; dic.Add(cell[0].ToString(), cell[0].ToString() + " - " + cell[1].ToString()); cell = null; } binding.DataSource = dic; return binding; }