示例#1
0
        public void CarregarDadosGrid()
        {
            try
            {
                BLL.Cargo cat = new BLL.Cargo();
                dataGridView1.DataSource = cat.Listar(textBox1.Text, 1).Tables[0];
                // textBox1.Focus();
                //a propriedade DATASOURCE do datagrid é a fonte de dados. Esta propriedade recebe (=) do objeto USU o método LISTAR usando como parametro o texto TEXT.TRIM().TOUPPER() digitado no TEXTBOX1. Esse DATASOURCE usará a tabela zero TABLES[0] do método LISTAR

                if (dataGridView1.Rows.Count == 0)
                {
                    btnAlterar.Enabled   = false;
                    btnConsultar.Enabled = false;
                    btnAtivar.Enabled    = false;
                    btnDesativar.Enabled = false;
                }
                else
                {
                    btnAlterar.Enabled   = true;
                    btnConsultar.Enabled = true;
                    btnAtivar.Enabled    = true;
                    btnDesativar.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //throw;
            }
        }
        private void CarregarCombo(object o, EventArgs e)
        {
            BLL.Cargo c = new BLL.Cargo();

            cbCargo.DataSource    = c.Listar(String.Empty, (byte)BLL.FuncoesGerais.TipoStatus.Ativo).Tables[0];
            cbCargo.DisplayMember = "NomeCargo";
            cbCargo.ValueMember   = "CodigoCargo";
        }
示例#3
0
        public void CarregarCombo(object o, EventArgs e)
        {
            BLL.Cargo c = new BLL.Cargo();

            cbCargo.DataSource    = c.Listar(String.Empty, (byte)1).Tables[0];
            cbCargo.DisplayMember = "Descricao";
            cbCargo.ValueMember   = "CodigoCargo";
        }