public BaseGerador(ConexaoEntidade conexao, SistemaEntidade sistema, ProjetoEntidade projeto, List <Entidade> entidades) { Conexao = conexao; Entidades = entidades; Sistema = sistema; Projeto = projeto; }
//[Autorizador] public ActionResult Manter(int?id) { var caracteristicaServico = ServicoDeDependencia.MontarCaracteristicaServico(); var subtopicosServico = ServicoDeDependencia.MontarSubtopicoServico(); var caracteristicas = caracteristicaServico.Listar(); var subtopicos = subtopicosServico.Listar(); var projetoModel = new ProjetoModel(); if (id.HasValue && id.Value > 0) { var projeto = new ProjetoEntidade() { Id = id.Value }; var projetoDaBase = projetoServico.BuscarPorId(projeto); if (projetoDaBase != null) { projetoModel = Mapper.Map <ProjetoEntidade, ProjetoModel>(projetoDaBase); } } projetoModel.listaDeCaracteristicas = caracteristicas; projetoModel.listaDeSubtopicos = subtopicos; return(View("Projeto", projetoModel)); }
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); }
public Dependecias(ProjetoEntidade projetoSelecionado) { InitializeComponent(); if (!DesignMode) { ProjetoSelecionado = projetoSelecionado; } }
private void GerarImports(ProjetoEntidade proj, Service service) { SB.AppendLine("import { BaseService, RequestType, ResponseType } from \"@intech/react-service\";"); foreach (var import in service.Imports) { var imp = import.Replace("Array<", "").Replace(">", ""); SB.AppendLine($"import {{ {imp} }} from \"../entidades/{imp}\";"); } SB.AppendLine(); }
private void adicionarVinculos(ProjetoEntidade projeto) { foreach (var caracteristica in projeto.Caracteristicas) { using (var transaction = new TransactionScope(TransactionScopeOption.Required)) using (var connection = Conexao()) { connection.Open(); var sql = new StringBuilder(); var parameters = new List <SqlParameter>(); sql.Append($"INSERT INTO ProjetoCaracteristica VALUES("); sql.Append($"@param_ProjetoId,@param_CaracteristicaId)"); parameters.Add(new SqlParameter("@param_ProjetoId", projeto.Id)); parameters.Add(new SqlParameter("@param_CaracteristicaId", caracteristica.Id)); var command = new SqlCommand(sql.ToString(), connection); foreach (SqlParameter param in parameters) { command.Parameters.Add(param); } command.ExecuteNonQuery(); transaction.Complete(); } } foreach (var subtopico in projeto.Subtopicos) { using (var transaction = new TransactionScope(TransactionScopeOption.Required)) using (var connection = Conexao()) { connection.Open(); var sql = new StringBuilder(); var parameters = new List <SqlParameter>(); sql.Append($"INSERT INTO ProjetoSubtopico VALUES("); sql.Append($"@param_ProjetoId,@param_SubtopicoId)"); parameters.Add(new SqlParameter("@param_ProjetoId", projeto.Id)); parameters.Add(new SqlParameter("@param_SubtopicoId", subtopico.Id)); var command = new SqlCommand(sql.ToString(), connection); foreach (SqlParameter param in parameters) { command.Parameters.Add(param); } command.ExecuteNonQuery(); transaction.Complete(); } } }
private void removerVinculos(ProjetoEntidade projeto) { var tabelas = new[] { "ProjetoSubtopico", "ProjetoCaracteristica" }; foreach (var tabela in tabelas) { using (var transaction = new TransactionScope(TransactionScopeOption.Required)) using (var connection = Conexao()) { connection.Open(); string sql = $"DELETE FROM {tabela} WHERE ProjetoId = @param_idProjeto"; var command = new SqlCommand(sql, connection); command.Parameters.Add(new SqlParameter("@param_idProjeto", $"{projeto.Id}")); command.ExecuteNonQuery(); transaction.Complete(); } } }
private void CarregarProjetosAPI(ProjetoEntidade projetoSelecionado = null) { if (projetoSelecionado != null) { ComboBoxProjetoAPI.DataSource = ProjetoService .Listar() .Where(x => x.OID_PROJETO != projetoSelecionado.OID_PROJETO && x.IND_TIPO_PROJETO == "API" ) .ToList(); } else { ComboBoxProjetoAPI.DataSource = ProjetoService .Listar() .Where(x => x.IND_TIPO_PROJETO == "API" ) .ToList(); } }
public ActionResult Excluir(int id) { var usuarioAutenticado = new UsuarioEntidade() { Email = ServicoDeAutenticacao.UsuarioLogado.Email }; var projeto = new ProjetoEntidade() { Id = id }; var projetoDaBase = projetoServico.BuscarPorId(projeto); try { projetoServico.Remover(projetoDaBase, usuarioAutenticado); } catch (UsuarioException e) { ModelState.AddModelError("", e.Message); } return(View("Projeto")); }
public GeradorService(ProjetoEntidade projeto, List <ProjetoEntidade> projetosSelecionados) { Projeto = projeto; ProjetosSelecionados = projetosSelecionados; }
public GeradorSqlServer(ConexaoEntidade conexao, SistemaEntidade sistema, ProjetoEntidade projeto, List <Entidade> entidades) : base(conexao, sistema, projeto, entidades) { }
protected override void Seed(Maturidade_Online.Repositorio.ContextoDeDadosEF context) { UsuarioEntidade usuario1 = new UsuarioEntidade { Nome = "Victor", Email = "*****@*****.**", Permissao = Permissao.ADMINISTRADOR, Senha = "6f1d81c734062fe646d96eb97dfd1d9c" }; UsuarioEntidade usuario2 = new UsuarioEntidade { Nome = "Maicon", Email = "*****@*****.**", Permissao = Permissao.ADMINISTRADOR, Senha = "6f1d81c734062fe646d96eb97dfd1d9c" }; UsuarioEntidade usuario3 = new UsuarioEntidade { Nome = "Normal", Email = "*****@*****.**", Permissao = Permissao.USUARIO, Senha = "6f1d81c734062fe646d96eb97dfd1d9c" }; context.Usuario.AddOrUpdate( p => p.Nome, usuario1, usuario2, usuario3 ); context.Pilar.AddOrUpdate( p => p.Titulo, new PilarEntidade { Id = 1, Titulo = "Infraestrutura" }, new PilarEntidade { Id = 2, Titulo = "Gestão" }, new PilarEntidade { Id = 3, Titulo = "Qualidade" } ); SubtopicoEntidade subtopico1 = new SubtopicoEntidade { Id = 1, Nome = "subtopico1", Descricao = "Nenhuma", Pontuacao = 3, PilarEntidadeId = 1 }; SubtopicoEntidade subtopico2 = new SubtopicoEntidade { Id = 2, Nome = "subtopico2", Descricao = "Nenhuma", Pontuacao = 5, PilarEntidadeId = 1 }; SubtopicoEntidade subtopico3 = new SubtopicoEntidade { Id = 3, Nome = "subtopico3", Descricao = "Nenhuma", Pontuacao = 3, PilarEntidadeId = 2 }; SubtopicoEntidade subtopico4 = new SubtopicoEntidade { Id = 4, Nome = "subtopico4", Descricao = "Nenhuma", Pontuacao = 5, PilarEntidadeId = 3 }; context.Subtopico.AddOrUpdate( p => p.Nome, subtopico1, subtopico2, subtopico3, subtopico4 ); var caracteristica1subtopico = new List <SubtopicoEntidade>() { subtopico1, subtopico2 }; var caracteristica2subtopico = new List <SubtopicoEntidade>() { subtopico3, subtopico4 }; CaracteristicaEntidade caracteristica1 = new CaracteristicaEntidade() { Id = 1, Nome = "Caracteristica1", Subtopicos = caracteristica1subtopico }; CaracteristicaEntidade caracteristica2 = new CaracteristicaEntidade() { Id = 2, Nome = "Caracteristica2", Subtopicos = caracteristica2subtopico }; context.Caracteristica.AddOrUpdate( p => p.Nome, caracteristica1, caracteristica2 ); var projeto1Caracteristicas = new List <CaracteristicaEntidade>() { caracteristica1, caracteristica2 }; var projeto1subtopicos = new List <SubtopicoEntidade>() { subtopico1, subtopico2, subtopico3, subtopico4 }; ProjetoEntidade projeto1 = new ProjetoEntidade() { Id = 1, Nome = "Projeto1", Caracteristicas = projeto1Caracteristicas, Subtopicos = projeto1subtopicos, Usuario = usuario1 }; context.Projeto.AddOrUpdate( p => p.Nome, projeto1 ); }
public void AlterarVinculos(ProjetoEntidade projeto) { this.removerVinculos(projeto); this.adicionarVinculos(projeto); }
public static bool Atualizar(ProjetoEntidade Projeto) => CriarRequisicaoEnvio <ProjetoEntidade, bool>("Projeto/editar", Projeto);
public static bool Deletar(ProjetoEntidade Projeto) => CriarRequisicaoEnvio <ProjetoEntidade, bool>("Projeto/deletar", Projeto);
public GeradorDAO(SistemaEntidade sistema, ProjetoEntidade projeto, Entidade entidade, List <EntidadeConsulta> consultas) { Sistema = sistema; Entidade = entidade; Consultas = consultas; }
public static decimal Inserir(ProjetoEntidade Projeto) => CriarRequisicaoEnvio <ProjetoEntidade, decimal>("Projeto", Projeto);
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(); }
public override long Inserir(ProjetoEntidade entidade) { return(base.Inserir(entidade)); }
public bool Delete([FromBody] ProjetoEntidade sistema) => new ProjetoProxy().Deletar(sistema);
public bool Update([FromBody] ProjetoEntidade sistema) => new ProjetoProxy().Atualizar(sistema);
public decimal Inserir([FromBody] ProjetoEntidade sistema) => new ProjetoProxy().Inserir(sistema);