public void alteraAgendamento(Agendamento agendamento) { using (OdbcConnection conexao = ConexaoPadrao.createConnection()) { string sql = "update AGENDAMENTO set ID_CLIENTE = ?, ID_FUNCIONARIO = ?, ID_SERVICO = ?, HORA = ?, ATENDIDO = ? where ID_AGENDAMENTO = ?"; OdbcCommand command = new OdbcCommand(sql, conexao); command.Parameters.AddWithValue("@ID_CLIENTE", agendamento.idCliente); command.Parameters.AddWithValue("@ID_FUNCIONARIO", agendamento.idFuncionario); command.Parameters.AddWithValue("@ID_SERVICO", agendamento.idServico); command.Parameters.AddWithValue("@HORA", agendamento.hora); command.Parameters.AddWithValue("@ATENDIDO", agendamento.atendido); command.Parameters.AddWithValue("@ID_AGENDAMENTO", agendamento.id); conexao.Open(); command.ExecuteNonQuery(); } }
public void inserirAgendamento(Agendamento agendamento) { using (OdbcConnection conexao = ConexaoPadrao.createConnection()) { string sql = "insert into AGENDAMENTO (ID_AGENDAMENTO, ID_CLIENTE, ID_FUNCIONARIO, ID_SERVICO, HORA, ATENDIDO) values(?,?,?,?,?,?)"; OdbcCommand command = new OdbcCommand(sql, conexao); command.Parameters.AddWithValue("@ID_AGENDAMENTO", agendamento.id); command.Parameters.AddWithValue("@ID_CLIENTE", agendamento.idCliente); command.Parameters.AddWithValue("@ID_FUNCIONARIO", agendamento.idFuncionario); command.Parameters.AddWithValue("@ID_SERVICO", agendamento.idServico); command.Parameters.AddWithValue("@HORA", agendamento.hora); command.Parameters.AddWithValue("@ATENDIDO", agendamento.atendido); conexao.Open(); command.ExecuteNonQuery(); } }