private void buttonLogin_Click(object sender, EventArgs e) { bool key = false; if (textBoxLogin.Text != "" && textBoxPassword.Text != "") { foreach (User user in Program.m.User) { if (textBoxLogin.Text == user.Email && textBoxPassword.Text == user.Password) { if (user.RoleId == "R") { Form form = new Runs(); form.Show(); this.Hide(); users.login = user.Email; users.password = user.Email; users.type = "R"; key = true; break; } else if (user.RoleId == "A") { Form form = new AdmMenu(); form.Show(); this.Hide(); users.login = user.Email; users.password = user.Email; users.type = "A"; key = true; break; } else if (user.RoleId == "C") { Form form = new MenuCoordinator(); form.Show(); this.Hide(); users.login = user.Email; users.password = user.Email; users.type = ""; key = true; break; } } } if (!key) { MessageBox.Show("Пользователь не найден!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Заполните все поля!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); } }