Beispiel #1
0
        private void categoriaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();
            f.ShowDialog();
            f.Dispose();

        }
        private void btAdd_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();

            f.ShowDialog();
            f.Dispose();

            DaoConexao   cx  = new DaoConexao(DadosDeConexao.StringDeConexao);
            BLLCategoria bll = new BLLCategoria(cx);

            //  cbCatCod.DataSource = bll.Localizar("");
            cbCatCod.DisplayMember = "cat_nome";
            cbCatCod.ValueMember   = "cat_cod";
        }
        private void btAdd_Click(object sender, EventArgs e) //aula 49 - criar um novo cadastro
        {
            frmCadastroCategoria f = new frmCadastroCategoria();

            f.ShowDialog();
            f.Dispose();

            //Atualizar combobox:
            DALConexao   cx  = new DALConexao(DadosDaConexao.StringDeConexao);
            BLLCategoria bll = new BLLCategoria(cx);

            //carregar o combobox: DataSource indica a origem dos dados
            cbCatCod.DataSource    = bll.Localizar(""); //retornar um datatable com todas as catagorias
            cbCatCod.DisplayMember = "cat_nome";        //qual campo sera monstrado, (Fica Visivel)
            cbCatCod.ValueMember   = "cat_cod";         // indicar qual campo vai ser guardado como referencia
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();
            f.ShowDialog();
            f.Dispose();

            DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
            BLLCategoria bll = new BLLCategoria(cx);
            cbxCategoria.DataSource = bll.Localizar("");//trás todos os dados
            cbxCategoria.DisplayMember = "cat_nome";// valor que aparece
            cbxCategoria.ValueMember = "cat_cod";//valor que vai ser passado
        }
        private void btAdd_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria cat = new frmCadastroCategoria();
            cat.ShowDialog();
            cat.Dispose();
            DALConexao cx = new DALConexao(DadosDaConexao.srtConexao);
            BLLCategoria bll = new BLLCategoria(cx);
            cbCatCod.DataSource = bll.Localizar("");
            cbCatCod.DisplayMember = "cat_nome";
            cbCatCod.ValueMember = "cat_cod";

        }
        private void categoriaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();

            CheckMdiChildren(f);
        }
Beispiel #7
0
 private void categoriaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmCadastroCategoria f = new frmCadastroCategoria();
     f.ShowDialog(); //chama o form e não permite alteração em outro form enquanto ele estiver aberto
     f.Dispose(); //matar o objeto form(quando fechar elemina o mesmo)
 }
        private void btAddCat_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria cat = new frmCadastroCategoria();
            cat.ShowDialog();
            cat.Dispose();
            DALConexao cx = new DALConexao(DadosDaConexao.srtConexao);
            BLLCategoria bll = new BLLCategoria(cx);
            cbCategoria.DataSource = bll.Localizar("");
            cbCategoria.DisplayMember = "cat_nome";
            cbCategoria.ValueMember = "cat_cod";
            cbCategoria.AutoCompleteMode = AutoCompleteMode.Suggest;
            cbCategoria.AutoCompleteSource = AutoCompleteSource.ListItems;

        }
        private void btnAddCat_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();
            f.ShowDialog();
            f.Dispose();

            DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
            BLLCategoria bll = new BLLCategoria(cx);
            cbCategoria.DataSource = bll.Localizar("");
            cbCategoria.DisplayMember = "cat_nome";
            cbCategoria.ValueMember = "cat_cod";
            try
            {
                //combo da subcategoria
                BLLSubCategoria sbll = new BLLSubCategoria(cx);
                cbSubCategoria.DataSource = sbll.LocalizarPorCategoria((int)cbCategoria.SelectedValue);
                cbSubCategoria.DisplayMember = "scat_nome";
                cbSubCategoria.ValueMember = "scat_cod";
            }
            catch
            {
                //MessageBox.Show("Cadastre uma categoria");
            }
        }