Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. private void ButtonChangePermissions_Click(object sender, RoutedEventArgs e)
  2. {
  3. if (ComboBoxSelectedProfile.SelectedIndex != -1)
  4. {
  5. ChangePermissionsWindow cpWindow = new ChangePermissionsWindow { parent = this };
  6. cpWindow.Show();
  7. }
  8. else
  9. {
  10. MessageBox.Show("Please choose a profile first.");
  11. }
  12. }
  13.  
  14. public partial class ChangePermissionsWindow : Window
  15. {
  16. private readonly string dbConnectionString = Properties.Settings.Default.dbConnectionString;
  17. public postLoginWindow parent { get; set; }
  18.  
  19. public ChangePermissionsWindow()
  20. {
  21. InitializeComponent();
  22. ComboBoxValuesToShow();
  23. }
  24.  
  25. private void ComboBoxValuesToShow()
  26. {
  27. using (SqlConnection connection = new SqlConnection(dbConnectionString))
  28. {
  29. try
  30. {
  31. connection.Open();
  32. if (TableFunctions.doesTableExist("ProfilePermissions", dbConnectionString))
  33. {
  34. string selectQuery = "SELECT Permissions from ProfilePermissions where ProfileName=@ProfileName";
  35. using (SqlCommand command = new SqlCommand(selectQuery, connection))
  36. {
  37. command.Parameters.AddWithValue("@ProfileName", parent.ComboBoxSelectedProfile.Text);
  38.  
  39. ...Does not matter from here
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement