private void ListEntidades_SelectedIndexChanged(object sender, EventArgs e)
        {
            var podeGerarProxy = true;

            foreach (DirectoryInfo entidade in ListEntidades.SelectedItems)
            {
                var caminho      = entidade.FullName;
                var nomeEntidade = entidade.Name;
                var nomeArquivo  = Path.Combine(UserConfigManager.Get().GitBase, SistemaSelecionado.TXT_DIRETORIO_NEGOCIO, "Proxy", nomeEntidade + "Proxy.cs");

                if (!File.Exists(nomeArquivo))
                {
                    podeGerarProxy = true;
                }
                else
                {
                    var metodos = GetAllMethodNames(nomeArquivo);
                    if (metodos.Count > 0)
                    {
                        podeGerarProxy = false;
                    }
                }
            }

            CheckBoxGerarProxy.Enabled = podeGerarProxy;
            CheckBoxGerarProxy.Checked = podeGerarProxy;
        }
        protected void SalvarEntidadeTS(ProjetoEntidade projeto, Entidade entidade)
        {
            var dirEntidades = Path.Combine(UserConfigManager.Get().GitBase, projeto.TXT_DIRETORIO, "src", "entidades");

            if (!Directory.Exists(dirEntidades))
            {
                Directory.CreateDirectory(dirEntidades);
            }

            var entidadeTS = new GeradorEntidadeTS(entidade, Colunas).Gerar();

            File.WriteAllText(Path.Combine(dirEntidades, $"{entidade.Nome}Entidade.tsx"), entidadeTS, Encoding.UTF8);

            // Salva index.tsx
            var listaEntidades = Directory.GetFiles(dirEntidades).ToList();
            var entidadesIndex = new List <string>();

            foreach (var ent in listaEntidades)
            {
                var arquivo = new FileInfo(ent);
                if (arquivo.Name != "index.tsx")
                {
                    entidadesIndex.Add(arquivo.Name.Replace(".tsx", ""));
                }
            }

            var entidadeTSIndex = new GeradorEntidadeTSIndex(entidadesIndex).Gerar();

            File.WriteAllText(Path.Combine(dirEntidades, $"index.tsx"), entidadeTSIndex, Encoding.UTF8);
        }
Beispiel #3
0
 private void FormConfiguracao_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (UserConfigManager.Get() == null)
     {
         MessageBox.Show("É necessário informar o diretório do repositório!");
         e.Cancel = true;
     }
 }
 private void FormGerador_Load(object sender, System.EventArgs e)
 {
     if (UserConfigManager.Get() == null)
     {
         var formConfig = new FormConfiguracao();
         formConfig.ShowDialog();
     }
 }
Beispiel #5
0
        private void FormConfiguracao_Load(object sender, EventArgs e)
        {
            var userConfig = UserConfigManager.Get();

            if (userConfig != null)
            {
                TextBoxDiretorioGIT.Text = userConfig.GitBase;
            }
        }
Beispiel #6
0
        public UserConfig getStatus()
        {
            if (!SessionConfigUtil.ValidRequest())
            {
                return(null);
            }
            IUserConfigManager dao = new UserConfigManager();

            return(dao.Get(SessionConfigUtil.GetUserId()));
        }
 private void ButtonIncluir_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(TextBoxDiretorio.Text))
     {
         var newRow = DataTable.NewRow();
         newRow.SetField("Diretorio", TextBoxDiretorio.Text.Replace(UserConfigManager.Get().GitBase + "\\", ""));
         DataTable.Rows.Add(newRow);
         GridDiretorios.DataSource = DataTable;
         TextBoxDiretorio.Text     = "";
     }
 }
Beispiel #8
0
        private void LimparFormulario()
        {
            ListProjetos.SelectedIndex = -1;

            TextBoxNome.Text                 = "";
            TextBoxDiretorio.Text            = UserConfigManager.Get().GitBase;
            TextBoxNamespace.Text            = "";
            ComboBoxTipo.SelectedIndex       = -1;
            ComboBoxSistema.SelectedIndex    = -1;
            ComboBoxProjetoAPI.Enabled       = true;
            ComboBoxProjetoAPI.SelectedIndex = -1;
        }
