Пример #1
0
        private void btnLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaCategoria tela = new frmConsultaCategoria();

            tela.ShowDialog();

            if (tela.codigo != 0)
            {
                DALConexao con = new DALConexao(DadosConexao.StringConexao);

                BLLCategoria c = new BLLCategoria(con);

                ModeloCategoria m = c.carregaCategoria(tela.codigo);

                txtCodigo.Text    = m.CodCategoria.ToString();
                txtDescricao.Text = m.NomeCategoria;

                this.AlteraBotoes(3);
            }
            else
            {
                this.LimparCampos();
                this.AlteraBotoes(1);
            }

            tela.Dispose();
        }
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaCategoria ConsultaCategoria = new frmConsultaCategoria();

            ConsultaCategoria.ShowDialog();

            if (ConsultaCategoria.codigo != 0)
            {
                DALConexao      cx        = new DALConexao(DadosDaConexao.StringDaConexao);
                BLLCategoria    bll       = new BLLCategoria(cx);
                ModeloCategoria categoria = bll.carregaCategoria(ConsultaCategoria.codigo);
                txtCodigo.Text = categoria.CatCod.ToString();
                txtNome.Text   = categoria.CatNome;
                alteraBotoes(3);
            }
            else
            {
                this.LimpaTela();
                this.alteraBotoes(1);
            }
            ConsultaCategoria.Dispose();
        }