예제 #1
0
        public bool KullaniciEkle(string username, string nAme, string sUrname, string pAssword, int userRoleid, int questionID, string answer)
        {
            using (dbYazılımSınamaEntities y = new dbYazılımSınamaEntities())
            {
                y.tblUsers.Add(new tblUsers()
                {
                    userName       = username,
                    name           = nAme,
                    surname        = sUrname,
                    password       = pAssword,
                    userRoleID     = userRoleid,
                    userCreateDate = DateTime.Now,
                    questionID     = questionID,
                    answer         = answer
                });

                if (y.SaveChanges() == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
예제 #2
0
        public string SifreDegistir(string username, int questionid, string sAnswer, string newPassword)
        {
            using (dbYazılımSınamaEntities y = new dbYazılımSınamaEntities())
            {
                var degistir = (from us in y.tblUsers
                                join qu in y.tblSecurityQuestions on us.questionID equals qu.questionID
                                where (us.userName == username) && (qu.questionID == questionid) && (us.answer == sAnswer)
                                select us).SingleOrDefault();

                if (degistir == null)
                {
                    return("Böyle bir kullanıcı yok!");
                }
                else
                {
                    degistir.password = newPassword;
                    //degistir = newPassword;
                    // y.tblUsers.Where(u => u.userName == username);
                    //tblUsers guncelle=y.


                    if (y.SaveChanges() == 1)
                    {
                        return("Şifre Değiştirildi! :)");
                    }
                    else
                    {
                        return("Hata!! :(");
                    }
                }
            }
        }
예제 #3
0
        private void btn_GirisYap_Click(object sender, EventArgs e)
        {
            dbYazılımSınamaEntities y = new dbYazılımSınamaEntities();

            if (y.tblUsers.Any(x => x.userName == txt_Giris_kullaniciAdi.Text))
            {
                id2 = y.tblUsers.Where(x => x.userName == txt_Giris_kullaniciAdi.Text).FirstOrDefault().userID;
            }
            frm2.userid = id2;
            Users u = new Users();

            if (txt_Giris_kullaniciAdi.Text == "" || txt_Giris_Parola.Text == "")
            {
                MessageBox.Show("Boş Geçilemez!");
            }
            else
            {
                if (u.GirisYap(txt_Giris_kullaniciAdi.Text, txt_Giris_Parola.Text) == true)
                {
                    frm2.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("hata");
                }
            }
            txt_Giris_kullaniciAdi.Clear();
            txt_Giris_Parola.Clear();
        }
예제 #4
0
 private void btn_Kaydol_Click_1(object sender, EventArgs e)
 {
     if (txt_Kaydol_Ad.Text == "" || txt_Kaydol_kullaniciAdi.Text == "" || txt_Kaydol_Parola.Text == "" || txt_Kaydol_Soyad.Text == "" || txt_Kaydol_Cevap.Text == "")
     {
         MessageBox.Show("Boş geçme !");
     }
     else
     {
         if (lblSifre.Text == "Kullanılabilir Şifre")
         {
             Users u = new Users();
             dbYazılımSınamaEntities y = new dbYazılımSınamaEntities();
             if (userroleID == 1)
             {
                 if (u.KullaniciEkle(txt_Kaydol_kullaniciAdi.Text, txt_Kaydol_Ad.Text, txt_Kaydol_Soyad.Text, txt_Kaydol_Parola.Text, userroleID, cmb_GuvenlikSorusu.SelectedIndex + 2, txt_Kaydol_Cevap.Text) == true)
                 {
                     MessageBox.Show("Kayıt başarılı.");
                 }
                 else
                 {
                     MessageBox.Show("Veritabanı Hatası.");
                 }
             }
             else if (userroleID == 2)
             {
                 if (u.KullaniciEkle(txt_Kaydol_kullaniciAdi.Text, txt_Kaydol_Ad.Text, txt_Kaydol_Soyad.Text, txt_Kaydol_Parola.Text, userroleID, cmb_GuvenlikSorusu.SelectedIndex + 2, txt_Kaydol_Cevap.Text) == true)
                 {
                     MessageBox.Show("Kayıt başarılı.");
                 }
                 else
                 {
                     MessageBox.Show("Veritabanı Hatası.");
                 }
             }
             else if (userroleID == 3)
             {
                 if (u.KullaniciEkle(txt_Kaydol_kullaniciAdi.Text, txt_Kaydol_Ad.Text, txt_Kaydol_Soyad.Text, txt_Kaydol_Parola.Text, userroleID, cmb_GuvenlikSorusu.SelectedIndex + 2, txt_Kaydol_Cevap.Text) == true)
                 {
                     MessageBox.Show("Kayıt başarılı.");
                 }
                 else
                 {
                     MessageBox.Show("Veritabanı Hatası.");
                 }
             }
         }
         else
         {
             MessageBox.Show("Hatalı Şifre");
         }
     }
     txt_Kaydol_Ad.Clear();
     txt_Kaydol_Cevap.Clear();
     txt_Kaydol_kullaniciAdi.Clear();
     txt_Kaydol_Parola.Clear();
     txt_Kaydol_Soyad.Clear();
 }
예제 #5
0
 public bool GirisYap(string username, string pAssword)
 {
     using (dbYazılımSınamaEntities y = new dbYazılımSınamaEntities())
     {
         tblUsers giris = (from a in y.tblUsers where a.userName == username && a.password == pAssword select a).FirstOrDefault();
         if (giris != null)
         {
             userid = giris.userID;
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #6
0
        public bool KullaniciAdKontrol(string username)
        {
            using (dbYazılımSınamaEntities y = new dbYazılımSınamaEntities())
            {
                var kullanici = y.tblUsers.Where(u => u.userName == username).Count();

                if (kullanici > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
예제 #7
0
 private void btn_Degistir_Click(object sender, EventArgs e)
 {
     if (txt_SifreDegistir_Cevap.Text == "" || txt_SifreDegistir_kullaniciAdi.Text == "" || txt_YeniSifre.Text == "" || txt_YeniSifreTekrar.Text == "" || cmb_GuvenlikSorusu.Text == "")
     {
         MessageBox.Show("Boş geçme !");
     }
     else
     {
         Users u = new Users();
         dbYazılımSınamaEntities y = new dbYazılımSınamaEntities();
         if (txt_YeniSifre.Text == txt_YeniSifreTekrar.Text)
         {
             MessageBox.Show(u.SifreDegistir(txt_SifreDegistir_kullaniciAdi.Text, cmb_GuvenlikSorusu.SelectedIndex + 1, txt_SifreDegistir_Cevap.Text, txt_YeniSifre.Text));
         }
         else
         {
             MessageBox.Show("Şifreler Uyuşmuyor!");
         }
         txt_SifreDegistir_Cevap.Clear();
         txt_SifreDegistir_kullaniciAdi.Clear();
         txt_YeniSifre.Clear();
         txt_YeniSifreTekrar.Clear();
     }
 }