Ejemplo n.º 1
0
        //***********************************************************************************************************************************
        //***********************************************************************************************************************************
        //***********************************************************************************************************************************
        //***********************************************************************************************************************************
        internal static void GravaDestalhesRegras(string nomeTabela, List <string> lsRegras)
        {
            XMLModel.ListaDescricoesModel lsDescricoes    = DAO.DescricaoXMLDAO.Ler();
            XMLModel.DescricaoTabelaModel descricaoTabela = (from ds in lsDescricoes.listaDescricaoTabelas where String.Equals(ds.NomeTabela, nomeTabela, StringComparison.OrdinalIgnoreCase) select ds).DefaultIfEmpty().First();

            if (descricaoTabela != null)
            {
                descricaoTabela.Regras = lsRegras;
            }
            else
            {
                descricaoTabela            = new XMLModel.DescricaoTabelaModel();
                descricaoTabela.NomeTabela = nomeTabela;
                descricaoTabela.Regras     = lsRegras;
                lsDescricoes.listaDescricaoTabelas.Add(descricaoTabela);
            }

            DAO.DescricaoXMLDAO.PersistirAtributos(lsDescricoes);
        }
Ejemplo n.º 2
0
        internal static void DetalhaTabela(TableInfoModel tableInfo, string nomeTabela)
        {
            tableInfo.nomeTabela       = nomeTabela;
            tableInfo.dtDetalheColunas = ListaDestalhesTabelas(tableInfo.nomeTabela);
            tableInfo.dtReferenciasFK  = DAO.TabelasInfoSQLDao.DependenciasFK(tableInfo.nomeTabela);
            tableInfo.schema           = DAO.TabelasInfoSQLDao.SchemaTabela(tableInfo.nomeTabela);
            tableInfo.dtPermissoes     = DAO.TabelasInfoSQLDao.Permissoes(tableInfo.nomeTabela);

            //Chaves Primarias
            DataTable chavesPrimarias = DAO.TabelasInfoSQLDao.ChavesPrimarias(tableInfo.nomeTabela);

            for (int row = 0; row < chavesPrimarias.Rows.Count; row++)
            {
                tableInfo.chavesPrimarias += chavesPrimarias.Rows[row][0].ToString();
                if (row != chavesPrimarias.Rows.Count - 1)
                {
                    tableInfo.chavesPrimarias += ", ";
                }
            }



            XMLModel.ListaDescricoesModel lsDescricoes     = DAO.DescricaoXMLDAO.Ler();
            XMLModel.DescricaoTabelaModel tableDescription = (from ts in lsDescricoes.listaDescricaoTabelas
                                                              where String.Equals(ts.NomeTabela, nomeTabela, StringComparison.OrdinalIgnoreCase)
                                                              select ts).DefaultIfEmpty().First();
            if (tableDescription != null)
            {
                tableInfo.descricaoTabela = tableDescription.Descricao;
                tableInfo.dtRegras        = tableDescription.Regras;
            }
            else
            {
                tableInfo.descricaoTabela = "";
            }
        }