private void tsKaydet_Click(object sender, EventArgs e) { if (txtAdi.Text.Trim() != "" && txtSoyadi.Text.Trim() != "" && txtTCKNo.Text.Trim() != "") { if (os.OgrenciKontrolByTCKNo(txtTCKNo.Text)) { MessageBox.Show("var bu"); txtAdi.Focus(); } else { Ogrenci o = new Ogrenci(); o.Adi = txtAdi.Text; o.Soyadi = txtSoyadi.Text; o.Telefon = txtTelefon.Text; o.Adres = txtAdres.Text; o.TCKNo = txtTCKNo.Text; o.TaksitSayisi = Convert.ToByte(txtTaksitSayisi.Text); o.TaksitTutari = Convert.ToDouble(txtTaksitTutari.Text); o.SinifId = SinifID; if (os.OgrenciEkle(o)) { MessageBox.Show("ok"); dataGridView1.DataSource = os.OgrenciListesi(); dgvOgrenciler.DataSource = os.OgrenciListesi(); } else { MessageBox.Show("Ürün bilgileri eklenemedi.", "Kayıt Gerçekleşmedi."); } } } else { MessageBox.Show("eksik"); txtAdi.Focus(); } }
private void tsKaydet_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtAdi.Text) && !string.IsNullOrEmpty(txtSoyadi.Text) && !string.IsNullOrEmpty(txtTaksitTutari.Text)) { if (os.OgrenciKontrolByTCKNo(txtTCKNo.Text)) { MessageBox.Show("Bu tcye ait öğrenci var"); txtTCKNo.Focus(); } else { Ogrenci o = new Ogrenci(); o.TCKNo = txtTCKNo.Text; o.Adi = txtAdi.Text; o.Soyadi = txtSoyadi.Text; o.SinifId = sinifid; o.Telefon = txtTelefon.Text; o.Adres = txtAdres.Text; o.TaksitSayisi = Convert.ToByte(txtTaksitSayisi.Text); o.TaksitTutari = Convert.ToDouble(txtTaksitTutari.Text); if (os.OgrenciEkle(o)) { Listele(os.OgrenciListesi(), dgvOgrenciler); MessageBox.Show("Ogrenci başarıyla eklendi"); Genel.Temizle(tpOgrenciKayit); tsKaydet.Enabled = false; } } tsKaydet.Enabled = false; } else { MessageBox.Show("Eksik bilgi girişi.", "Dikkat eksik bilgi!!"); } txtAdi.Focus(); }