Пример #1
0
    /// <summary>
    ///     ''' Obtem os Sistemas do Usuário.
    ///     ''' </summary>
    ///     ''' <param name="CODFNC"></param>
    ///     ''' <param name="SISTEMAS"></param>
    ///     ''' <returns></returns>
    ///     ''' <remarks>Leon Denis Paiva e Silva [PrimeTeam]</remarks>
    public List <ControleDeAcessoTO.ObterSistemasUsuario> ObterSistemasUsuario(int CODFNC, List <string> SISTEMAS)
    {
        var    DALSQL      = new ControleDeAcessoDALSQL();
        string ListaGrupos = "";
        var    FirstIn     = true;

        SISTEMAS.ForEach(Item =>
        {
            if ((FirstIn))
            {
                FirstIn     = false;
                ListaGrupos = string.Format("UPPER('{0}')", Item);
            }
            else
            {
                ListaGrupos = string.Format("{0}, UPPER('{1}')", ListaGrupos, Item);
            }
        });

        string cmdSql = string.Format(DALSQL.ObterSistemasUsuario(), ListaGrupos);

        var dbCommand = MRT001.GetSqlStringCommand(cmdSql);

        dbCommand.AddWithValue("CODFNC", CODFNC);

        dbCommand.TrataDbCommandUniversal();

        return(MRT001.ExecuteReader(dbCommand).DataReaderParaClasse <ControleDeAcessoTO.ObterSistemasUsuario>());
    }
Пример #2
0
    public List <ControleDeAcessoTO.ObterSistemasPermitidos> ObterSistemasPermitidos(int CODSISINFPORTAL, int CODFNC)
    {
        var    DALSQL = new ControleDeAcessoDALSQL();
        string cmdSql = DALSQL.ObterSistemasPermitidos();
        //
        var dbCommand = MRT001.GetSqlStringCommand(cmdSql);

        //
        dbCommand.AddWithValue("CODSISINFPORTAL", CODSISINFPORTAL);
        dbCommand.AddWithValue("CODFNC", CODFNC);
        //
        dbCommand.TrataDbCommandUniversal();
        return(MRT001.ExecuteReader(dbCommand).DataReaderParaClasse <ControleDeAcessoTO.ObterSistemasPermitidos>());
    }
Пример #3
0
    /// <summary>
    ///     ''' Obtem os controles permitidos de cada tela.
    ///     ''' </summary>
    ///     ''' <returns></returns>
    public List <ControleDeAcessoTO.ObterControles> ObterControlesPermitidos(decimal CODMDUSIS, int CODSISINF, int CODFNC)
    {
        var    DALSQL = new ControleDeAcessoDALSQL();
        string cmdSql = DALSQL.ObterControlesPermitidos();

        var dbCommand = MRT001.GetSqlStringCommand(cmdSql);

        dbCommand.AddWithValue("CODMDUSIS", CODMDUSIS);
        dbCommand.AddWithValue("CODSISINF", CODSISINF);
        dbCommand.AddWithValue("CODFNC", CODFNC);

        dbCommand.TrataDbCommandUniversal();

        return(MRT001.ExecuteReader(dbCommand).DataReaderParaClasse <ControleDeAcessoTO.ObterControles>());
    }
Пример #4
0
    public List <ControleDeAcessoTO.ObterInformacoesUsuario> ObterInformacoesUsuario(int CODFNC, string NOMUSRRCF)
    {
        var    DALSQL = new ControleDeAcessoDALSQL();
        string cmdSql = DALSQL.ObterInformacoesUsuario(CODFNC);
        //
        var dbCommand = MRT001.GetSqlStringCommand(cmdSql);

        //
        if (CODFNC > 0)
        {
            dbCommand.AddWithValue("CODFNC", CODFNC);
        }
        else
        {
            dbCommand.AddWithValue("NOMUSRRCF", NOMUSRRCF);
        }
        //
        dbCommand.TrataDbCommandUniversal();
        return(MRT001.ExecuteReader(dbCommand).DataReaderParaClasse <ControleDeAcessoTO.ObterInformacoesUsuario>());
    }
Пример #5
0
    /// <summary>
    ///     ''' Insere uma nova Relação de Sistemas do Usuário.
    ///     ''' </summary>
    ///     ''' <param name="CODFNC"></param>
    ///     ''' <param name="CODGRPRDESISSMA"></param>
    ///     ''' <returns></returns>
    ///     ''' <remarks>Leon Denis Paiva e Silva [PrimeTeam]</remarks>
    public bool InserirRelacaoSistemaUsuario(int CODFNC, long CODGRPRDESISSMA)
    {
        var DALSQL = new ControleDeAcessoDALSQL();

        string cmdSql = DALSQL.ObterPerfisPorGrupo();

        var dbCommand = MRT001.GetSqlStringCommand(cmdSql);

        bool retorno = false;
        bool inseriu = false;

        dbCommand.AddWithValue("CODGRPRDESISSMA", CODGRPRDESISSMA);

        dbCommand.TrataDbCommandUniversal();

        var Perfis = MRT001.ExecuteReader(dbCommand).DataReaderParaClasse <ControleDeAcessoTO.ObterPerfisPorGrupo>();

        //cmdSql = DALSQL.InserirRelacaoSistemaUsuario();
        cmdSql = DALSQL.AtualizarRelacaoSistemaUsuario();

        foreach (var Item in Perfis)
        {
            dbCommand = MRT001.GetSqlStringCommand(cmdSql);
            dbCommand.AddWithValue("CODGRPRDESISSMA", CODGRPRDESISSMA);
            dbCommand.AddWithValue("CODFNC", CODFNC);
            dbCommand.AddWithValue("CODPFLACS", Item.CODPFLACS);
            dbCommand.AddWithValue("CODGRPRDESISSMA1", CODGRPRDESISSMA);
            inseriu = Convert.ToBoolean(MRT001.ExecuteNonQuery(dbCommand));
            if (inseriu && !retorno)
            {
                retorno = inseriu;
            }
        }

        return(retorno);
    }