private void metroButton1_Click(object sender, EventArgs e) { using (var db = new OtelDbcontext()) { 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 { OtelAd = o_Ad, Sehir = o_Il, Ilce = o_Ilce, OtelAdres = o_Adres, Telefon = o_Tel, EPosta = o_EPosta, YildizSayisi = o_Yildiz, OdaSayisi = o_Oda }; db.OtelKayits.Add(query1); db.SaveChanges(); MessageBox.Show("Insertion successfully"); } } }
private void PersonelGuncelleBtn_Click(object sender, EventArgs e) { var sorgu = from a in db.OtelCalisans where a.TCKimlik == personelTCtbox.Text select a; foreach (var item in sorgu) { item.TCKimlik = personelTCtbox.Text; item.Ad = personelAdTbox.Text; item.Adres = personelAdresTbox.Text; item.Departman = personelDepartmanTbox.Text; item.Eposta = personelEpostaTbox.Text; item.Telefon = personelTelTbox.Text; item.Soyad = personelSoyadTbox.Text; } db.SaveChanges(); MessageBox.Show("Güncelleme Başarılı"); }
private void metroButton2_Click(object sender, EventArgs e) { var query = from a in db.musteriYorums select a; foreach (var item in query) { item.Yorum = metroTextBox1.Text; db.musteriYorums.Add(item); } db.SaveChanges(); MessageBox.Show("Yorum kaydedildi."); }
private void metroButton1_Click(object sender, EventArgs e) { using (var db = new OtelDbcontext()) { var sorgu2 = from a in db.OtelKayits where a.Id.ToString() == txtId.Text.ToString() select a; foreach (var item in sorgu2) { item.OtelPuani += metroComboBox4.SelectedIndex + 1; } db.SaveChanges(); MessageBox.Show("Başarılı"); } }
private void Kayitbtn_Click(object sender, EventArgs e) { using (var db = new OtelDbcontext()) { 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; int per = Convert.ToInt32(personelPuanTbox.Text); var query = new OtelCalisan { TCKimlik = TC, Ad = ad, Soyad = soyad, Telefon = tel, Adres = adres, Eposta = ePosta, Departman = departman, personelpuan = per }; db.OtelCalisans.Add(query); db.SaveChanges(); MessageBox.Show("Insertion successfully!"); } foreach (var item in db.OtelCalisans) { //metroListView2.Items.Add(item.Id.ToString()); } } }
private void Kayitbtn_Click(object sender, EventArgs e) { using (var db = new OtelDbcontext()) { 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; int TcNo; TcNo = Convert.ToInt32(TcNotbox.Text); ad = Adtbox.Text; soyad = soyadtbox.Text; telefon = teltbox.Text; eposta = epostotbox.Text; sifre = sifreTbox.Text; var query = new MusteriKayit() { Ad = ad, Eposta = eposta, Sifre = sifre, Soyad = soyad, TCKimlik = TcNo, IsTrue = false, telefon = Convert.ToInt32(telefon) }; db.musteriKayits.Add(query); db.SaveChanges(); MessageBox.Show("Başarılı Kayıt"); Giris frm = new Giris(); frm.Show(); this.Hide(); } } }