예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Nome,Id")] Conhecimento conhecimento)
        {
            if (id != conhecimento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(conhecimento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConhecimentoExists(conhecimento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(conhecimento));
        }
        public PainelDetalhesConhecimento(UserControlCentro ucc, bool back)
        {
            InitializeComponent();
            PainelCentro = ucc;
            conhe        = new Conhecimento();
            anexo        = new Anexo();

            buttonsDetails = new Controls.ButtonsDetails();
            gridFundo.Children.Add(buttonsDetails);

            buttonsDetails.SaveClick   += new EventHandler(Add_Conhecimento);
            buttonsDetails.HomeClick   += new EventHandler(Home);
            buttonsDetails.DeleteClick += new EventHandler(DeleteConhecimento);

            treeView = new Controls.TreeView(this);
            gridPesquisa.Children.Add(treeView);
            propertyGridInfo = new Controls.PropertyGrid(this);
            gridPropertyInfo.Children.Add(propertyGridInfo);

            propertyGridComboBox.SelectedIndex = 2;

            textEditor.TextArea.TextEntering += textEditor_TextArea_TextEntering;
            textEditor.TextArea.TextEntered  += textEditor_TextArea_TextEntered;

            DispatcherTimer foldingUpdateTimer = new DispatcherTimer();

            foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
            foldingUpdateTimer.Tick    += foldingUpdateTimer_Tick;
            foldingUpdateTimer.Start();
        }
        public IHttpActionResult PutConhecimento(int id, Conhecimento conhecimento)
        {
            if (conhecimento == null)
            {
                return(BadRequest(ModelState));
            }

            if (id != conhecimento.ID)
            {
                return(BadRequest());
            }

            db.Entry(conhecimento).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ConhecimentoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public string DelProg(int prog)
        {
            try
            {
                using (Banco bco = new Banco())
                {
                    Programador  progr = bco.Programadores.Find(prog);
                    Conhecimento con   = bco.Conhecimentos.Find(prog);
                    Endereco     end   = bco.Enderecos.Find(prog);
                    DBancario    dban  = bco.DBancarios.Find(prog);

                    bco.Programadores.Remove(progr);
                    bco.Conhecimentos.Remove(con);
                    bco.Enderecos.Remove(end);
                    bco.DBancarios.Remove(dban);

                    bco.SaveChanges();

                    return("Ok");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public string AddProg(Programador programers, Conhecimento conhec, DBancario dban, Endereco end)
        {
            if (programers != null && conhec != null && dban != null && end != null)
            {
                using (Banco bco = new Banco())
                {
                    try
                    {
                        bco.Enderecos.Add(end);
                        bco.DBancarios.Add(dban);
                        bco.Conhecimentos.Add(conhec);
                        bco.Programadores.Add(programers);
                        bco.SaveChanges();

                        return("Ok");
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            else
            {
                return("Invalid");
            }
        }
예제 #6
0
        public void ApagarConfirmacao(int id)
        {
            Conhecimento conhecimento = db.Conhecimento.Find(id);

            db.Conhecimento.Remove(conhecimento);
            db.SaveChanges();
        }
예제 #7
0
        public async Task <IActionResult> Create([Bind("Nome,Id")] Conhecimento conhecimento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(conhecimento);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(conhecimento));
        }
        public IHttpActionResult GetConhecimento(int id)
        {
            Conhecimento conhecimento = db.Conhecimento.Find(id);

            if (conhecimento == null)
            {
                return(NotFound());
            }

            return(Ok(conhecimento));
        }
예제 #9
0
        public IHttpActionResult PostConhecimento(Conhecimento conhecimento)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Conhecimento.Add(conhecimento);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = conhecimento.IdConhecimento }, conhecimento));
        }
        public async Task <bool> Atualizar(Conhecimento conhecimento)
        {
            if (!ExecutarValidacao(new ConhecimentoValidation(), conhecimento))
            {
                //TODO Completar
                return(false);
            }

            await _conhecimentoRepository.Atualizar(conhecimento);

            return(true);
        }
        public IHttpActionResult DeleteConhecimento(int id)
        {
            Conhecimento conhecimento = db.Conhecimento.Find(id);

            if (conhecimento == null)
            {
                return(NotFound());
            }

            db.Conhecimento.Remove(conhecimento);
            db.SaveChanges();

            return(Ok(conhecimento));
        }
        public IHttpActionResult PostConhecimento(Conhecimento conhecimento)
        {
            if (conhecimento == null)
            {
                return(BadRequest(ModelState));
            }

            //conhecimento.Profissional_Conhecimento = null;

            db.Conhecimento.Add(conhecimento);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = conhecimento.ID }, conhecimento));
        }
        public async Task <bool> Adcionar(Conhecimento conhecimento)
        {
            if (!ExecutarValidacao(new ConhecimentoValidation(), conhecimento))
            {
                return(false);
            }
            if (_conhecimentoRepository.Buscar(c => c.Nome == conhecimento.Nome).Result.Any()) //TODO Criar um método existe caso este esteja materializando o objeto
            {
                Notificar("Já existe um conhecimento com o nome informado");                   //TODO Criar resources de mensagem
                return(false);
            }
            await _conhecimentoRepository.Adicionar(conhecimento);

            return(true);
        }
예제 #14
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Conhecimento = await _context.Conhecimentos.FirstOrDefaultAsync(m => m.Id == id);

            if (Conhecimento == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #15
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Conhecimento = await _context.Conhecimentos.FindAsync(id);

            if (Conhecimento != null)
            {
                _context.Conhecimentos.Remove(Conhecimento);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
예제 #16
0
        public ActionResult Edit(Conhecimento conhecimento)
        {
            if (ModelState.IsValid)
            {
                conhecimentoBusiness.AlterarConfirmacao(conhecimento);
                return(RedirectToAction("../Conhecimento/IndexValidacao"));
            }
            var temaCon = temaConhecimentoBusiness.Listar();

            temaCon.Add(new TemaConhecimento
            {
                IDTema = 0,
                Nome   = "[ Selecione ]"
            });
            temaCon = temaCon.OrderBy(d => d.Nome).ToList();

            ViewBag.IDTema = new SelectList(temaCon, "IDTema", "Nome", conhecimento.IDTema);
            return(View(conhecimento));
        }
예제 #17
0
        /// <summary>
        /// Esse método serve apenas pra ajudar a preencher a tela ele vai auxiliar na hora de carregar todos os atributos da classe conhecimento
        /// </summary>
        /// <param name="c">Conhecimento</param>
        /// <returns>Lista dos atributos</returns>
        public static List <AtributoDto> GetConhecimentos(Conhecimento c = null)
        {
            //É semelhante ao processo acima só que ele retorna os atributos ao invés da string concatenada
            if (c == null)
            {
                c = new Conhecimento();
            }
            var properties = c.GetType().GetProperties().Where(e => e.PropertyType.Name != "String" && e.Name != "Id").ToList();
            var atributos  = new List <AtributoDto>();

            foreach (PropertyInfo propertyInfo in properties)
            {
                atributos.Add(new AtributoDto()
                {
                    Nome = propertyInfo.Name,
                    Nota = Convert.ToInt32((propertyInfo.GetValue(c, null)?.ToString()) ?? "0")
                });
            }

            return(atributos);
        }
예제 #18
0
        /// <summary>
        /// Esse fuunção usa reflexão para exibir os atributos por ordem de nota
        /// </summary>
        /// <param name="c">Objeto Conhecimento com todos as atributos do candidato</param>
        /// <returns>Uma string com os conhecimentos ordenados por nota e concatenados por vírgula</returns>
        public static string GetAtributosString(Conhecimento c)
        {
            var resultado = "";
            //Pega as propriedades da classe
            var properties = c.GetType().GetProperties().Where(e => e.PropertyType.Name != "String" && e.Name != "Id").ToList();
            var atributos  = new List <AtributoDto>();

            foreach (PropertyInfo propertyInfo in properties)
            {
                //Pega o valor e o nome se a nota for maior que 0
                var nota = Convert.ToInt32(propertyInfo.GetValue(c, null).ToString());
                if (nota > 0)
                {
                    atributos.Add(new AtributoDto()
                    {
                        Nome = propertyInfo.Name,
                        Nota = nota
                    });
                }
            }

            //Ordena por nota e concatena com vírgula
            foreach (var h in atributos.OrderByDescending(e => e.Nota))
            {
                resultado = resultado + h.Nome + ", ";
            }
            //Remove Última vírgula e último espaço caso ele não tenha outra habilidade
            if (c.Outra.IsNullOrEmpty())
            {
                resultado = resultado.Remove(resultado.Length - 2);
            }
            else
            {
                resultado = resultado + c.Outra;
            }
            return(resultado);
        }
예제 #19
0
        public ActionResult Create(Conhecimento conhecimento)
        {
            conhecimento.UserName     = User.Identity.Name;
            conhecimento.NomeCompleto = Usuario.Get.NomeCompleto;
            conhecimento.DataPost     = DateTime.Now;
            conhecimento.validacao    = false;

            if (ModelState.IsValid)
            {
                conhecimentoBusiness.Inserir(conhecimento);
                return(RedirectToAction("Index", "Conhecimento", new { v = 1 }));
            }
            var temaCon = temaConhecimentoBusiness.Listar();

            temaCon.Add(new TemaConhecimento
            {
                IDTema = 0,
                Nome   = "[ Selecione ]"
            });
            temaCon = temaCon.OrderBy(d => d.Nome).ToList();

            ViewBag.IDTema = new SelectList(temaCon, "IDTema", "Nome");
            return(View(conhecimento));
        }
예제 #20
0
        //--------------INSERIR-------------------

        public void Inserir(Conhecimento conhecimento)
        {
            db.Conhecimento.Add(conhecimento);
            db.SaveChanges();
        }
예제 #21
0
 public void Excluir(int id)
 {
     Conhecimento.delete(id);
 }
예제 #22
0
 public object Alterar(int id, [FromBody] Conhecimento item)
 {
     return(item.save(id));
 }
예제 #23
0
 public object Cadastrar([FromBody] Conhecimento item)
 {
     return(item.save());
 }
예제 #24
0
 public object GetById(int id)
 {
     return(Conhecimento.getById(id));
 }
예제 #25
0
 public object GetAll(string descricao = "")
 {
     return(Conhecimento.getAll(descricao));
 }
        public string UpdateProg(Programador prg, Conhecimento con, DBancario db, Endereco en)
        {
            if (prg != null && con != null && db != null && en != null)
            {
                using (Banco bco = new Banco())
                {
                    try
                    {
                        int idp = Convert.ToInt32(prg.cod_prog_id);
                        int idc = Convert.ToInt32(con.cod_prog_id);
                        int idb = Convert.ToInt32(db.cod_prog_id);
                        int ide = Convert.ToInt32(en.cod_prog_id);

                        Programador  _prg = bco.Programadores.Find(idp);
                        Conhecimento _con = bco.Conhecimentos.Find(idc);
                        DBancario    _db  = bco.DBancarios.Find(idb);
                        Endereco     _en  = bco.Enderecos.Find(ide);

                        _prg.nome_prog      = prg.nome_prog;
                        _prg.skype_prog     = prg.skype_prog;
                        _prg.celular        = prg.celular;
                        _prg.linkedin       = prg.linkedin;
                        _prg.portifolio     = prg.portifolio;
                        _prg.disp_horas     = prg.disp_horas;
                        _prg.melhor_hora    = prg.melhor_hora;
                        _prg.pretensao_hora = prg.pretensao_hora;

                        _con.Android     = con.Android;
                        _con.AngularJs   = con.AngularJs;
                        _con.AspNetMVC   = con.AspNetMVC;
                        _con.Bootstrap   = con.Bootstrap;
                        _con.Cake        = con.Cake;
                        _con.CSS         = con.CSS;
                        _con.C_mais_mais = con.C_mais_mais;
                        _con.Django      = con.Django;
                        _con.Ionic       = con.Ionic;
                        _con.IOS         = con.IOS;
                        _con.Jquery      = con.Jquery;
                        _con.Java        = con.Java;
                        _con.PHP         = con.PHP;
                        _con.Wordpress   = con.Wordpress;
                        _con.Phyton      = con.Phyton;
                        _con.MySQLServer = con.MySQLServer;
                        _con.Ruby        = con.Ruby;
                        _con.MySQL       = con.MySQL;
                        _con.Salesforce  = con.Salesforce;
                        _con.Photoshop   = con.Photoshop;
                        _con.Illustrator = con.Illustrator;
                        _con.SEO         = con.SEO;
                        _con.Majento     = con.Majento;
                        _con.HTML        = con.HTML;

                        _db.nome_Favorecido = db.nome_Favorecido;
                        _db.nro_agencia     = db.nro_agencia;
                        _db.nro_agencia     = db.nro_conta;
                        _db.n_cpf           = db.n_cpf;
                        _db.tp_conta        = db.tp_conta;

                        _en.cep            = en.cep;
                        _en.logradouro     = en.logradouro;
                        _en.nro_residencia = en.nro_residencia;
                        _en.bairro         = en.bairro;
                        _en.cidade         = en.cidade;
                        _en.estado         = en.estado;

                        bco.Entry(_prg).State = System.Data.Entity.EntityState.Modified;
                        bco.Entry(_con).State = System.Data.Entity.EntityState.Modified;
                        bco.Entry(_db).State  = System.Data.Entity.EntityState.Modified;
                        bco.Entry(_en).State  = System.Data.Entity.EntityState.Modified;

                        bco.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                }
                return("Teste");
            }
            else
            {
                return("Invalid");
            }
        }
 public void Update(Conhecimento Conhecimento)
 {
     context.Entry(Conhecimento).State = EntityState.Modified;
 }
예제 #28
0
 public void InserirFoto(Conhecimento conhecimento)
 {
     db.Entry(conhecimento).State = EntityState.Modified;
     db.SaveChanges();
 }
예제 #29
0
        //---------------APAGAR------------------

        public Conhecimento Apagar(int?id)
        {
            Conhecimento conhecimento = db.Conhecimento.Find(id);

            return(conhecimento);
        }
예제 #30
0
        //--------------ALTERAR-------------------

        public void AlterarConfirmacao(Conhecimento conhecimento)
        {
            db.Entry(conhecimento).State = EntityState.Modified;
            db.SaveChanges();
        }