private BindingSource NewMethodTV() { tb_co_tipoventasBL BL = new tb_co_tipoventasBL(); tb_co_tipoventas BE = new tb_co_tipoventas(); 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; }
public void validaTipoVenta() { txtTipoventa.Text = txtTipoventa.Text.PadLeft(2, '0'); if (txtTipoventa.Text.Trim().Length > 0) { tb_co_tipoventasBL BL = new tb_co_tipoventasBL(); tb_co_tipoventas BE = new tb_co_tipoventas(); BE.tipoid = txtTipoventa.Text.Trim(); DataTable tventa = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tventa.Rows.Count == 0) { txtTipoventa.Text = j_String; } else { txtTipoventa.Text = tventa.Rows[0]["tipoid"].ToString().Trim(); lblTipoventa.Text = tventa.Rows[0]["tiponame"].ToString().Trim(); cboMoneda.SelectedValue = tventa.Rows[0]["moneda"].ToString().Trim(); } } else { txtTipoventa.Text = j_String; } // txtTipoventa.Text = VariablesPublicas.PADL(txtTipoventa.Text.Trim(), txtTipoventa.MaxLength, "0"); // tmptabla = ocapa.KAG0600_CONSULTA((txtTipoventa.Text.Trim().Length == 0 ? ".." : txtTipoventa.Text.Trim()), "", GlobalVars.GetInstance.TipoConceptoVentas, 1, GlobalVars.GetInstance.Company, 0); //if (ocapa.sql_error.Length == 0) //{ //if (tmptabla.Rows.Count > 0) //{ // txtTipoventa.Text = tmptabla.Rows[0]["tipoc_6k"].ToString(); // lblTipoventa.Text = tmptabla.Rows[0]["nomb_6k"].ToString(); //} //else //{ // txtTipoventa.Text = j_TipoVenta; //} //} }
private void llenar_Tipocompra() { try { var BL = new tb_co_tipoventasBL(); var BE = new tb_co_tipoventas(); 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) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }