private void btnKullaniciAra_Click(object sender, EventArgs e)
        {
            if (cnn.State == ConnectionState.Closed)
            {
                cnn.Open();
            }
            SqlCommand    cmd    = new SqlCommand("Select * From Kullanicilar", cnn);
            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                //Kullanicilar kullanicim = new Kullanicilar();
                while (reader.Read())
                {
                    Kullanicilar kullanici = new Kullanicilar();
                    kullanici.KullaniciID = int.Parse(reader["KullaniciID"].ToString());
                    kullanici.KullaniciTC = (reader["KullaniciTC"].ToString());
                    kullanici.sifre       = reader["Sifre"].ToString();
                    ListKullanicilarim.Add(kullanici);
                }
                reader.Close();
                cmd.Dispose();
                foreach (Kullanicilar kullanici in ListKullanicilarim)
                {
                    if (txtTC.Text == kullanici.KullaniciTC)
                    {
                        KullaniciVarmi = true;
                        ID             = kullanici.KullaniciID;
                        break;
                    }
                    else
                    {
                        KullaniciVarmi = false;
                    }
                }
                if (KullaniciVarmi == true)
                {
                    txtSifre2.Visible    = true;
                    txtSifre.Visible     = true;
                    btnYeniSifre.Visible = true;
                    lblSifre.Visible     = true;
                    lblSifre2.Visible    = true;
                }
                else
                {
                    MessageBox.Show("Hatalı Giriş");
                    // lblGUID.Text = Guid.NewGuid().ToString().Substring(0, 5);
                }
                //PropertyInfo[] kullanicim = typeof(Kullanicilar).GetProperties();
                //foreach (PropertyInfo property in kullanicim)
                //{
                //    //var value = property.GetValue(kullanicim);
                //}
            }
            cnn.Close();
            cmd.Dispose();
        }
Ejemplo n.º 2
0
 private void btnGirisYap_Click(object sender, EventArgs e)
 {
     if (txtSifre.Text == null && txtTC.Text == null)
     {
         MessageBox.Show("Lütfen TC Kimlik ve Şifre Alanlarını Doldorunuz.");
     }
     else
     {
         if (txtGUID.Text == lblGUID.Text)
         {
             if (cnn.State == ConnectionState.Closed)
             {
                 cnn.Open();
             }
             SqlCommand    cmd    = new SqlCommand("Select * From Kullanicilar", cnn);
             SqlDataReader reader = cmd.ExecuteReader();
             if (reader.HasRows)
             {
                 //Kullanicilar kullanicim = new Kullanicilar();
                 while (reader.Read())
                 {
                     Kullanicilar kullanici = new Kullanicilar();
                     kullanici.KullaniciID = int.Parse(reader["KullaniciID"].ToString());
                     kullanici.KullaniciTC = (reader["KullaniciTC"].ToString());
                     kullanici.sifre       = reader["Sifre"].ToString();
                     ListKullanicilarim.Add(kullanici);
                 }
                 reader.Close();
                 foreach (Kullanicilar kullanici in ListKullanicilarim)
                 {
                     if (txtTC.Text != kullanici.KullaniciTC.ToString() || txtSifre.Text != kullanici.sifre)
                     {
                         giris = false;
                     }
                     else
                     {
                         giris       = true;
                         KullaniciID = kullanici.KullaniciID;
                         break;
                     }
                 }
                 if (giris == true)
                 {
                     AnaSayfaRandevu frmrandevu = new AnaSayfaRandevu();
                     this.Hide();
                     frmrandevu.Show();
                 }
                 else
                 {
                     MessageBox.Show("Hatalı Giriş");
                     lblGUID.Text = Guid.NewGuid().ToString().Substring(0, 5);
                 }
                 //PropertyInfo[] kullanicim = typeof(Kullanicilar).GetProperties();
                 //foreach (PropertyInfo property in kullanicim)
                 //{
                 //    //var value = property.GetValue(kullanicim);
                 //}
             }
             cnn.Close();
             cmd.Dispose();
         }
         else
         {
             MessageBox.Show("Lütfen Resimde Gördüğünüzü Yazınız. ");
         }
     }
 }
