private static processo_de_avaliacao RecuperarProcessoDeAvaliacaoDeDesempenho(string nome) { MGAD_BDDataContext bd = new MGAD_BDDataContext(); var processoDeAvaliacaoDeDesempenhoExiste = (from p in bd.GetTable<processo_de_avaliacao>() where p.nome == nome select p).SingleOrDefault(); return processoDeAvaliacaoDeDesempenhoExiste; }
private static avaliacao RecuperarAvaliacao(Avaliacao avaliacao) { MGAD_BDDataContext bd = new MGAD_BDDataContext(); var avaliacaoExistente = (from a in bd.GetTable<avaliacao>() where a.tipo == avaliacao.Tipo && a.processo_de_avaliacao == avaliacao.processoDeAvaliacaoDeDesempenho.Nome select a).SingleOrDefault(); return avaliacaoExistente; }
private static grupo_de_comportamento RecuperarGrupoDeComportamento(string nome) { MGAD_BDDataContext db = new MGAD_BDDataContext(); var grupoExiste = (from g in db.GetTable<grupo_de_comportamento>() where g.nome == nome select g).SingleOrDefault(); return grupoExiste; }
internal bool ExisteGestor(string nome) { MGAD_BDDataContext db = new MGAD_BDDataContext(); var gestorExistente = (from g in db.GetTable<gestor>() where g.nome == nome select g).SingleOrDefault(); return gestorExistente != null; }
internal static List<GrupoDeComportamentos> SelecionarTodosGruposDeComportamentos() { MGAD_BDDataContext db = new MGAD_BDDataContext(); List<GrupoDeComportamentos> gruposDeComportamentos = new List<GrupoDeComportamentos>(); foreach (grupo_de_comportamento grupoComportamentos in db.GetTable<grupo_de_comportamento>()) { gruposDeComportamentos.Add(new GrupoDeComportamentos(grupoComportamentos.nome)); } return gruposDeComportamentos; }
internal List<Colaborador> SelecionarTodosColaboradoresDeUmGestor(Gestor gestor) { MGAD_BDDataContext db = new MGAD_BDDataContext(); var listaColaboradoresQuery = (from c in db.GetTable<colaborador>() where c.gestor == gestor.Nome select c); List<Colaborador> colaboradoresComGestor = new List<Colaborador>(); foreach(colaborador colaboradorBD in listaColaboradoresQuery) { colaboradoresComGestor.Add(new Colaborador(colaboradorBD.nome, new Gestor(colaboradorBD.gestor))); } return colaboradoresComGestor; }
internal void Salvar(Gestor novoGestor) { MGAD_BDDataContext db = new MGAD_BDDataContext(); var gestorExistente = (from g in db.GetTable<gestor>() where g.nome == novoGestor.Nome select g).SingleOrDefault(); if (gestorExistente == null) { Inserir(novoGestor, db); } else { Atualizar(novoGestor, db, gestorExistente); } }
public void Salvar(Comportamento comportamento) { MGAD_BDDataContext db = new MGAD_BDDataContext(); if (!new GrupoDeComportamentosDAO().Existe(comportamento.Grupo.Nome)) { new GrupoDeComportamentosDAO().Salvar(comportamento.Grupo); } var comportamentoExistente = (from c in db.GetTable<comportamento>() where c.descricao == comportamento.Descricao select c).SingleOrDefault(); if (comportamentoExistente == null) { InsereComportamento(comportamento, db); } else { AtualizarComportamento(comportamento, db, comportamentoExistente); } }
internal void Salvar(Colaborador colaborador) { MGAD_BDDataContext db = new MGAD_BDDataContext(); if (!new GestorDAO().ExisteGestor(colaborador.GestorAssociado.Nome)) { new GestorDAO().Salvar(colaborador.GestorAssociado); } var colaboradorExistente = (from c in db.GetTable<colaborador>() where c.nome == colaborador.Nome select c).SingleOrDefault(); if (colaboradorExistente == null) { Salvar(colaborador, db); } else { Atualizar(colaborador, db, colaboradorExistente); } }