Esempio n. 1
0
 public static ServerKullanici Select(ServerKullanici serverKullanici)
 {
     using (SQLiteConnection Baglanti = new SQLiteConnection(DatabaseManager.ConnectionString))
     {
         using (SQLiteCommand com = new SQLiteCommand("SELECT * FROM ServerKullanicilar WHERE KullaniciAdi=@KullaniciAdi AND Sifre=@Sifre ", Baglanti))
         {
             Baglanti.Open();
             ServerKullanici item = null;
             com.Parameters.AddWithValue("KullaniciAdi", serverKullanici.KullaniciAdi);
             com.Parameters.AddWithValue("Sifre", serverKullanici.Sifre);
             using (SQLiteDataReader rdr = com.ExecuteReader())
             {
                 if (rdr.HasRows)
                 {
                     while (rdr.Read())
                     {
                         item = new ServerKullanici
                         {
                             KullaniciId  = Convert.ToInt16(rdr["KullaniciId"]),
                             KullaniciAdi = (string)rdr["KullaniciAdi"],
                             Sifre        = (string)rdr["Sifre"],
                             Mail         = (string)rdr["Mail"]
                         };
                     }
                 }
             }
             Baglanti.Close();
             return(item);
         }
     }
 }
Esempio n. 2
0
 public static int Insert(ServerKullanici item)
 {
     using (SQLiteConnection Baglanti = new SQLiteConnection(DatabaseManager.ConnectionString))
     {
         using (SQLiteCommand com = new SQLiteCommand("INSERT INTO ServerKullanicilar(KullaniciAdi,Sifre,Mail) VALUES(@KullaniciAdi,@Sifre, @Mail)", Baglanti))
         {
             Baglanti.Open();
             com.Parameters.AddWithValue("KullaniciAdi", item.KullaniciAdi);
             com.Parameters.AddWithValue("Sifre", item.Sifre);
             com.Parameters.AddWithValue("Mail", item.Mail);
             var result = com.ExecuteNonQuery();
             Baglanti.Close();
             return(result);
         }
     }
 }
Esempio n. 3
0
        public static int Update(ServerKullanici item)
        {
            using (SQLiteConnection Baglanti = new SQLiteConnection(DatabaseManager.ConnectionString))
            {
                using (SQLiteCommand com = new SQLiteCommand("UPDATE ServerKullanicilar SET Sifre=@Sifre WHERE KullaniciId=@KullaniciId ", Baglanti))
                {
                    Baglanti.Open();

                    com.Parameters.AddWithValue("KullaniciId", item.KullaniciId);
                    com.Parameters.AddWithValue("Sifre", item.Sifre);

                    var result = com.ExecuteNonQuery();
                    Baglanti.Close();
                    return(result);
                }
            }
        }
Esempio n. 4
0
        private void YeniUyelik_Click(object sender, RoutedEventArgs e)
        {
            var serverKullanici = new ServerKullanici
            {
                KullaniciAdi = KullaniciAdi.Text,
                Sifre        = Sifre.Password,
                Mail         = MailAdresi.Text
            };

            var result = FServerKullanici.Insert(serverKullanici);

            if (result > 0)
            {
                UcGiris.GirisInfo("Kayıt Oluşturuldu", true);
            }
            else
            {
                UcGiris.GirisInfo("Kayıt Başarısız", true);
            }
        }
Esempio n. 5
0
        private void GirisYap_Click(object sender, RoutedEventArgs e)
        {
            // Kullanıcı Datasını Çek ve Kontrol Et
            var serverKullanici = new ServerKullanici
            {
                KullaniciAdi = KullaniciAdi.Text,
                Sifre        = Sifre.Password
            };

            var serverKullaniciData = FServerKullanici.Select(serverKullanici);

            if (serverKullaniciData != null)
            {
                Global.AktifKullanici(serverKullaniciData);
                Anasayfa.Yonlendir(new UcAnasayfa());
            }
            else
            {
                UcGiris.GirisInfo("Böyle Bir Kullanıcı Yok", false);
            }
        }
Esempio n. 6
0
 public static void AktifKullanici(ServerKullanici serverKullanici)
 {
     ServerKullanici = serverKullanici;
 }