public static void registreerOnderhoud(Tramonderhoud onderhoud) { try { connection.Open(); OracleCommand command = new OracleCommand("INSERT INTO TRAM_ONDERHOUD(Medewerker_ID, Tram_ID, DatumTijdStip, BeschikbaarDatum, TypeOnderhoud, Notitie)" + "VALUES (:medewerker_ID, :tram_ID, :datumTijdstip, :datumBeschikbaar, :typeOnderhoud, :notitie)"); command.CommandType = CommandType.Text; command.Connection = connection; command.Parameters.Add(":medewerker_ID", onderhoud.Medewerker.Id); command.Parameters.Add(":tram_ID", onderhoud.Tram.Id); command.Parameters.Add(":datumTijdstip", onderhoud.DatumTijdstip); command.Parameters.Add(":datumBeschikbaar", onderhoud.BeschikbaarDatum); command.Parameters.Add(":typeOnderhoud", (int)onderhoud.TypeOnderhoud + 1); command.Parameters.Add(":notitie", onderhoud.Opmerking); command.ExecuteNonQuery(); } catch (OracleException) { throw; } finally { connection.Close(); } }
public void Onderhoud(TypeOnderhoud typeOnderhoud, string opmerking, DateTime beschikbaar, Medewerker medewerker) { if (typeOnderhoud == TypeOnderhoud.GroteSchoonmaak || typeOnderhoud == TypeOnderhoud.KleineSchoonmaak) { this.IsNietVervuild(); } else if (typeOnderhoud == TypeOnderhoud.GroteReparatie || typeOnderhoud == TypeOnderhoud.KleineReparatie) { this.IsNietDefect(); } Tramonderhoud onderhoud = new Tramonderhoud(medewerker, this, beschikbaar, DateTime.Now, typeOnderhoud, opmerking); TramManager.voegOnderhoudToe(onderhoud); DatabaseManager.registreerOnderhoud(onderhoud); }
public static void VoltooiOnderhoud(Tramonderhoud onderhoud) { try { connection.Open(); OracleCommand command = new OracleCommand("UPDATE TRAM_ONDERHOUD SET Voltooid = 1 WHERE ID = :mID"); command.CommandType = CommandType.Text; command.Connection = connection; command.Parameters.Add(":mID", onderhoud.Id); command.ExecuteNonQuery(); } catch (OracleException) { throw; } finally { connection.Close(); } }
public static void voegOnderhoudToe(Tramonderhoud onderhoud) { onderhoudsBeurten.Add(onderhoud); }