private void btnCadastrar_Click(object sender, EventArgs e) { //Preencher o objeto da BLL com o conteudo da UI. aluno.Ra = txtRa.Text; aluno.Nome = txtNome.Text; aluno.Cpf = txtCpf.Text; aluno.Idade = int.Parse(txtIdade.Text); if (atualizar) { alunoDAL.Atualizar(aluno); MessageBox.Show("Aluno cadastrado!"); btnCadastrar.Text = "Cadastrar"; atualizar = false; txtRa.ReadOnly = false; btnCancelar.Visible = false; } else { //Enviar para o Cadastrar da camada DAL alunoDAL.Cadastrar(aluno); MessageBox.Show("Aluno cadastrado!"); } txtRa.Clear(); txtNome.Clear(); txtCpf.Clear(); txtIdade.Clear(); txtRa.Focus(); }
/*protected void btnLogin_Click(object sender, EventArgs e) * { * Response.Redirect("Login.aspx"); * }*/ protected void btnCadastrar_Click(object sender, EventArgs e) { BLL.Aluno alu = new BLL.Aluno(); lo.Usuario = txtUsuario.Text; lo.Senha = BLL.Criptografia.getMdIHash(txtSenha.Text); lo.Tipo = 1; alu.Nome = txtNome.Text; alu.Cpf = txtCpf.Text; alu.Rg = txtRg.Text; alu.Nascimento = DateTime.Parse(txtNasc.Text); alu.Cep = txtCep.Text; alu.Estado = DropDownList.SelectedValue; alu.Bairro = txtBairro.Text; alu.Cidade = txtCidade.Text; alu.RuaAv = txtRuaAv.Text; alu.Numero = txtNum.Text; alu.Email = txtEmail.Text; alu.Telefone = txtTelefone.Text; if (CheckBox1.Checked == true) { alu.IdLogin = loDAL.Cadastrar(lo); DAL.AlunoDAL aluDAL = new DAL.AlunoDAL(); aluDAL.Cadastrar(alu); txtUsuario.Text = ""; txtNome.Text = ""; txtCpf.Text = ""; txtSenha.Text = ""; txtRg.Text = ""; txtNasc.Text = ""; txtCep.Text = ""; DropDownList.SelectedIndex = 1; txtBairro.Text = ""; txtCidade.Text = ""; txtRuaAv.Text = ""; txtNum.Text = ""; txtEmail.Text = ""; txtTelefone.Text = ""; txtNome.Focus(); Response.Write("<script>alert('Cadastro efetuado!')</script>"); } else { litAviso.Text = "VocĂȘ deve concordar com termos para continuar!"; } //btnLogin_Click(null, null); }
protected void btnCadastrar_Click(object sender, EventArgs e) { try { BLL.Aluno aluno = new BLL.Aluno(); aluno.Nome = txtNome.Text; aluno.Cpf = txtCpf.Text; DAL.AlunoDAL alunoDAL = new DAL.AlunoDAL(); alunoDAL.Cadastrar(aluno); lblMsg.Text = "Aluno cadastrado"; txtCpf.Text = ""; txtNome.Text = ""; } catch (Exception ex) { lblMsg.Text = ex.Message; } }
private void btnCadastrar_Click_1(object sender, EventArgs e) { alu.Nome = txtNomeAlu.Text; alu.Cpf = txtCpfAlu.Text; alu.Rg = txtRgAlu.Text; alu.Email = txtEmailAlu.Text; alu.DataNascimento = Convert.ToDateTime(mtxtDataNascimentoAlu.Text); if (editar == false) { aluDAL.Cadastrar(alu); } else { aluDAL.Atualizar(alu); } MessageBox.Show("Dados Gravados com Sucesso!"); dgvConsulta.DataSource = aluDAL.ConsultarTodos(); limpar(); }