//Consulta visita na tabela Visita public static Visita ConsultaVisita(int idVisita) { RecepcaoDataClassesDataContext Db = new RecepcaoDataClassesDataContext(); Visita iVisita = (from selecao in Db.Visita where selecao.IdVisita == idVisita select selecao).SingleOrDefault(); return(iVisita); }
//Insere visita na tabela visita public static bool Criar(Visita visita) { try { RecepcaoDataClassesDataContext Db = new RecepcaoDataClassesDataContext(); Db.Visita.InsertOnSubmit(visita); Db.SubmitChanges(); Db.Dispose(); return(true); } catch (Exception) { return(false); } }
//Deleta visita utilizando id, na tabela Visita public static bool Deleta(int visita) { try { RecepcaoDataClassesDataContext Db = new RecepcaoDataClassesDataContext(); Visita ivisita = (from selecao in Db.Visita where selecao.IdVisita == visita select selecao).SingleOrDefault(); Db.Visita.DeleteOnSubmit(ivisita); Db.SubmitChanges(); Db.Dispose(); return(true); } catch (Exception) { return(false); } }
//Atualizar visita utilizando id, na tabela Visita public static bool Atualiza(Visita idVisita) { try { RecepcaoDataClassesDataContext Db = new RecepcaoDataClassesDataContext(); Visita iVisita = (from selecao in Db.Visita where selecao.IdVisita == idVisita.IdVisita select selecao).SingleOrDefault(); iVisita.Setor = idVisita.Setor; iVisita.Secretaria = idVisita.Secretaria; iVisita.Liberacao = idVisita.Liberacao; iVisita.ContatoInterno = idVisita.ContatoInterno; Db.SubmitChanges(); Db.Dispose(); return(true); } catch (Exception) { return(false); } }
private void detach_Visita(Visita entity) { this.SendPropertyChanging(); entity.Visitante = null; }
private void attach_Visita(Visita entity) { this.SendPropertyChanging(); entity.Visitante = this; }
partial void DeleteVisita(Visita instance);
partial void UpdateVisita(Visita instance);
partial void InsertVisita(Visita instance);
private void detach_Visita(Visita entity) { this.SendPropertyChanging(); entity.Funcionario = null; }