public static bool AddIncident(Incident i, int missieUID) { using (OracleConnection o = new OracleConnection(connstring)) { using (OracleCommand c = new OracleCommand()) { try { c.Connection = o; o.Open(); c.CommandText = "INSERT INTO TIncident (Beschrijving) VALUES ('" + i.Beschrijving + "')"; c.ExecuteNonQuery(); c.CommandText = "SELECT MAX(ID) FROM TIncident"; OracleDataReader dr = c.ExecuteReader(); if (dr.Read()) { c.CommandText = "INSERT INTO TMissie_Incident (MissieID, IncidentID) VALUES ('" + missieUID + "', '" + GetInt(dr[0]) + "')"; c.ExecuteNonQuery(); } return true; } catch (Exception e) { MessageBox.Show(e.Message); return false; } finally { o.Close(); } } } }
public static bool UpdateIncident(Incident i) { using (OracleConnection o = new OracleConnection(connstring)) { using (OracleCommand c = new OracleCommand()) { try { c.Connection = o; o.Open(); c.CommandText = "UPDATE TIncident SET Beschrijving = '" + i.Beschrijving + "' WHERE ID = '" + i.UID + "'"; c.ExecuteNonQuery(); return true; } catch (Exception e) { MessageBox.Show(e.Message); return false; } finally { o.Close(); } } } }
public static bool DeleteIncident(Incident i) { using (OracleConnection o = new OracleConnection(connstring)) { using (OracleCommand c = new OracleCommand()) { try { c.Connection = o; o.Open(); c.CommandText = "DELETE FROM TIncident WHERE ID = '" + i.UID + "'"; c.ExecuteNonQuery(); return true; } catch (Exception e) { MessageBox.Show(e.Message); return false; } finally { o.Close(); } } } }
public bool DeleteIncident(Incident i) { return DBConnect.DeleteIncident(i); }
public bool AddIncident(Incident i, int missieUID) { return DBConnect.AddIncident(i, missieUID); }
public bool UpdateIncident(Incident i) { return DBConnect.UpdateIncident(i); }