private void button2_Click(object sender, EventArgs e) { AdibahceContainer adb = new AdibahceContainer(); if (textBox5.Text==textBox7.Text) { Kullanici k = new Kullanici(); k.Id = adb.Kullanici.Count() + 1; k.KullaniciAdi = textBox6.Text; k.KullaniciSifre = textBox5.Text; k.AdminMi = Convert.ToBoolean(textBox4.Text); adb.Kullanici.Add(k); adb.SaveChanges(); MessageBox.Show("Yeni Kullanıcı Tanımlandı", "Mesaj"); Yenile(); } else { MessageBox.Show("Parolalar Eşleşmiyor,Lütfen Doğru Yazdığınızdan Emin Olun", "Uyarı"); } }
private void button1_Click(object sender, EventArgs e) { AdibahceContainer adibahce = new AdibahceContainer(); var deneme = adibahce.Kullanici.Where(x => x.KullaniciAdi == textBox1.Text && x.KullaniciSifre == textBox2.Text).ToList(); foreach (var item in deneme) { k.KullaniciAdi = item.KullaniciAdi; k.Sifre = item.KullaniciSifre; k.AdminMi = Convert.ToBoolean(item.AdminMi); } if (deneme.Count == 1) { MessageBox.Show("Başarıyla Giriş Yaptınız sayın:" + textBox1.Text, "Mesaj"); Form1 frm1 = new Form1(); frm1.KullaniciAdi(textBox1.Text); this.Visible = false; frm1.Show(); } else { MessageBox.Show("Kullanıcı Adı veya Şİfreyi Yanlış Girdiniz", "Uyarı"); } }
public void PersonelSecimPaneli(Panel panel, Label label) { panel.Controls.Clear(); AdibahceContainer Adibahce = new AdibahceContainer(); label.Text = DateTime.Now.ToShortDateString(); var sorgu1 = Adibahce.Personel.Select(x => x.PersonelAdSoyad); int i = 0; foreach (var item in sorgu1) { Button btn = new System.Windows.Forms.Button(); btn.Location = new System.Drawing.Point(0, 50 * i); btn.Size = new System.Drawing.Size(panel.Width, 50); btn.Text = item; btn.Font = new System.Drawing.Font("Century Gothic", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); btn.BackColor = System.Drawing.Color.Transparent; panel.Controls.Add(btn); i++; btn.Click += new EventHandler(btn_Click); void btn_Click(object sender, EventArgs e) { Form3 personelform = new Form3(); personelform.Text = item; personelform.Font = new System.Drawing.Font("Century Gothic", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); personelform.Show(); } } }
private void button3_Click(object sender, EventArgs e) { AdibahceContainer adb = new AdibahceContainer(); var model = adb.Kullanici.Where(x => x.KullaniciAdi == comboBox1.Text).Select(x => x.Id).ToList().FirstOrDefault(); Kullanici k = adb.Kullanici.First(x => x.Id == model); k.KullaniciAdi = textBox1.Text; k.KullaniciSifre = textBox2.Text; k.AdminMi = Convert.ToBoolean(textBox3.Text); adb.SaveChanges(); MessageBox.Show("Güncelleme İşlemi Başarıyla Tamamlandı", "Mesaj"); }
private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e) { AdibahceContainer adb = new AdibahceContainer(); var model = adb.Kullanici.Where(x => x.KullaniciAdi == comboBox1.Text).ToList(); foreach (var item in model) { textBox1.Text = item.KullaniciAdi; textBox2.Text = item.KullaniciSifre; textBox3.Text = Convert.ToString(item.AdminMi); } }
public void Yenile() { comboBox1.Items.Clear(); AdibahceContainer adb = new AdibahceContainer(); var model = adb.Kullanici.ToList(); foreach (var item in model) { comboBox1.Items.Add(item.KullaniciAdi); } }
private void button4_Click(object sender, EventArgs e) { AdibahceContainer adb = new AdibahceContainer(); var model = adb.Kullanici.Where(x => x.KullaniciAdi == comboBox1.Text).Select(x => x.Id).ToList().FirstOrDefault(); Kullanici k = adb.Kullanici.First(x => x.Id == model); adb.Kullanici.Remove(k); DialogResult d = MessageBox.Show("Silmek İstediğinize Eminmisiniz?", "Uyarı", MessageBoxButtons.YesNo); if(d==DialogResult.Yes) { adb.SaveChanges(); Yenile(); } else { MessageBox.Show("Silme İşlemi İptal Edildi", "Mesaj"); } }