示例#1
0
        private void DefinirExibicaoModoAssessor()
        {
            ReceberSessaoRequest lReq = new ReceberSessaoRequest();

            lReq.CodigoSessao          = base.CodigoSessao;
            lReq.CodigoSessaoARetornar = base.CodigoSessao;
            ReceberSessaoResponse lRes = ServicoSeguranca.ReceberSessao(lReq);

            if (lRes.StatusResposta == OMS.Library.MensagemResponseStatusEnum.OK &&
                (lRes.Usuario.Perfis.Contains("6")))
            {
                gIdAsessorLogado = lRes.Usuario.CodigoAssessor.ToString();
            }
        }
示例#2
0
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!Page.IsPostBack)
            {
                var lReceberSessao = ServicoSeguranca.ReceberSessao(
                    new ReceberSessaoRequest()
                {
                    CodigoSessao          = base.CodigoSessao,
                    CodigoSessaoARetornar = base.CodigoSessao,
                });

                if (lReceberSessao.StatusResposta == OMS.Library.MensagemResponseStatusEnum.OK)
                {
                    this.litRelAssessor.Visible = !lReceberSessao.Usuario.Perfis.Contains("6");

                    //--> Defindo o valor para posicionamento da grid
                    gIdAsessorLogado = !this.litRelAssessor.Visible ? lReceberSessao.Usuario.CodigoAssessor.ToString() : string.Empty;
                }

                this.PreenchePaisesAtividadesSinacor();

                base.PopularComboComListaGenerica <TipoDePendenciaCadastralInfo>(this.GetTiposPendenciaCadastral, this.rptClientes_FiltroRelatorio_TipoDePendencia);
                base.PopularComboComListaGenerica <PaisesBlackListInfo>(this.GetPaisesBlackListCadastrados, this.rptClientes_FiltroRelatorio_Pais);
                base.PopularComboComListaGenerica <AtividadeIlicitaInfo>(this.GetAtividadesIlicitasCadastradas, this.rptClientes_FiltroRelatorio_AtividadeIlicita);
                base.PopularComboComListaGenerica <PoupeDirectProdutoInfo>(this.GetProdutosPoupe, this.rptClientes_FiltroRelatorio_ProdutosPoupe);

                base.PopularControleComListaDoSinacor(eInformacao.AssessorPadronizado, this.rptRisco_FiltroRelatorio_Assessor); //--> Combo Assessores Sinacor

                this.rptClientes_FiltroRelatorio_Produtos.DataSource = this.GetProdutosCliente;
                this.rptClientes_FiltroRelatorio_Produtos.DataBind();

                this.rptClientes_FiltroAssessor.DataSource = new TransporteRelatorio_017().TraduzirListaConsulta(this.GetListaClientesVinculados);
                this.rptClientes_FiltroAssessor.DataBind();

                this.rptRelatorio018_ClientesAssessor.DataSource = new TransporteRelatorio_017().TraduzirListaConsulta(this.GetListaClientesVinculados);
                this.rptRelatorio018_ClientesAssessor.DataBind();

                base.PopularControleComListaDoSinacor(eInformacao.AssessorPadronizado, this.rptRelatorio018_Assessores); //--> Combo Assessores Sinacor
            }
        }
