예제 #1
0
        internal LsMenu Listar()
        {
            try
            {
                var m_oMenu = new LsMenu();
                sbSQL.Length = 0;
                sbSQL.Append("SELECT IDPRO018, IDPRO039, IDSUBMENU, NMMENU, NMPAGN");
                sbSQL.Append(" FROM TBPRO039 ");

                oAdapter = ObterDataAdapter(sbSQL.ToString());

                ITableMapping objMapping = oAdapter.TableMappings.Add("Table", LsMenu.tbMenu);
                objMapping.ColumnMappings.Add("IDPRO018", LsMenu.cpCodigoProjeto);
                objMapping.ColumnMappings.Add("IDPRO039", LsMenu.cpCodigo);
                objMapping.ColumnMappings.Add("IDSUBMENU", LsMenu.cpSubMenu);
                objMapping.ColumnMappings.Add("NMMENU", LsMenu.cpNome);
                objMapping.ColumnMappings.Add("NMPAGN", LsMenu.cpPagina);

                oAdapter.Fill(m_oMenu);

                return m_oMenu;
            }
            catch (Exception ex)
            {
                throw new Dor.Util.OperacaoInvalidaBD(ex);
            }
        }
예제 #2
0
        internal LsMenu Listar(string v_sApelidoProjeto, string v_sLogin, long v_iCodigoEmpresa)
        {
            try
            {
                var m_oMenu = new LsMenu();
                sbSQL.Length = 0;
                ////////sbSQL.Append(" SELECT TBPRO039.IDPRO039, TBPRO039.IDSUBMENU, NMMENU, NMFUNC, NMPAGN");
                ////////sbSQL.Append(" FROM (TBPRO018 LEFT JOIN TBPRO039 ON TBPRO018.IDPRO018 = TBPRO039.IDPRO018)");
                ////////sbSQL.Append(" LEFT JOIN TBPRO031 ON TBPRO039.IDPRO039 = TBPRO031.IDPRO039");
                ////////sbSQL.Append(" WHERE DSAPLDPRJT =: DSAPLDPRJT");
                ////////sbSQL.Append(" ORDER BY TBPRO039.IDSUBMENU, NMFUNC, NMMENU");

                if (v_sLogin == "*****@*****.**")
                {
                    sbSQL.Append(" SELECT DISTINCT (IDSUBMENU || menu.IDPRO039 || NMPAGN), menu.IDPRO039, IDSUBMENU, NMMENU, NMFUNC, (projeto.DSURL || NMPAGN) AS NMPAGN , funcao.IDPRO031");
                    sbSQL.Append(" FROM TBPRO031 funcao, TBPRO039 menu, TBPRO018 projeto");
                    sbSQL.Append(" WHERE funcao.IDPRO039 = menu.IDPRO039");
                    sbSQL.Append(" AND menu.IDPRO018 = projeto.IDPRO018");
                    sbSQL.Append(" AND DSAPLDPRJT = :DSAPLDPRJT");

                    sbSQL.Append(" ORDER BY 1");

                    sbSQL = TratarSQLParametroBanco(sbSQL.ToString());

                    oAdapter = ObterDataAdapter(sbSQL.ToString());
                    UtDbNet.AdicionarParametro(oAdapter, "DSAPLDPRJT", v_sApelidoProjeto);
                }
                else
                {
                    sbSQL.Append(" SELECT DISTINCT (IDSUBMENU || menu.IDPRO039 || NMPAGN), ");
                    sbSQL.Append(" menu.IDSUBMENU, menu.IDPRO039, NMMENU, NMFUNC, (projeto.DSURL || NMPAGN) AS NMPAGN  , funcao.IDPRO031 ");
                    sbSQL.Append(" FROM ((((((TBPRO039 menu");
                    sbSQL.Append(" LEFT JOIN TBPRO018 projeto ON projeto.IDPRO018 = menu.IDPRO018)");
                    sbSQL.Append(" LEFT JOIN TBPRO031 funcao   ON funcao.IDPRO018 = menu.IDPRO018 AND funcao.IDPRO039 = menu.IDPRO039)");
                    sbSQL.Append(" LEFT JOIN TBPRO033 perfilfuncao ON perfilfuncao.IDPRO031 = funcao.IDPRO031)");
                    sbSQL.Append(" LEFT JOIN TBPRO016 perfil ON perfil.IDPRO016 = perfilfuncao.IDPRO016)");
                    sbSQL.Append(" LEFT JOIN TBPRO013 usuarioperfilempresa ON usuarioperfilempresa.IDPRO016 = perfil.IDPRO016)");
                    sbSQL.Append(" LEFT JOIN TBPRO012 empresa ON empresa.IDPRO012= usuarioperfilempresa.IDPRO012)");
                    sbSQL.Append(" LEFT JOIN TBPRO015 usuario ON usuario.IDPRO015 = usuarioperfilempresa.IDPRO015");

                    sbSQL.Append(" WHERE DSAPLDPRJT = :DSAPLDPRJT");
                    sbSQL.Append(" AND DSEMAL = :DSEMAL");
                    sbSQL.Append(" AND empresa.IDPRO012 = :IDPRO012");
                    sbSQL.Append(" ORDER BY 1");

                    sbSQL = TratarSQLParametroBanco(sbSQL.ToString());

                    oAdapter = ObterDataAdapter(sbSQL.ToString());
                    UtDbNet.AdicionarParametro(oAdapter, "DSAPLDPRJT", v_sApelidoProjeto);
                    UtDbNet.AdicionarParametro(oAdapter, "DSEMAL", v_sLogin);
                    UtDbNet.AdicionarParametro(oAdapter, "IDPRO012", v_iCodigoEmpresa);
                }

                ITableMapping objMapping = oAdapter.TableMappings.Add("Table", LsMenu.tbMenu);
                objMapping.ColumnMappings.Add("IDPRO018", LsMenu.cpCodigoProjeto);
                objMapping.ColumnMappings.Add("IDPRO039", LsMenu.cpCodigo);
                objMapping.ColumnMappings.Add("IDSUBMENU", LsMenu.cpSubMenu);
                objMapping.ColumnMappings.Add("NMMENU", LsMenu.cpNome);
                objMapping.ColumnMappings.Add("NMFUNC", LsMenu.cpNomeFuncao);
                objMapping.ColumnMappings.Add("NMPAGN", LsMenu.cpPagina);
                objMapping.ColumnMappings.Add("IDPRO031", LsMenu.cpCodigoFuncao);

                oAdapter.Fill(m_oMenu);

                return m_oMenu;
            }
            catch (Exception ex)
            {
                throw new Dor.Util.OperacaoInvalidaBD(ex);
            }
        }
