private void textBox4_TextChanged(object sender, EventArgs e) { tbKullanicilar o = ent.tbKullanicilar.Where(x => x.kullanici_adi == textBox4.Text).FirstOrDefault(); if (o != null) { label8.Text = "X"; label8.ForeColor = Color.Red; } else if (o == null) { label8.Text = "○"; label8.ForeColor = Color.Green; } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && maskedTextBox1.Text != "" && richTextBox1.Text != "" && comboBox2.Text != "") { if (label8.ForeColor == Color.Green) { tbKullanicilar kullanici = new tbKullanicilar(); kullanici.kullanici_adi = textBox4.Text.Trim(); kullanici.kullanici_sifresi = textBox3.Text.Trim(); kullanici.kullanici_ad_soyad = textBox1.Text.ToUpper(); kullanici.kullanici_mail = textBox2.Text.Trim(); kullanici.kullanici_tel = maskedTextBox1.Text; kullanici.kullanici_adres = richTextBox1.Text; if (comboBox2.Text == "YÖNETİCİ") { kullanici.kullanici_admin = true; } else if (comboBox2.Text == "KULLANICI") { kullanici.kullanici_admin = false; } else { MessageBox.Show("KULLANICI TÜRÜ OLARAK SADECE YÖNETİCİ VE KULLANICIYI SEÇEBİLİRSİNİZ!", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ent.tbKullanicilar.Add(kullanici); var k = ent.SaveChanges(); if (k != 0) { frmPersonel f1 = (frmPersonel)Application.OpenForms["frmPersonel"]; f1.doldur(); Hide(); } } else { MessageBox.Show("AYNI KULLANICI ADIYLA BAŞKA KULLANICI EKLEYEMEZSİNİZ!", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("LÜTFEN BOŞ ALANLARI DOLDURUNUZ!", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btn_giris_Click_1(object sender, EventArgs e) { if (textBox2.Text != "") { label2.ForeColor = Color.Lime; } else { return; } tbKullanicilar k = ent.tbKullanicilar.Where(x => x.kullanici_adi == textBox1.Text && x.kullanici_sifresi == textBox2.Text).SingleOrDefault(); if (k == null) { label2.ForeColor = Color.Red; label1.ForeColor = Color.Red; MessageBox.Show("KULLANICI BULUNAMADI\n LÜTFEN KULLANICI ADINIZI ŞİFRENİZİ DOĞRU YAZINIZ", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (k != null) { frmBilet frm = new frmBilet(); Form2 frm2 = new Form2(); adi.ad = k.kullanici_adi; if (k.kullanici_admin == true) { frm2.label1.Text = "HOŞ GELDİNİZ SAYIN " + k.kullanici_ad_soyad.ToUpper() + " " + DateTime.Now; frm2.Show(); this.Hide(); } else if (k.kullanici_admin == false) { frm.button51.Visible = false; frm.label1.Text = "HOŞ GELDİNİZ " + k.kullanici_ad_soyad.ToUpper() + " " + DateTime.Now; frm.Show(); this.Hide(); } } }