Ejemplo n.º 1
0
 private void btnOpslaan_Click(object sender, RoutedEventArgs e)
 {
     Boodschap boodschap = new Boodschap();
     boodschap.Aantal = Convert.ToInt32(txtAantal.Text);
     boodschap.Beschrijving = txtBeschrijving.Text;
     boodschap.Winkel = cboWinkel.Text;
     _service.BoodschapToevoegen(boodschap);
     RefreshListbox();
 }
Ejemplo n.º 2
0
 public void Toevoegen(Boodschap boodschap)
 {
     SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=BoodschappenDB;Integrated Security=True;Pooling=False");
     SqlCommand cmd = connection.CreateCommand();
     string sqlString = "INSERT INTO tbl_boodschappen (product,aantal,winkel) VALUES ('"+boodschap.Beschrijving+"',"+boodschap.Aantal+",'"+boodschap.Winkel+"')"; 
     cmd.CommandText = sqlString;
     connection.Open();
     cmd.ExecuteNonQuery();
     connection.Close();
 }
Ejemplo n.º 3
0
        public bool Toevoegen(Boodschap boodschap)
        {
            int result = 0;
            using (var connection = new SqlConnection(_connectionString))
            {
                SqlCommand cmd = connection.CreateCommand();
                cmd.CommandText = sqlStringInsert;
                cmd.Parameters.AddWithValue("@product", boodschap.Beschrijving);
                cmd.Parameters.AddWithValue("@aantal", boodschap.Aantal);
                cmd.Parameters.AddWithValue("@winkel", boodschap.Winkel);
                connection.Open();
                result = cmd.ExecuteNonQuery();
                connection.Close();
            }
            return result == 1;

        }
Ejemplo n.º 4
0
 public void BoodschapVerwijderen(Boodschap b)
 {
     BoodschapVerwijderen(b.ID);
 }
Ejemplo n.º 5
0
 public void BoodschapToevoegen(Boodschap boodschap)
 {
     da.Toevoegen(boodschap);
 }