示例#1
0
        private void BtnAlterarSenha_Click(object sender, RoutedEventArgs e)
        {
            String senhaAtual    = txtSenhaAtual.Password.ToString();
            String senhaNova     = txtSenhaNova.Password.ToString();
            String confSenhaNova = txtConfSenhaNova.Password.ToString();


            CalculaPontuacaoSenha(senhaNova);

            try
            {
                if (ValidacaoUtils.SenhaValida(ModoVerificacaoSenha.Alterando, senhaNova, confSenhaNova, senhaAtual))
                {
                    _usuarioApplication.AlterarSenhaUsuario(_cpf, senhaNova);

                    MensagemUtils.MostrarMensagemSucesso(Title, "Senha alterada com sucesso!");

                    Close();
                }
            }
            catch (Exception ex)
            {
                MensagemUtils.MostrarMensagemAlerta(Title, ex.Message);

                txtSenhaAtual.Clear();
                txtSenhaNova.Clear();
                txtConfSenhaNova.Clear();

                txtSenhaNova.Focus();
            }
        }
示例#2
0
        private void BtnCadastrar_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;

                _usuarioApplication.CadastrarUsuario(txtCPF.Text, txtRG.Text, txtUsuario.Text, txtSenha.Password, txtConfSenha.Password);

                MensagemUtils.MostrarMensagemSucesso(Title, "Usuário cadastrado com sucesso!");

                Close();
            }
            catch (CPFInvalidoException ex)
            {
                MensagemUtils.MostrarMensagemAlerta(Title, ex.Message);

                txtCPF.Clear();
                txtCPF.Focus();
            }
            catch (RGInvalidoException ex)
            {
                MensagemUtils.MostrarMensagemAlerta(Title, ex.Message);

                txtRG.Clear();
                txtRG.Focus();
            }
            catch (SenhaInvalidaException ex)
            {
                MensagemUtils.MostrarMensagemAlerta(Title, ex.Message);

                txtSenha.Clear();
                txtConfSenha.Clear();

                txtSenha.Focus();
            }
            catch (Exception)
            {
                MensagemUtils.MostrarMensagemErro(Title, "Um erro inesperado ocorreu, tente novamente mais tarde!");
            }
            finally
            {
                Mouse.OverrideCursor = null;
            }
        }
示例#3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (cmbCPFs.SelectedItem == null)
            {
                MensagemUtils.MostrarMensagemErro(Title, "Nenhum usuário está selecionado!");
            }
            else
            {
                try
                {
                    _usuarioApplication.AlterarUsuario(_usuario.CPF, cmbEstado.SelectedItem.ToString(), cmbPerfil.SelectedItem.ToString());
                    MensagemUtils.MostrarMensagemSucesso(Title, "Usuário alterado com sucesso!");

                    Close();
                }
                catch (Exception)
                {
                    MensagemUtils.MostrarMensagemErro(Title, "Um erro aconteceu, tente novamente mais tarde!");
                }
                finally
                {
                }
            }
        }