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 AbonelerModel AboneGetirID(int id) { using (OtoparkOtomasyonEntities db = new OtoparkOtomasyonEntities()) { var ab = db.Aboneler.Where(x => x.AboneID == id).FirstOrDefault(); AbonelerModel abone = new AbonelerModel(); abone.AboneID = ab.AboneID; abone.TC = ab.TC; abone.Ad = ab.Ad; abone.Soyad = ab.Soyad; abone.Telefon = ab.Telefon; abone.Email = ab.Email; abone.AracTipiID = ab.AracTipiID; abone.AbonelikDurumu = ab.AbonelikDurumu; abone.PlakaNo = ab.PlakaNo; return(abone); } }
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); } }
public static List <AbonelerModel> AboneleriGetir() { using (OtoparkOtomasyonEntities db = new OtoparkOtomasyonEntities()) { List <AbonelerModel> abonelermodel = new List <AbonelerModel>(); var a = db.Aboneler.ToList(); foreach (Aboneler item in a) { AbonelerModel ab = new AbonelerModel(); ab.AboneID = item.AboneID; ab.Ad = item.Ad; ab.Soyad = item.Soyad; ab.TC = item.TC; ab.PlakaNo = item.PlakaNo; ab.Telefon = item.Telefon; ab.Email = item.Email; ab.AbonelikDurumu = item.AbonelikDurumu; ab.AracTipiID = item.AracTipiID; abonelermodel.Add(ab); } return(abonelermodel); } }