示例#1
0
        public TList_Cad_Campo_Tabela Select(TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_Cad_Campo_Tabela lista = new TList_Cad_Campo_Tabela();
            SqlDataReader          reader;
            bool podeFecharBco = false;

            if (Banco_Dados == null)
            {
                this.CriarBanco_Dados(false);
                podeFecharBco = true;
            }
            try
            {
                reader = ExecutarBusca(SqlCodeBusca(vBusca, vTop, vNM_Campo));

                while (reader.Read())
                {
                    TRegistro_Cad_Campo_Tabela reg = new TRegistro_Cad_Campo_Tabela();

                    if (!reader.IsDBNull(reader.GetOrdinal("Tabela")))
                    {
                        reg.NM_Tabela = reader.GetString(reader.GetOrdinal("Tabela"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Campo")))
                    {
                        reg.NM_Campo = reader.GetString(reader.GetOrdinal("Campo"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Existe")))
                    {
                        reg.ST_Existe = reader.GetString(reader.GetOrdinal("Existe"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Chave_Estrangeira")))
                    {
                        reg.Chave_Estrangeira = reader.GetString(reader.GetOrdinal("Chave_Estrangeira"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            };
            return(lista);
        }
示例#2
0
        public void Adiciona_Tree(TreeView treeBase)
        {
            treeBase.Nodes.Clear();

            //ADICIONA OS DADOS
            TList_Cad_Amarracoes lista = TCN_Cad_Amarracoes.Busca(0, (BS_Consulta.Current as TRegistro_Cad_Consulta).ID_Consulta);

            //BUSCA OS CAMPOS DAS TABELAS AMARRADAS
            for (int i = 0; i < lista.Count; i++)
            {
                //CRIO O GROUP BOX DAS TABELAS
                TreeNode node = new TreeNode();
                node.NodeFont = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);
                node.Text     = lista[i].NM_Tabela.ToString();
                node.Name     = lista[i].ID_Amarracoes.ToString();
                treeBase.Nodes.AddRange(new TreeNode[] { node });

                //CRIO O LIST
                TList_Cad_Campo_Tabela listaCampo = busca_Campos(lista[i].NM_Tabela);

                if (listaCampo != null)
                {
                    TreeNode[] treeNode = new TreeNode[listaCampo.Count];

                    for (int x = 0; x < listaCampo.Count; x++)
                    {
                        TreeNode nodeFilho = new TreeNode();
                        nodeFilho.Text = listaCampo[x].NM_Campo.Trim().ToString();

                        if (listaCampo[x].Chave_Estrangeira == "S")
                        {
                            nodeFilho.ForeColor = Color.Red;
                        }

                        treeNode[x] = nodeFilho;
                        //treeBase.Nodes[i].Nodes.Add(listaCampo[x].NM_Campo.Trim());
                    }

                    if (listaCampo.Count > 0)
                    {
                        treeBase.Nodes[i].Nodes.AddRange(treeNode);
                    }
                }
            }

            treeBase.ExpandAll();
        }
示例#3
0
        public void monta_Aba_Campo()
        {
            flowLayoutCampo.Controls.Clear();

            //BUSCA AS TABELAS QUE ESTÃO AMARRADAS
            TList_Cad_Amarracoes listaAmarracoes = TCN_Cad_Amarracoes.Busca(0, (BS_Consulta.Current as TRegistro_Cad_Consulta).ID_Consulta);

            //BUSCA OS CAMPOS DAS TABELAS AMARRADAS
            for (int i = 0; i < listaAmarracoes.Count; i++)
            {
                //CRIO O CHECKLIST DAS TABELAS
                GroupBox groupBox = new GroupBox();
                groupBox.Text = listaAmarracoes[i].NM_Tabela;
                CheckedListBoxDefault checkTabela = new CheckedListBoxDefault();
                checkTabela.CheckOnClick = true;
                TList_Cad_Campo_Tabela listaCampo = busca_Campos(listaAmarracoes[i].NM_Tabela);

                if (listaCampo != null)
                {
                    for (int x = 0; x < listaCampo.Count; x++)
                    {
                        checkTabela.Items.Add(listaCampo[x].NM_Campo.Trim());
                        checkTabela.Name = listaCampo[x].NM_Tabela;

                        if (listaCampo[x].ST_Existe == "S")
                        {
                            checkTabela.SetItemChecked(x, true);
                        }
                    }
                }

                //ADD O CHECKLISTBOX PARA O GROUP BOX
                checkTabela.Dock = DockStyle.Fill;
                groupBox.Controls.Add(checkTabela);
                flowLayoutCampo.Controls.Add(groupBox);
            }
        }
示例#4
0
        public TList_Cad_Campo_Tabela busca_Campos(string vNM_Tabela)
        {
            TList_Cad_Campo_Tabela lista = TCN_Cad_Campo_Tabela.Busca(vNM_Tabela, (BS_Consulta.Current as TRegistro_Cad_Consulta).ID_Consulta);

            return(lista);
        }