public static Stoel GetStoelFromTicket(int ticketId) { using (OracleConnection con = Connection) { Stoel tempStoel = null; try { OracleCommand cmd = CreateOracleCommand(con, "SELECT stoel.id, stoel.type, stoel.rij, stoel.nummer, stoel.xpos, stoel.ypos, stoel.status FROM stoel INNER JOIN TICKET ON stoel_id = stoel.ID Where ticket.id = :ticketId"); cmd.Parameters.Add("ticketId", ticketId); con.Open(); OracleDataReader reader = ExecuteQuery(cmd); while (reader.Read()) { int id = Convert.ToInt32(reader["Id"]); string type = Convert.ToString(reader["Type"]); int rij = Convert.ToInt32(reader["Rij"]); int nummer = Convert.ToInt32(reader["Nummer"]); int xpos = Convert.ToInt32(reader["Xpos"]); int ypos = Convert.ToInt32(reader["Ypos"]); string status = Convert.ToString(reader["Status"]); tempStoel = new Stoel(id, type, rij, nummer, xpos, ypos, status); } return(tempStoel); } catch (Exception e) { throw e; } } }
public List <Stoel> GetByZaalId(int id) { List <Stoel> stoelen = new List <Stoel>(); using (SqlConnection conn = new SqlConnection(ConnectionString)) { conn.Open(); string query = "SELECT * FROM dbo.stoel WHERE Zaal_ID = @id"; SqlCommand cmd = new SqlCommand(query, conn); cmd.Parameters.AddWithValue("id", id); SqlDataReader reader = cmd.ExecuteReader(); Stoel s = new Stoel(); while (reader.Read()) { s.Id = reader.GetInt32(reader.GetOrdinal("ID")); s.Rij = reader.GetInt32(reader.GetOrdinal("rij")); s.StoelNummer = reader.GetInt32(reader.GetOrdinal("stoelnummer")); s.Bezet = reader.GetBoolean(reader.GetOrdinal("bezet")); stoelen.Add(s); } conn.Close(); } return(stoelen); }
public void TestStoelToString() { int rij = 1; int stoelnummer = 1; bool vipplaats = false; string infoString = "Rij: 1 - Stoelnummer: 1 - VIP plaats: False"; Stoel s = new Stoel(rij, stoelnummer, vipplaats); Assert.AreEqual(infoString, s.ToString()); }
public void TestStoelConstructorCorrect() { int rij = 1; int stoelnummer = 1; bool vipplaats = false; Stoel s = new Stoel(rij, stoelnummer, vipplaats); Assert.AreEqual(rij, s.Rij); Assert.AreEqual(stoelnummer, s.Stoelnummer); Assert.AreEqual(vipplaats, s.VIPplaats); }
public void Update(Stoel stoel, int resId) { using (SqlConnection conn = new SqlConnection(ConnectionString)) { conn.Open(); string query = "UPDATE dbo.stoel (reservering_ID, bezet) SET (@resId, @bezet) WHERE id = (@id)"; SqlCommand cmd = new SqlCommand(query, conn); cmd.Parameters.AddWithValue("@resId", resId); cmd.Parameters.AddWithValue("@bezet", stoel.Bezet); cmd.Parameters.AddWithValue("@id", stoel.Id); cmd.ExecuteNonQuery(); conn.Close(); } }
/// <summary> /// Maak een bestelling aan /// Wanneer de klant een bezoeker of lid is wordt deze bestelling automatisch aan de klant toegevoegd /// </summary> /// <param name="bestellingsID"></param> /// <param name="klant"></param> public Bestelling(Persoon klant, Bioscoopvertoning bioscoopvertoning, Stoel stoel) { Klant = klant ?? throw new ArgumentNullException(); Bioscoopvertoning = bioscoopvertoning ?? throw new ArgumentNullException(); Stoel = stoel ?? throw new ArgumentNullException(); if (klant is Bezoeker) { (klant as Bezoeker).VoegBestellingToe(this); } if (klant is Lid) { (klant as Lid).VoegBestellingToe(this); } bioscoopvertoning.VoegBestellingToe(this); }
public void StartStuff() { using (var context = new MyContext()) { var bank001 = new Bank("SklerBljeg", "Een hele mooie oranje sofa uit het noorden van Zweden, Hunke Tünke", 40, 20); if (!context.producten.Where(b => b.name == bank001.name).Any()) { context.producten.Add(bank001); } var stoel001 = new Stoel("SkonBljat", "Een mooie blauwe stoel", 10, 10); if (!context.producten.Where(b => b.name == stoel001.name).Any()) { context.producten.Add(stoel001); } context.SaveChanges(); List <Product> products = new List <Product>(); foreach (Product product in context.producten) { products.Add(product); } } }
public void VoegStoelToe(Stoel stoel) { this.Stoel = stoel; }
public Ticket(int id, Stoel stoel, Prijs prijs) { Id = id; Stoel = stoel; Prijs = prijs; }
public void UpdateStoel(Stoel s, int reserveringId) { rep.Update(s, reserveringId); }