Skip to content

Instantly share code, notes, and snippets.

@wilcorrea
Last active May 23, 2017 04:43
Show Gist options
  • Save wilcorrea/e289a57b191a3d46c8a72347728ff722 to your computer and use it in GitHub Desktop.
Save wilcorrea/e289a57b191a3d46c8a72347728ff722 to your computer and use it in GitHub Desktop.
Json
atualizacao() {
//FAÇO O REQUEST PARA PEGAR AS OS
this.http.get("127.0.0.1/minhasos.php")
.map(res => res.json()).subscribe(dataAtualiza => {
if (!dataAtualiza) {
alert("ERRO AO ATUALIZAR O SISTEMA");
return;
}
this.MinhasOS = dataAtualiza['DataOS']
this.MinhasOS.map((data) => {
const sql =
"INSERT INTO ordermservico (os, cliente, descricao, solicitado, encerramento) " +
"VALUES " +
"('" + data.os + "','" + data.cliente + "','" + data.descricao + "','" + data.solicitado + "','" + data.encerramento + "')";
return this.database.executeSql(sql, []).then((data) => {
console.log("INSERIDO COM SUCESSO: " + JSON.stringify(data));
}, (error) => {
console.log("SQL Error: " + sql);
});
})
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment