private void Btn_Click(object sender, RoutedEventArgs e) { win_rentals.rentals_window rw = new win_rentals.rentals_window(); this.Close(); rw.ShowDialog(); }
private void Btn_login_Click(object sender, RoutedEventArgs e) { connection.openConnection(); connection.sql = "SELECT COUNT(1) FROM UserTb WHERE login=@login AND password=@password"; connection.cmd.CommandType = CommandType.Text; connection.cmd.CommandText = connection.sql; connection.cmd.Parameters.AddWithValue("@login", txt_login.Text); connection.cmd.Parameters.AddWithValue("@password", txt_password.Password); int count = Convert.ToInt32(connection.cmd.ExecuteScalar()); if (count == 1) { win_rentals.rentals_window rw = new win_rentals.rentals_window(); this.Close(); rw.ShowDialog(); } else { MessageBox.Show("Podany login lub hasło jest błędne. Spróbuj ponownie", "Komunikat."); } connection.closeConnection(); }