Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && comboBox1.SelectedItem != null && textBox5.Text != "")
            {
                if (Convert.ToInt32(textBox5.Text) > 0)
                {
                    string[] bol;
                    string   sec = comboBox1.SelectedItem.ToString();
                    bol = sec.Split('*');
                    int        tutar = 0;
                    int        toplam;
                    SqlCommand kmt = new SqlCommand("select fiyat from urunler where urun=@urun", baglanti);
                    kmt.Parameters.AddWithValue("@urun", bol[0]);
                    baglanti.Open();
                    SqlDataReader getir = kmt.ExecuteReader();
                    while (getir.Read())
                    {
                        tutar = Convert.ToInt32(getir["fiyat"].ToString());
                    }
                    baglanti.Close();
                    toplam = tutar * Convert.ToInt32(textBox5.Text);

                    siparis  sipariss = new siparis();
                    DateTime gun      = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                    sipariss.tarih   = gun.ToString("yyyy-MM-dd");
                    sipariss.tc      = textBox1.Text;
                    sipariss.adsoyad = textBox2.Text;
                    sipariss.tel     = textBox3.Text;
                    sipariss.bolge   = textBox4.Text;
                    sipariss.adres   = richTextBox1.Text;
                    sipariss.urun    = bol[0];
                    sipariss.adet    = Convert.ToInt32(textBox5.Text);
                    sipariss.fiyat   = toplam.ToString();
                    sipariss.durum   = "Hazırlanıyor";
                    sipariss.siparisekle();
                    gridview();
                }
                else
                {
                    MessageBox.Show("Adet SIFIR olamaz");
                }
            }
            else
            {
                MessageBox.Show("Tüm alanları doldurunuz");
            }
        }
Beispiel #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (textBox7.Text != "")
     {
         int     secilensatir = dataGridView1.SelectedCells[0].RowIndex;
         string  durum        = "Hazırlanıyor";
         siparis siparis      = new siparis();
         siparis.tc    = textBox7.Text;
         siparis.durum = durum;
         siparis.urun  = dataGridView1.Rows[secilensatir].Cells[8].Value.ToString();
         siparis.adet  = Convert.ToInt16(dataGridView1.Rows[secilensatir].Cells[10].Value.ToString());
         siparis.id    = Convert.ToInt16(id);
         siparis.siparissil();
         gridview();
     }
     else
     {
         MessageBox.Show("Müşteri Tcsini giriniz");
     }
 }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && comboBox1.SelectedItem != null && textBox5.Text != "")
            {
                if (Convert.ToInt32(textBox5.Text) > 0)
                {
                    siparis siparis      = new siparis();
                    int     secilensatir = dataGridView1.SelectedCells[0].RowIndex;
                    if (dataGridView1.Rows[secilensatir].IsNewRow == false)
                    {
                        siparis.urun2 = dataGridView1.Rows[secilensatir].Cells[8].Value.ToString();
                        siparis.adet2 = Convert.ToInt16(dataGridView1.Rows[secilensatir].Cells[10].Value.ToString());
                    }

                    string[] bol;
                    string   sec = comboBox1.SelectedItem.ToString();
                    bol = sec.Split('*');
                    int        tutar = 0;
                    int        toplam;
                    SqlCommand kmt = new SqlCommand("select fiyat from urunler where urun=@urun", baglanti);
                    kmt.Parameters.AddWithValue("@urun", bol[0]);
                    baglanti.Open();
                    SqlDataReader getir = kmt.ExecuteReader();
                    while (getir.Read())
                    {
                        tutar = Convert.ToInt32(getir["fiyat"].ToString());
                    }
                    baglanti.Close();

                    SqlCommand kmt1 = new SqlCommand("select adet from siparis where mtc=@tc and id=@id", baglanti);
                    kmt1.Parameters.AddWithValue("@tc", textBox1.Text);
                    kmt1.Parameters.AddWithValue("@id", id);
                    baglanti.Open();
                    SqlDataReader hesap = kmt1.ExecuteReader();
                    if (hesap.Read())
                    {
                        siparis.tut = Convert.ToInt32(hesap["adet"].ToString());
                    }
                    baglanti.Close();
                    DateTime gun = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                    toplam          = tutar * Convert.ToInt32(textBox5.Text);
                    siparis.id      = Convert.ToInt16(id);
                    siparis.tc      = textBox1.Text;
                    siparis.adsoyad = textBox2.Text;
                    siparis.bolge   = textBox4.Text;
                    siparis.tarih   = gun.ToString("yyyy-MM-dd");
                    siparis.tel     = textBox3.Text;
                    siparis.adres   = richTextBox1.Text;
                    siparis.urun    = bol[0];
                    siparis.adet    = Convert.ToInt32(textBox5.Text);
                    siparis.durum   = "Hazırlanıyor";
                    siparis.fiyat   = toplam.ToString();
                    siparis.siparisguncelle();
                    gridview();
                }
                else
                {
                    MessageBox.Show("Adet SIFIR olamaz");
                }
            }
            else
            {
                MessageBox.Show("Tüm alanları doldurun");
            }
        }