Note that there are some explanatory texts on larger screens.

plurals
  1. POUsername and role
    primarykey
    data
    text
    <p>I have this databases: <code>table&lt;User&gt;(UserID,Name,Surname,Username,Password,Email)</code>, <code>table&lt;Role&gt;(RoleID,RoleName,Description)</code>, and <code>table&lt;UsersInRole&gt;(UserID,RoleID)</code>. I create a login authentication with username and password to access to the application (with Linq ToSql to store data), and it is right. Now I wish to create a role for each user, but I don't know how work out it; I saw some features about it but it refers to web.app.</p> <p>This is the code of the procedure that applies to login: </p> <pre><code>public partial class Window1 : Window { public Window1() { InitializeComponent(); } public bool ValidateApplicationUser(string userName, string password) { { var AuthContext = new DataClasses1DataContext(); var query = from c in AuthContext.Users where (c.Username == userName.ToLower() &amp;&amp; c.Password == password.ToLower()) select c; if(query.Count() != 0 ) { return true; } return false; } } private void mahhh(object sender, RoutedEventArgs e) { bool authenticated = true; { if (usernameTextBox.Text !="" &amp;&amp; passwordTextBox.Text != "") { authenticated = ValidateApplicationUser(usernameTextBox.Text , passwordTextBox.Text); } } if (!authenticated) { MessageBox.Show("Invalid login. Try again."); } else { MessageBox.Show("Congradulations! You're a valid user!"); Window3 c = new Window3(); c.ShowDialog(); this.Close(); } } } </code></pre> <p>I don't know how to implement a method to assign a role to the user. Do you have any idea or suggest to make it right?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload