Exemple #1
0
        private void subCategoriaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCadastroSubCategoria f = new frmCadastroSubCategoria();

            f.ShowDialog();
            f.Dispose();
        }
Exemple #2
0
        private void btAddSubCategoria_Click(object sender, EventArgs e)
        {
            frmCadastroSubCategoria f = new frmCadastroSubCategoria();

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

            DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao);//criar conexão

            //--------------------------------------------------------------------------------------------------
            // 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/XtknKZ5JAeM?list=PLfvOpw8k80Wqj1a66Qsjh8jj4hlkzKSjA&t=756
            }
        }
        private void btnSubcategoria_Click(object sender, EventArgs e)
        {
            frmCadastroSubCategoria f = new frmCadastroSubCategoria();

            f.ShowDialog();
            f.Dispose();
        }
 private void subToolStripMenuItem_Click(object sender, EventArgs e)
 {
   using (frmCadastroSubCategoria frmSubCategoria = new frmCadastroSubCategoria())
   {
     frmSubCategoria.ShowDialog();
   }
 }
Exemple #5
0
 private void dgvDados_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         frmCadastroSubCategoria f = new frmCadastroSubCategoria();
         f.codigo = Convert.ToInt32(dgvDados.Rows[e.RowIndex].Cells[0].Value);
         this.Close();
         f.ShowDialog();
         f.Dispose();
     }
 }
        private void btAddSubCat_Click(object sender, EventArgs e)
        {
            frmCadastroSubCategoria f = new frmCadastroSubCategoria();

            f.ShowDialog();
            f.Dispose();
            //criar conexão para exibir no combobox os nomes da subcategoria
            DALConexao      cx   = new DALConexao(DadosDaConexao.StringDeConexao);
            BLLSubcategoria sbll = new BLLSubcategoria(cx);

            cbSubCategoria.DataSource    = sbll.LocalizaPorCategoria((int)cbCategoria.SelectedValue);
            cbSubCategoria.DisplayMember = "scat_nome";
            cbSubCategoria.ValueMember   = "scat_cod";
        }
        private void btAddScat_Click(object sender, EventArgs e)
        {
            frmCadastroSubCategoria f = new frmCadastroSubCategoria();

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

            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");
            }
        }
Exemple #8
0
        private void btnAddSubCategoria_Click(object sender, EventArgs e)
        {
            frmCadastroSubCategoria f = new frmCadastroSubCategoria();

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

            try
            {
                //combo sub categoria
                BLLSubCategoria sbll = new BLLSubCategoria(cx);
                cbxSubCategoria.DataSource    = sbll.LocalizarPorCategoria(Convert.ToInt32(cbxCategoria.SelectedValue));
                cbxSubCategoria.DisplayMember = "NOME";
                cbxSubCategoria.ValueMember   = "CODIGO";
            }
            catch
            {
                Erro("CADASTRE UMA SUB CATEGORIA");
            }
        }
 private void subCategoriaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmCadastroSubCategoria f = new frmCadastroSubCategoria();
     f.ShowDialog();
     f.Dispose();
 }
        private void subCategoriaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCadastroSubCategoria f = new frmCadastroSubCategoria();

            CheckMdiChildren(f);
        }
Exemple #11
0
 private void subCategoriaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmCadastroSubCategoria f = new frmCadastroSubCategoria();
     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 btAssSubCat_Click(object sender, EventArgs e)
        {
            frmCadastroSubCategoria sub = new frmCadastroSubCategoria();
            sub.ShowDialog();
            sub.Dispose();
            DALConexao cx = new DALConexao(DadosDaConexao.srtConexao);


            cbSubCategoria.Text = "";
            BLLSubCategoria sbll = new BLLSubCategoria(cx);
            cbSubCategoria.DataSource = sbll.LocalizarPorCategoria((int)cbCategoria.SelectedValue);
            cbSubCategoria.DisplayMember = "scat_nome";
            cbSubCategoria.ValueMember = "scat_cod";
            cbSubCategoria.AutoCompleteMode = AutoCompleteMode.Suggest;
            cbSubCategoria.AutoCompleteSource = AutoCompleteSource.ListItems;


        }
 private void btnAddSubCategoria_Click(object sender, EventArgs e)
 {
     frmCadastroSubCategoria f = new frmCadastroSubCategoria();
     f.ShowDialog();
     f.Dispose();
     DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
     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");
     }
 }