public void addCadeausToDB(Cadeau cadeau) { //de connectie met de databank maken MySqlConnection conn = new MySqlConnection(_connectionString); //Het SQL-commando definiëren string opdracht = "INSERT INTO wishlist.cadeau(Naam, Omschrijving, Website) VALUES(@name, @omsc, @web)"; MySqlCommand cmd = new MySqlCommand(opdracht, conn); //voeg de waarden toe, je haalt ze uit het object eval cmd.Parameters.AddWithValue("name", cadeau.Name); cmd.Parameters.AddWithValue("omsc", cadeau.Description); cmd.Parameters.AddWithValue("web", cadeau.Website); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); }
protected void BtnToMyList_Click(object sender, EventArgs e) { int selectedGiftIndex = lbxAllCadeaus.SelectedIndex; Cadeau item = _controller.addCadeauToList(selectedGiftIndex); LbxCurrentList.Items.Add(item.ToString()); }
public List <Cadeau> getLHCFromCode(int indexLijst) { MySqlConnection conn = new MySqlConnection(_connectionString); //Het SQL-commando definiëren string opdracht = " SELECT cadeau.*,GekochtJaOfNee FROM wishlist.cadeau inner join lijst_has_cadeau on id_Cadeau = FK_Cadeau where FK_Lijst = @indxL;"; MySqlCommand cmd = new MySqlCommand(opdracht, conn); cmd.Parameters.AddWithValue("indxL", indexLijst); List <Cadeau> itemLijst = new List <Cadeau>(); conn.Open(); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { Cadeau item = new Cadeau( Convert.ToInt16(dataReader[0]), dataReader[1].ToString(), dataReader[2].ToString(), dataReader[3].ToString(), dataReader[4].ToString() ); itemLijst.Add(item); } conn.Close(); return(itemLijst); }
public List <Cadeau> getCadeausFromDB() { MySqlConnection conn = new MySqlConnection(_connectionString); //Het SQL-commando definiëren string opdracht = "SELECT * FROM wishlist.cadeau"; MySqlCommand cmd = new MySqlCommand(opdracht, conn); List <Cadeau> itemLijst = new List <Cadeau>(); conn.Open(); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { Cadeau item = new Cadeau( Convert.ToInt16(dataReader[0]), dataReader[1].ToString(), dataReader[2].ToString(), dataReader[3].ToString() ); itemLijst.Add(item); } conn.Close(); return(itemLijst); }
private void Button_Click_1(object sender, RoutedEventArgs e) { Cadeau cadeau = new Cadeau(txtnaam.Text, txtomschrijving.Text, txtwebsite.Text); _controller.addCadeausToDB(cadeau); fillControls(); }
protected void btnAdd_Click(object sender, EventArgs e) { Cadeau cadeau = new Cadeau(txtName.Text, txtDescription.Text, txtWebsite.Text); _controller.addCadeausToDB(cadeau); fillControls(); }
protected void btnAdd_Click(object sender, EventArgs e) { Gebruiker gebruiker = _controller.getActiveGebruiker(); Lijst lijst = new Lijst(txtName.Text, lblCode.Text, "Ja", gebruiker.ID); Cadeau cadeau = new Cadeau(txtName.Text, txtDescription.Text, txtWebsite.Text); _controller.addCadeausToDB(cadeau); fillControls(); }
public static CadeauModel CadeauToCadeauModel(Cadeau C) { return(new CadeauModel() { IdCadeau = C.IdCadeau, Nom = C.Nom, Description = C.Description, }); }
public static CadeauxModel CadeauxToCadeauxModel(Cadeau c) { return(new CadeauxModel() { Description = c.Description, IdCadeau = c.Id, IdMembre = c.IdMembre, Magasin = c.Magasin, Nom = c.Nom, Prix = c.Prix }); }
public void Absorb() { GameObject[] presents = GameObject.FindGameObjectsWithTag("present"); Debug.Log("NbCadeau = " + presents.Length + " id cheminee = " + id); int score = 0; foreach (GameObject present in presents) { Cadeau c = present.GetComponent <Cadeau>(); if (c.getCheminee() == id) { score += c.getScore(); Destroy(present); } } score *= multiplier; gm.addSCore(score); if (!gameObject.GetComponent <AudioSource>().isPlaying) { gameObject.GetComponent <AudioSource>().Play(); } }
public void changeCadeauInDB(Cadeau cadeau, int id) { MySqlConnection conn = new MySqlConnection(_connectionString); //Het SQL-commando definiëren string opdracht = ("UPDATE wishlist.cadeau SET Naam = @name, Omschrijving = @omsc, Website = @web, GekochtJaOfNee= @geko WHERE (id = @idparameter);"); MySqlCommand cmd = new MySqlCommand(opdracht, conn); cmd.Parameters.AddWithValue("name", cadeau.Name); cmd.Parameters.AddWithValue("omsc", cadeau.Description); cmd.Parameters.AddWithValue("web", cadeau.Website); cmd.Parameters.AddWithValue("idparameter", id); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); }
public Cadeau getInfosCadeau(int pId_cadeau) { String sql = "SELECT intitule_cadeau, description, prix, id_cadeau" + " FROM \"cadeaux\"" + " WHERE id_cadeau = " + pId_cadeau + ";"; try { Cadeau cadeauRetour = new Cadeau(); DataTable dt = conn.getConnection(sql); cadeauRetour.id_cadeau = pId_cadeau; cadeauRetour.intitule_cadeau = dt.Rows[0].ItemArray.GetValue(0).ToString(); cadeauRetour.description = dt.Rows[0].ItemArray.GetValue(1).ToString(); cadeauRetour.prix = dt.Rows[0].ItemArray.GetValue(2).ToString(); return(cadeauRetour); } catch (Exception) { return(null); } }
public void addCadeausToDB(Cadeau item) { CadeauMapper mapper = new CadeauMapper(_connectionstring); mapper.addCadeausToDB(item); }