コード例 #1
0
        private void btnKullaniciEkleme_Click(object sender, EventArgs e)
        {
            string KAd, Sifre, Sonuc;
            int    Id;

            KAd   = txtKullaniciAdi.Text;
            Sifre = txtSifre.Text;
            if (chckFakulteSekreteri.Checked)
            {
                Id = 1;
            }
            else
            {
                Id = 0;
            }

            KullaniciView K = new KullaniciView()
            {
                KAd   = KAd,
                Sifre = Sifre,
                Type  = Id
            };

            Sonuc = KullaniciIslemleri.KullaniciEkle(K);
            if (Sonuc == "Yes")
            {
                MessageBox.Show("Kullanici Eklendi.");
            }
            else
            {
                MessageBox.Show(Sonuc);
            }
        }
コード例 #2
0
 public static string KullaniciEkle(KullaniciView Kullanici)
 {
     try
     {
         using (PersonelOtomasyonDBEntities2 db = new PersonelOtomasyonDBEntities2())
         {
             tblKullanicilar K = new tblKullanicilar();
             K.kullanici_Ad    = Kullanici.KAd;
             K.kullanici_Sifre = Kullanici.Sifre;
             K.type_ID         = Kullanici.Type;
             db.tblKullanicilar.Add(K);
             db.SaveChanges();
             return("Yes");
         }
     }catch (Exception e)
     {
         return("No");
     }
 }