Beispiel #1
0
        ///<summary>
        ///
        /// Método para chamar formulário de gerenciamento de mensagens
        ///
        ///</summary>
        private void login()
        {
            try
            {
                string name = textBoxNome.Text;
                string pass = textBoxPass.Text;

                string hash = gerenciaServlet.geraHash(pass);

                int indice = gerenciaServlet.consultaUsuario(name, hash);

                if (indice >= 100 && indice <= 130)
                {
                    MessageBox.Show(MSG_FALTA + indice + MSG_EXPIRA, MSG_AVISO, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    indice = 0;
                }

                if (indice == 1)
                {
                    MessageBox.Show(MSG_ALTERACAO, MSG_AVISO, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    gerenciaSenha newForm = new gerenciaSenha(name);
                    newForm.FormClosed += new FormClosedEventHandler(formVisivel);
                    this.Visible        = false;
                    newForm.ShowDialog();
                }
                else if (indice == 2)
                {
                    MessageBox.Show(MSG_CHAVE_EXPIRADA, MSG_ERRO, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    limpaCampos();
                }
                else if (indice == 0)
                {
                    gerenciaServlet.atualizaUsuarioLogLocal(name, hash);

                    gerenciaMensagem newForm = new gerenciaMensagem(name);
                    newForm.FormClosed += new FormClosedEventHandler(formVisivel);
                    this.Visible        = false;
                    newForm.ShowDialog();
                }
                else if (indice == 3)
                {
                    MessageBox.Show(MSG_ACESSO_NEGADO, MSG_ERRO, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    limpaCampos();
                }
            }
            catch (excecao except)
            {
                MessageBox.Show(except.Message, MSG_ERRO, MessageBoxButtons.OK, MessageBoxIcon.Error);
                limpaCampos();
            }
        }
Beispiel #2
0
        ///<summary>
        /// 
        /// Método para chamar formulário de gerenciamento de mensagens
        /// 
        ///</summary>
        private void login()
        {
            try
            {
                string name = textBoxNome.Text;
                string pass = textBoxPass.Text;

                string hash = gerenciaServlet.geraHash(pass);

                int indice = gerenciaServlet.consultaUsuario(name, hash);

                if (indice >= 100 && indice <= 130)
                {
                    MessageBox.Show(MSG_FALTA + indice + MSG_EXPIRA, MSG_AVISO, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    indice = 0;
                }

                if (indice == 1)
                {
                    MessageBox.Show(MSG_ALTERACAO, MSG_AVISO, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    gerenciaSenha newForm = new gerenciaSenha(name);
                    newForm.FormClosed += new FormClosedEventHandler(formVisivel);
                    this.Visible = false;
                    newForm.ShowDialog();
                }
                else if (indice == 2)
                {
                    MessageBox.Show(MSG_CHAVE_EXPIRADA, MSG_ERRO, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    limpaCampos();
                }
                else if (indice == 0)
                {
                    gerenciaServlet.atualizaUsuarioLogLocal(name, hash);

                    gerenciaMensagem newForm = new gerenciaMensagem(name);
                    newForm.FormClosed += new FormClosedEventHandler(formVisivel);
                    this.Visible = false;
                    newForm.ShowDialog();
                }
                else if (indice == 3)
                {
                    MessageBox.Show(MSG_ACESSO_NEGADO, MSG_ERRO, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    limpaCampos();
                }
            }
            catch (excecao except)
            {
                MessageBox.Show(except.Message, MSG_ERRO, MessageBoxButtons.OK, MessageBoxIcon.Error);
                limpaCampos();
            }
        }