Esempio n. 1
0
        private void vip_Giris_Click(object sender, RoutedEventArgs e)
        {
            txt_kulad.Visibility     = Visibility.Collapsed;
            cmb_sirketler.Visibility = Visibility.Collapsed;
            txt_kod.Visibility       = Visibility.Collapsed;
            lbl_kod.Visibility       = Visibility.Collapsed;
            lbl_kulad.Visibility     = Visibility.Collapsed;
            lbl_sirketler.Visibility = Visibility.Collapsed;
            vip_uyeOl.Visibility     = Visibility.Collapsed;

            lbl_kodGir.Visibility = Visibility.Visible;
            txt_kodGir.Visibility = Visibility.Visible;


            SqlConnection sqlCon = new SqlConnection("Data Source=GLORY\\SQLEXPRESS;Initial Catalog=uye;Integrated Security=True");

            try
            {
                if (sqlCon.State == ConnectionState.Closed)
                {
                    sqlCon.Open();
                }
                string     sorgu  = "SELECT COUNT(1) FROM vipUyeler WHERE girisKodu=@girisKodu";
                SqlCommand sqlCmd = new SqlCommand(sorgu, sqlCon);
                sqlCmd.CommandType = CommandType.Text;
                sqlCmd.Parameters.AddWithValue("@girisKodu", txt_kodGir.Text);

                int count = Convert.ToInt32(sqlCmd.ExecuteScalar());
                if (count == 1)
                {
                    MessageBox.Show("Giriş Başarılı");
                    ga_etkinlik ga_etkinlik_ = new ga_etkinlik();
                    ga_etkinlik_.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Hatalı Giriş Kodu");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                sqlCon.Close();
            }
        }