コード例 #1
0
        //Boolean perInserir = false; Boolean perAlterar = false; Boolean perExcluir = false; Boolean perImprimir = false;

        private void frmSubCategoria_Load(object sender, EventArgs e)
        {
            try
            {
                DaoConexao     cx     = new DaoConexao(DadosDeConexao.StringDeConexao);
                BLLNivelAcesso bll    = new BLLNivelAcesso(cx);
                DataTable      tabela = new DataTable();
                tabela = bll.LocalizarNivelAcesso(SessaoUsuario.Session.Instance.UsuID, this.txtNome.ToString());

                BLLCategoria bllc = new BLLCategoria(cx);
                cbCatCod.DataSource    = bllc.loadComboBox();
                cbCatCod.DisplayMember = "cat_nome";
                cbCatCod.ValueMember   = "cat_cod";

                this.alteraBotoes(1);
            }
            catch
            {
            }
        }
コード例 #2
0
        private void frmCadastroProduto_Load(object sender, EventArgs e)
        {
            try
            {
                DaoConexao     cx     = new DaoConexao(DadosDeConexao.StringDeConexao);
                BLLNivelAcesso bll    = new BLLNivelAcesso(cx);
                DataTable      tabela = new DataTable();
                tabela = bll.LocalizarNivelAcesso(SessaoUsuario.Session.Instance.UsuID, this.txtNome.ToString());

                BLLCategoria cbll = new BLLCategoria(cx);
                cbCategoria.DataSource    = cbll.loadComboBox();
                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");
                }
                //combo und medida
                BLLUnidadeDeMedida ubll = new BLLUnidadeDeMedida(cx);
                cbUnd.DataSource    = ubll.Localizar("");
                cbUnd.DisplayMember = "umed_nome";
                cbUnd.ValueMember   = "umed_cod";

                this.alteraBotoes(1);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }