示例#1
0
        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);
            }
        }
示例#2
0
        private void button7_Click(object sender, EventArgs e)
        {
            frmPersonel frm = new frmPersonel();

            frm.Show();
        }