private void CihazBGuncelle_Click(object sender, EventArgs e)
 {
     if (marka.Text != "" && model.Text != "" && (imei.Text != "" || serino.Text != ""))
     {
         byte sonuc;
         sonuc = fk.Guncelle("Teknik_Takip", "Takip_marka='" + fk.IlkHarfleriBuyut(marka.Text) + "', Takip_model='" + fk.IlkHarfleriBuyut(model.Text) + "', Takip_imei='" + imei.Text + "', Takip_serino='" + serino.Text + "'", "Takip_no='" + label8.Text + "'");
         if (sonuc == 1)
         {
             MessageBox.Show("Cihaz bilgileri başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Tkp.GridGuncelle();
             if (Tkp.takipno.Text != "TKP")
             {
                 Tkp.TakipArama();
             }
             else
             {
                 Tkp.FormLoad();
             }
         }
         else
         {
             MessageBox.Show("Cihaz bilgileri güncellenemedi ( Hata kodu: T-10 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Cihaz bilgilerini eksiksiz doldurunuz. ( Hata kodu: T-09 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void BtnGuncelle_Click(object sender, EventArgs e)
        {
            katAdi.Text = katAdi.Text.Replace("'", "’");
            katAdi.Text = fk.IlkHarfleriBuyut(katAdi.Text);
            FbConnection baglan = new FbConnection(fk.Baglanti_Kodu());

            baglan.Open();
            FbCommand Kontrol = new FbCommand("SELECT * FROM Musteri_kategori WHERE Kategori_adi='" + katAdi.Text + "'", baglan);
            object    k1      = Kontrol.ExecuteScalar();

            if (k1 == null)
            {
                byte sonuc = fk.Guncelle("Musteri_kategori", "Kategori_adi='" + katAdi.Text + "'", "Kategori_id='" + id + "'");
                if (sonuc == 1)
                {
                    MessageBox.Show("Müşteri kategorisi başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Müşteri kategorisi güncellenemedi ( Hata kodu: M-11 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Güncellenmek istenen kategori sistemde kayıtlı bulunduğundan güncellenmemiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            baglan.Close();
        }
 private void Guncelle_Click(object sender, EventArgs e)
 {
     try
     {
         if (GuncellemeKategoriAdi.Text.Length > 0)
         {
             if (GuncellemeKategoriAdi.Text != katadi)
             {
                 GuncellemeKategoriAdi.Text = GuncellemeKategoriAdi.Text.Replace("'", "’");
                 FbConnection b1 = new FbConnection(fk.Baglanti_Kodu());
                 b1.Open();
                 FbCommand KatSor = new FbCommand("SELECT * FROM Urun_kategori WHERE Kategori_adi='" + fk.IlkHarfleriBuyut(GuncellemeKategoriAdi.Text) + "'", b1);
                 object    ss     = KatSor.ExecuteScalar();
                 if (ss == null)
                 {
                     b1.Close();
                     byte guncelle;
                     guncelle = fk.Guncelle("Urun_kategori", "Kategori_adi='" + fk.IlkHarfleriBuyut(GuncellemeKategoriAdi.Text) + "'", "Kategori_id='" + id + "'");
                     if (guncelle == 1)
                     {
                         MessageBox.Show("Kategori başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         UrunKategoriCombo.Items.Clear();
                         UrunKategoriCombo.Items.Add(fk.IlkHarfleriBuyut(GuncellemeKategoriAdi.Text));
                         UrunKategoriCombo.Text = fk.IlkHarfleriBuyut(GuncellemeKategoriAdi.Text);
                     }
                     else
                     {
                         MessageBox.Show("Kategori güncellenemedi ( Hata kodu: K-02 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Yeni kategori sistemde kayıtlı, güncelleme iptal edildi.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 }
                 b1.Close();
             }
             else
             {
                 // kategori adları aynı..
                 MessageBox.Show("Kategori başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             MessageBox.Show("Yeni kategori adını giriniz", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception e1)
     {
         MessageBox.Show(e1.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void SilEvet_Click(object sender, EventArgs e)
        {
            byte sonuc;

            FbConnection baglan  = new FbConnection(fk.Baglanti_Kodu());
            FbConnection baglan1 = new FbConnection(fk.Baglanti_Kodu());
            FbConnection baglan2 = new FbConnection(fk.Baglanti_Kodu());

            // Müşteri sipariş verdiyse bu siparişleri silicez.

            baglan.Open();
            FbCommand MusUrun = new FbCommand("SELECT Satis_urun FROM Satis WHERE Satis_musteri='" + id + "'", baglan);

            string[]     urun_id = new string[0];
            FbDataReader UrunidOku = MusUrun.ExecuteReader(); int i = 0;

            while (UrunidOku.Read())
            {
                Array.Resize(ref urun_id, urun_id.Length + 1);
                urun_id[i] = UrunidOku["Satis_urun"].ToString();
                i++;
            }
            baglan.Close();

            foreach (string uid in urun_id)
            {
                baglan.Open();
                FbCommand    SatisTab   = new FbCommand("SELECT Satis_id FROM Satis WHERE Satis_urun='" + uid + "'", baglan);
                FbDataReader SatisIdOku = SatisTab.ExecuteReader();
                while (SatisIdOku.Read())
                {
                    fk.Sil("Satis", "Satis_id='" + SatisIdOku["Satis_id"].ToString() + "'");
                }
                baglan.Close();

                baglan.Open();
                FbCommand    RaporTab   = new FbCommand("SELECT rapor_id,rapor_sayac FROM Rapor WHERE rapor_satisId='" + uid + "'", baglan);
                FbDataReader RaporIdOku = RaporTab.ExecuteReader();
                while (RaporIdOku.Read())
                {
                    if (int.Parse(RaporIdOku["rapor_sayac"].ToString()) > 1)
                    {
                        fk.Guncelle("Rapor", "rapor_sayac=rapor_sayac-1", "rapor_id='" + RaporIdOku["rapor_id"].ToString() + "'");
                    }
                    else
                    {
                        fk.Sil("Rapor", "rapor_id='" + RaporIdOku["rapor_id"].ToString() + "'");
                    }
                }
                baglan.Close();
            }

            // Teknik takipleri sil
            baglan.Open();
            FbCommand    TeknikTab = new FbCommand("SELECT Takip_id FROM Teknik_Takip WHERE Takip_musteri='" + id + "'", baglan);
            FbDataReader Takipid   = TeknikTab.ExecuteReader();

            string[] takip_id = new string[0]; int b = 0;
            while (Takipid.Read())
            {
                Array.Resize(ref takip_id, takip_id.Length + 1);
                takip_id[b] = Takipid["Takip_id"].ToString();
                b++;
            }
            baglan.Close();

            foreach (string tid in takip_id)
            {
                fk.Sil("Teknik_TakipIslemler", "Takip_id='" + tid + "'");
                fk.Sil("Teknik_Takip", "Takip_id='" + tid + "'");
            }



            sonuc = fk.Sil("Musteriler", "Musteri_id='" + id + "'");
            if (sonuc == 1)
            {
                MessageBox.Show("Müşteri başarıyla silinmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("Müşteri silinemedi ( Hata kodu: M-09 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 5
0
        private void YeniSatisBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string       satis_urun = "", satis_musteri = "", satis_kategori = ""; byte sonuc, sonuc1;
                float        bakiye = 0, tutar = 0;
                FbConnection baglan = new FbConnection(fk.Baglanti_Kodu());

                baglan.Open();
                FbCommand UrunBilgi = new FbCommand("SELECT Urun_id FROM Urunler WHERE Urun_adi='" + SatisUrun.Text + "'", baglan);
                object    s1        = UrunBilgi.ExecuteScalar();
                if (s1 != null)
                {
                    FbDataReader UrunOku = UrunBilgi.ExecuteReader();
                    UrunOku.Read(); satis_urun = UrunOku["Urun_id"].ToString(); UrunOku.Close();
                }
                else
                {
                    MessageBox.Show("Sistemsel bir sorun oluştu, lütfen sağlayıcınıza başvurunuz.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                baglan.Close();

                baglan.Open();
                FbCommand KategoriBilgi = new FbCommand("SELECT * FROM Urun_kategori WHERE Kategori_adi='" + SatisUrunKategorisi.Text + "'", baglan);
                object    s2            = KategoriBilgi.ExecuteScalar();
                if (s2 != null)
                {
                    FbDataReader KategoriOku = KategoriBilgi.ExecuteReader();
                    KategoriOku.Read(); satis_kategori = KategoriOku["Kategori_id"].ToString(); KategoriOku.Close();
                }
                else
                {
                    MessageBox.Show("Sistemsel bir sorun oluştu, lütfen sağlayıcınıza başvurunuz.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                baglan.Close();

                int satisadet = int.Parse(SatisAdet.Value.ToString());
                int satisSay  = 0;
                for (int i = 1; i <= satisadet; i++)
                {
                    if (KayitliMi1.Checked)
                    {
                        string[] ads = SatisMusteri.Text.Split(' ');
                        baglan.Open();
                        FbCommand MusBilgi = new FbCommand("SELECT Musteri_id,Musteri_bakiye FROM Musteriler WHERE Musteri_adi='" + ads[0] + "' and Musteri_soyadi='" + ads[1] + "'", baglan);
                        object    s3       = MusBilgi.ExecuteScalar();
                        if (s3 != null)
                        {
                            FbDataReader MusOku = MusBilgi.ExecuteReader();
                            MusOku.Read(); satis_musteri = MusOku["Musteri_id"].ToString(); bakiye = float.Parse(MusOku["Musteri_bakiye"].ToString()); MusOku.Close();
                        }
                        else
                        {
                            MessageBox.Show("Sistemsel bir sorun oluştu, lütfen sağlayıcınıza başvurunuz.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        baglan.Close();
                    }
                    string tarih = DateTime.Now.Year.ToString(); tarih += '-' + DateTime.Now.Month.ToString(); tarih += '-' + DateTime.Now.Day.ToString();
                    if (satis_musteri == "")
                    {
                        sonuc = fk.Ekle("Satis", "Satis_urun,Satis_tarih,Satis_not", "'" + satis_urun + "','" + tarih + "','" + SatisNot.Text + "'");
                        baglan.Open();
                        FbCommand UrunVarMi = new FbCommand("SELECT rapor_satisId,rapor_tarih FROM Rapor WHERE rapor_satisId='" + satis_urun + "' and rapor_tarih='" + tarih + "'", baglan);
                        object    varmi     = UrunVarMi.ExecuteScalar();
                        if (varmi != null)
                        {
                            sonuc1 = fk.Guncelle("Rapor", "rapor_sayac=rapor_sayac+1", "rapor_satisId='" + satis_urun + "' and rapor_tarih='" + tarih + "'");
                        }
                        else
                        {
                            sonuc1 = fk.Ekle("Rapor", "rapor_satisId,rapor_satisKt,rapor_sayac,rapor_tarih", "'" + satis_urun + "','" + satis_kategori + "','1','" + tarih + "'");
                        }
                        baglan.Close();
                        if (sonuc == 1 && sonuc1 == 1)
                        {
                            satisSay++;
                        }
                        else
                        {
                            satisSay = satisSay + 0;
                        }
                    }
                    else
                    {
                        sonuc = fk.Ekle("Satis", "Satis_urun,Satis_musteri,Satis_tarih,Satis_not", "'" + satis_urun + "','" + satis_musteri + "','" + tarih + "','" + SatisNot.Text + "'");
                        baglan.Open();
                        FbCommand UrunVarMi = new FbCommand("SELECT rapor_satisId,rapor_tarih FROM Rapor WHERE rapor_satisId='" + satis_urun + "' and rapor_tarih='" + tarih + "'", baglan);
                        object    varmi     = UrunVarMi.ExecuteScalar();
                        if (varmi != null)
                        {
                            sonuc1 = fk.Guncelle("Rapor", "rapor_sayac=rapor_sayac+1", "rapor_satisId='" + satis_urun + "' and rapor_tarih='" + tarih + "'");
                        }
                        else
                        {
                            sonuc1 = fk.Ekle("Rapor", "rapor_satisId,rapor_satisKt,rapor_sayac,rapor_tarih", "'" + satis_urun + "','" + satis_kategori + "','1','" + tarih + "'");
                        }
                        baglan.Close();
                        if (sonuc == 1 && sonuc1 == 1)
                        {
                            satisSay++;
                            if (checkBox1.Checked)
                            {
                                tutar        = float.Parse(SatisTutar.Text);
                                bakiye       = bakiye - tutar;
                                ybakiye.Text = bakiye.ToString();
                                ybakiye.Text = ybakiye.Text.Replace(',', '.');
                                fk.Guncelle("Musteriler", "Musteri_bakiye='" + ybakiye.Text + "'", "Musteri_id='" + satis_musteri + "'");
                            }
                        }
                        else
                        {
                            satisSay = satisSay + 0;
                        }
                    }
                }
                if (satisSay > 0)
                {
                    MessageBox.Show("Satış başarıyla eklenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    SatisAdet.Value = 1;
                    SatisNot.Text   = "";
                }
                else
                {
                    MessageBox.Show("Satış eklenemedi ( Hata kodu: S-01 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception e4)
            {
                MessageBox.Show(e4.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void Guncelle_Click(object sender, EventArgs e)
 {
     if (guncelleme.Text != "")
     {
         byte sonuc;
         sonuc = fk.Ekle("TeknikTakipIslemler", "Takip_id,Takip_bilgi", "'" + id + "','" + guncelleme.Text + "'");
         islemler.Items.Add(guncelleme.Text);
         if (sonuc == 1)
         {
             islemler.SelectedIndex = 0;
             if (islemler.Text == "Bu cihazda şuanda işlem yapılmamıştır")
             {
                 islemler.Items.Clear();
                 islemler.Items.Add(guncelleme.Text);
                 islemler.SelectedIndex = -1;
             }
             else
             {
                 islemler.SelectedIndex = -1;
             }
             MessageBox.Show("Takip başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
             guncelleme.Text = "";
         }
         else
         {
             MessageBox.Show("Takip güncellenemedi ( Hata kodu: T-06 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         if (tkpKapat.Checked)
         {
             byte   sonuc1;
             string tarih = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString();
             sonuc1 = fk.Guncelle("Teknik_Takip", "Takip_kapanisTarih='" + tarih + "',Takip_durum='0'", "Takip_id='" + id + "'");
             if (sonuc1 == 1)
             {
                 MessageBox.Show("Takip başarıyla kapatılmıştır", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 fk.Ekle("TeknikTakipIslemler", "Takip_id,Takip_bilgi", "'" + id + "','Tüm işlemler tamamlanmıştır.'");
                 islemler.Items.Add("Tüm işlemler tamamlanmıştır.");
                 grup5.Enabled = false;
             }
             else
             {
                 MessageBox.Show("Takip kapatılamadı ( Hata kodu: T-07 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else if (guncelleme.Text == "" && tkpKapat.Checked == true)
     {
         byte   sonuc;
         string tarih = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString();
         sonuc = fk.Guncelle("Teknik_Takip", "Takip_kapanisTarih='" + tarih + "',Takip_durum='0'", "Takip_id='" + id + "'");
         if (sonuc == 1)
         {
             MessageBox.Show("Takip başarıyla kapatılmıştır", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
             fk.Ekle("TeknikTakipIslemler", "Takip_id,Takip_bilgi", "'" + id + "','Tüm işlemler tamamlanmıştır.'");
             islemler.Items.Add("Tüm işlemler tamamlanmıştır.");
             grup5.Enabled = false;
         }
         else
         {
             MessageBox.Show("Takip kapatılamadı ( Hata kodu: T-07 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Güncelleme bilgisini giriniz ( Hata kodu: T-08 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 7
0
        public void SatisIptali()
        {
            try
            {
                SatisId.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                string[] ads = SatisId.Text.Split(' ');
                if (ads[0] == "S")
                {
                    SatisId.Text = ads[1].ToString();
                    FbConnection b1 = new FbConnection(fk.Baglanti_Kodu());

                    b1.Open();
                    FbCommand    SatisUrun = new FbCommand("SELECT Satis_urun FROM Satis WHERE Satis_id='" + SatisId.Text + "'", b1);
                    FbDataReader Oku       = SatisUrun.ExecuteReader();
                    Oku.Read();
                    string urunid = Oku["Satis_urun"].ToString();
                    Oku.Close();
                    b1.Close();

                    DialogResult m = MessageBox.Show(dataGridView1.CurrentRow.Cells[1].Value.ToString() + " Satışı iptal edilecek. Emin misiniz ? ", "Onaylama", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (DialogResult.Yes == m)
                    {
                        fk.Sil("Satis", "Satis_id='" + SatisId.Text + "' and Satis_tarih='" + tarih + "'");
                        b1.Open();
                        FbCommand       RaporSor = new FbCommand("SELECT * FROM Rapor WHERE rapor_satisId='" + urunid + "' and rapor_tarih='" + tarih + "'", b1);
                        FbDataReader    cek      = RaporSor.ExecuteReader();
                        cek.Read(); int say      = int.Parse(cek["rapor_sayac"].ToString()); cek.Close();
                        b1.Close();
                        if (say > 1)
                        {
                            byte sonuc = fk.Guncelle("Rapor", "rapor_sayac=rapor_sayac-1", "rapor_satisId='" + urunid + "' and rapor_tarih='" + tarih + "'");
                            if (sonuc == 1)
                            {
                                MessageBox.Show("Satış başarıyla silinmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                GridGuncelle();
                                FormLoad();
                            }
                            else
                            {
                                MessageBox.Show("Satış silinemedi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            byte sonuc = fk.Sil("Rapor", "rapor_satisId='" + urunid + "' and rapor_tarih='" + tarih + "'");
                            if (sonuc == 1)
                            {
                                MessageBox.Show("Satış başarıyla silinmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                GridGuncelle();
                                FormLoad();
                            }
                            else
                            {
                                MessageBox.Show("Satış silinemedi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
                else
                {
                    SatisId.Text = ads[1].ToString();
                    DialogResult m = MessageBox.Show(dataGridView1.CurrentRow.Cells[1].Value.ToString() + " Satışı iptal edilecek. Emin misiniz ? ", "Onaylama", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (DialogResult.Yes == m)
                    {
                        byte sonuc = fk.Sil("ManuelSatis", "satis_id='" + SatisId.Text + "'");
                        if (sonuc == 1)
                        {
                            MessageBox.Show("Satış başarıyla silinmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Satış silinemedi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 8
0
        private void Guncelle_Click(object sender, EventArgs e)
        {
            try
            {
                Urunler Uruns = (Urunler)Application.OpenForms["Urunler"];
                UrunAdi.Text   = UrunAdi.Text.Replace("'", "’");
                UrunFiyat.Text = UrunFiyat.Text.Replace(',', '.');
                AlisFiyat.Text = AlisFiyat.Text.Replace(',', '.');
                string ad, barkod, fiyat, kategori; string katId = "";
                ad = UrunAdi.Text; barkod = UrunBarkod.Text; fiyat = UrunFiyat.Text; kategori = UrunKategori.Text;
                if ((ad != "" && ad.Length > 3) && fiyat != "" && kategori != "" && AlisFiyat.Text != "")
                {
                    // urun id yi çıkar //
                    FbConnection baglanti = new FbConnection(fk.Baglanti_Kodu()); FbDataReader KategoriIdCek;
                    baglanti.Open();
                    FbCommand KategoriAdiSorgu = new FbCommand("SELECT Kategori_id FROM Urun_kategori WHERE Kategori_adi='" + kategori + "'", baglanti);
                    KategoriIdCek = KategoriAdiSorgu.ExecuteReader();
                    KategoriIdCek.Read(); katId = KategoriIdCek["Kategori_id"].ToString();
                    baglanti.Close();
                    // urun id yi çıkar //

                    if (barkodlu.Checked == true)
                    {
                        // Ürünü güncelle //
                        byte sonuc;
                        sonuc = fk.Guncelle("Urunler", "Urun_barkodNo='0',Urun_adi='" + fk.IlkHarfleriBuyut(ad) + "',Urun_fiyat='" + fiyat + "',Urun_kategori='" + katId + "',Urun_alisFiyat='" + AlisFiyat.Text + "'", "Urun_id='" + id + "'");
                        if (sonuc == 1)
                        {
                            MessageBox.Show("Ürün başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            if (Uruns.UrunAdi.Text != "")
                            {
                                Uruns.GridGuncelle();
                                Uruns.UrunAra();
                            }
                            else if (Uruns.BarkodNo.Text != "")
                            {
                                Uruns.GridGuncelle();
                                Uruns.UrunAraBarkod();
                            }
                            else
                            {
                                Uruns.GridGuncelle();
                                Uruns.FormLoad();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Ürün güncellenemedi ( Hata kodu: M-03 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        // Ürünü güncelle //
                    }
                    else
                    {
                        barkod = UrunBarkod.Text;
                        if (barkod.Length > 14)
                        {
                            // Ürünü güncelle //
                            byte sonuc;
                            sonuc = fk.Guncelle("Urunler", "Urun_barkodNo='" + barkod + "',Urun_adi='" + ad + "',Urun_fiyat='" + fiyat + "',Urun_alisFiyat='" + AlisFiyat.Text + "', Urun_kategori='" + katId + "'", "Urun_id='" + id + "'");
                            if (sonuc == 1)
                            {
                                MessageBox.Show("Ürün başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                if (Uruns.UrunAdi.Text != "")
                                {
                                    Uruns.GridGuncelle();
                                    Uruns.UrunAra();
                                }
                                else if (Uruns.BarkodNo.Text != "")
                                {
                                    Uruns.GridGuncelle();
                                    Uruns.UrunAraBarkod();
                                }
                                else
                                {
                                    Uruns.GridGuncelle();
                                    Uruns.FormLoad();
                                }
                            }
                            else
                            {
                                MessageBox.Show("Ürün güncellenemedi ( Hata kodu: M-03 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }

                            // Ürünü güncelle //
                        }
                        else
                        {
                            MessageBox.Show("Barkod numarasını 15 hane olarak giriş yapınız", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    // BOŞ ALANLAR
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 9
0
        private void ButonAramayaGoreGuncelle_Click(object sender, EventArgs e)
        {
            Musteri_adi.Text    = Musteri_adi.Text.Replace("'", "’");
            Musteri_soyadi.Text = Musteri_soyadi.Text.Replace("'", "’");
            Musteri_adresi.Text = Musteri_adresi.Text.Replace("'", "’");
            Musteri_adi.Text    = fk.IlkHarfleriBuyut(Musteri_adi.Text);
            Musteri_soyadi.Text = fk.IlkHarfleriBuyut(Musteri_soyadi.Text);
            string ad, soyad, telefon, adres, kategori; string katId = "";

            ad       = Musteri_adi.Text; soyad = Musteri_soyadi.Text; telefon = Musteri_telefonu.Text; kategori = Musteri_kategori.Text; adres = Musteri_adresi.Text;
            kategori = Musteri_kategori.Text;
            if ((ad != "" && ad.Length >= 3) && (soyad != "" && soyad.Length >= 3) && (telefon != "" && telefon.Length >= 10) && (adres != ""))
            {
                // Kategori id yi çıkar //
                FbConnection baglanti = new FbConnection(fk.Baglanti_Kodu()); FbDataReader KategoriIdCek;
                baglanti.Open();
                FbCommand KategoriAdiSorgu = new FbCommand("SELECT * FROM Musteri_kategori WHERE Kategori_adi='" + kategori + "'", baglanti);
                KategoriIdCek = KategoriAdiSorgu.ExecuteReader();
                KategoriIdCek.Read(); katId = KategoriIdCek["Kategori_id"].ToString();
                baglanti.Close();
                // Kategori id yi çıkar //

                if (Musteri_bakiye.Text == "")
                {
                    Musteri_bakiye.Text = "0";
                }
                else
                {
                    Musteri_bakiye.Text = Musteri_bakiye.Text.Replace(',', '.');
                }

                if (Musteri_adi.Text == Mad && Musteri_soyadi.Text == Msoyad)
                {
                    // Müşteriyi güncelle //
                    byte sonuc;
                    sonuc = fk.Guncelle("Musteriler", "Musteri_adi='" + ad + "', Musteri_soyadi='" + soyad + "', Musteri_telefon='" + telefon + "', Musteri_adres='" + fk.IlkHarfleriBuyut(adres) + "', Musteri_kategori='" + katId + "', Musteri_bakiye='" + Musteri_bakiye.Text + "'", "Musteri_id='" + id + "'");
                    if (sonuc == 1)
                    {
                        MessageBox.Show("Müşteri başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Müşteri güncellenemedi ( Hata kodu: M-07 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    // Müşteriyi güncelle //
                }
                else
                {
                    // kontrol
                    baglanti.Open();
                    FbCommand MusteriKontrol = new FbCommand("SELECT * FROM MUSTERILER WHERE Musteri_adi='" + Musteri_adi.Text + "' and Musteri_soyadi='" + Musteri_soyadi.Text + "'", baglanti);
                    object    kontrol        = MusteriKontrol.ExecuteScalar();
                    if (kontrol == null)
                    {
                        // Müşteriyi güncelle //
                        byte sonuc;
                        sonuc = fk.Guncelle("Musteriler", "Musteri_adi='" + ad + "', Musteri_soyadi='" + soyad + "', Musteri_telefon='" + telefon + "', Musteri_adres='" + adres + "', Musteri_kategori='" + katId + "', Musteri_bakiye='" + Musteri_bakiye.Text + "'", "Musteri_id='" + id + "'");
                        if (sonuc == 1)
                        {
                            MessageBox.Show("Müşteri başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Müşteri güncellenemedi ( Hata kodu: M-07 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        // Müşteriyi güncelle //
                    }
                    else
                    {
                        MessageBox.Show("Güncellemek istediğiniz müşteri sistemde kayıtlıdır.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    baglanti.Close();
                }
            }
            else
            {
                MessageBox.Show("Lütfen boş alan bırakmayın ve bilgileri doğru şekilde doldurun", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 10
0
        private void Guncelle_Click(object sender, EventArgs e)
        {
            try
            {
                UrunAd.Text    = UrunAd.Text.Replace("'", "’");
                UrunFiyat.Text = UrunFiyat.Text.Replace(',', '.');
                AlisFiyat.Text = AlisFiyat.Text.Replace(',', '.');
                string katId = ""; string kategori = UrunKategori.Text;
                if (UrunAd.Text != "" && UrunAd.Text.Length > 3 && UrunFiyat.Text != "" && AlisFiyat.Text != "")
                {
                    // Kategori id yi çıkar //
                    FbConnection bagla = new FbConnection(fk.Baglanti_Kodu()); FbDataReader KategoriIdCek;
                    bagla.Open();
                    FbCommand KategoriAdiSorgu = new FbCommand("SELECT * FROM Urun_kategori WHERE Kategori_adi='" + kategori + "'", bagla);
                    KategoriIdCek = KategoriAdiSorgu.ExecuteReader();
                    KategoriIdCek.Read(); katId = KategoriIdCek["Kategori_id"].ToString();
                    bagla.Close();
                    // Kategori id yi çıkar //

                    if (barkodlu.Checked == true)
                    {
                        byte sonuc;
                        sonuc = fk.Guncelle("Urunler", "Urun_adi='" + fk.IlkHarfleriBuyut(UrunAd.Text) + "', Urun_fiyat='" + UrunFiyat.Text + "', Urun_alisFiyat='" + AlisFiyat.Text + "', Urun_kategori='" + katId + "'", "Urun_id='" + id + "'");
                        if (sonuc == 1)
                        {
                            MessageBox.Show("Ürün başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            if (UrunAdi.Text != "")
                            {
                                comboBox1.Items.Clear();
                                UrunAdi.Text = UrunAd.Text;
                                UrunAraisim();
                                comboBox1.Text = UrunAd.Text;
                            }
                            else
                            {
                                comboBox1.Items.Clear();
                                BarkodNo.Text = UrunBarkod.Text;
                                UrunAraBarkod();
                                comboBox1.Text = UrunAd.Text;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Ürün güncellenemedi ( Hata kodu: U-07 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        if (UrunBarkod.Text.Length > 14)
                        {
                            byte sonuc;
                            sonuc = fk.Guncelle("Urunler", "Urun_adi='" + UrunAd.Text + "', Urun_fiyat='" + UrunFiyat.Text + "', Urun_alisFiyat='" + AlisFiyat.Text + "', Urun_kategori='" + katId + "', Urun_barkodNo='" + UrunBarkod.Text + "'", "Urun_id='" + id + "'");
                            if (sonuc == 1)
                            {
                                MessageBox.Show("Ürün başarıyla güncellenmiştir", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                if (UrunAdi.Text != "")
                                {
                                    comboBox1.Items.Clear();
                                    UrunAdi.Text = UrunAd.Text;
                                    UrunAraisim();
                                    comboBox1.Text = UrunAd.Text;
                                }
                                else
                                {
                                    comboBox1.Items.Clear();
                                    BarkodNo.Text = UrunBarkod.Text;
                                    UrunAraBarkod();
                                    comboBox1.Text = UrunAd.Text;
                                }
                            }
                            else
                            {
                                MessageBox.Show("Ürün güncellenemedi ( Hata kodu: U-07 )", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Barkod numarasını 15 hane olarak giriniz", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Boş alanları doldurunuz", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }