Example #1
0
        private void btnEkle_Click(object sender, EventArgs e)
        {
            cBaglanti bgl = new cBaglanti();
            //cBilgilendirme tab = new cBilgilendirme();
            cUrunler        urun = new cUrunler();
            MySqlConnection con  = new MySqlConnection(bgl.baglanti);

            con.Open();
            for (int i = 0; i < Convert.ToInt32(ndAdet.Value); i++)
            {
                string no     = lvUrunler.SelectedItems[0].SubItems[0].Text;
                string adi    = lvUrunler.SelectedItems[0].SubItems[1].Text;
                string fiyati = lvUrunler.SelectedItems[0].SubItems[2].Text;

                MySqlCommand kmt = new MySqlCommand("insert into siparis(masa_id,urun_id) values(" + cBilgilendirme._buttonId + "," + no + ")", con);
                kmt.ExecuteNonQuery();

                string[]     row  = { no, adi, fiyati };
                ListViewItem item = new ListViewItem(row);
                lvSiparis.Items.Add(item);
            }
            txtUrun.Text = "";
            ndAdet.Value = 1;
            tutar();
        }
Example #2
0
        private void cmbKatagori_SelectedIndexChanged(object sender, EventArgs e)
        {
            lvUrunler.Items.Clear();
            cBaglanti       bgl    = new cBaglanti();
            MySqlConnection connet = new MySqlConnection(bgl.baglanti);
            MySqlCommand    kmt    = new MySqlCommand("select * from urunler where kId=" + (cmbKatagori.SelectedItem as cKategori).Id + "", connet);
            List <cUrunler> urn    = new List <cUrunler>();

            connet.Open();
            MySqlDataReader drUrunler = kmt.ExecuteReader();

            while (drUrunler.Read())
            {
                ListViewItem item = new ListViewItem(drUrunler["id"].ToString());
                item.SubItems.Add(drUrunler["adi"].ToString());
                item.SubItems.Add(drUrunler["fiyati"].ToString());

                lvUrunler.Items.Add(item);

                cUrunler urun = new cUrunler();
                urun.Id    = Convert.ToInt32(drUrunler["id"]);
                urun.kId   = Convert.ToInt32(drUrunler["kId"]);
                urun.Adi   = drUrunler["adi"].ToString();
                urun.fiyat = Convert.ToSingle(drUrunler["fiyati"]);

                urn.Add(urun);
            }
        }