Ejemplo n.º 3
0
 private void btnKayitOl_Click(object sender, EventArgs e)
 {
     if (txtTC.Text == "" || txtAd.Text == "" || txtSoyad.Text == "" || txtSifre.Text == "" || txtSifreTekrar.Text == "")
     {
         MessageBox.Show("Lütfen zorunlu alanları doldurunuz.");
     }
     else
     {
         if (txtSifre.Text != txtSifreTekrar.Text)
         {
             MessageBox.Show("Şifreler aynı değil.");
         }
         else
         {
             if (txtTC.Text.Length < 11)
             {
                 MessageBox.Show("TC Kimlik numarası 11 haneli olmalıdır.");
             }
             else
             {
                 if (txtSifre.Text.Length < 8)
                 {
                     MessageBox.Show("Şifre en az 8 haneli olmalıdır.");
                 }
                 else
                 {
                     if (rbErkek.Checked || rbKadin.Checked)
                     {
                         if (dtpDogumTarihi.Value.ToShortDateString() == DateTime.Now.ToShortDateString())
                         {
                             MessageBox.Show("Lütfen Doğum Tarihi Alanını Boş geçmeyin");
                         }
                         else
                         {
                             if (rbKadin.Checked)
                             {
                                 cinsiyet = true;
                             }
                             else
                             {
                                 cinsiyet = false;
                             }
                             dtpDogumTarihi.Format       = DateTimePickerFormat.Custom;
                             dtpDogumTarihi.CustomFormat = "dd-MM-yyyy";
                             if (cnn.State == ConnectionState.Closed)
                             {
                                 cnn.Open();
                             }
                             SqlCommand    getir  = new SqlCommand("select * from Kullanicilar", cnn);
                             SqlDataReader reader = getir.ExecuteReader();
                             while (reader.Read())
                             {
                                 Kullanicilar kullanicim = new Kullanicilar();
                                 // kullanicim.KullaniciTC=int.Parse(reader["KullaniciTC"].ToString());
                                 kullanicim.KullaniciTC = (reader["KullaniciTC"].ToString());
                                 kullanici.Add(kullanicim);
                             }
                             reader.Close();
                             cmd.Dispose();
                             foreach (Kullanicilar item in kullanici)
                             {
                                 if (item.KullaniciTC == (txtTC.Text))
                                 {
                                     MessageBox.Show("Bu kullanıcı Sistemimizde mevcuttur.");
                                     kullaniciMevcutmu = true;
                                     break;
                                 }
                             }
                             if (kullaniciMevcutmu == false)
                             {
                                 SqlCommand cmd = new SqlCommand("Insert Into Kullanicilar (KullaniciTC , Sifre , Ad , Soyad , DogumTarihi , Cinsiyet ) Values (@KullaniciTC , @KullaniciSifre , @Ad , @Soyad , @DogumTarihi , @Cinsiyet)", cnn);
                                 cmd.Parameters.AddWithValue("@KullaniciTC", txtTC.Text);
                                 cmd.Parameters.AddWithValue("@KullaniciSifre", txtSifre.Text);
                                 cmd.Parameters.AddWithValue("@Ad", txtAd.Text);
                                 cmd.Parameters.AddWithValue("@Soyad", txtSoyad.Text);
                                 cmd.Parameters.AddWithValue("@DogumTarihi", dtpDogumTarihi.Value.ToShortDateString());
                                 cmd.Parameters.AddWithValue("@Cinsiyet", cinsiyet);
                                 cmd.ExecuteNonQuery();
                                 cnn.Close();
                                 cmd.Dispose();
                                 MessageBox.Show("Sistemimize kaydınız alınmıştır.");
                             }
                         }
                     }
                     else
                     {
                         MessageBox.Show("Lütfen Cinsiyet Seçiniz.");
                     }
                 }
             }
         }
     }
 }