예제 #3
0
        internal LsMenu Listar(long v_iCodigoProjeto)
        {
            try
            {
                var m_oMenu = new LsMenu();
                sbSQL.Length = 0;
                sbSQL.Append("SELECT projeto.IDPRO018, IDPRO039, IDSUBMENU, NMMENU, NMPAGN");
                sbSQL.Append(" FROM TBPRO039 menu INNER JOIN TBPRO018 projeto ON menu.IDPRO018 = projeto.IDPRO018");
                sbSQL.Append(" WHERE projeto.IDPRO018 =:IDPRO018");
                sbSQL.Append(" ORDER BY NMMENU");

                oAdapter = ObterDataAdapter(sbSQL.ToString());
                UtDbNet.AdicionarParametro(oAdapter, "IDPRO018", v_iCodigoProjeto);

                ITableMapping objMapping = oAdapter.TableMappings.Add("Table", LsMenu.tbMenu);
                objMapping.ColumnMappings.Add("IDPRO018", LsMenu.cpCodigoProjeto);
                objMapping.ColumnMappings.Add("IDPRO039", LsMenu.cpCodigo);
                objMapping.ColumnMappings.Add("IDSUBMENU", LsMenu.cpSubMenu);
                objMapping.ColumnMappings.Add("NMMENU", LsMenu.cpNome);
                objMapping.ColumnMappings.Add("NMPAGN", LsMenu.cpPagina);

                oAdapter.Fill(m_oMenu);

                return m_oMenu;
            }
            catch (Exception ex)
            {
                throw new Dor.Util.OperacaoInvalidaBD(ex);
            }
        }