Exemple #1
0
        private void ValidaUsuario()
        {
            if (Regex.IsMatch(this.TxtBxLogin.Text, "[A-Za-z]"))
            {
                // Administrativo
                UsuarioLogado = new BllAdmUsuario().ValidaUsuario(this.TxtBxLogin.Text);

                if (UsuarioLogado.IdUsuario == 0)
                {
                    MessageBox(this, "Usuário não encontrado!");
                    this.TxtBxLogin.Focus();
                }
                else
                {
                    this.ImgBttnConfirma1.Visible = false;
                    this.ImgBttnConfirma2.Visible = true;
                    this.divSenha.Visible         = true;
                    TxtBxSenha.Focus();
                    TxtBxLogin.Enabled           = false;
                    LNKBttnTrocarUsuario.Visible = true;
                    LnkBttnSenha.Visible         = true;
                }
            }
            else
            {
                if (StringUtils.OnlyNumbers(this.TxtBxLogin.Text).Length == 11)
                {
                    // CPF

                    if (!StringUtils.ValidaCPF(StringUtils.OnlyNumbers(this.TxtBxLogin.Text)))
                    {
                        MessageBox(this, "CPF Inválido!");
                        TxtBxLogin.Focus();
                    }
                    else
                    {
                        ValidaEmpresa();
                    }
                }
                else if (StringUtils.OnlyNumbers(this.TxtBxLogin.Text).Length == 14)
                {
                    // CNPJ

                    if (!StringUtils.ValidaCNPJ(StringUtils.OnlyNumbers(this.TxtBxLogin.Text)))
                    {
                        MessageBox(this, "CNPJ Inválido!");
                        TxtBxLogin.Focus();
                    }
                    else
                    {
                        ValidaEmpresa();
                    }
                }
                else
                {
                    MessageBox(this, "CPF/CNPJ Inválido!");
                    TxtBxLogin.Focus();
                }
            }
        }
 public void LoginError()
 {
     //Mensagem apresentando que não foi possível seguir com o login
     MessageBox.Show("Login e senha não coincide", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     //Limpa caixa de texto do login e senha
     TxtBxLogin.Clear();
     TxtBxPassword.Clear();
     //chama o foco para a caixa de texto do login
     TxtBxLogin.Focus();
 }
Exemple #3
0
 protected void LNKBttnTrocarUsuario_Click(object sender, EventArgs e)
 {
     this.ImgBttnConfirma1.Visible = true;
     this.ImgBttnConfirma2.Visible = false;
     this.divSenha.Visible         = false;
     TxtBxSenha.Text    = "";
     TxtBxLogin.Enabled = true;
     TxtBxLogin.Text    = "";
     TxtBxLogin.Focus();
     LNKBttnTrocarUsuario.Visible = false;
     LnkBttnSenha.Visible         = false;
 }
Exemple #4
0
        private void ValidaUsuario()
        {
            if (Regex.IsMatch(this.TxtBxLogin.Text, "[A-Za-z]"))
            {
                // Administrativo
                UsuarioLogado = new BllAdmUsuario().ValidaUsuario(this.TxtBxLogin.Text);

                if (UsuarioLogado.IdUsuario == 0)
                {
                    MessageBox(this, "Usuário não encontrado!");
                    this.TxtBxLogin.Focus();
                }
                else
                {
                    this.ImgBttnConfirma1.Visible = false;
                    this.ImgBttnConfirma2.Visible = true;
                    this.divSenha.Visible         = true;
                    TxtBxSenha.Focus();
                    TxtBxLogin.Enabled           = false;
                    LNKBttnTrocarUsuario.Visible = true;
                    LnkBttnSenha.Visible         = true;
                    LblSenha.Visible             = true;
                }
            }
            else
            {
                if (StringUtils.OnlyNumbers(this.TxtBxLogin.Text).Length == 11)
                {
                    // CPF
                    MessageBox(this, "Somente empresas com CNPJ podem participar deste programa. Acesse o Portal do SEBRAE (www.sebrae.com.br) e encontre uma solução adequada à sua empresa.");
                    TxtBxLogin.Focus();
                }
                else if (StringUtils.OnlyNumbers(this.TxtBxLogin.Text).Length == 14)
                {
                    // CNPJ

                    if (!StringUtils.ValidaCNPJ(StringUtils.OnlyNumbers(this.TxtBxLogin.Text)))
                    {
                        MessageBox(this, "CNPJ Inválido!");
                        TxtBxLogin.Focus();
                    }
                    else
                    {
                        ValidaEmpresa();
                    }
                }
                else
                {
                    MessageBox(this, "CNPJ Inválido!");
                    TxtBxLogin.Focus();
                }
            }
        }