Exemplo n.º 1
0
        public void Alterar(ModeloUsuario obj)
        {
            if (obj.UsuNome.Trim().Length == 0)
            {
                throw new Exception("O nome do usuário é obrigatório");
            }

            if (obj.UsuUsuario.Trim().Length == 0)
            {
                throw new Exception("O nome de login é obrigatória");
            }

            if (obj.UsuSenha.Trim().Length == 0)
            {
                throw new Exception("A senha é obrigatória");
            }

            if (obj.RegraNivel.Trim().Length == 0)
            {
                throw new Exception("O nível de acesso é obrigatório");
            }

            DAOUsuario DALobj = new DAOUsuario(conexao);

            DALobj.Alterar(obj);
        }
Exemplo n.º 2
0
 private void atualizar(Usuario usuario)
 {
     try
     {
         daoUsuario.Alterar(usuario);
     }
     catch (Exception ex)
     {
         throw new Exception("Erro: " + ex.Message);
     }
 }
Exemplo n.º 3
0
        public void Alterar(ModelUsuario modelo)
        {
            DAOUsuario dao = new DAOUsuario(cx);

            if (dao.Alterar(modelo))
            {
                MessageBox.Show("Atualização realizada com sucesso!", "Operação Invalida!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Erro na atualização", "Operação Invalida!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            dao = null;
        }