private void Kayitbtn_Click(object sender, EventArgs e) { using (var db = new OtelBilgiEntities()) { if (string.IsNullOrWhiteSpace(TcNotbox.Text) || string.IsNullOrWhiteSpace(Adtbox.Text) || string.IsNullOrWhiteSpace(soyadtbox.Text) || string.IsNullOrWhiteSpace(adrestbox.Text) || string.IsNullOrWhiteSpace(Departmantbox.Text) || string.IsNullOrWhiteSpace(teltbox.Text) || string.IsNullOrWhiteSpace(Pozisyontbox.Text) || string.IsNullOrWhiteSpace(epostotbox.Text)) { MessageBox.Show("You must fill in the all empty fields"); } else { string TC = TcNotbox.Text, ad = Adtbox.Text, soyad = soyadtbox.Text, tel = teltbox.Text, adres = adrestbox.Text; string ePosta = epostotbox.Text, departman = Departmantbox.Text, pozisyon = Pozisyontbox.Text; var query = new CalisanBilgi { calisanTC = TC, calisanAd = ad, calisanSoyad = soyad, calisanTel = tel, calisanAdres = adres, calisanEPosta = ePosta, calisanDepartaman = departman, calisanPozisyon = pozisyon }; db.CalisanBilgis.Add(query); db.SaveChanges(); MessageBox.Show("Insertion successfully!"); } } }
private void metroButton1_Click(object sender, EventArgs e) { using (var db = new OtelBilgiEntities()) { if (string.IsNullOrWhiteSpace(oteladTbox.Text) || string.IsNullOrWhiteSpace(ilTbox.Text) || string.IsNullOrWhiteSpace(ilceTbox.Text) || string.IsNullOrWhiteSpace(adresTxt.Text) || string.IsNullOrWhiteSpace(telefonTbox.Text) || string.IsNullOrWhiteSpace(epostaTbox.Text) || string.IsNullOrWhiteSpace(yildizTbox.Text) || string.IsNullOrWhiteSpace(odaTbox.Text)) { MessageBox.Show("You must fill in the all empty fields"); } else { string o_Ad = oteladTbox.Text, o_Il = ilTbox.Text, o_Ilce = ilceTbox.Text, o_Adres = adresTxt.Text, o_Tel = telefonTbox.Text, o_EPosta = epostaTbox.Text; int o_Yildiz = Convert.ToInt32(yildizTbox.Text), o_Oda = Convert.ToInt32(odaTbox.Text); var query1 = new OtelKayit { otelAdi = o_Ad, otelIl = o_Il, otelIlce = o_Ilce, otelAdres = o_Adres, otelTel = o_Tel, otelEPosta = o_EPosta, yildizSayisi = o_Yildiz, odaSayisi = o_Oda }; db.OtelKayits.Add(query1); db.SaveChanges(); MessageBox.Show("Insertion successfully!"); } } }
private void girisBtn_Click(object sender, EventArgs e) { using (var db = new OtelBilgiEntities()) { string eposta = girisEpostaTbox.Text, sifre = girisSifreTbox.Text; if (string.IsNullOrWhiteSpace(girisEpostaTbox.Text) || string.IsNullOrWhiteSpace(girisSifreTbox.Text)) { MessageBox.Show("You must fill in the all empty fields"); } else { MusteriKayit kd = new MusteriKayit(); var sorgu2 = from a in db.MusteriKayits where a.musteriEPosta == eposta select a.musteriEPosta; var sorgu3 = from a in db.MusteriKayits where a.musteriSifre == sifre select a.musteriSifre; var sorgu = from a in db.MusteriKayits where a.musteriEPosta == eposta && a.musteriSifre == sifre select a.isTrue; string sorgu4 = "", sorgu5 = ""; foreach (string item in sorgu2) { sorgu4 = item; } foreach (string item in sorgu3) { sorgu5 = item; } if (sorgu4 == eposta && sorgu5 == sifre) { foreach (int item in sorgu) { if (item == 1) { yon.Show(); this.Hide(); kul.Hide(); } else if (item == 0) { kul.Show(); this.Hide(); yon.Hide(); } else { MessageBox.Show("Hatalı Giriş"); } } } else { MessageBox.Show("Hatalı Giriş"); } } } }
private void Kayitbtn_Click(object sender, EventArgs e) { using (var db = new OtelBilgiEntities()) { if (string.IsNullOrWhiteSpace(TcNotbox.Text) || string.IsNullOrWhiteSpace(Adtbox.Text) || string.IsNullOrWhiteSpace(soyadtbox.Text) || string.IsNullOrWhiteSpace(epostotbox.Text) || string.IsNullOrWhiteSpace(sifreTbox.Text) || string.IsNullOrWhiteSpace(teltbox.Text)) { MessageBox.Show("You must fill in the all empty fields"); } else { string ad, soyad, telefon, eposta, sifre; string TcNo; TcNo = TcNotbox.Text; ad = Adtbox.Text; soyad = soyadtbox.Text; telefon = teltbox.Text; eposta = epostotbox.Text; sifre = sifreTbox.Text; var query = new MusteriKayit { musteriAd = ad, musteriTel = telefon, musteriEPosta = eposta, musteriSifre = sifre, musteriSoyad = soyad, musteriTC = TcNo, isTrue = 0 }; db.MusteriKayits.Add(query); db.SaveChanges(); MessageBox.Show("Başarılı Kayıt"); Giris frm = new Giris(); frm.Show(); this.Hide(); } } }