Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 2
0
        private void ValidaEmpresa()
        {
            // Existe Empresa Cadastrada?
            EmpresaLogada = new BllEmpresaCadastro().ValidarEmpresa(StringUtils.OnlyNumbers(this.TxtBxLogin.Text), objPrograma.IdPrograma);


            if (EmpresaLogada.IdEmpresaCadastro == 0)
            {
                MessageBox(this, "Cadastro não encontrado!");
                FormsAuthentication.RedirectFromLoginPage("0", false);
                if (objPrograma.IdPrograma == EntPrograma.PROGRAMA_MPE)
                {
                    objTurma           = new BllTurma().ObterTurmaAtiva(objPrograma.IdPrograma);
                    Session["CpfCnpj"] = StringUtils.OnlyNumbers(TxtBxLogin.Text);
                    //Response.Redirect("CadastroInscricoesEmpresa.aspx?IdEmpresaCadastro=0&CpfCnpj=" + StringUtils.OnlyNumbers(TxtBxLogin.Text) + "&acesso=" + 1);
                }
                else
                {
                    Response.Redirect("CadastroInscricoesEmpresaBasico.aspx?IdEmpresaCadastro=0&CpfCnpj=" + StringUtils.OnlyNumbers(TxtBxLogin.Text));
                }
            }
            else
            {
                this.ImgBttnConfirma1.Visible = false;
                this.ImgBttnConfirma2.Visible = true;
                this.divSenha.Visible         = true;
                TxtBxSenha.Focus();
                TxtBxLogin.Enabled           = false;
                LNKBttnTrocarUsuario.Visible = true;
                LnkBttnSenha.Visible         = true;
            }
        }
Ejemplo n.º 3
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();
                }
            }
        }