private void button1_Click(object sender, EventArgs e) { var durum = string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrWhiteSpace(textBox2.Text) || string.IsNullOrWhiteSpace(textBox3.Text) || string.IsNullOrWhiteSpace(textBox4.Text) || string.IsNullOrWhiteSpace(textBox5.Text) || string.IsNullOrWhiteSpace(textBox6.Text) || comboBox1.SelectedIndex == -1 || comboBox2.SelectedIndex == -1; if (durum) { MessageBox.Show("Tüm Alanları Doldurun !"); } else { if (textBox1.Text.Length < 11) { MessageBox.Show("Geçerli Bir TC Giriniz !"); } else { AbonelerModel ab = new AbonelerModel(); ab.AbonelikDurumu = Convert.ToBoolean(comboBox2.SelectedIndex); ab.AboneID = musteriID; ab.TC = textBox1.Text; ab.Ad = textBox2.Text; ab.Soyad = textBox3.Text; ab.Telefon = textBox4.Text; ab.Email = textBox5.Text; ab.PlakaNo = textBox6.Text; ab.AracTipiID = (comboBox1.SelectedIndex + 1); Aboneler k = new Aboneler(); k.AbonelikDurumu = ab.AbonelikDurumu; k.AboneID = ab.AboneID; k.TC = ab.TC; k.Ad = ab.Ad; k.Soyad = ab.Soyad; k.Telefon = ab.Telefon; k.Email = ab.Email; k.PlakaNo = ab.PlakaNo; k.AracTipiID = ab.AracTipiID; AboneİslemHelper.MusteriAptade(k); MusteriKayıt mk = new MusteriKayıt(); mk.Refresh(); Hide(); } } }
public static bool MusteriAptade(Aboneler a) { using (OtoparkOtomasyonEntities db = new OtoparkOtomasyonEntities()) { db.Entry(a).State = System.Data.Entity.EntityState.Modified; if (db.SaveChanges() > 0) { return(true); } else { return(false); } } }
private void button1_Click(object sender, EventArgs e) { var durum = string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrWhiteSpace(textBox2.Text) || string.IsNullOrWhiteSpace(textBox3.Text) || string.IsNullOrWhiteSpace(textBox4.Text) || string.IsNullOrWhiteSpace(textBox5.Text) || string.IsNullOrWhiteSpace(textBox6.Text) || comboBox1.SelectedIndex == -1; if (durum) { MessageBox.Show("Tüm Alanları Doldurun !"); } else { if (textBox1.Text.Length < 11) { MessageBox.Show("Geçerli Bir Tc Giriniz !"); } else { Aboneler ab = new Aboneler(); ab.AbonelikDurumu = true; ab.TC = textBox1.Text; ab.Ad = textBox2.Text; ab.Soyad = textBox3.Text; ab.Telefon = textBox4.Text; ab.Email = textBox5.Text; ab.PlakaNo = textBox6.Text; ab.AracTipiID = comboBox1.SelectedIndex + 1; AboneİslemHelper.AboneKayıt(ab); dataGridView1.DataSource = AboneİslemHelper.AboneleriGetir(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); } } }
public static AbonelerModel AboneKayıt(Aboneler a) { using (OtoparkOtomasyonEntities db = new OtoparkOtomasyonEntities()) { var k = db.Aboneler.Add(a); db.SaveChanges(); AbonelerModel ab = new AbonelerModel(); ab.AboneID = k.AboneID; ab.TC = k.TC; ab.Ad = k.Ad; ab.Soyad = k.Soyad; ab.Telefon = k.Telefon; ab.Email = k.Email; ab.PlakaNo = k.PlakaNo; ab.AracTipiID = k.AracTipiID; ab.AbonelikDurumu = k.AbonelikDurumu; return(ab); } }