Beispiel #1
0
        private void BtnMusteriGüncelle_Click(object sender, EventArgs e)
        {
            Database db = new Database();

            if (db.baglanti.State == ConnectionState.Open)
            {
                db.baglanti.Close();
            }
            try
            {
                db.baglanti.Open();
                SqlCommand musteriBul = new SqlCommand("select musteri.musteri_id from musteri where musteri_tc=@musteri_tc", db.baglanti);
                musteriBul.Parameters.AddWithValue("@musteri_tc", TbTc.Text);
                SqlDataReader idOku = musteriBul.ExecuteReader();
                if (idOku.Read())
                {
                    string      id = idOku["musteri_id"].ToString();
                    MusteriCrud mc = new MusteriCrud();
                    mc.musteriGuncelle(TbTc.Text, id, TbAd.Text, TbSoyad.Text, TbTel.Text, TbAdres.Text);
                }
                db.baglanti.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Kişi Bilgileri bulunamadı !");
            }
            finally
            {
                lblTc.Text = "TC:";
                db.baglanti.Close();
            }
        }
Beispiel #2
0
        private void BtnSil_Click(object sender, EventArgs e)
        {
            MusteriCrud mc    = new MusteriCrud();
            int         satir = dataGridView1.CurrentRow.Index;
            string      id    = dataGridView1.Rows[satir].Cells["musteri_id"].Value.ToString();

            mc.musteriSil(id);
            dataGridView1.DataSource = mc.tablolar();
        }
Beispiel #3
0
        private void BtnGüncelle_Click(object sender, EventArgs e)
        {
            MusteriCrud mc    = new MusteriCrud();
            int         satir = dataGridView1.CurrentRow.Index;
            string      id    = dataGridView1.Rows[satir].Cells["musteri_id"].Value.ToString();
            string      tc    = Convert.ToString(TbTc.Text);

            mc.musteriGuncelle(tc, id, TbAd.Text, TbSoyad.Text, TbTel.Text, TbAdres.Text);
            dataGridView1.DataSource = mc.tablolar();
        }
Beispiel #4
0
 private void BtnKaydet_Click(object sender, EventArgs e)
 {
     if (TbAd.Text == null || TbAd.Text == "" || TbAd.Text == " " || TbAdres.Text == null || TbAdres.Text == "" || TbAdres.Text == " " || TbSoyad.Text == null || TbSoyad.Text == "" || TbSoyad.Text == " " || TbTc.Text == null || TbTc.Text == "" || TbTel.Text == null || TbTel.Text == "")
     {
         MessageBox.Show("Boş Kutucuk Bırakmayınız");
     }
     else
     {
         MusteriCrud mc = new MusteriCrud();
         mc.ekle(TbTc.Text, TbAd.Text, TbSoyad.Text, TbTel.Text, TbAdres.Text);
         dataGridView1.DataSource = mc.tablolar();
     }
 }
Beispiel #5
0
 private void btnMusteriKaydet_Click(object sender, EventArgs e)
 {
     if (TbAd.Text == "" || TbAd.Text == " " || TbAdres.Text == "" || TbAdres.Text == " " || TbSoyad.Text == "" || TbSoyad.Text == " " || TbTc.Text == "" || TbTc.Text == null || TbTcEkle.Text == "" || TbTcEkle.Text == null || TbTel.Text == "" || TbTel.Text == " ")
     {
         MessageBox.Show("Lütfen Boş Kutucuk Bırakmayınız");
     }
     else
     {
         if ((Cb_islem.SelectedItem).ToString() == "Ekle")
         {
             lblTc.Text = "TC:";
             MusteriCrud mc = new MusteriCrud();
             mc.ekle(TbTcEkle.Text, TbAd.Text, TbSoyad.Text, TbTel.Text, TbAdres.Text);
         }
         else if ((Cb_islem.SelectedItem).ToString() == "Güncelle")
         {
             Database db = new Database();
             if (db.baglanti.State == ConnectionState.Open)
             {
                 db.baglanti.Close();
             }
             try
             {
                 db.baglanti.Open();
                 SqlCommand musteriBul = new SqlCommand("select musteri.musteri_id from musteri where musteri_tc=@musteri_tc", db.baglanti);
                 musteriBul.Parameters.AddWithValue("@musteri_tc", TbTc.Text);
                 SqlDataReader idOku = musteriBul.ExecuteReader();
                 if (idOku.Read())
                 {
                     string      id = idOku["musteri_id"].ToString();
                     MusteriCrud mc = new MusteriCrud();
                     mc.musteriGuncelle(TbTcEkle.Text, id, TbAd.Text, TbSoyad.Text, TbTel.Text, TbAdres.Text);
                 }
                 db.baglanti.Close();
             }
             catch (Exception)
             {
                 MessageBox.Show("Kişi Bilgileri bulunamadı !");
             }
             finally
             {
                 lblTc.Text = "TC:";
                 db.baglanti.Close();
             }
         }
     }
 }
Beispiel #6
0
        private void HastaEkran_Load(object sender, EventArgs e)
        {
            MusteriCrud mc = new MusteriCrud();

            dataGridView1.DataSource = mc.tablolar();
        }