Esempio 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();
                }
            }
        }
Esempio n. 2
0
        protected void grdSimplificado_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Int32 IdQuestionarioEmpresa = StringUtils.ToInt(grdSimplificado.DataKeys[0].Value.ToString());

            ImageButton ImgBttnClassificar = ((ImageButton)grdSimplificado.Rows[e.RowIndex].FindControl("ImgBttnClassificar"));
            CheckBox    ChckBxClassificar  = ((CheckBox)grdSimplificado.Rows[e.RowIndex].FindControl("ChckBxClassificar"));

            if (ChckBxClassificar.Checked)
            {
                ImgBttnClassificar.ImageUrl = "~/Image/unchecked.gif";
                DropDownList DrpDwnLstSenior       = ((DropDownList)grdSimplificado.Rows[e.RowIndex].FindControl("DrpDwnLstSenior"));
                DropDownList DrpDwnLstAcompanhante = ((DropDownList)grdSimplificado.Rows[e.RowIndex].FindControl("DrpDwnLstAcompanhante"));
                ImageButton  ImgBttnGravar         = ((ImageButton)grdSimplificado.Rows[e.RowIndex].FindControl("ImgBttnGravar"));

                DrpDwnLstSenior.Visible       = false;
                DrpDwnLstAcompanhante.Visible = false;
                ImgBttnGravar.Visible         = false;
                ChckBxClassificar.Checked     = false;

                //Passa para etapa anterior pois não é mais vencedor
                EntQuestionarioEmpresa objQuestionarioEmpresa = new EntQuestionarioEmpresa();
                Label lblIdEmpresaCadastro = ((Label)grdSimplificado.Rows[e.RowIndex].FindControl("lblIdEmpresaCadastro"));

                objQuestionarioEmpresa.IdQuestionarioEmpresa             = IdQuestionarioEmpresa;
                objQuestionarioEmpresa.EmpresaCadastro.IdEmpresaCadastro = StringUtils.ToInt(lblIdEmpresaCadastro.Text);
                objQuestionarioEmpresa.Usuario.IdUsuario           = IdUsuarioLogado;
                objQuestionarioEmpresa.Questionario.IdQuestionario = (Int32)UCFiltroRanking1.GetFiltro(int.Parse(Request["TipoEtapaId"])).Questionario;
                objQuestionarioEmpresa.Etapa.TipoEtapa.IdTipoEtapa = (Int32)EnumType.TipoEtapaMpe.ClassificacaoNacional;

                new BllRelatorioRanking().EncaminharEtapaAnterior(objQuestionarioEmpresa.EmpresaCadastro.IdEmpresaCadastro, objQuestionarioEmpresa.Questionario.IdQuestionario, objQuestionarioEmpresa.Etapa.IdEtapa, true);
            }
            else
            {
                ImgBttnClassificar.ImageUrl = "~/Image/checked.gif";
                Label            lblIdEstado           = ((Label)grdSimplificado.Rows[e.RowIndex].FindControl("lblIdEstado"));
                RelFiltroRanking objRelFiltroRanking   = this.UCFiltroRanking1.GetFiltro(int.Parse(Request["TipoEtapaId"]));
                DropDownList     DrpDwnLstSenior       = ((DropDownList)grdSimplificado.Rows[e.RowIndex].FindControl("DrpDwnLstSenior"));
                DropDownList     DrpDwnLstAcompanhante = ((DropDownList)grdSimplificado.Rows[e.RowIndex].FindControl("DrpDwnLstAcompanhante"));
                ImageButton      ImgBttnGravar         = ((ImageButton)grdSimplificado.Rows[e.RowIndex].FindControl("ImgBttnGravar"));

                DrpDwnLstSenior.Visible       = true;
                DrpDwnLstAcompanhante.Visible = true;
                ImgBttnGravar.Visible         = true;
                ChckBxClassificar.Checked     = true;

                List <EntAdmUsuario> ListaUser = new BllAdmUsuario().ObterPorFuncionalidade("Avaliar", int.Parse(lblIdEstado.Text), objPrograma.IdPrograma, objRelFiltroRanking.Turma);
                DrpDwnLstSenior.Items.Clear();
                DrpDwnLstSenior.DataSource = ListaUser;
                DrpDwnLstSenior.DataBind();
                DrpDwnLstSenior.Items.Insert(0, new ListItem("<< Selecionar >>", "0"));
                DrpDwnLstSenior.SelectedValue = "0";

                DrpDwnLstAcompanhante.Items.Clear();
                DrpDwnLstAcompanhante.DataSource = ListaUser;
                DrpDwnLstAcompanhante.DataBind();
                DrpDwnLstAcompanhante.Items.Insert(0, new ListItem("<< Selecionar >>", "0"));
                DrpDwnLstAcompanhante.SelectedValue = "0";
            }
        }
Esempio n. 3
0
        public void Editar(Int32 IdUsuario)
        {
            EntAdmUsuario objUsuario = new BllAdmUsuario().ObterPorId(IdUsuario);

            this.ObjectToPage(objUsuario);
            this.EnableSenha(false);
            this.Show(EnumType.StateIA.Alterar);
        }
Esempio n. 4
0
        private void PopulaGridUsuario()
        {
            EntAdmUsuario objAdmUsuario = new EntAdmUsuario();

            this.PageToObject(objAdmUsuario);

            ListaGrid = new BllAdmUsuario().ObterPorFiltro(objAdmUsuario, objPrograma.IdPrograma);
            this.AtualizaGrid();
        }
Esempio n. 5
0
        private Boolean Gravar()
        {
            EntAtendimento objAtendimento = new EntAtendimento();

            this.PageToObject(objAtendimento);

            try
            {
                //Verifica se é Insert ou Update
                if (objAtendimento.IdAtendimento == 0)
                {
                    Int32 IdEstado = -1;
                    if (UsuarioLogado.IdUsuario > 0)
                    {
                        IdEstado = UsuarioLogado.Estado.IdEstado;
                    }
                    else
                    {
                        IdEstado = EmpresaLogada.Estado.IdEstado;
                    }
                    List <EntAdmUsuario> listUsuario = new BllAdmUsuario().ObterPorFuncionalidade(this.Page.Title, IdEstado, objPrograma.IdPrograma, objTurma.IdTurma);
                    if (listUsuario.Count == 0)
                    {
                        listUsuario = new BllAdmUsuario().ObterTodos();
                    }
                    objAtendimento.UsuarioResponsavel = listUsuario[0];
                    objAtendimento = new BllAtendimento().Inserir(objAtendimento);
                    StringBuilder sMensagem = new StringBuilder();

                    sMensagem.AppendLine("Essa é uma mensagem automática, por favor, não responda.");
                    sMensagem.AppendLine();
                    sMensagem.AppendLine("Foi criado um novo chamado, e o mesmo encontra-se designado para o seu usuário.");
                    sMensagem.AppendLine("Para verificar acesse o link: " + Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + (Request.Url.IsDefaultPort ? "" : ":" + Request.Url.Port) + "/Paginas/Login.aspx");
                    sMensagem.AppendLine();
                    sMensagem.AppendLine("Em caso de dúvida, contate o Gestor do Prêmio MPE Brasil 2011.");
                    sMensagem.AppendLine();
                    sMensagem.AppendLine("Administração MPE.");
                    WebUtils.EnviaEmail(objAtendimento.UsuarioResponsavel.Email, "Chamado de Atendimento MPE", sMensagem);
                    MessageBox(this.Page, "Atendimento inserido com sucesso!");
                }
                else
                {
                    new BllAtendimento().Alterar(objAtendimento);
                    MessageBox(this.Page, "Atendimento alterado com sucesso!");
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox(this.Page, "Erro ao tentar Gravar o Atendimento!");
                return(false);
            }
        }
Esempio n. 6
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();
                }
            }
        }
