/// <summary> /// Método que trata as tabelas de importação e coloca nas tabelas definitivas vinculando com o projeto /// </summary> /// <param name="projeto">Código do projeto a se vincular as tabelas</param> private static void TratarImportacao(int codigo, ref List <Model.Tabela> tabelas, ref List <Model.Campo> campos, ref List <Model.Relacionamento> relacionamentos) { Util.CL_Files.WriteOnTheLog("Importador.TratarImportacao()", Util.Global.TipoLog.DETALHADO); Model.MD_Projeto projeto = new Model.MD_Projeto(codigo); BarraDeCarregamento barraCarregamento = new BarraDeCarregamento(tabelas.Count(), "Importando Tabelas"); barraCarregamento.Show(); TratarTabelas(projeto, ref tabelas, ref barraCarregamento); barraCarregamento.Hide(); barraCarregamento.Dispose(); barraCarregamento = null; barraCarregamento = new BarraDeCarregamento(campos.Count(), "Importando Colunas"); barraCarregamento.Show(); TratarColunas(projeto, ref campos, ref barraCarregamento); barraCarregamento.Hide(); barraCarregamento.Dispose(); barraCarregamento = null; barraCarregamento = new BarraDeCarregamento(relacionamentos.Count(), "Importando Relacionamentos"); barraCarregamento.Show(); TratarRelacionamento(projeto, ref relacionamentos, ref barraCarregamento); projeto = null; barraCarregamento.Hide(); barraCarregamento.Dispose(); barraCarregamento = null; }
/// <summary> /// Método que preenche o corpo do html /// </summary> /// <param name="projeto">Projeto para se preencher o corpo do html</param> /// <param name="builder_tableB">string builder para montar o html</param> private static void PreencheText(Model.MD_Projeto projeto, ref StringBuilder builder_tableB, ref StringBuilder builder_tableR) { Util.CL_Files.WriteOnTheLog("Document.PreencheText", Global.TipoLog.SIMPLES); int quantidade = 0; string sentenca = "SELECT COUNT(1) AS contador FROM " + ClassesGenericas.tabelaBase.DAO.table.Table_Name + " WHERE PROJETO = " + projeto.DAO.Codigo; DbDataReader reader = DataBase.Connection.Select(sentenca); if (reader == null) { return; } while (reader.Read()) { quantidade = int.Parse(reader["contador"].ToString()); } sentenca = ClassesGenericas.tabelaBase.DAO.table.CreateCommandSQLTable() + " WHERE PROJETO = " + projeto.DAO.Codigo + " ORDER BY NOME"; reader = DataBase.Connection.Select(sentenca); if (reader == null) { return; } BarraDeCarregamento barraCarregamento = new BarraDeCarregamento(quantidade, "Criando DER"); barraCarregamento.Show(); builder_tableR.Append("<div class=\"bookmark\">" + Environment.NewLine); while (reader.Read()) { barraCarregamento.AvancaBarra(1); Model.MD_Tabela tabela = new MD_Tabela(int.Parse(reader["CODIGO"].ToString()), projeto.DAO.Codigo); builder_tableB.Append("<a name = \"Table_" + tabela.DAO.Codigo + "\"></a>" + Environment.NewLine); builder_tableB.Append("<div class=\"caption1\">" + tabela.DAO.Nome + "</div>" + Environment.NewLine); builder_tableB.Append("<div class=\"caption2\">Columns</div>" + Environment.NewLine); PreencheColunas(tabela, ref builder_tableB); builder_tableB.Append("<div class=\"caption2\">Relationships</div>" + Environment.NewLine); PreencheRelationships(tabela, ref builder_tableB); builder_tableB.Append("<div class=\"caption2\">Notes</div>" + Environment.NewLine); PreencheNotes(tabela, ref builder_tableB); builder_tableB.Append("<br><br> " + Environment.NewLine); builder_tableR.Append("<a href=\"TableB.html#Table_" + tabela.DAO.Codigo + "\"target=\"body\">" + tabela.DAO.Nome + "</a>" + Environment.NewLine); tabela = null; } builder_tableR.Append("</div>" + Environment.NewLine); barraCarregamento.Hide(); barraCarregamento.Dispose(); barraCarregamento = null; reader.Close(); }