Exemplo n.º 1
0
        /// <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 + "!");
                }
            }
        }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
        /// <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]);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Método que carrega os projetos cadastrados e os coloca no treeView
        /// </summary>
        private TreeNode CarregaProjetos(ref BarraDeCarregamento aguarde)
        {
            Util.CL_Files.WriteOnTheLog("FO_Principal.CarregaProjetos()", Util.Global.TipoLog.DETALHADO);

            DbDataReader reader   = DataBase.Connection.Select(new DAO.MD_Projeto().table.CreateCommandSQLTable());
            TreeNode     projetos = new TreeNode("Projetos");

            while (reader.Read())
            {
                aguarde.AvancaBarra(1);
                Model.MD_Projeto project = new Model.MD_Projeto(int.Parse(reader["CODIGO"].ToString()));

                TreeNode node = new TreeNode(project.DAO.Nome);
                node.Tag                = "projetos:" + project.DAO.Codigo;
                node.ImageIndex         = 0;
                node.SelectedImageIndex = 0;

                this.MontaMenuProjeto(project, ref node);

                if (project.DAO.StatusProjeto == Status.ATIVO)
                {
                    TreeNode tabela = new TreeNode("Tabelas");
                    tabela.Tag = "tabelas:" + project.DAO.Codigo;;
                    this.MontaMenuTabela(project, ref tabela);
                    node.Nodes.Add(tabela);
                }

                projetos.Nodes.Add(node);
            }

            projetos.Tag = -1;
            projetos.Expand();
            reader.Close();

            return(projetos);
        }