Esempio n. 7
0
        private void EfetuaLogin(String sLogin, String sSenha)
        {
            if (Regex.IsMatch(this.TxtBxLogin.Text.Substring(0, 1), "[A-Za-z]"))
            {
                // Administrativo
                UsuarioLogado = new BllAdmUsuario().ValidaUsuario(this.TxtBxLogin.Text);

                if (UsuarioLogado.Senha == StringUtils.EncryptPassword(sSenha))
                {
                    FormsAuthentication.RedirectFromLoginPage(UsuarioLogado.IdUsuario.ToString(), false);

                    UsuarioLogado = new BllAdmUsuario().ObterPorPermissoes(UsuarioLogado.IdUsuario, objPrograma.IdPrograma);
                    EmpresaLogada = null;
                    Response.Redirect("~/Paginas/Principal.aspx");
                }
                else
                {
                    MessageBox(this, "Senha não confere!");
                    this.TxtBxSenha.Focus();
                }
            }
            else
            {
                // Empresa
                this.UsuarioLogado = null;
                EmpresaLogada      = new BllEmpresaCadastro().ValidarEmpresa(StringUtils.OnlyNumbers(this.TxtBxLogin.Text), objPrograma.IdPrograma);

                if (EmpresaLogada.ProgramaEmpresa.Senha == StringUtils.EncryptPassword(sSenha))
                {
                    FormsAuthentication.RedirectFromLoginPage(EmpresaLogada.IdEmpresaCadastro.ToString(), false);
                    UsuarioLogado = null;

                    EntInscricoesEmpresa objInscricoesEmpresa = new BllInscricoesEmpresa().ObterPorIdEmpresaPrograma(EmpresaLogada.IdEmpresaCadastro, objPrograma.IdPrograma);

                    if (objInscricoesEmpresa.TurmaEmpresa.EmpresaCadastro.IdEmpresaCadastro > 0 && objInscricoesEmpresa.TurmaEmpresa.Turma.IdTurma > 0)
                    {
                        this.EmpresaLogada = objInscricoesEmpresa.TurmaEmpresa.EmpresaCadastro;
                        this.objTurma      = objInscricoesEmpresa.TurmaEmpresa.Turma;
                        Response.Redirect("~/Paginas/Principal.aspx");
                    }
                }
                else
                {
                    MessageBox(this, "Senha não confere!");
                    this.TxtBxSenha.Focus();
                }
            }
        }
Esempio n. 8
0
        protected void grdUsuario_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                DataKey dk = grdUsuario.DataKeys[e.RowIndex];

                EntAdmUsuario objUsuario = new BllAdmUsuario().ObterPorId(ObjectUtils.ToInt(dk.Value));
                objUsuario.Ativo = !objUsuario.Ativo;

                new BllAdmUsuario().Alterar(objUsuario);
                this.PopulaGridUsuario();

                MessageBox(this, "Ação alterado com sucesso!");
            }
            catch (Exception)
            {
            }
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["UserCD"] != null && Request.QueryString["Tipo"] != null)
            {
                int    UserCD   = int.Parse(Request.QueryString["UserCD"]);
                int    Programa = int.Parse(Request.QueryString["Programa"]);
                String Tipo     = Request.QueryString["Tipo"];

                if (Tipo == "Adm")
                {
                    EntAdmUsuario objUsuario = new BllAdmUsuario().ObterPorId(UserCD);

                    if (objUsuario.IdUsuario == 0)
                    {
                        MessageBox(this, "Usuário não encontrado.");
                    }
                    else
                    {
                        // Gerar senha
                        String sNovaSenha = StringUtils.Random(8);
                        objUsuario.Senha = StringUtils.EncryptPassword(sNovaSenha);

                        //Altear a senha do usuário no banco
                        new BllAdmUsuario().AlterarSenha(objUsuario);

                        // Enviar outro email contendo a senha
                        StringBuilder sMensagem = new StringBuilder();

                        sMensagem.AppendLine("Essa é uma mensagem automática, por favor, não responda.");
                        sMensagem.AppendLine();
                        sMensagem.AppendLine("Sua nova senha é: " + sNovaSenha);
                        sMensagem.AppendLine("Acesse o link " + Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + (Request.Url.IsDefaultPort ? "" : ":" + Request.Url.Port) + "/Paginas/Login.aspx para efetuar o login");
                        sMensagem.AppendLine();
                        sMensagem.AppendLine("Administração FGA.");

                        WebUtils.EnviaEmail(objUsuario.Email, "Solicitação de senha FGA", sMensagem);

                        MessageBox(this, "Sua nova senha foi enviada para: " + objUsuario.Email);
                    }
                }
                else if (Tipo == "Empresa")
                {
                    EntInscricoesEmpresa objUsuario = new BllInscricoesEmpresa().ObterPorIdEmpresaPrograma(UserCD, Programa);

                    if (objUsuario.ProgramaEmpresa.IdProgramaEmpresa == 0)
                    {
                        MessageBox(this, "Usuário não encontrado.");
                    }
                    else
                    {
                        // Gerar senha
                        String sNovaSenha = StringUtils.Random(8);
                        objUsuario.ProgramaEmpresa.Senha = StringUtils.EncryptPassword(sNovaSenha);

                        //Altear a senha do usuário no banco
                        new BllProgramaEmpresa().Alterar(objUsuario.ProgramaEmpresa);

                        // Enviar outro email contendo a senha
                        StringBuilder sMensagem = new StringBuilder();

                        sMensagem.AppendLine("Essa é uma mensagem automática, por favor, não responda.");
                        sMensagem.AppendLine();
                        sMensagem.AppendLine("Sua nova senha é: " + sNovaSenha);
                        sMensagem.AppendLine("Acesse o link " + Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + (Request.Url.IsDefaultPort ? "" : ":" + Request.Url.Port) + "/Paginas/Login.aspx para efetuar o login");
                        sMensagem.AppendLine();
                        sMensagem.AppendLine("Administração FGA.");

                        WebUtils.EnviaEmail(objUsuario.ProgramaEmpresa.EmailResponsavel, "Solicitação de senha FGA", sMensagem);

                        MessageBox(this, "Sua nova senha foi enviada para: " + objUsuario.ProgramaEmpresa.EmailResponsavel);
                    }
                }
            }
            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "window.close();", true);
        }
