예제 #1
0
        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();
                    }
                }
            }
        }
예제 #2
0
 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();
             }
         }
     }
 }
예제 #3
0
 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();
             }
         }
     }
 }
예제 #4
0
 public bool DeleteIncident(Incident i)
 {
     return DBConnect.DeleteIncident(i);
 }
예제 #5
0
 public bool AddIncident(Incident i, int missieUID)
 {
     return DBConnect.AddIncident(i, missieUID);
 }
예제 #6
0
 public bool UpdateIncident(Incident i)
 {
     return DBConnect.UpdateIncident(i);
 }