Пример #1
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            var aluno = new Aluno();

            try
            {
                try
                {
                    aluno.Nome        = Convert.ToString(txtNome.Text);
                    aluno.Email       = Convert.ToString(txtEmail.Text);
                    aluno.DataNasc    = Convert.ToDateTime(txtDataNasc.Text);
                    aluno.Telefone    = Convert.ToString(txtTelefone.Text);
                    aluno.Celular     = Convert.ToString(txtCelular.Text);
                    aluno.Endereco    = Convert.ToString(txtEndereco.Text);
                    aluno.Numero      = Convert.ToInt32(txtNumero.Text);
                    aluno.Bairro      = Convert.ToString(dpBairro.SelectedValue);
                    aluno.Complemento = Convert.ToString(txtComplemento.Text);

                    var alunoBO = new AlunoBO();

                    alunoBO.inserirNovoAluno(aluno);

                    lblMensagem.Text = "Aluno Cadastrado com sucesso!";
                }
                catch (AlunoInvalidoException)
                {
                    lblMensagem.Text = "Erro no preenchimento dos Campos!";
                }
            }catch (AlunoNaoCadastradoException) {
                lblMensagem.Text = "Erro ao Cadastrar o Aluno!";
            }
        }
Пример #2
0
        protected void btnPesquisar_Click(object sender, EventArgs e)
        {
            try
            {
                var cod = txtCodigo.Text;

                _aluno   = new Aluno();
                _alunoBO = new AlunoBO();

                _aluno = _alunoBO.preencherAlunoPorCodigo(Convert.ToInt32(cod));

                //preencher os campos da página
                txtNome.Text     = _aluno.Nome;
                txtEmail.Text    = _aluno.Email;
                txtTelefone.Text = _aluno.Telefone;
                txtCelular.Text  = _aluno.Celular;

                lblMensagem.Text = "Pesquisa Concluida!";
            }
            catch (AlunoNaoCadastradoException)
            {
                lblMensagem.Text = "Aluno não Encontrado!";
            }
        }
Пример #3
0
        public void Gravar()
        {
            AlunoBO albo = new AlunoBO();

            albo.Gravar(this);
        }