private void Nou_gaetkinlik_Click(object sender, RoutedEventArgs e) { panel p_ = new panel(); p_.Show(); //this.Close(); }
private void adminGiris(object sender, RoutedEventArgs e) { try { if (ds.sqlCon.State == ConnectionState.Closed) { ds.sqlCon.Open(); } string sorgu = "SELECT COUNT(1) FROM tblAdmin WHERE kulad=@kulad AND parola=@parola"; SqlCommand sqlCmd = new SqlCommand(sorgu, ds.sqlCon); sqlCmd.CommandType = CommandType.Text; sqlCmd.Parameters.AddWithValue("@kulad", txt_kulad.Text); sqlCmd.Parameters.AddWithValue("@parola", txt_parola.Password); int count = Convert.ToInt32(sqlCmd.ExecuteScalar()); if (count == 1) { MessageBox.Show("Giriş Başarılı"); panel panel_ = new panel(); panel_.Show(); this.Close(); } else { MessageBox.Show("Kullanıcı adı veya parola hatalı!\n Kalan deneme hakkı " + hak); if (hak == 0) { an.anaadmin.IsEnabled = false; an.Show(); this.Close(); } hak--; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { ds.sqlCon.Close(); } }