Beispiel #9
0
        private void ListProjetos_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ProjetoSelecionado != null)
            {
                TextBoxNome.Text      = ProjetoSelecionado.NOM_PROJETO;
                TextBoxDiretorio.Text = Path.Combine(UserConfigManager.Get().GitBase, ProjetoSelecionado.TXT_DIRETORIO);
                TextBoxNamespace.Text = ProjetoSelecionado.TXT_NAMESPACE;

                switch (ProjetoSelecionado.IND_TIPO_PROJETO)
                {
                case "WEB":
                    ComboBoxTipo.SelectedItem = "Web";
                    break;

                case "API":
                    ComboBoxTipo.SelectedItem = "API";
                    break;

                case "MOB":
                    ComboBoxTipo.SelectedItem = "Mobile";
                    break;
                }

                ComboBoxSistema.SelectedValue = ProjetoSelecionado.OID_SISTEMA;

                CarregarProjetosAPI(ProjetoSelecionado);

                if (ComboBoxProjetoAPI.Items.Count > 0)
                {
                    ComboBoxProjetoAPI.Enabled = true;

                    if (ProjetoSelecionado.OID_PROJETO_API.HasValue)
                    {
                        ComboBoxProjetoAPI.SelectedValue = ProjetoSelecionado.OID_PROJETO_API.Value;
                    }
                    else
                    {
                        ComboBoxProjetoAPI.SelectedIndex = -1;
                    }
                }
                else
                {
                    ComboBoxProjetoAPI.Enabled       = false;
                    ComboBoxProjetoAPI.SelectedIndex = -1;
                    ComboBoxProjetoAPI.Text          = "";
                }

                ModoEdicao = true;
            }
        }
Beispiel #10
0
        private void Home_Load(object sender, EventArgs e)
        {
            var userConfig = UserConfigManager.Get();

            if (userConfig != null)
            {
                TextBoxDiretorioGIT.Text    = userConfig.GitBase;
                ComboBoxUrlApi.SelectedItem = userConfig.UrlApi;
            }

            ButtonProcurarDiretorio.Image = FontAwesome.Instance
                                            .GetImage(new FontAwesome.Properties(FontAwesome.Type.FolderOpenO)
            {
                Size      = 18,
                ForeColor = Color.Black
            });
        }
        private void BuscarEntidades()
        {
            var caminhoDados = Path.Combine(UserConfigManager.Get().GitBase, SistemaSelecionado.TXT_DIRETORIO_DADOS);

            if (!Directory.Exists(caminhoDados))
            {
                MessageBox.Show($"Diretório {caminhoDados} não encontrado!");
                return;
            }

            var listaEntidades     = new List <DirectoryInfo>();
            var diretorioEntidades = Directory.EnumerateDirectories(Path.Combine(caminhoDados, "Scripts"));

            foreach (var diretorioEntidade in diretorioEntidades)
            {
                listaEntidades.Add(new DirectoryInfo(diretorioEntidade));
            }

            ListEntidades.DataSource    = listaEntidades;
            ListEntidades.DisplayMember = "Name";
        }
Beispiel #12
0
        private void ButtonSalvar_Click(object sender, EventArgs e)
        {
            if (ModoEdicao)
            {
                ProjetoSelecionado.NOM_PROJETO   = TextBoxNome.Text;
                ProjetoSelecionado.TXT_DIRETORIO = TextBoxDiretorio.Text.Replace(UserConfigManager.Get().GitBase + "\\", "");
                ProjetoSelecionado.TXT_NAMESPACE = TextBoxNamespace.Text;

                switch (ComboBoxTipo.SelectedItem)
                {
                case "Web":
                    ProjetoSelecionado.IND_TIPO_PROJETO = "WEB";
                    break;

                case "API":
                    ProjetoSelecionado.IND_TIPO_PROJETO = "API";
                    break;

                case "Mobile":
                    ProjetoSelecionado.IND_TIPO_PROJETO = "MOB";
                    break;
                }

                ProjetoSelecionado.OID_SISTEMA = ((SistemaEntidade)ComboBoxSistema.SelectedItem).OID_SISTEMA;

                if (ComboBoxProjetoAPI.SelectedItem != null)
                {
                    ProjetoSelecionado.OID_PROJETO_API = ((ProjetoEntidade)ComboBoxProjetoAPI.SelectedItem).OID_PROJETO;
                }

                ProjetoService.Atualizar(ProjetoSelecionado);

                MessageBox.Show("Projeto alterado com sucesso!");
            }
            else
            {
                var projeto = new ProjetoEntidade
                {
                    NOM_PROJETO   = TextBoxNome.Text,
                    TXT_DIRETORIO = TextBoxDiretorio.Text.Replace(UserConfigManager.Get().GitBase + "\\", ""),
                    TXT_NAMESPACE = TextBoxNamespace.Text
                };

                switch (ComboBoxTipo.SelectedItem)
                {
                case "Web":
                    projeto.IND_TIPO_PROJETO = "WEB";
                    break;

                case "API":
                    projeto.IND_TIPO_PROJETO = "API";
                    break;

                case "Mobile":
                    projeto.IND_TIPO_PROJETO = "MOB";
                    break;
                }

                projeto.OID_SISTEMA = ((SistemaEntidade)ComboBoxSistema.SelectedItem).OID_SISTEMA;

                if (ComboBoxProjetoAPI.SelectedItem != null)
                {
                    projeto.OID_PROJETO_API = ((ProjetoEntidade)ComboBoxProjetoAPI.SelectedItem).OID_PROJETO;
                }

                ProjetoService.Inserir(projeto);

                MessageBox.Show("Projeto inserido com sucesso!");
            }

            CarregarProjetos();
            LimparFormulario();
        }