public static Telefone BuscarTelefone(Int32 id) { SqlConnection conexao = FabricaConexao.GetConnection(); TelefoneDAO telefoneDAO = new TelefoneDAO(conexao); return(telefoneDAO.buscarTelefone(id)); }
public static Telefone BuscarTelefoneDoAtendente(Atendente atendente) { SqlConnection conexao = FabricaConexao.GetConnection(); TelefoneDAO telefoneDAO = new TelefoneDAO(conexao); return(telefoneDAO.buscarTelefoneDoAtendente(atendente)); }
public static void SalvarAtendente(Atendente atendente) { SqlConnection conexao = null; SqlTransaction tx = null; try { conexao = FabricaConexao.GetConnection(); tx = conexao.BeginTransaction(); AtendenteDAO atendenteDAO = new AtendenteDAO(conexao, tx); atendenteDAO.salvarAtendente(atendente); atendenteDAO.salvarAtendenteFilial(atendente); TelefoneDAO telefoneDAO = new TelefoneDAO(conexao, tx); telefoneDAO.salvarTelefone(atendente.Telefone); atendenteDAO.salvarAtendenteTelefone(atendente); tx.Commit(); } catch (Exception ex) { tx.Rollback(); throw ex; } finally { FabricaConexao.CloseConnection(conexao); } }
internal static void AtualizarCliente(Cliente cliente) { SqlConnection conexao = null; SqlTransaction tx = null; try { conexao = FabricaConexao.GetConnection(); tx = conexao.BeginTransaction(); ClienteDAO clienteDAO = new ClienteDAO(conexao, tx); clienteDAO.atualizarCliente(cliente); TelefoneDAO telefoneDAO = new TelefoneDAO(conexao, tx); telefoneDAO.atualizarTelefoneDoCliente(cliente); tx.Commit(); } catch (Exception ex) { tx.Rollback(); throw ex; } finally { FabricaConexao.CloseConnection(conexao); } }
public static void SalvarTelefone(String numero) { SqlConnection conexao = FabricaConexao.GetConnection(); TelefoneDAO telefoneDAO = new TelefoneDAO(conexao); Telefone telefone = new Telefone(numero); telefoneDAO.salvarTelefone(telefone); }
internal static Telefone BuscarTelefoneDaFilial(Filial filial) { SqlConnection conexao = null; Telefone telefone; try { conexao = FabricaConexao.GetConnection(); TelefoneDAO telefoneDAO = new TelefoneDAO(conexao); telefone = telefoneDAO.buscarTelefoneDaFilial(filial); } catch (Exception ex) { throw ex; } finally { FabricaConexao.CloseConnection(conexao); } return(telefone); }