예제 #1
0
        //Menu Textos

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

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

            f.ShowDialog();
            f.Dispose();
        }
예제 #3
0
        private void btAddCategoria_Click(object sender, EventArgs e)//adicionar catagoria aula 49
        {
            frmCadastroCategoria f = new frmCadastroCategoria();

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

            //combo da categoria
            DALConexao   cx  = new DALConexao(DadosDaConexao.StringDeConexao); //criar conexão
            BLLCategoria bll = new BLLCategoria(cx);                           //criar o objeto categoria

            cbCategoria.DataSource    = bll.Localizar("");                     //localizar todas as catagorias cadastradas, e mostra a 1° da lista
            cbCategoria.DisplayMember = "cat_nome";                            //mostrar o nome (Indicar qual coluna é exibida para selecionar)
            cbCategoria.ValueMember   = "cat_cod";                             //armazena o codigo do item selecionado

            //--------------------------------------------------------------------------------------------------
            // Carragar o combobox das subcatagorias
            //--------------------------------------------------------------------------------------------------
            try// Tratar erro caso nao tenha catagoria cadastrado, ou campo esta vazio
            {
                //so montrar a subcatagiria conforme a catagiria selecionada:
                //combo da subcategoria, que depende da catagoria selecionada A
                BLLSubCategoria sbll = new BLLSubCategoria(cx);
                cbSubCategoria.DataSource    = sbll.LocalizarPorCategoria((int)cbCategoria.SelectedValue); //aula 33 7:00
                cbSubCategoria.DisplayMember = "scat_nome";                                                //mostrar o nome (Indicar qual coluna é exibida para selecionar)
                cbSubCategoria.ValueMember   = "scat_cod";                                                 //armazena o codigo do item selecionado
            }
            catch
            {
                //MessageBox.Show("Cadastre uma categoria"); //https://youtu.be/rrHEAtoJSIs?list=PLfvOpw8k80Wqj1a66Qsjh8jj4hlkzKSjA&t=182
            }
        }
        private void btAddCat_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();

            f.ShowDialog();
            f.Dispose();
            DALConexao   cx  = new DALConexao(DadosDaConexao.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");
            }
        }
예제 #5
0
        private void btnAddCategoria_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();

            f.ShowDialog();
            f.Dispose();
            DALConexao   cx  = new DALConexao(DadosDaConexao.StringDeConexão);
            BLLCategoria bll = new BLLCategoria(cx);

            cbxCategoria.DataSource    = bll.Localizar("");
            cbxCategoria.DisplayMember = "NOME";
            cbxCategoria.ValueMember   = "CODIGO";
            try
            {
                //combo sub categoria
                BLLSubCategoria sbll = new BLLSubCategoria(cx);
                cbxSubCategoria.DataSource    = sbll.LocalizarPorCategoria(Convert.ToInt32(cbxCategoria.SelectedValue));
                cbxSubCategoria.DisplayMember = "NOME";
                cbxSubCategoria.ValueMember   = "CODIGO";
            }
            catch
            {
                MessageBox.Show("Cadastre uma categoria");
            }
        }
예제 #6
0
        private void categoriaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();
            f.ShowDialog();
            f.Dispose();

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

            f.ShowDialog(); //so permite interagir com outros forms se fechar este
            //f.Show();//permite interagir com outras telas mesmo com este aberto
            f.Dispose();    //destroi o objeto, limpar memoria
        }
예제 #8
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();

            f.ShowDialog();
            f.Dispose();
            DALConexao   cx  = new DALConexao(DadosDaConexao.StringDeConexão);
            BLLCategoria bll = new BLLCategoria(cx);

            cbxCategoria.DataSource = bll.Localizar("");
        }
예제 #9
0
 private void dgvDados_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         frmCadastroCategoria f = new frmCadastroCategoria();
         f.codigo = Convert.ToInt32(dgvDados.Rows[e.RowIndex].Cells[0].Value);
         this.Close();
         f.ShowDialog();
         f.Dispose();
     }
 }
        private void btAdd_Click(object sender, EventArgs e)
        {
            frmCadastroCategoria f = new frmCadastroCategoria();

            f.ShowDialog();
            f.Dispose();
            DALConexao   cx  = new DALConexao(DadosDaConexao.StringDeConexao);
            BLLCategoria bll = new BLLCategoria(cx);

            cbCat.DataSource    = bll.Localizar("");
            cbCat.DisplayMember = "cat_nome";
            cbCat.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
        }
예제 #12
0
        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
        }
예제 #13
0
        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";

        }
예제 #14
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)
 }
예제 #15
0
        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;

        }
예제 #16
0
        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");
            }
        }