示例#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);
 }