public void Dispose() { using (var db = new golfeEntities()) { db.Dispose(); } }
public void Edit(int id, Tarefas tarefa) { try { using (var db = new golfeEntities()) { var tarefaFound = db.tarefasgerais.Find(id); if (tarefaFound == null) { throw new ArgumentException("Id not in database"); } ; tarefaFound.areajogo = tarefa.AreaJogo; tarefaFound.concluida = tarefa.Concluida; tarefaFound.data = tarefa.Data; tarefaFound.funcionario = tarefa.Funcionario; tarefaFound.maquina = tarefa.Maquina; tarefaFound.operacao = tarefa.Operacao; this.Save(db); } } catch (Exception e) { throw e; } }
public Funcionarios Find(int id) { try { using (var db = new golfeEntities()) { var funcionarioFound = db.funcionarios.Find(id); return(funcionarioFound != null?this._mapper.Map <Funcionarios>(funcionarioFound) : null); } } catch (Exception e) { throw e; } }
public Maquinas Find(int id) { try { using (var db = new golfeEntities()) { var maquinaFound = db.maquina.Find(id); return(maquinaFound != null?this._mapper.Map <Maquinas>(maquinaFound) : null); } } catch (Exception e) { throw e; } }
public Tarefas Find(int id) { try { using (var db = new golfeEntities()) { var tarefaFound = db.tarefasgerais.Find(id); return(tarefaFound != null?this._mapper.Map <Tarefas>(tarefaFound) : null); } } catch (Exception e) { throw e; } }
public AreaJogo Find(int id) { try { using (var db = new golfeEntities()) { var areaFound = db.areajogo.Find(id); return(areaFound != null?this._mapper.Map <AreaJogo>(areaFound) : null); } } catch (Exception e) { throw e; } }
public Operacao Find(int id) { try { using (var db = new golfeEntities()) { var operacaoFound = db.operacao.Find(id); return(operacaoFound != null?this._mapper.Map <Operacao>(operacaoFound) : null); } } catch (Exception e) { throw e; } }
public void Add(Funcionarios funcionario) { try { using (var db = new golfeEntities()) { var funcionarioToAdd = this._mapper.Map <Funcionarios, funcionarios>(funcionario); db.funcionarios.Add(funcionarioToAdd); this.Save(db); } } catch (Exception e) { throw e; } }
public void Add(Tarefas tarefa) { try { using (var db = new golfeEntities()) { var tarefaToAdd = this._mapper.Map <Tarefas, tarefasgerais>(tarefa); db.tarefasgerais.Add(tarefaToAdd); this.Save(db); } } catch (Exception e) { throw e; } }
public IEnumerable <Funcionarios> GetFuncionarios() { try{ using (var db = new golfeEntities()) { var funcionarios = from t in db.funcionarios orderby t.nome descending select t; return(this._mapper.Map <IEnumerable <funcionarios>, IEnumerable <Funcionarios> >(funcionarios)); } } catch (Exception e) { throw e; } }
public IEnumerable <AreaJogo> GetAreasJogo() { try { using (var db = new golfeEntities()) { var areas = from t in db.areajogo orderby t.id descending select t; return(this._mapper.Map <IEnumerable <areajogo>, IEnumerable <AreaJogo> >(areas)); } } catch (Exception e) { throw e; } }
public IEnumerable <Operacao> GetOperacoes() { try { using (var db = new golfeEntities()) { var operacoes = from t in db.operacao orderby t.nome descending select t; return(this._mapper.Map <IEnumerable <operacao>, IEnumerable <Operacao> >(operacoes)); } } catch (Exception e) { throw e; } }
public IEnumerable <Maquinas> GetMaquinas() { try { using (var db = new golfeEntities()) { var maquinas = from t in db.maquina orderby t.nome descending select t; return(this._mapper.Map <IEnumerable <maquina>, IEnumerable <Maquinas> >(maquinas)); } } catch (Exception e) { throw e; } }
public void Delete(int id) { try { using (var db = new golfeEntities()) { var tarefaToDelete = db.tarefasgerais.Find(id); if (tarefaToDelete == null) { return; } db.tarefasgerais.Remove(tarefaToDelete); this.Save(db); } } catch (Exception e) { throw e; } }
public void Delete(int id) { try { using (var db = new golfeEntities()) { var funcionarioToDelete = db.funcionarios.Find(id); if (funcionarioToDelete == null) { return; } db.funcionarios.Remove(funcionarioToDelete); this.Save(db); } } catch (Exception e) { throw e; } }
public IEnumerable <Tarefas> GetTarefasByFuncionarioAndDataAndConcluida(string funcionario, DateTime start, DateTime end, bool concluida) { try { using (var db = new golfeEntities()) { var tarefas = (from t in db.tarefasgerais where (t.funcionario == funcionario && t.data >= start && t.data <= end && t.concluida == concluida) orderby t.id descending select t); return(this._mapper.Map <IEnumerable <tarefasgerais>, IEnumerable <Tarefas> >(tarefas)); } } catch (Exception e) { throw e; } }
public void Edit(int id, Funcionarios funcionario) { try { using (var db = new golfeEntities()) { var funcionariofound = db.funcionarios.Find(id); if (funcionariofound == null) { return; } funcionariofound.nome = funcionario.Nome; funcionariofound.email = funcionario.Email; this.Save(db); } } catch (Exception e) { throw e; } }
public IEnumerable <Tarefas> GetTarefas() { try { using (var db = new golfeEntities()) { var tarefas = from t in db.tarefasgerais orderby t.id descending select t; if (tarefas.Any()) { return(this._mapper.Map <IEnumerable <tarefasgerais>, IEnumerable <Tarefas> >(tarefas)); } return(null); } } catch (Exception e) { throw e; } }
public void Save(golfeEntities db) { db.SaveChanges(); }