Ejemplo n.º 1
0
        private void btnkaydet_Click(object sender, EventArgs e)
        {
            if (gridView1.RowCount != 0)
            {
                string adi = Convert.ToString(gridView1.GetFocusedRowCellValue("ADINIZ"));
            }



            if (txt_adi.Text == "" || txt_soyadi.Text == "" || txt_evtel.Text == "" || txt_ceptel.Text == "" || txt_adres.Text == "")
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Boş Geçtiğiniz Alanlarınız Mevcuttur." + '\n' + "Lütfen Alanlarınızı Doldurun", "DİKKAT", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                using (TestDevexpresOgrenciOtomasyonEntities3 enti = new TestDevexpresOgrenciOtomasyonEntities3())
                {
                    TBL_TELEFONREHBERİ rh = new TBL_TELEFONREHBERİ();

                    rh.ADINIZ    = txt_adi.Text;
                    rh.SOYADINIZ = txt_soyadi.Text;
                    rh.CEPTEL    = txt_ceptel.Text;
                    rh.EVTEL     = txt_evtel.Text;
                    rh.ADRES     = txt_adres.Text;
                    rh.RESİM     = txtresim.Text;
                    enti.TBL_TELEFONREHBERİ.Add(rh);
                    enti.SaveChanges();
                    Listele();
                    temizlik();
                }
            }
        }
Ejemplo n.º 2
0
        private void btnsil_Click(object sender, EventArgs e)
        {
            int    ID    = (int)gridView1.GetFocusedRowCellValue("ID");
            string cikis = DevExpress.XtraEditors.XtraMessageBox.Show("" + ID + " numaralı Kaydınızı Silmek istediğinize Emin Misiniz? ", "DİKKAT", MessageBoxButtons.YesNo, MessageBoxIcon.Error).ToString();

            if (cikis == DialogResult.Yes.ToString())
            {
                using (TestDevexpresOgrenciOtomasyonEntities3 sil = new TestDevexpresOgrenciOtomasyonEntities3())
                {
                    TBL_TELEFONREHBERİ a = sil.TBL_TELEFONREHBERİ.SingleOrDefault(g => g.ID == ID);
                    sil.TBL_TELEFONREHBERİ.Remove(a);

                    sil.SaveChanges();
                    Listele();
                }
            }
            else
            {
            }
        }