Esempio n. 10
0
        private Boolean Gravar()
        {
            EntAdmUsuario objUsuario = new EntAdmUsuario();

            this.PageToObject(objUsuario);

            try
            {
                //Verifica se é Insert ou Update
                if (objUsuario.IdUsuario == 0)
                {
                    if (new BllAdmUsuario().ExisteUsuario(this.TxtBxLogin.Text))
                    {
                        MessageBox(this.Page, "Login já existente!");
                        return(false);
                    }
                    else
                    if ((StringUtils.OnlyNumbers(this.TxtBxLogin.Text).Length) == (this.TxtBxLogin.Text.Length))
                    {
                        MessageBox(this.Page, "Login deve conter pelomenos uma letra!");
                        return(false);
                    }
                    else
                    if (new BllAdmUsuario().ExisteCPF(StringUtils.OnlyNumbers(this.TxtBxCPF.Text)))
                    {
                        MessageBox(this.Page, "CPF já existente!");
                        return(false);
                    }
                    else
                    {
                        objUsuario = new BllAdmUsuario().Inserir(objUsuario);
                        MessageBox(this.Page, "Usuário inserido com sucesso!");
                    }
                }
                else
                {
                    EntAdmUsuario objUsuarioAux = new BllAdmUsuario().ObterPorId(objUsuario.IdUsuario);

                    if (objUsuarioAux.Login != objUsuario.Login)
                    {
                        if (new BllAdmUsuario().ExisteUsuario(this.TxtBxLogin.Text))
                        {
                            MessageBox(this.Page, "Login já existente!");
                            return(false);
                        }
                        else
                        if ((StringUtils.OnlyNumbers(this.TxtBxLogin.Text).Length) == (this.TxtBxLogin.Text.Length))
                        {
                            MessageBox(this.Page, "Login deve conter pelomenos uma letra!");
                            return(false);
                        }
                    }
                    else
                    {
                        if (objUsuarioAux.CPF != objUsuario.CPF)
                        {
                            if (new BllAdmUsuario().ExisteCPF(StringUtils.OnlyNumbers(this.TxtBxCPF.Text)))
                            {
                                MessageBox(this.Page, "CPF já existente!");
                                return(false);
                            }
                        }
                    }

                    new BllAdmUsuario().Alterar(objUsuario);
                    MessageBox(this.Page, "Usuário alterado com sucesso!");
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox(this.Page, "Erro ao tentar Gravar o Usuário!");
                return(false);
                //logger.Error("Erro ao inserir o EntUsuario!", ex);
            }
        }
Esempio n. 11
0
        protected void grdSimplificado_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int Index = ObjectUtils.ToInt(e.CommandArgument) - (grdSimplificado.PageIndex * grdSimplificado.PageSize);

            if (e.CommandName == "Gravar")
            {
                //Gravar
                DropDownList DrpDwnLstSenior = ((DropDownList)grdSimplificado.Rows[Index].FindControl("DrpDwnLstSenior"));

                if (DrpDwnLstSenior.SelectedIndex == 0)
                {
                    MessageBox(this, "Selecione o Consultor!");
                }
                else
                {
                    Label       lblIdEmpresaCadastro     = ((Label)grdSimplificado.Rows[Index].FindControl("lblIdEmpresaCadastro"));
                    Label       lblIdQuestionarioEmpresa = ((Label)grdSimplificado.Rows[Index].FindControl("lblIdQuestionarioEmpresa"));
                    ImageButton imgBtnSalvar             = ((ImageButton)grdSimplificado.Rows[Index].FindControl("ImgBttnGravar"));
                    int         IdEmpresaCadastro        = StringUtils.ToInt(((Label)this.grdSimplificado.Rows[Index].Cells[1].FindControl("lblIdEmpresaCadastro")).Text);
                    int         IdEtapa = StringUtils.ToInt(((Label)this.grdSimplificado.Rows[Index].Cells[1].FindControl("lblIdEtapa")).Text);

                    RelFiltroRanking objRelFiltroRanking = this.UCFiltroRanking1.GetFiltro(int.Parse(Request["TipoEtapaId"]));
                    foreach (EntQuestionarioEmpresa qe in new BllQuestionarioEmpresa().ObterQuestionarioEmpresaAtivoPorTurmaEmpresa(int.Parse(lblIdEmpresaCadastro.Text), objRelFiltroRanking.Turma))
                    {
                        EntQuestionarioEmpresaAvaliador objQuestionarioEmpresaAvaliador = new EntQuestionarioEmpresaAvaliador();

                        objQuestionarioEmpresaAvaliador.QuestionarioEmpresa.IdQuestionarioEmpresa = qe.IdQuestionarioEmpresa;
                        objQuestionarioEmpresaAvaliador.Usuario.IdUsuario = StringUtils.ToInt(DrpDwnLstSenior.SelectedValue);
                        objQuestionarioEmpresaAvaliador.Avaliado          = false;
                        objQuestionarioEmpresaAvaliador.Primario          = true;

                        new BllQuestionarioEmpresaAvaliador().Inserir(objQuestionarioEmpresaAvaliador);
                    }

                    new BllRelatorioRanking().EncaminharProximaEtapa(IdEmpresaCadastro, (int)EnumType.Questionario.Gestao, IdEtapa, false);

                    DrpDwnLstSenior.Enabled = false;
                    imgBtnSalvar.Visible    = false;
                }
            }
            else
            if (e.CommandName == "Desclassificar")
            {
                Label lblIdQuestionarioEmpresa = ((Label)grdSimplificado.Rows[Index].FindControl("lblIdQuestionarioEmpresa"));
                Label lblFlDesclassificado     = ((Label)grdSimplificado.Rows[Index].FindControl("lblFlDesclassificado"));

                int IdQuestionarioEmpresa = StringUtils.ToInt(lblIdQuestionarioEmpresa.Text);

                if (lblFlDesclassificado.Text == "True")
                {
                    EntQuestionarioEmpresa objQuestionarioEmpresa = new EntQuestionarioEmpresa();
                    objQuestionarioEmpresa.IdQuestionarioEmpresa = int.Parse(lblIdQuestionarioEmpresa.Text);
                    objQuestionarioEmpresa.Excluido = false;
                    new BllQuestionarioEmpresa().AlterarSomenteDesclassificar(objQuestionarioEmpresa);
                }
                else if (lblFlDesclassificado.Text == "False")
                {
                    switch (objPrograma.IdPrograma)
                    {
                    case (int)EnumType.Programa.MPE:
                        this.UCJustificativaRanking1.Show(IdQuestionarioEmpresa, (int)EnumType.TipoEtapaMpe.ClassificaçãoEstadual, EnumType.Questionario.Gestao);
                        break;

                    case (int)EnumType.Programa.FGA:
                        this.UCJustificativaRanking1.Show(IdQuestionarioEmpresa, (int)EnumType.TipoEtapaFga.ValidacaoAnaliseRespostas, EnumType.Questionario.Gestao);
                        break;

                    case (int)EnumType.Programa.PEG:
                        this.UCJustificativaRanking1.Show(IdQuestionarioEmpresa, (int)EnumType.TipoEtapaPeg.ValidacaoAnaliseRespostas, EnumType.Questionario.Gestao);
                        break;

                    default:
                        this.UCJustificativaRanking1.Show(IdQuestionarioEmpresa, (int)EnumType.TipoEtapaMpe.ClassificaçãoEstadual, EnumType.Questionario.Gestao);
                        break;
                    }
                }

                CheckBox ChckBxDesclassificar = ((CheckBox)grdSimplificado.Rows[Index].FindControl("ChckBxDesclassificar"));
                CheckBox ChckBxClassificar    = ((CheckBox)grdSimplificado.Rows[Index].FindControl("ChckBxClassificar"));

                ImageButton imgBttnDesclassificar = ((ImageButton)grdSimplificado.Rows[Index].FindControl("imgBttnDesclassificar"));
                ImageButton ImgBttnClassificar    = ((ImageButton)grdSimplificado.Rows[Index].FindControl("ImgBttnClassificar"));

                if (ChckBxDesclassificar.Checked)
                {
                    imgBttnDesclassificar.ImageUrl = "~/Image/unchecked.gif";
                    ChckBxDesclassificar.Checked   = false;
                    HabilitaDesabilitaBotao(ImgBttnClassificar, true);
                }
                else
                {
                    imgBttnDesclassificar.ImageUrl = "~/Image/checked.gif";
                    ChckBxDesclassificar.Checked   = true;
                    HabilitaDesabilitaBotao(ImgBttnClassificar, false);
                }
            }
            else if (e.CommandName == "Visualizar")
            {
                RelFiltroRanking objRelFiltroRanking = this.UCFiltroRanking1.GetFiltro(int.Parse(Request["TipoEtapaId"]));
                int IdTurma           = objRelFiltroRanking.Turma;
                int IdEmpresaCadastro = StringUtils.ToInt(((Label)grdSimplificado.Rows[Index].FindControl("lblIdQuestionarioEmpresa")).Text);
                this.UCVisualizarAutodiagnosticoInicial1.Visualiar(IdEmpresaCadastro, IdTurma);
            }
            else if (e.CommandName == "Update")
            {
                CheckBox           ChckBxClassificar        = ((CheckBox)grdSimplificado.Rows[Index].FindControl("ChckBxClassificar"));
                Label              lblIdEmpresaCadastro     = ((Label)grdSimplificado.Rows[Index].FindControl("lblIdEmpresaCadastro"));
                Label              lblIdQuestionarioEmpresa = ((Label)grdSimplificado.Rows[Index].FindControl("lblIdQuestionarioEmpresa"));
                Label              lblIdEstado         = ((Label)grdSimplificado.Rows[Index].FindControl("lblIdEstado"));
                Label              lblIdEtapa          = ((Label)grdSimplificado.Rows[Index].FindControl("lblIdEtapa"));
                RelFiltroRanking   objRelFiltroRanking = this.UCFiltroRanking1.GetFiltro(int.Parse(Request["TipoEtapaId"]));
                DropDownList       DrpDwnLstSenior     = ((DropDownList)grdSimplificado.Rows[Index].FindControl("DrpDwnLstSenior"));
                EntEmpresaCadastro objEmpresaCadastro  = new BllEmpresaCadastro().ObterPorId(int.Parse(lblIdEmpresaCadastro.Text));

                if (!ChckBxClassificar.Checked)
                {
                    List <EntAdmUsuario> ListaUser = new BllAdmUsuario().ObterPorFuncionalidade("Avaliações", objEmpresaCadastro.Estado.IdEstado, objPrograma.IdPrograma, objRelFiltroRanking.Turma);
                    DrpDwnLstSenior.Items.Clear();
                    DrpDwnLstSenior.DataSource = ListaUser;
                    DrpDwnLstSenior.DataBind();
                    DrpDwnLstSenior.Items.Insert(0, new ListItem("<< Selecionar >>", "0"));
                    DrpDwnLstSenior.SelectedValue = "0";
                }
                else
                {
                    EntEtapa objEtapa = new BllEtapa().ObterProximaEtapaPorEtapaEstadoOrdem(int.Parse(lblIdEtapa.Text));

                    new BllQuestionarioEmpresaAvaliador().RemoverPorQuestionarioEmpresa(int.Parse(lblIdQuestionarioEmpresa.Text));
                    new BllQuestionarioEmpresa().AlterarSomentePassaProximaEtapa(int.Parse(lblIdQuestionarioEmpresa.Text));
                    new BllQuestionarioEmpresa().DesabilitaAnteriores(int.Parse(lblIdEmpresaCadastro.Text), objEtapa.IdEtapa, EntQuestionario.QUESTIONARIO_GESTAO_2011);
                }
            }
            else if (e.CommandName == "Download")
            {
                Boolean comentarios = false;
                Int32   intro       = 0;
                String  estado      = null;
                String  categoria   = null;
                String  protocolo   = ((Label)grdSimplificado.Rows[Index].Cells[8].Controls[1]).Text;
                Int32   programaId  = objPrograma.IdPrograma;
                Boolean avaliador   = false;
                String  caminho     = "";

                List <EntQuestionarioEmpresa> listQuestionarioEmpresa = new BllQuestionarioEmpresa().ObterPorProtocolo(protocolo);

                if (listQuestionarioEmpresa != null)
                {
                    List <EntEmpresaCadastro> listEmpresaCadastro = new BllEmpresaCadastro().ObterPorIdPrograma(listQuestionarioEmpresa[0].EmpresaCadastro.IdEmpresaCadastro, programaId);

                    if (listEmpresaCadastro != null)
                    {
                        caminho = new PaginaBase().gerarRelatorioPDF(listEmpresaCadastro[0].IdEmpresaCadastro.ToString(), listEmpresaCadastro[0].CPF_CNPJ, listQuestionarioEmpresa[0].IdQuestionarioEmpresa.ToString(), protocolo, estado, categoria, comentarios, programaId, objTurma.IdTurma, BooleanUtils.ToInt(avaliador), intro, false, this.Page);
                        if (caminho != "")
                        {
                            NovaJanela(this.Page, caminho);
                        }
                    }
                }
            }
        }