Example #1
0
        private void btnUrunEkle_Click(object sender, EventArgs e)
        {
            AddProduct addProduct = new AddProduct(users, UserIndex);

            addProduct.Show();
            this.Hide();
        }
Example #2
0
        private void btnGuncelle_Click(object sender, EventArgs e)
        {
            products[Convert.ToInt32(urunIndex) - 1].EskiUrunFiyati = products[Convert.ToInt32(urunIndex) - 1].UrunFiyati;
            products[Convert.ToInt32(urunIndex) - 1].UrunFiyati     = Convert.ToDecimal(txtGuncelUrunFiyati.Text);

            products[Convert.ToInt32(urunIndex) - 1].EskiUrunBirimi = products[Convert.ToInt32(urunIndex) - 1].UrunBirimi;
            products[Convert.ToInt32(urunIndex) - 1].UrunBirimi     = txtGuncelUrunBirimi.Text;

            SqlCommand urunGuncelle = new SqlCommand("Update Urunler set UrunBirimi=@p1,UrunFiyati=@p2,UrunOnay=@p3,EskiUrunFiyati=@p4,EskiUrunBirimi=@p5 where UrunId=@p6", sqlConnect.Connection());

            urunGuncelle.Parameters.AddWithValue("@p1", txtGuncelUrunBirimi.Text);
            urunGuncelle.Parameters.AddWithValue("@p2", Convert.ToString(txtGuncelUrunFiyati.Text));
            urunGuncelle.Parameters.AddWithValue("@p3", false);
            urunGuncelle.Parameters.AddWithValue("@p4", Convert.ToString(products[Convert.ToInt32(urunIndex) - 1].EskiUrunFiyati));
            urunGuncelle.Parameters.AddWithValue("@p5", products[Convert.ToInt32(urunIndex) - 1].EskiUrunBirimi);
            urunGuncelle.Parameters.AddWithValue("@p6", products[Convert.ToInt32(urunIndex) - 1].UrunId);

            urunGuncelle.ExecuteNonQuery();
            MessageBox.Show("Ürün güncelleme işleminiz admin onayından sonra başarıyla gerçekleştirilecektir!");



            AddProduct addProduct = new AddProduct(users, userIndex);

            addProduct.Show();
            this.Hide();
        }