Exemplo n.º 1
0
        /// <summary>
        /// Devuelve un simbolo
        /// </summary>
        /// <param name="raiz"></param>
        /// <param name="operClass"></param>
        /// <returns></returns>
        public static Simbolo Interpretar(ParseTreeNode raiz, Operar operClass, TipoRel tipo)
        {
            //Asigna la variable global
            Relacionar.tipo = tipo;

            Simbolo symizq = operClass.Interpretar(raiz.ChildNodes[0]);
            Simbolo symder = operClass.Interpretar(raiz.ChildNodes[2]);

            //ENTERO DOUBLE
            if (symizq.TipoDato == Tipo.INT || symizq.TipoDato == Tipo.DOUBLE)
            {
                return(RelDouble(symizq.TipoDato == Tipo.INT ? (int)symizq.Dato : (double)symizq.Dato, symder));
            }
            if (symizq.TipoDato == Tipo.STRING)
            {
                return(RelString(symizq.Dato.ToString(), symder));
            }
            if (symizq.TipoDato == Tipo.CHAR)
            {
                return(RelChar((char)symizq.Dato, symder));
            }
            if (symizq.TipoDato == Tipo.BOOLEAN)
            {
                return(RelBool((bool)symizq.Dato, symder));
            }
            ////-----------
            if (symder.TipoDato == Tipo.INT || symder.TipoDato == Tipo.DOUBLE)
            {
                return(RelDouble(symder.TipoDato == Tipo.INT ? (int)symder.Dato : (double)symder.Dato, symizq));
            }
            if (symder.TipoDato == Tipo.STRING)
            {
                return(RelString(symder.Dato.ToString(), symizq));
            }
            if (symder.TipoDato == Tipo.CHAR)
            {
                return(RelChar((char)symder.Dato, symizq));
            }
            if (symder.TipoDato == Tipo.BOOLEAN)
            {
                return(RelBool((bool)symder.Dato, symizq));
            }
            return(new Simbolo());
        }
Exemplo n.º 2
0
 protected abstract List <ReportParameter> BuildParamList(TipoRel tRel, bool incCamposEstr);
Exemplo n.º 3
0
 protected abstract List<ReportParameter> BuildParamList(TipoRel tRel, bool incCamposEstr);
