public void AddHOPE(HOPE hope) { int id = AddMission(hope as Mission); if (id > 0) { List<string> rowListHope = new List<string>(); rowListHope.Add("missieID"); rowListHope.Add("terugkomstDatum"); List<OracleParameter> parametersHope = new List<OracleParameter>(); parametersHope.Add(new OracleParameter(":missieID", id)); parametersHope.Add(new OracleParameter(":terugkomstDatum", hope.ReturnDate)); } }
public List<Mission> GetMissions() { List<Mission> missions = new List<Mission>(); string missionQuery = "SELECT * FROM MISSIE"; OracleDataReader getAllMissions = this.Read(missionQuery, new List<OracleParameter>()); if (getAllMissions != null) { if (getAllMissions.HasRows) { while (getAllMissions.Read()) { Mission mission = null; int missionID = Convert.ToInt32(getAllMissions["ID"]); int boatID = Convert.ToInt32(getAllMissions["bootID"]); DateTime leaveDate = Convert.ToDateTime(getAllMissions["vertrekDatum"]); string description = Convert.ToString(getAllMissions["beschrijving"]); double locationX = Convert.ToDouble(getAllMissions["locatieX"]); double locationY = Convert.ToDouble(getAllMissions["locatieY"]); GeoCoordinate location = new GeoCoordinate(locationX, locationY); string report = Convert.ToString(getAllMissions["verslag"]); char type = Convert.ToChar(getAllMissions["soort"]); switch (type) { case 'H': string hopeQuery = "SELECT * FROM M_HOPE WHERE MissieID = :missionID"; List<OracleParameter> hopeParameters = new List<OracleParameter>(); hopeParameters.Add(new OracleParameter(":missionID", missionID)); OracleDataReader getHope = this.Read(hopeQuery, hopeParameters); if (getHope != null) { if (getHope.HasRows) { while (getHope.Read()) { int hopeID = Convert.ToInt32(getHope["ID"]); DateTime returnDate = Convert.ToDateTime(getHope["terugkomstDatum"]); bool approved = Convert.ToChar(getHope["goed"]) == 'Y'; mission = new HOPE(missionID,null,leaveDate,description,location,new BoatType(boatID), null, null, report, hopeID, returnDate, approved, null); break; } } getHope.Close(); } break; case 'S': string sinQuery = "SELECT * FROM M_SIN WHERE MissieID = :missionID"; List<OracleParameter> sinParameters = new List<OracleParameter>(); sinParameters.Add(new OracleParameter(":missionID", missionID)); OracleDataReader getSin = this.Read(sinQuery, sinParameters); if (getSin != null) { if (getSin.HasRows) { while (getSin.Read()) { int sinID = Convert.ToInt32(getSin["ID"]); mission = new SIN(missionID, null, leaveDate, description, location, new BoatType(boatID), null, null, report,sinID, null); break; } } getSin.Close(); } break; } missions.Add(mission); } } getAllMissions.Close(); } this.CloseConnection(); return missions; }