private BindingSource NewMethodServicio() { tb_co_detraccionBL BL = new tb_co_detraccionBL(); tb_co_detraccion BE = new tb_co_detraccion(); DataTable table = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; DataRowCollection rows = table.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[2].ToString() + "%) - " + cell[1].ToString()); cell = null; } binding.DataSource = dic; return binding; }
private void cboServicio_SelectedIndexChanged(object sender, EventArgs e) { if (u_n_opsel > 0) { bool VMZOK = false; if (cboServicio.SelectedValue.ToString().Trim().Length == 0) { txtPorcdet.Text = ""; } else { try { tb_co_detraccionBL BL = new tb_co_detraccionBL(); tb_co_detraccion BE = new tb_co_detraccion(); BE.detraccionid = cboServicio.SelectedValue.ToString(); tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; // tmptabla = ocapa.CaeSoft_GetAllCuentaDetraccion(cmbservicio.SelectedValue, 0, "", "", "", 2); if (BL.Sql_Error.Length == 0) { if (tmptabla.Rows.Count > 0) { txtPorcdet.Text = tmptabla.Rows[0]["detraccionporcent"].ToString(); VMZOK = true; } } if (!VMZOK) { txtPorcdet.Text = ""; } } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } refrescacontroles(); } }