private void менюКоординатораToolStripMenuItem_Click(object sender, EventArgs e) { Window14 w14 = new Window14(); w14.Show(); Hide(); }
private void ButtonLogin(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=KAPRIMA\SQLSERVER;Initial Catalog=Baza;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 (TextBoxLogin.Text == reader["Email"].ToString() && textBox2.Text == reader["Password"].ToString()) { if ("R" == reader["RoleId"].ToString()) { Result = true; Window7 w7 = new Window7(); w7.Show(); this.Hide(); } else if ("A" == reader["RoleId"].ToString()) { Result = true; Window15 w15 = new Window15(); w15.Show(); this.Hide(); } else if ("C" == reader["RoleId"].ToString()) { Result = true; Window14 w14 = new Window14(); w14.Show(); this.Hide(); } } } if (Result == false) { MessageBox.Show("Логин или пароль введены неверно!", "Ошибка входа!", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox2.Text = "Enter your passvord"; textBox2.ForeColor = SystemColors.ControlDark; textBox2.PasswordChar = '\0'; } }