private void BackButton_Click(object sender, EventArgs e) { AdminHome AH = new AdminHome(); AH.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { AdminHome admin_home = new AdminHome(); admin_home.Show(); this.Hide(); }
private void ButtonLogin_Click(object sender, EventArgs e) { //mai's con //SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=IS Project;Integrated Security=True"); //mohie's con SqlConnection con = new SqlConnection("Data Source=LELOUCH;Initial Catalog=\"IS Project\";Integrated Security=True"); con.Open(); if (AdminUsername == TextBoxUsername.Text && AdminPassword == TextBoxPassword.Text) { AdminHome admin_home = new AdminHome(); admin_home.Show(); this.Close(); } else { bool alreadyuser = false; SqlCommand show_username_pass = new SqlCommand("select username , password from users", con); SqlDataReader username_password = show_username_pass.ExecuteReader(); while (username_password.Read()) { if ((string)username_password["username"] == TextBoxUsername.Text && (string)username_password["password"] == TextBoxPassword.Text) { currentUsername = TextBoxUsername.Text; UserHome user_home = new UserHome(); user_home.Show(); this.Close(); alreadyuser = true; } else if ((string)username_password["username"] == TextBoxUsername.Text && (string)username_password["password"] != TextBoxPassword.Text) { MessageBox.Show("The Username or Password is incorrect please retry."); alreadyuser = true; } } if (alreadyuser == false) { MessageBox.Show("The Username or Password is incorrect please retry or Register."); } username_password.Close(); } con.Close(); }