private void MainWindow_Load(object sender, EventArgs e) { user_text_menuitem.Text = "User: "******"Role: Student"; queryTeacherInformationToolStripMenuItem.Visible = false; break; case Common.UserType.TEACHER: role_text_menuitem.Text = "Role: Teacher"; submitScoreToolStripMenuItem.Visible = true; break; case Common.UserType.ADMIN: role_text_menuitem.Text = "Role: Administrator"; addAccountToolStripMenuItem.Visible = true; resetUserPasswordToolStripMenuItem.Visible = true; addCourseToolStripMenuItem.Visible = true; addCourseChoosingInfoToolStripMenuItem.Visible = true; modifyInformationToolStripMenuItem.Visible = true; break; default: role_text_menuitem.Text = "Role: Null"; break; } }
public void QueryForLogin() { using (MySqlConnection connection = SQL_Help.getConnection(Common.UserType.STUDENT)) { connection.Open(); LoginResult(SQL_Help.ExecuteDataTable("select authority from user_data where username = @name and password = SHA1(@pwd)", connection, new MySqlParameter[] { new MySqlParameter("@name", username.Text), new MySqlParameter("@pwd", password.Text) })); connection.Close(); } }