protected void btnCadastroAluno(object sender, EventArgs e) { try { Aluno p = new Aluno(); p.Nome = txtNome.Text; p.Data_Nasc = txtData_Nasc.Text; p.Idade = txtIdade.Text; p.Objetivo_Graduacao = txtObjetivo_Graduacao.Text; p.Genero = txtGenero.Text; AlunoDAL d = new AlunoDAL(); d.Gravar(p); //gravando o aluno lblMensagem.Text = "Aluno " + p.Nome + " Cadastrado com Sucesso!!!"; txtNome.Text = string.Empty; txtData_Nasc.Text = string.Empty; txtIdade.Text = string.Empty; txtObjetivo_Graduacao.Text = string.Empty; txtGenero.Text = string.Empty; } catch (Exception ex) { lblMensagem.Text = ex.Message; } }
protected void btnCadastrarAluno_Click(object sender, EventArgs e) { try { Aluno a = new Aluno(); a.IdInstrutor = Convert.ToInt32(txtIdUsuario.Text); a.IdCurso = Convert.ToInt32(ddl.SelectedItem.Value); a.NomeAluno = txtNomeAluno.Text; a.EmailAluno = txtEmailAluno.Text; AlunoDAL aDAL = new AlunoDAL(); aDAL.Gravar(a); lblmensagemTrue.Text = "O aluno " + a.NomeAluno + " foi adicionado com sucesso."; txtNomeAluno.Text = string.Empty; txtEmailAluno.Text = string.Empty; } catch (Exception) { throw; } }