private void coordMenuToolStripMenuItem_Click(object sender, EventArgs e) { coordinatorMenu pg14 = new coordinatorMenu(); pg14.Show(); this.Hide(); }
private void autorizationLogin_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=PROVICE-PC\SQLEXPRESS;Initial Catalog=SQL;Integrated Security=True"); SqlCommand com = new SqlCommand("SELECT * FROM [dbo].[User]", con); SqlDataReader reader; con.Open(); reader = com.ExecuteReader(); bool result = false; while (reader.Read()) { if (emailTextBox.Text == reader["Email"].ToString() && passwordTextBox.Text == reader["Password"].ToString()) { if ("R" == reader["RoleId"].ToString()) { runnerMenu pg7 = new runnerMenu(); pg7.Show(); this.Hide(); result = true; } else if ("A" == reader["RoleId"].ToString()) { administratorMenu pg15 = new administratorMenu(); pg15.Show(); this.Hide(); result = true; } else if ("C" == reader["RoleId"].ToString()) { coordinatorMenu pg14 = new coordinatorMenu(); pg14.Show(); this.Hide(); result = true; } } } if (result == false) { MessageBox.Show("Логин или пароль введены неверно!", "Ошибка входа!", MessageBoxButtons.OK, MessageBoxIcon.Warning); passwordTextBox.Text = "Enter your password"; passwordTextBox.ForeColor = Color.FromArgb(180, 180, 180); passwordTextBox.PasswordChar = '\0'; } con.Close(); }