public HttpResponseMessage Cadastrar(Usuario user)
 {
     try
     {
         UsuarioBLL bll = new UsuarioBLL();
         bll.Cadastrar(user, connection);
         return(Request.CreateResponse(HttpStatusCode.OK, "Usuário Cadastrado"));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
Example #2
0
        private void BtnCadastrar_Click(object sender, EventArgs e)
        {
            string log      = txtLog.Text;
            string senha    = txtSen.Text;
            string email    = txtEmail.Text;
            string telefone = txtTelefone.Text;

            UsuarioBLL usuarioBLL = new UsuarioBLL();

            usuarioBLL.Cadastrar(log, senha, email, telefone);
            lt.Text = "Usuario Cadastrado Com Sucesso";
            LimpaCampos();
        }
Example #3
0
        public ActionResult Cadastrar(FormCollection form)
        {
            string login    = form["Login"];
            string senha    = form["Senha"];
            string email    = form["Email"];
            string telefone = form["Telefone"];

            UsuarioBLL _usuarioBLL = new UsuarioBLL();

            _usuarioBLL.Cadastrar(login, senha, email, telefone);

            ModelState.AddModelError("Qualquer", "Usuario Cadastrado Com Sucesso");
            return(View("CadastroView"));
        }
Example #4
0
        private void btnCadastra_Click(object sender, EventArgs e)
        {
            Usuario usuario = new Usuario();

            usuario.login    = txtLogin.Text;
            usuario.senha    = txtSenha.Text;
            usuario.email    = txtEmail.Text;
            usuario.telefone = txtTelefone.Text;

            UsuarioBLL cad = new UsuarioBLL();

            cad.Cadastrar(usuario.login, usuario.senha, usuario.email, usuario.telefone);
            MessageBox.Show("Cadastro Efetuado Com Sucesso");
            LimpaCampos();
        }
Example #5
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtSenha.Text.Equals(txtConfirmarSenha.Text))
                {
                    UsuarioBLL.Cadastrar(txtNome.Text.Trim(), txtCPF.Text.Trim(), txtRG.Text.Trim(), txtSenha.Text.Trim(), 0, 0);
                }
                else
                {
                    MessageBox.Show("Senha e confirmação de senha diferentes!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //String mensagem = controle.cadastrar(txtCPF.Text,txtNome.Text, txtRG.Text, txtSenha.Text, txtConfirmarSenha.Text);
        }
Example #6
0
        private void btnNovoRegistro_Click(object sender, EventArgs e)
        {
            string user  = txtNome.Text;
            string senha = txtSenha.Text;
            string email = txtEmail.Text;
            string tel   = txtTel.Text;

            if (user != "" && senha != "" && email != "" && tel != "")
            {
                UsuarioBLL usuarioBLL = new UsuarioBLL();
                Usuario    usuario    = new Usuario();

                usuario = usuarioBLL.Login(user, senha);
                if (usuario != null)
                {
                    MessageBox.Show("Usuario Ja Cadastrado", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    Usuario usu = new Usuario();
                    usu.login    = user;
                    usu.senha    = senha;
                    usu.email    = email;
                    usu.telefone = tel;

                    UsuarioBLL cad = new UsuarioBLL();
                    cad.Cadastrar(usu.login, usu.senha, usu.email, usu.telefone);
                    MessageBox.Show("Cadastro Efetuado Com Sucesso");
                    LimpaCampos();
                }
            }
            else
            {
                MessageBox.Show("Por Favor Prencha todos os campos");
            }
        }
        public ActionResult Create(Usuario usuario)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    usuarioBLL.Cadastrar(usuario);

                    usuario = usuarioBLL.RetornarDadosUsuario(usuario.Login, usuario.Senha);

                    Session.Add("Usuario", usuario);

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(usuario));
                }
            }
            catch (Exception)
            {
                return(View("Error"));
            }
        }