/// <summary> /// Método que gera as classes de um projeto /// </summary> /// <param name="projeto"></param> public void GerarClasses(Model.MD_Projeto projeto) { Util.CL_Files.WriteOnTheLog("FO_Principal.GerarClasses()", Util.Global.TipoLog.DETALHADO); string mensagemErro = string.Empty; List <Model.MD_Tabela> tabelas = projeto.GetTabelasProjeto(); List <Model.MD_Tabela> tabelas_erro = projeto.GetTabelasProjeto(); bool houveErro = false; if (tabelas.Count < 1) { Message.MensagemAlerta("Não há tabelas cadastradas para o projeto selecionado!"); } else { BarraDeCarregamento barra = new BarraDeCarregamento(tabelas.Count * 2, "Gerando as classes"); barra.Show(); foreach (Model.MD_Tabela t in tabelas) { barra.AvancaBarra(1); if (!this.GerarClasse(t, ref mensagemErro)) { tabelas_erro.Add(t); houveErro = true; } } barra.Close(); barra.Dispose(); barra = null; if (houveErro) { string retorno = "Houve erro nas tabelas:" + Environment.NewLine; foreach (Model.MD_Tabela t in tabelas_erro) { retorno += t.DAO.Nome + Environment.NewLine; } Message.MensagemAlerta(retorno); } else { Message.MensagemSucesso("As classes foram geradas no diretórios: " + Util.Global.app_classesSaida_directory + "!"); } } }
/// <summary> /// Método que carrega o tree view /// </summary> private void CarregaTreeView() { Util.CL_Files.WriteOnTheLog("FO_Principal.CarregaTreeView()", Util.Global.TipoLog.DETALHADO); this.trv_projetos.Nodes.Clear(); BarraDeCarregamento aguarde = new BarraDeCarregamento(this.BuscaTotalItensTreeView(), "Carregando TreeView"); aguarde.Show(); this.trv_projetos.Scrollable = true; this.trv_projetos.Nodes.Add(this.CarregaProjetos(ref aguarde)); aguarde.Close(); aguarde.Dispose(); aguarde = null; }
/// <summary> /// Método que carrega a tabela de Tabelas /// </summary> public void CarregaTabelas(string filtro = "") { Util.CL_Files.WriteOnTheLog("UC_ControleTabelas().CarregaTabelas()", Util.Global.TipoLog.DETALHADO); this.lockChange = true; this.dgv_tabelas.Columns.Clear(); this.dgv_tabelas.Rows.Clear(); this.dgv_tabelas.Columns.Add("Nome", "Nome"); this.dgv_tabelas.Columns.Add("Descrição", "Descrição"); if (string.IsNullOrEmpty(filtro)) { this.listaTabelas = Model.MD_Tabela.RetornaTabelasProjeto(projeto.DAO.Codigo); } else { this.listaTabelas = Model.MD_Tabela.RetornaTabelasProjeto(filtro, projeto.DAO.Codigo); } int quantidade = this.listaTabelas.Count; BarraDeCarregamento barra = new BarraDeCarregamento(quantidade, "Quarregando talas"); barra.Show(); this.listaTabelas.ForEach(t => { CarregaTabelas(t); barra.AvancaBarra(1); }); barra.Dispose(); if (this.dgv_tabelas.Rows.Count > 0) { this.dgv_tabelas.Rows[0].Selected = true; } this.lockChange = false; if (this.listaTabelas.Count > 0) { this.CarregaCampos(this.listaTabelas[0]); } }