Exemplo n.º 1
0
        private void Btn_Sil_Click(object sender, EventArgs e)
        {
            OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Database/Musteri.accdb");
            string          sil      = "DELETE FROM MusteriListe WHERE Mno=@MNo";
            OleDbCommand    komut    = new OleDbCommand(sil, baglanti);

            try
            {
                komut.Parameters.AddWithValue("@MNo", Convert.ToInt32(Txt_MusteriNo.Text));
                baglanti.Open();
                int durum = komut.ExecuteNonQuery();
                baglanti.Close();
                Temizle();
                DateT_Tarih.ResetText();
                DateT_DogumT.ResetText();
                if (durum != 0)
                {
                    MessageBox.Show("Kayıt Silindi.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show("Kayıt Bulunamadığından Dolayı Silinemez", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            yeniKayitTablo();
            Listele();
        }
Exemplo n.º 2
0
        private void Btn_Kaydet_Click(object sender, EventArgs e)
        {
            if (Txt_MusteriAdSoyad.Text == "" && Txt_MusteriAdres.Text == "" && Txt_MusteriTel.Text == "" && Txt_MusteriIslem.Text == "" && Txt_MusteriToplamTutar.Text == "" && Txt_MusteriOdeme.Text == "")
            {
                MessageBox.Show("Yıldızlı Alanlar Boş Geçilemez!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            else
            {
                string tutar, ödeme;
                int    kalan;
                tutar = Txt_MusteriToplamTutar.Text;
                ödeme = Txt_MusteriOdeme.Text;
                kalan = Convert.ToInt32(tutar) - Convert.ToInt32(ödeme);
                Txt_MusteriKalanOdeme.Text = Convert.ToString(kalan);
                string ad = Txt_MusteriAdSoyad.Text;
                ad = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ad);

                OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Database/Musteri.accdb");
                baglanti.Open();
                string       ekle  = "insert into MusteriListe(TC_Kimlik,AdSoyad,DoğumTarihi,Adres,Telefon,Yapılanİşlem,Tarih,ToplamTutar,YapılanÖdeme,Taksit,KalanÖdeme,SonrakiRandevu)values(@TC_Kimlik,@AdSoyad,@DoğumTarihi,@Adres,@Telefon,@Yapılanİşlem,@Tarih,@ToplamTutar,@YapılanÖdeme,@Taksit,@KalanÖdeme,@SonrakiRandevu)";
                OleDbCommand komut = new OleDbCommand(ekle, baglanti);
                komut.Parameters.AddWithValue("@TC_Kimlik", Txt_MusteriTC.Text);
                komut.Parameters.AddWithValue("@AdSoyad", Txt_MusteriAdSoyad.Text.ToUpper());
                komut.Parameters.AddWithValue("@DoğumTarihi", DateT_DogumT.Value.ToOADate());
                komut.Parameters.AddWithValue("@Adres", Txt_MusteriAdres.Text.ToUpper());
                komut.Parameters.AddWithValue("@Telefon", Txt_MusteriTel.Text);
                komut.Parameters.AddWithValue("@Yapılanİşlem", Txt_MusteriIslem.Text.ToUpper());
                komut.Parameters.AddWithValue("@Tarih", DateT_Tarih.Value.ToOADate());
                komut.Parameters.AddWithValue("@ToplamTutar", Convert.ToInt32(Txt_MusteriToplamTutar.Text));
                komut.Parameters.AddWithValue("@YapılanÖdeme", Convert.ToInt32(Txt_MusteriOdeme.Text));
                komut.Parameters.AddWithValue("@Taksit", Txt_MusteriTaksit.Text);
                komut.Parameters.AddWithValue("@KalanÖdeme", Convert.ToInt32(Txt_MusteriKalanOdeme.Text));
                komut.Parameters.AddWithValue("@SonrakiRandevu", Txt_MusteriRandevu.Text);
                komut.ExecuteNonQuery();

                string       ekle2  = "insert into Musteriler(TC_Kimlik,AdSoyad,DoğumTarihi,Adres,Telefon)values(@TC_Kimlik,@AdSoyad,@DoğumTarihi,@Adres,@Telefon)";
                OleDbCommand komut2 = new OleDbCommand(ekle2, baglanti);
                komut2.Parameters.AddWithValue("@TC_Kimlik", Txt_MusteriTC.Text);
                komut2.Parameters.AddWithValue("@AdSoyad", Txt_MusteriAdSoyad.Text.ToUpper());
                komut2.Parameters.AddWithValue("@DoğumTarihi", DateT_DogumT.Value.ToOADate());
                komut2.Parameters.AddWithValue("@Adres", Txt_MusteriAdres.Text.ToUpper());
                komut2.Parameters.AddWithValue("@Telefon", Txt_MusteriTel.Text);
                try { komut2.ExecuteNonQuery(); }
                catch {}


                baglanti.Close();
                Temizle();
                DateT_Tarih.ResetText();
                DateT_DogumT.ResetText();
                Listele();
                DListele();
                MessageBox.Show("Kayıt Başarıyla Eklendi.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 3
0
        private void Btn_Guncelle_Click(object sender, EventArgs e)
        {
            if (Txt_MusteriAdSoyad.Text == "" && Txt_MusteriAdres.Text == "" && Txt_MusteriTel.Text == "" && Txt_MusteriIslem.Text == "" && Txt_MusteriToplamTutar.Text == "" && Txt_MusteriOdeme.Text == "")
            {
                MessageBox.Show("Yıldızlı Alanlar Boş Geçilemez!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Database/Musteri.accdb");
                string          guncelle = "UPDATE MusteriListe SET TC_Kimlik=@TC_Kimlik,AdSoyad=@AdSoyad,DoğumTarihi=@DoğumTarihi,Adres=@Adres,Telefon=@Telefon,Yapılanİşlem=@Yapılanİşlem,Tarih=@Tarih,ToplamTutar=@ToplamTutar,YapılanÖdeme=@YapılanÖdeme,Taksit=@Taksit,KalanÖdeme=@KalanÖdeme,SonrakiRandevu=@SonrakiRandevu WHERE MNo=@MNo";
                OleDbCommand    komut    = new OleDbCommand(guncelle, baglanti);
                try
                {
                    komut.Parameters.AddWithValue("@TC_Kimlik", Txt_MusteriTC.Text);
                    komut.Parameters.AddWithValue("@AdSoyad", Txt_MusteriAdSoyad.Text.ToUpper());
                    komut.Parameters.AddWithValue("@DoğumTarihi", DateT_DogumT.Value.ToOADate());
                    komut.Parameters.AddWithValue("@Adres", Txt_MusteriAdres.Text.ToUpper());
                    komut.Parameters.AddWithValue("@Telefon", Txt_MusteriTel.Text);
                    komut.Parameters.AddWithValue("@Yapılanİşlem", Txt_MusteriIslem.Text.ToUpper());
                    komut.Parameters.AddWithValue("@Tarih", DateT_Tarih.Value.ToOADate());
                    komut.Parameters.AddWithValue("@ToplamTutar", Convert.ToInt32(Txt_MusteriToplamTutar.Text));
                    komut.Parameters.AddWithValue("@YapılanÖdeme", Convert.ToInt32(Txt_MusteriOdeme.Text));
                    komut.Parameters.AddWithValue("@Taksit", Txt_MusteriTaksit.Text);
                    komut.Parameters.AddWithValue("@KalanÖdeme", Convert.ToInt32(Txt_MusteriKalanOdeme.Text) - Convert.ToInt32(Txt_MusteriOdeme.Text));
                    komut.Parameters.AddWithValue("@SonrakiRandevu", Txt_MusteriRandevu.Text);
                    komut.Parameters.AddWithValue("@MNo", Convert.ToInt32(Txt_MusteriNo.Text));



                    baglanti.Open();
                    int durum = komut.ExecuteNonQuery();
                    baglanti.Close();
                    Temizle();
                    DateT_Tarih.ResetText();
                    DateT_DogumT.ResetText();
                    Listele();
                    if (durum != 0)
                    {
                        MessageBox.Show("Kayıt Başarıyla Güncellendi.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch
                {
                    MessageBox.Show("Lütfen Bir Kayıt Seçiniz ve Sonra Güncelleme Yapınız.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }