protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            BLL.UsuarioBLL u    = new BLL.UsuarioBLL();
            DAL.UsuarioDAL uDAL = new DAL.UsuarioDAL();

            if (txtSenha1.Text != txtSenha2.Text)
            {
                Response.Write("<script>alert('Senha não confere !!')</script>");
            }
            else
            {
                u.Usuario = txtUsuarioLogin.Text;
                u.Senha   = txtSenha1.Text;
                if (checkAdministrador.Checked)
                {
                    u.Acesso = 1;
                }
                else
                {
                    u.Acesso = 0;
                }

                uDAL.Cadastrar(u);
                Response.Write("<script>alert('Cadastro efetuado!')</script>");
            }
        }
예제 #2
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            usu.NomeUsuario = txtNome.Text;
            usu.Senha       = txtSenha.Text;
            usu.TipoUsuario = txtTipo.Text;

            if (editar == false)
            {
                usuDAL.Cadastrar(usu);
            }
            else
            {
                usuDAL.Atualizar(usu);
            }

            MessageBox.Show("Dados Gravados com Sucesso!");

            dgvConsulta.DataSource = usuDAL.ConsultarTodos();
            limpar();
        }