private void performAction() { string s = sDateTime.Value.ToString("dd-MM-yyyy"); string t = eDateTime.Value.ToString("dd-MM-yyyy"); string q = "INSERT into leaves (uid, building_id, start_date, end_date) VALUES ('" + fid + "', '" + fid.Substring(0, 3) + "', '" + s + "', '" + t + "')"; //MessageBox.Show(q); done = oc.insert(q); }
private void btn_empty_database_Click(object sender, EventArgs e) { if (!checkDevice()) { return; } if (MetroFramework.MetroMessageBox.Show(this, "You are about to clear the entire database\nAre you sure you want to proceed ?", "Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (!oc.hasConnection()) { MetroFramework.MetroMessageBox.Show(this, "Error\nNo Internet Connection !!!", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string ds = deviceBuilding.Substring(0, 3); string q1 = "DELETE FROM employee WHERE building_id='" + ds + "'"; string q2 = "DELETE FROM attendance WHERE building_id='" + ds + "'"; string q3 = "DELETE FROM leaves WHERE building_id='" + ds + "'"; if (!oc.insert(q1) || !oc.insert(q2) || !oc.insert(q3)) { MetroFramework.MetroMessageBox.Show(this, "Error\nCouldn't empty online database !!!\nMay be it's partially hampered.\nTry agan...", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!dc.send("EMPTY\n")) { MetroFramework.MetroMessageBox.Show(this, "Error\nDevice may not be connected", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string w = dc.wait(); if (w != "OK") { MetroFramework.MetroMessageBox.Show(this, "Error\n" + w, "STOP", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string t = dc.get(); if (t.Equals("Success")) { MetroFramework.MetroMessageBox.Show(this, "Success !!!\nDatabase Cleared", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroFramework.MetroMessageBox.Show(this, "Error\n" + t, "STOP", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void performDelete() { DataGridViewRow row = dataGrid.CurrentRow; string q = "DELETE FROM employee WHERE id='" + row.Cells["id"].Value.ToString() + "'"; if (oc.insert(q)) { df++; } else { df = 0; return; } dc.deleteRequest(Convert.ToInt32(row.Cells["fid"].Value.ToString().Substring(3))); dc.wait(); if (dc.get() == "Deleted!") { df++; } }
private void performAction() { done = oc.insert(q); }
private void performeDelete() { done = oc.insert(q); }
private void waitAndUpadate() { sf = oc.insert(q); }
private void waitAndSend() { sf = oc.insert(q); }