示例#3
0
        private void ValidaPermissaoDeEdicaoDeClientesPassos3e4()
        {
            string[] lPerfiisComPermissao = ConfigurationManager.AppSettings["PerfiisComPermissaoDeAlterarClientesPasso3e4"].ToString().Split(',');

            //var lPerfiisDoUsuario = ServicoSeguranca.ListarPerfis(
            //    new OMS.Seguranca.Lib.ListarPerfisRequest(){
            //        CodigoSessao = base.CodigoSessao,
            //        IdUsuarioLogado=base.UsuarioLogado.Id,
            //        DescricaoUsuarioLogado = base.UsuarioLogado.Nome
            //    }
            //    );

            var Sessao = ServicoSeguranca.ReceberSessao(new OMS.Seguranca.Lib.ReceberSessaoRequest()
            {
                CodigoSessao           = base.CodigoSessao,
                CodigoSessaoARetornar  = base.CodigoSessao,
                IdUsuarioLogado        = base.UsuarioLogado.Id,
                DescricaoUsuarioLogado = base.UsuarioLogado.Nome
            });

            Boolean lPermissaoParaEditarClientesPasso3e3 = false;

            foreach (var itemUsuario in Sessao.Usuario.Perfis)
            {
                if (lPermissaoParaEditarClientesPasso3e3)
                {
                    break;
                }
                foreach (string itemPermisao in lPerfiisComPermissao)
                {
                    if (itemUsuario == itemPermisao)
                    {
                        lPermissaoParaEditarClientesPasso3e3 = true;
                        break;
                    }
                }
            }

            hdMenuClientesPermissaoAlterarPasso_3_4.Value = lPermissaoParaEditarClientesPasso3e3.ToString();
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.UsuarioLogado == null)
            {
                if (string.IsNullOrEmpty(this.Acao))
                {
                    this.RedirecionarPara("Default.aspx");
                    //Server.Transfer("Login.aspx");
                }
                else
                {
                    this.Response.Clear();

                    this.Response.Write(base.RetornarErroAjax(RESPOSTA_SESSAO_EXPIRADA));

                    this.Response.End();
                }
            }
            else
            {
                ReceberSessaoResponse lResSessao = ServicoSeguranca.ReceberSessao(new ReceberSessaoRequest()
                {
                    CodigoSessao          = this.CodigoSessao,
                    CodigoSessaoARetornar = this.CodigoSessao
                });

                if (!lResSessao.Sessao.EhSessaoDeAdministrador)
                {
                    object[] attrs = this.GetType().GetCustomAttributes(typeof(ValidarSegurancaAttribute), true);

                    if (attrs.Length > 0)
                    {
                        List <ItemSegurancaInfo> list = new List <ItemSegurancaInfo>();

                        list.Add(((ValidarSegurancaAttribute)attrs[0]).Seguranca);
                        ValidarItemSegurancaRequest lRequestSeguranca = new ValidarItemSegurancaRequest()
                        {
                            CodigoSessao   = this.CodigoSessao,
                            ItensSeguranca = list
                        };

                        try
                        {
                            ValidarItemSegurancaResponse lResponseSeguranca = this.ServicoSeguranca.ValidarItemSeguranca(lRequestSeguranca);

                            if (lResponseSeguranca.StatusResposta == MensagemResponseStatusEnum.OK)
                            {
                                if (!lResponseSeguranca.ItensSeguranca[0].Valido.Value)
                                {   //--> Acesso Negado
                                    this.Response.Clear();
                                    this.Response.End();
                                }
                            }
                            else
                            {
                                this.Response.Clear();
                                this.Response.End();
                            }
                        }
                        //catch (CommunicationObjectFaultedException)
                        //{
                        //    Ativador.AbortChannel(this.ServicoSeguranca);
                        //    this.ServicoSeguranca = Ativador.Get<IServicoSeguranca>();
                        //}
                        catch (System.Threading.ThreadAbortException)
                        {
                        }
                        catch (Exception ex)
                        {
                            this.Response.Clear();

                            this.Response.Write(base.RetornarErroAjax(ex.Message));

                            this.Response.End();
                        }
                    }
                }
            }
        }
示例#5
0
        private string ResponderEfetuarLogin()
        {
            string lRetorno;

            string lUsuario, lSenha;

            lUsuario = Request.Form["Usuario"];
            lSenha   = Request.Form["Senha"];

            if (string.IsNullOrEmpty(lUsuario))
            {
                lRetorno = RetornarErroAjax("Campo 'Usuário' é obrigatório");
            }
            else if (string.IsNullOrEmpty(lSenha))
            {
                lRetorno = RetornarErroAjax("Campo 'Senha' é obrigatório");
            }
            else
            {
                AutenticarUsuarioResponse lResponseAutenticacao = null;

                try
                {
                    this.LimparSessionsDoSistema();

                    AutenticarUsuarioRequest lRequestAuth = new AutenticarUsuarioRequest()
                    {
                        Email = lUsuario,                              // Admin
                        Senha = Criptografia.CalculateMD5Hash(lSenha), //123
                        IP    = Request.ServerVariables["REMOTE_ADDR"],
                        CodigoSistemaCliente = "Intranet"
                    };

                    IServicoSeguranca lServico = this.ServicoSeguranca;

                    lResponseAutenticacao = lServico.AutenticarUsuario(lRequestAuth);

                    if (lResponseAutenticacao.StatusResposta != MensagemResponseStatusEnum.OK)
                    {
                        return(RetornarErroAjax(lResponseAutenticacao.DescricaoResposta));
                    }

                    this.CodigoSessao = lResponseAutenticacao.Sessao.CodigoSessao;
                }
                catch (Exception ex)
                {
                    return(RetornarErroAjax(ex.Message));
                }

                var lRetornoSessao = ServicoSeguranca.ReceberSessao(new ReceberSessaoRequest()
                {
                    CodigoSessao          = this.CodigoSessao,
                    CodigoSessaoARetornar = this.CodigoSessao,
                });

                this.Session["Usuario"] = new Usuario()
                {
                    Id              = lRetornoSessao.Usuario.CodigoUsuario.DBToInt32(),
                    Nome            = lRetornoSessao.Usuario.Nome,
                    EmailLogin      = lUsuario,
                    EhAdministrador = lResponseAutenticacao != null ? lResponseAutenticacao.Sessao.EhSessaoDeAdministrador : false,
                    Perfis          = lRetornoSessao.Usuario.Perfis
                };

                lRetorno = base.RetornarSucessoAjax("Intranet/Default.aspx");
            }

            return(lRetorno);
        }