private void button9_Click(object sender, EventArgs e) { var back = new MenuAdmin(); this.Hide(); back.Show(); }
private void button8_Click(object sender, EventArgs e) { var menu = new MenuAdmin(); menu.Show(); this.Hide(); }
private void Avtoriz() { using (var connection = new SqlConnection(ConnectToSql.ConnectionString)) { bool success = false; try { const string comand = "Select * From Авторизация WHERE Логин=@Логин AND Пароль=@Пароль"; SqlCommand check = new SqlCommand(comand, connection); check.Parameters.AddWithValue("@Логин", Login.Text); check.Parameters.AddWithValue("@Пароль", passw.Text); connection.Open(); using (var dataReader = check.ExecuteReader()) { success = dataReader.Read(); } } finally { connection.Close(); } if (success) { if (Login.Text == "Admin") { AdminsSettings adm = new AdminsSettings(); adm.ShowDialog(); } else { MenuAdmin sotr = new MenuAdmin(); sotr.ShowDialog(); } this.Close(); } else { MessageBox.Show("Неверный логин или пароль"); } } }