public static bool Alterar(Entregas entrega) { try { using (OracleCommand c = ConexaoOracle.ObterConexao().CreateCommand()) { c.CommandType = System.Data.CommandType.Text; c.CommandText = "UPDATE ENTREGAS SET funcionarioid=:funcionarioid, status=:status, data=:data WHERE entregaid = :codigo"; c.Parameters.Add("funcionarioid", OracleType.Int32).Value = entrega.getFuncionarioId(); c.Parameters.Add("status", OracleType.VarChar).Value = entrega.getStatus(); c.Parameters.Add("data", OracleType.DateTime).Value = entrega.getData(); c.Parameters.Add("codigo", OracleType.Int32).Value = entrega.getEntregaId(); c.ExecuteNonQuery(); } return true; } catch (OracleException e) { throw e; } }
public static bool Inserir(Entregas entrega) { try { using (OracleCommand c = ConexaoOracle.ObterConexao().CreateCommand()) { c.CommandType = System.Data.CommandType.Text; c.CommandText = "INSERT into ENTREGAS values(ENTREGAS_SEQ.NEXTVAL, :funcionarioid, :status, :data)"; c.Parameters.Add("funcionarioid", OracleType.Int32).Value = entrega.getFuncionarioId(); c.Parameters.Add("status", OracleType.VarChar).Value = entrega.getStatus(); c.Parameters.Add("data", OracleType.DateTime).Value = entrega.getData(); c.ExecuteNonQuery(); return true; } } catch (OracleException e) { throw e; } }