Exemplo n.º 4
0
        protected override List<ReportParameter> BuildParamList(TipoRel tRel, bool incCamposEstr)
        {
            List<ReportParameter> parameters = new List<ReportParameter>();

            // NOTA: os parâmetros listados seguem a ordenação das normas
            switch (tRel)
            {
                case TipoRel.InventariosCatalogosPesqDetalhada:
                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.IDNivel,
                        new string[] { "n.ID" },
                        new string[] { },
                        new string[] { "n.isDeleted = 0" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Agrupador,
                        new string[] { "agr.Agrupador" },
                        new string[] { "LEFT JOIN SFRDAgrupador agr ON agr.IDFRDBase = frd.ID" },
                        new string[] { "(agr.isDeleted IS NULL OR agr.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Autores,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Dimensao,
                        new string[] { "sfrdds.Nota" },
                        new string[] { "LEFT JOIN SFRDDimensaoSuporte sfrdds ON sfrdds.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdds.isDeleted IS NULL OR sfrdds.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.CotaDocumento,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.UFsAssociadas,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.HistAdministrativaBiografica,
                        new string[] {  },
                        new string[] {  },
                        new string[] {  },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.FonteImediataAquisicaoTransferencia,
                        new string[] { "sfrdc.FonteImediataDeAquisicao" },
                        new string[] { "LEFT JOIN SFRDContexto sfrdc ON sfrdc.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdc.isDeleted IS NULL OR sfrdc.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.HistoriaArquivistica,
                        new string[] { "sfrdc.HistoriaCustodial" },
                        new string[] { "LEFT JOIN SFRDContexto sfrdc ON sfrdc.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdc.isDeleted IS NULL OR sfrdc.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.TipologiaInformacional,
                        new string[] { },
                        new string[] { },
                        new string[] { "ca.IDTipoNoticiaAut = 5" },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Diplomas,
                        new string[] { },
                        new string[] { },
                        new string[] { "ca.IDTipoNoticiaAut = 7 AND idx.Selector IS NULL" },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Modelos,
                        new string[] { },
                        new string[] { },
                        new string[] { "ca.IDTipoNoticiaAut = 8 AND idx.Selector IS NULL" },
                        ReportParameter.ReturnType.List));

                    if (incCamposEstr)
                    {
                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_RequerentesIniciais,
                            new string[] { },
                            new string[] { },
                            new string[] { },
                            ReportParameter.ReturnType.List));

                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_RequerentesAverbamentos,
                            new string[] { },
                            new string[] { },
                            new string[] { },
                            ReportParameter.ReturnType.List));

                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_DesignacaoNumPoliciaAct,
                            new string[] { },
                            new string[] { },
                            new string[] { },
                            ReportParameter.ReturnType.List));

                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_DesignacaoNumPoliciaAntigo,
                            new string[] { },
                            new string[] { },
                            new string[] { },
                            ReportParameter.ReturnType.List));

                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_TipoObra,
                            new string[] { "lo.TipoObra" },
                            new string[] { "LEFT JOIN LicencaObra lo ON lo.IDFRDBase = frd.ID AND lo.isDeleted = 0" },
                            new string[] { },
                            ReportParameter.ReturnType.TextOnly));

                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_PropHorizontal,
                            new string[] { "lo.PropriedadeHorizontal" },
                            new string[] { "LEFT JOIN LicencaObra lo ON lo.IDFRDBase = frd.ID AND lo.isDeleted = 0" },
                            new string[] { },
                            ReportParameter.ReturnType.TextOnly));

                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_TecnicoObra,
                            new string[] { },
                            new string[] { },
                            new string[] { },
                            ReportParameter.ReturnType.List));

                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_AtestHabit,
                            new string[] { },
                            new string[] { },
                            new string[] { },
                            ReportParameter.ReturnType.List));

                        parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.LO_DataLicConst,
                            new string[] { },
                            new string[] { },
                            new string[] { },
                            ReportParameter.ReturnType.List));
                    }

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.ConteudoInformacional,
                        new string[] { "ce.ConteudoInformacional" },
                        new string[] { "LEFT JOIN SFRDConteudoEEstrutura ce ON ce.IDFRDBase = frd.ID" },
                        new string[] { "(ce.isDeleted IS NULL OR ce.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.DiplomaLegal,
                        new string[] { },
                        new string[] { },
                        new string[] { "ca.IDTipoNoticiaAut = 7 AND idx.Selector = 1" },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.RefTab,
                        new string[] { "sfrda.RefTabelaAvaliacao" },
                        new string[] { "LEFT JOIN SFRDAvaliacao sfrda ON sfrda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrda.isDeleted IS NULL OR sfrda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.DestinoFinal,
                        new string[] { "CASE sfrda.Preservar WHEN 0 THEN 'Eliminação' WHEN 1 THEN 'Conservação' ELSE '' END 'Preservar'" },
                        new string[] { "LEFT JOIN SFRDAvaliacao sfrda ON sfrda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrda.isDeleted IS NULL OR sfrda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Prazo,
                        new string[] { "sfrda.PrazoConservacao" },
                        new string[] { "LEFT JOIN SFRDAvaliacao sfrda ON sfrda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrda.isDeleted IS NULL OR sfrda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Publicado,
                        new string[] { "CASE sfrda.Publicar WHEN 1 THEN 'Sim' ELSE 'Não' END 'Publicado'" },
                        new string[] { "LEFT JOIN SFRDAvaliacao sfrda ON sfrda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrda.isDeleted IS NULL OR sfrda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.ObservacoesEnquadramentoLegal,
                        new string[] { "sfrda.Observacoes" },
                        new string[] { "LEFT JOIN SFRDAvaliacao sfrda ON sfrda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrda.isDeleted IS NULL OR sfrda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Incorporacoes,
                        new string[] { "ce.Incorporacao" },
                        new string[] { "LEFT JOIN SFRDConteudoEEstrutura ce ON ce.IDFRDBase = frd.ID" },
                        new string[] { "(ce.isDeleted IS NULL OR ce.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.TradicaoDocumental,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Ordenacao,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.ObjectosDigitais,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.CondicoesAcesso,
                        new string[] { "sfrdcda.CondicaoDeAcesso" },
                        new string[] { "LEFT JOIN SFRDCondicaoDeAcesso sfrdcda ON sfrdcda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdcda.isDeleted IS NULL OR sfrdcda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.CondicoesReproducao,
                        new string[] { "sfrdcda.CondicaoDeReproducao" },
                        new string[] { "LEFT JOIN SFRDCondicaoDeAcesso sfrdcda ON sfrdcda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdcda.isDeleted IS NULL OR sfrdcda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Lingua,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Alfabeto,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.FormaSuporteAcondicionamento,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.MaterialSuporte,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.TecnicaRegisto,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.EstadoConservacao,
                        new string[] { "tedc.Designacao" },
                        new string[] { "LEFT JOIN SFRDCondicaoDeAcesso sfrdcda ON sfrdcda.IDFRDBase = frd.ID", 
	                            "LEFT JOIN SFRDEstadoDeConservacao sfrdedc ON sfrdedc.IDFRDBase = sfrdcda.IDFRDBase", 
	                            "LEFT JOIN TipoEstadoDeConservacao tedc ON tedc.ID = sfrdedc.IDTipoEstadoDeConservacao" },
                        new string[] { "(sfrdcda.isDeleted IS NULL OR sfrdcda.isDeleted = 0)", 
	                            "(sfrdedc.isDeleted IS NULL OR sfrdedc.isDeleted = 0)", 
	                            "(tedc.isDeleted IS NULL OR tedc.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.InstrumentosPesquisa,
                        new string[] { "sfrdcda.AuxiliarDePesquisa" },
                        new string[] { "LEFT JOIN SFRDCondicaoDeAcesso sfrdcda ON sfrdcda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdcda.isDeleted IS NULL OR sfrdcda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.ExistenciaLocalizacaoOriginais,
                        new string[] { "sfrdda.ExistenciaDeOriginais" },
                        new string[] { "LEFT JOIN SFRDDocumentacaoAssociada sfrdda ON sfrdda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdda.isDeleted IS NULL OR sfrdda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.ExistenciaLocalizacaoCopias,
                        new string[] { "sfrdda.ExistenciaDeCopias" },
                        new string[] { "LEFT JOIN SFRDDocumentacaoAssociada sfrdda ON sfrdda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdda.isDeleted IS NULL OR sfrdda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.UnidadesDescricaoAssociadas,
                        new string[] { "sfrdda.UnidadesRelacionadas" },
                        new string[] { "LEFT JOIN SFRDDocumentacaoAssociada sfrdda ON sfrdda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdda.isDeleted IS NULL OR sfrdda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.NotaPublicacao,
                        new string[] { "sfrdda.NotaDePublicacao" },
                        new string[] { "LEFT JOIN SFRDDocumentacaoAssociada sfrdda ON sfrdda.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdda.isDeleted IS NULL OR sfrdda.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Notas,
                        new string[] { "sfrdng.NotaGeral" },
                        new string[] { "LEFT JOIN SFRDNotaGeral sfrdng ON sfrdng.IDFRDBase = frd.ID" },
                        new string[] { "(sfrdng.isDeleted IS NULL OR sfrdng.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.NotaArquivista,
                        new string[] { "frd.NotaDoArquivista" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.RegrasConvenções,
                        new string[] { "RegrasOuConvencoes" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelInvCatPesqDet(ReportParameterRelInvCatPesqDet.CamposRelInvCatPesqDet.Indexacao,
                        new string[] { },
                        new string[] { },
                        new string[] { "(ca.IDTipoNoticiaAut = 1 OR ca.IDTipoNoticiaAut = 2 OR ca.IDTipoNoticiaAut = 3)" },
                        ReportParameter.ReturnType.List));
                    break;
                case TipoRel.UnidadesFisicas:
                    parameters.Add(new ReportParameterRelPesqUF(ReportParameterRelPesqUF.CamposRelPesqUF.GuiaIncorporacao,
                        new string[] { "nuf.GuiaIncorporacao" },
                        new string[] { "LEFT JOIN NivelUnidadeFisica nuf ON nuf.ID = nd.ID" },
                        new string[] { "(nuf.isDeleted IS NULL OR nuf.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelPesqUF(ReportParameterRelPesqUF.CamposRelPesqUF.CotaCodigoBarras,
                        new string[] { "c.Cota", "nuf.CodigoBarras" },
                        new string[] { 
                            "LEFT JOIN NivelUnidadeFisica nuf ON nuf.ID = nd.ID", 
                            "LEFT JOIN SFRDUFCota c ON c.IDFRDBase = frd.ID" },
                        new string[] { 
                            "(nuf.isDeleted IS NULL OR nuf.isDeleted = 0)", 
                            "(c.isDeleted IS NULL OR c.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelPesqUF(ReportParameterRelPesqUF.CamposRelPesqUF.DatasProducao,
                        new string[] { "dp.InicioAno", "dp.InicioMes", "dp.InicioDia", "dp.InicioAtribuida", "dp.FimAno", "dp.FimMes", "dp.FimDia", "dp.FimAtribuida" },
                        new string[] { "LEFT JOIN SFRDDatasProducao dp ON dp.IDFRDBase = frd.ID" },
                        new string[] { "(dp.isDeleted IS NULL OR dp.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelPesqUF(ReportParameterRelPesqUF.CamposRelPesqUF.TipoDimensoes,
                        new string[] { "ta.Designacao", "df.MedidaAltura", "df.MedidaLargura", "df.MedidaProfundidade" },
                        new string[] { 
                            "LEFT JOIN SFRDUFDescricaoFisica df ON df.IDFRDBase = frd.ID", 
                            "LEFT JOIN TipoAcondicionamento ta ON ta.ID = df.IDTipoAcondicionamento" },
                        new string[] { 
                            "(df.isDeleted IS NULL OR df.isDeleted = 0)", 
                            "(ta.isDeleted IS NULL OR ta.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelPesqUF(ReportParameterRelPesqUF.CamposRelPesqUF.UltimaAlteracao,
                        new string[] { "DataEdicao.de" },
                        new string[] { 
                            "LEFT JOIN (" +
		                        "SELECT frd.ID, MAX(ddd.DataEdicao) de " +
		                        "FROM #ReportParametersUnidadesFisicas report " +
                                    "INNER JOIN FRDBase frd ON frd.IDNivel = report.ID " +
			                        "INNER JOIN FRDBaseDataDeDescricao ddd ON ddd.IDFRDBase = frd.ID " +
		                        "WHERE frd.isDeleted = 0 " +
			                        "AND ddd.isDeleted = 0 " +
		                        "GROUP BY frd.ID " +
	                        ") DataEdicao ON DataEdicao.ID = frd.ID" },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelPesqUF(ReportParameterRelPesqUF.CamposRelPesqUF.ConteudoInformacional,
                        new string[] { "ce.ConteudoInformacional" },
                        new string[] { "LEFT JOIN SFRDConteudoEEstrutura ce ON ce.IDFRDBase = frd.ID" },
                        new string[] { "(ce.isDeleted IS NULL OR ce.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelPesqUF(ReportParameterRelPesqUF.CamposRelPesqUF.UnidadesInformacionaisAssociadas,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));
                    
                    parameters.Add(new ReportParameterRelPesqUF(ReportParameterRelPesqUF.CamposRelPesqUF.Eliminada,
                        new string[] { "nuf.Eliminado", "AutosEliminacao = LEFT(o1.list, LEN(o1.list)-1)" },
                        new string[] { "LEFT JOIN NivelUnidadeFisica nuf ON nuf.ID = nd.ID",  
                                      @"CROSS APPLY ( 
                                            SELECT CONVERT(VARCHAR(200), autos.Designacao) + '; ' AS [text()]
                                            FROM (
                                                SELECT ae.Designacao
                                                FROM SFRDUFAutoEliminacao ufae
                                                    INNER JOIN AutoEliminacao ae ON ae.ID = ufae.IDAutoEliminacao AND ae.isDeleted = 0
                                                WHERE ufae.isDeleted = 0 AND ufae.IDFRDBase = frd.ID
                                                UNION
                                                SELECT ae.Designacao
                                                FROM SFRDUnidadeFisica sfrduf
                                                    INNER JOIN FRDBase frdNvlDoc ON frdNvlDoc.ID = sfrduf.IDFRDBase AND frdNvlDoc.isDeleted = 0
	                                                INNER JOIN SFRDAvaliacao av ON av.IDFRDBase = frdNvlDoc.ID AND av.isDeleted = 0
	                                                INNER JOIN AutoEliminacao ae ON ae.ID = av.IDAutoEliminacao AND ae.isDeleted = 0
                                                WHERE sfrduf.isDeleted = 0 AND sfrduf.IDNivel = frd.IDNivel
                                            ) autos
                                            GROUP BY autos.Designacao
                                            FOR XML PATH('') 
                                        ) o1 (list)" },
                        new string[] { "(nuf.isDeleted IS NULL OR nuf.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    break;
                case TipoRel.EntidadesProdutoras:
                    // quando uma EP é criada não é atribuido o tipo de entidade produtora só quando é gravada pela 
                    // 2ª vez (a 1ª é no masterpanel e a 2ª vez é quando se des-selecciona a EP); o LEFT JOIN (em 
                    // vez do INNER JOIN) é para prever o caso de algo de errado acontecer durante o 2º save e o 
                    // tipo não ser atribuído
                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.TipoEntidadeProdutora,
                        new string[] { "tep.Designacao" },
                        new string[] { 
                            "LEFT JOIN ControloAutEntidadeProdutora caep ON caep.IDControloAut = ca.ID ",
                            "LEFT JOIN TipoEntidadeProdutora tep ON tep.ID = caep.IDTipoEntidadeProdutora " },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.FormaParalela,
                        new string[] { },
                        new string[] { },
                        new string[] { "cad.IDTipoControloAutForma = 2" },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.FormaNormalizada,
                        new string[] { },
                        new string[] { },
                        new string[] { "cad.IDTipoControloAutForma = 3" },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.OutrasFormas,
                        new string[] { },
                        new string[] { },
                        new string[] { "cad.IDTipoControloAutForma = 4" },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.IdentificadorUnico,
                        new string[] { "ca.ChaveColectividade" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.DatasExistencia,
                        new string[] { "cade.InicioAno", "cade.InicioMes", "cade.InicioDia", "cade.InicioAtribuida", "cade.FimAno", "cade.FimMes", "cade.FimDia", "cade.FimAtribuida", "cade.DescDatasExistencia" },
                        new string[] { "LEFT JOIN ControloAutDatasExistencia cade ON cade.IDControloAut = ca.ID" },
                        new string[] { "(cade.isDeleted IS NULL OR cade.isDeleted = 0)" },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.Historia,
                        new string[] { "ca.DescHistoria" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.ZonaGeografica,
                        new string[] { "ca.DescZonaGeografica" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.EstatutoLegal,
                        new string[] { "ca.DescEstatutoLegal" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.FuncoesOcupacoesActividades,
                        new string[] { "ca.DescOcupacoesActividades" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.EnquadramentoLegal,
                        new string[] { "ca.DescEnquadramentoLegal" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.EstruturaInterna,
                        new string[] { "ca.DescEstruturaInterna" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.ContextoGeral,
                        new string[] { "ca.DescContextoGeral" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.OutrasInformacoesRelevantes,
                        new string[] { "ca.DescOutraInformacaoRelevante" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.Relacoes,
                        new string[] { },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.List));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.RegrasConvencoes,
                        new string[] { "ca.RegrasConvencoes" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.Validado,
                        new string[] { "CASE ca.Autorizado WHEN 1 THEN 'Sim' ELSE 'Não' END 'Autorizado'" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.Completo,
                        new string[] { "CASE ca.Completo WHEN 1 THEN 'Sim' ELSE 'Não' END 'Completo'" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.LinguaAlfabeto,
                        new string[] {
                            "Iso639.LanguageNameEnglish",
                            "Iso15924.ScriptNameEnglish" },
                        new string[] { 
                            "LEFT JOIN Iso639 ON Iso639.ID = IDIso639p2", 
                            "LEFT JOIN Iso15924 ON Iso15924.ID = ca.IDIso15924" },
                        new string[] { 
                            "(Iso639.isDeleted IS NULL OR Iso639.isDeleted = 0)",
                            "(Iso15924.isDeleted IS NULL OR Iso15924.isDeleted = 0)"},
                        ReportParameter.ReturnType.TextOnly));

                    parameters.Add(new ReportParameterRelEPs(ReportParameterRelEPs.CamposRelEPs.FontesObservacoes,
                        new string[] { "ca.Observacoes" },
                        new string[] { },
                        new string[] { },
                        ReportParameter.ReturnType.TextOnly));
                    break;
            }

            return parameters;
        }